R functions

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/32

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

33 Terms

1
New cards
<p>to create a boxplot </p>

to create a boxplot

boxplot(data)

2
New cards
<p>to create a Normal Quantile-Quantile (“QQ”) plot</p>

to create a Normal Quantile-Quantile (“QQ”) plot

qqnorm(data)

3
New cards
<p>to create a histogram</p>

to create a histogram

hist(data)

4
New cards
<p>to create a plot graph</p>

to create a plot graph

plot(data)

5
New cards
<p>to display the <strong>first </strong>few rows of R data</p>

to display the first few rows of R data

head(data)

6
New cards
<p>to display the <strong>last </strong>few rows of R data</p>

to display the last few rows of R data

tail(data)

7
New cards
<p>to return the dimensions of a data frame</p>

to return the dimensions of a data frame

dim(data)

8
New cards

to determine the number of elements in a dataset

length(data)

9
New cards
<p><span>to generate all possible ways to choose a specific number of items from a larger set, where the order of selection does not matter.</span></p>

to generate all possible ways to choose a specific number of items from a larger set, where the order of selection does not matter.

combinations()

10
New cards
<p>to create a subset of data from a larger dataset</p>

to create a subset of data from a larger dataset

sample()

11
New cards
<p>to arrange data into a specific order</p>

to arrange data into a specific order

sort()

12
New cards
<p>to provide a quick overview of the dataset</p>

to provide a quick overview of the dataset

summary()

13
New cards

to install packages

install.packages(“gtools”)

14
New cards

to see the package library for R

library(gtools)

15
New cards

to see installed packages in R

installed.packages()

16
New cards
<p>to determine the class or type of an R object</p>

to determine the class or type of an R object

class(df)

17
New cards

to determine the data type or class of a specific column within a data frame

class(df$colname)

18
New cards

similar to a pivot table in excel, used to apply a function (FUN=) to subsets of data within a data frame

aggregate()

19
New cards

part of the “apply()” family of functions and is used to apply a specified function (FUN=) to each element of a list or vector, lists columns vertically

lapply()

20
New cards

part of the “apply()” family of functions and is used to apply a specified function (FUN=) to each element of a list or vector, lists columns horizontally

sapply()

21
New cards

what does “df” stand for

“data frame”

22
New cards

converts various R objects into a data frame structure

as.data.frame()

23
New cards

calculates the sum of values in each row of a data frame. 

rowsums(df)

24
New cards

calculates the sum of values in each column of a data frame

colsums(df)

25
New cards

used to calculate the mean of each row in a data frame

rowMean(df)

26
New cards

used to calculate the mean of each column in a data frame

colMean(df)

27
New cards

used to access and modify the column names of data frames

colnames()

28
New cards

sorts data from low to high

order()

29
New cards

3 ways used to create calculated columns

  • df$new.col.name<-column1+column2

  • df$new.col.name<-sum(col1+col2)/2

  • df$new.col.name<-mean(col1+col2)

30
New cards

used to select subsets of data from data frames

subset()

31
New cards

element used to make variables

<-

32
New cards

element used to combine elements

c()

33
New cards

element used to make comments

#