[R] Problem with range()
Colin Wahl
biowahl at gmail.com
Thu Feb 2 01:48:06 CET 2012
Hello,
I'm using range do define boundaries for a linear model, so the line I
graph is only graphed for the range of data. There are NAs in the
data, but I dont remember this being a problem before. I typed
na.action=na.omit anyway, which has usually solved any NA issues in
the past. Any idea why R cant do vector functions for these data?
Solution?
Thanks,
Colin Wahl
M.S. Biology candidate
Western Washington University
fit<-lm(sandcomb ~ CCEC25)
z<-predict(fit, data.frame(CCEC25=range(CCEC25)))
lines(range(CCEC25), z, lty=2, lwd=0.75, col="grey51")
> is.vector(CCEC25)
[1] TRUE
> is.numeric(CCEC25)
[1] TRUE
> range(CCEC25)
[1] NA NA
> CCEC25
[1] 375.8 8769.0 NA 4197.0 NA 36880.0 4167.0 13100.0 3694.0
[10] 51420.0 30660.0 30850.0 4076.0 NA 59450.0 16050.0 NA 65480.0
[19] 2101.0 16390.0 5968.0 11330.0 9112.0 8326.0
> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] grid_2.14.1 lattice_0.20-0 lme4_0.999375-42 Matrix_1.0-2
[5] nlme_3.1-102 stats4_2.14.1 tools_2.14.1
More information about the R-help
mailing list