![]() Par(omi=c(0,0,1,0) ) #set the size of the outer margins Par(ask=TRUE) #ask for user input before drawing a new graph Par(mfrow=c(nrow,mcol)) #number of rows and columns to graph Z=apply(x,1,which.min) #tells the row with the minimum value for every column ) #applies the function (FUN) to either rows (1) or columns (2) on object XĪpply(x,1,min) #finds the minimum for each rowĪpply(x,2,max) #finds the maximum for each columnĬol.max(x) #another way to find which column has the maximum value for each row ) #finds row sums for each level of a grouping variableĪpply(X, MARGIN, FUN. Princomp() (see principal in the psych package) Solve(A,B) #inverse of A * B (may be used for linear regression)įactanal() (see also fa in the psych package) More statistics: Regression, the linear model, factor analysis and principal components analysis (PCA) Power = NULL, type = c("two.sample", "one.sample", "paired"),Īlternative = c("two.sided", "one.sided"),strict = FALSE) Power.t.test(n = NULL, delta = NULL, sd = 1, sig.level = 0.05, Within.var = NULL, sig.level = 0.05, power = NULL) (groups = NULL, n = NULL, between.var = NULL, Lm(x~y,data=dataset) #basic linear model where x and y can be matrices (see plot.lm for plotting options) Print(model.tables(aov.ex1,"means"),digits=3) #report the means and the number of subjects/cellīoxplot(DV~IV,data=data.ex1) #graphical summary appears in graphics window Scale(data,scale=FALSE) #centers around the mean but does not scale by the sd)Ĭumsum(x,na=rm=TRUE) #cumulative sum, etc.Ĭor(x,y,use="pair") #correlation matrix for pairwise complete data, use="complete" for complete casesĪov(x~y,data=datafile) #where x and y can be matricesĪov.ex1 = aov(DV~IV,data=data.ex1) #do the analysis of variance orĪov.ex2 = aov(DV~IV1*IV21,data=data.ex2) #do a two way analysis of variance ![]() Table(x) #frequency counts of entries, ideally the entries are factors(although it works with integers or even reals) Mad(x, na.rm=TRUE) #(median absolute deviation)įivenum(x, na.rm=TRUE) #Tukey fivenumbers min, lowerhinge, median, upper hinge, max Var(x, na.rm=TRUE) #produces the variance covariance matrix Max(x, na.rm=TRUE) #Find the maximum value in the vector x, exclude missing values Y%in%x #tests each element of y for membership in xĪll(x%in%y) #true if x is a proper subset of yĪll(x) # for a vector of logical values, are they all true?Īny(x) #for a vector of logical values, is at least one true? X%in%y #tests each element of x for membership in y Transform(data.df,variable names = some operation) #can be part of a set up for a data set Read.table(filename,header=TRUE,sep=',') #read csv filesįloor(x) #vector x of largest interger < xĪs.integer(x) #truncates real x to integers (compare to round(x,0)Īs.integer(x < cutpoint) #vector x of 0 if less than cutpoint, 1 if greater than cutpoint)įactor(ifelse(a < cutpoint, "Neg", "Pos")) #is another way to dichotomize and to make a factor for analysis Read.table(filename,header=TRUE) #read a tab or space delimited file See the R-reference card by Tom Short for a much more complete list. Unfortunately, knowing what to ask for help about is the hardest problem. For all of these commands, using the help(function) or ? function is the most useful source of information. See the relevant part of the guide for better examples. A short list of the most useful R commandsĪ summary of the most important commands with minimal examples.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |