Tags » Plyr

Value Matching in R

Similiar to Index function in Excel.

To find more information on Excel’s Vlookup.
Excel “Vlookup” in RĀ 

Replicate Excel’s Index-Match in R

  1. Left_Join
  2. Match
  3. ddpply…
  4. 144 more words

Plotting Soil Composition

#Load packages
TT.plot( class.sys = "none" )
TT.plot( class.sys = "USDA.TT" )

#convert texture to classifications
vert <- TT.vertices.tbl(class.sys = "USDA.TT")
vert$x <- 1-vert$SAND+(vert$SAND-(1-vert$SILT))*0.5
vert$y <- vert$CLAY*sin(pi/3)

USDA.TT <- data.frame(TT.classes.tbl(class.sys = "USDA.TT", collapse = ", "))
TT.pnt <- as.list(rep(NA, length(USDA.TT$name)))
poly.lst <- as.list(rep(NA, length(USDA.TT$name)))
for(i in 1:length(USDA.TT$name)){
TT.pnt[[i]] <- as.integer(strsplit(unclass(paste(USDA.TT)), ", ")[[1]])
poly.lst[[i]] <- vert],c("x","y")]
poly.lst[[i]] <- Polygons(list(Polygon(rbind(poly.lst[[i]], poly.lst[[i]]))), ID=i)

#convert texture triangle to a spatial object:
poly.sp <- SpatialPolygons(poly.lst, proj4string=CRS(as.character(NA)))
poly.USDA.TT <- SpatialPolygonsDataFrame(poly.sp, data.frame(ID=USDA.TT$name), match.ID=FALSE)

#Load soil composition data
soil <- read.csv("soil.csv")
class.sys = "HYPRES.TT",
tri.data = soil,
main = "Soil texture data"

TT.plot(class.sys = "none",
tri.data = soil,
z.name = "Organic Content",
main = "Soil texture triangle and Organic Content bubble plot"


tidyverse 101: Simplifying life for useRs

Hadley Wickham‘s tidyverse has improved the workflow of analysts / data scientists, makes coding errors less likely and code more transparent. You’ve got to love theĀ figure below, representing a simplified workflow of the average analysis project. 307 more words