Displaying 2 results from an estimated 2 matches for "logleach".
2008 Jun 05
1
choosing an appropriate linear model
...ch.lm)
dev.off()
library(MASS)
boxcox(leach.lm,plotit=T,lambda=seq(0,0.4,by=0.01))
boxtran <- function(y,lambda,inverse=F){
if(inverse)
return((lambda*y+1)^(1/lambda))
else
return((y^lambda-1)/lambda)
}
png("boxcox-dianostics.png",height=1200,width=700)
par(mfrow=c(3,2))
logleach.lm <- lm(boxtran(leachate,0.21)~rainmm-1,data=leachdata)
plot(leachate~rainmm,data=leachdata,main="Data and fitted line")
x <- leachdata$rainmm
y <- boxtran(predict(logleach.lm),0.21,T)
xy <- cbind(x,y)[order(x),]
lines(xy)
plot(y~leachdata$leachate,xlim=c(0,12),ylim=c(0,12),m...
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame.
For instance
> ddTable <-
data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry"))
I want a dataset that is
Id Name
1 Paul
2 Bob
> unique(ddTable)
Will give me all 4 rows, and
> unique(ddTable$Id)
Will give me c(1,2), but not accompanied by the name column.