Skip to main content

Posts

Showing posts with the label R commands

Usefull R Commands

Most useful R commands You should know right Now. Start learning one by one. help() #give help regarding a command, e.g. help(hist)  c() #concatenate objects, e.g. x = c(3,5,8,9) or y = c(”Jack”,”Queen”,”King”) 1:19 #create a sequence of integers from 1 to 19  (…) #give arguments to a function, e.g. sum(x), or help(hist)  […] #select elements from a vector or list, e.g. x[2] gives 5, x[c(2,4)] gives 5 9 for x as above matrix() #fill in (by row) the values from y in a matrix of 4 rows and 3 columns by giving #m = matrix(y,4,3,byrow=T)  dim() #gives the number of rows and the number of columns of a matrix, or a data frame head() #gives the first 6 rows of a large matrix, or data frame  tail() #gives the last 6 rows of a large matrix, or data frame  m[ ,3] #gives the 3rd column of the matrix m  m[2, ] #gives the 2nd row of the matrix m  = or <- #assign something to a variable, e.g. x = c(”a”,”b”,”b”,”e”)  == #ask whether two things are ...