- Binding of different columns into one column: mutate(data,data=paste(col1,col2,col3))
- Round of your column: round(data$colname,2)
- Selection of a range of columns: data[,c(1:7)]
- Selection of random column: data [,c(1,2,3,4,5,7,9,10)]
- Deletion of column: data[,-c(7,9)]
- Rename of columns: names(datasoil)[c(5,6)]<-c("Organic matter","Water contents")
- Reorder levels of a factor: factor(data$mulches, levels=levels(data$mulches)[c(1,3,4,2)])
- View the level of a factor: levels(data$mulches)
- Row binding of two data sets: rbind(data1, data2)
- Column binding of two data sets: cbind(data1, data2)
- Conversion of variable into factor: irrigation <- factor(irrigation)
- Conversion of a variable into numeric: irrigation <- as.numeric(irrigation)
- Import CSV file: read.csv("data.csv",na="***")
- Frame a data set into columns and rows:data.frame(data)
- View structure of data: str(data)
- View top 06 rows of imported data set: head(data)
- View bottom 06 rows of imported data set: tail(data)
- View summary of data set: summary(data)
- View summary of single column: summary(dataset$height)
- Select one level of a factor: subset(dataset,irrigation=="normal")
- Install a package: Install.package(“knitr”)
- Install multiple packages: install.packages(c("knitr","emmeans"))
- Activate pacakge:library(knitr)
- Make histogram: hist(data$height)
- Descriptive statistics of a data: stat.desc(data)
- make A working directory: setwd("D:/foldername")
- Save plot in PNG file: ggsave("SOD.png", width = 20, height = 7)
- Group standard deviation table:tapply(POD,list(treatment, variety), sd)
- Save plot as PDF file: ggsave("SOD.pdf", width = 20, height = 7)
- Load R session: load(file= "D:/R-training/R-basic-Course-6/session")
- Save R Session: save(list = ls(all=TRUE), file= "D:/R-training//session")
- Export file as excel: writexl::write_xlsx(data,"summary.xlsx")
- View column of data :colnames(data)
- Subset by value: subset(data,height<34)
- Remove extra staff: rm(list = setdiff(ls(), "data"))
- De-attach data file: detach(data)
- Remove data files from environment: rm(list = ls())
- Descriptive statistics: describe(iris)
- Import excel file: import(" /Desktop/mbb.xlsx")
- Import text file: import(" /Desktop/mbb.txt")
- Import CSV file: import(" /Desktop/mbb.csv")
- View data file: View(data)
- Rainbow color view: barplot(seq(1:12), col=rainbow(12))
- Terrain color view: barplot(seq(1:12), col=terrain.colors(12))
- cm color view: barplot(seq(1:12), col=cm.colors(12))
- Heat color view: barplot(seq(1:12), col=heat.colors(12))
- Topo color view: barplot(seq(1:12), col=topo.colors(12))
- Brewer color: display.brewer.all(colorblindFriendly = TRUE)
- Brewer color: display.brewer.all(colorblindFriendly = TRUE)
- Multiple plots view: par(mfrow=c(2,3))
- Function demo in R: demo(graphics)
- Find package for function in R: find("lowess")
- Information about package: library(help=spatial)
- Calculation of arithmetic mean: arithmetic.mean(y)
- Calculation of Geometric mean: geometric(insects)
- Calculation of Harmonic mean: harmonic(c(1,2,4,1))
- Calculation Variance: variance(y)
- View history: history(Inf)
- Cartesian: plot(x,y)
- formula: plot(y x)
Saturday, January 7, 2023
List of Important functions in R
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment