R Commands
Common R commands.
typeof()- Type of object
typeof(d)
Dataframes
nrows()- Count rows in dataframe
dnrow(d) d[ d$col == 'condition' ]- Filter dataframe
dby columncold2 <- d[ d$col == 'condition' ]
Vectors
list()- Construct a list, evaluating elements before saving them in the list.
mylist <- list(1,2,3,4,5) alist()- Construct a list without evaluating the elements.
mylist <- alist( dunif(75, 0, 100) ) c()- Combine values into a vector.
> c(1,2,3,4,5) [1] 1 2 3 4 5
Distributions
dnorm(x, 1, 1)- Gives the value of the normal pdf at
x
RStudio
rm(list = ls() )- Remove all data from the global environment.