[R] PLSR error
romzero
romzero at yahoo.it
Fri May 13 11:38:42 CEST 2011
Hi,
this is my R-Script
library(pls)
file <- "C:\\TXT\\brix.txt"
d <- as.matrix(read.table(file, header=T, sep=",", row.names = NULL))
plsdata <- data.frame(NIR=c(1:nrow(X)))
plsdata$NIR <- I(d[,3:603])
plsdata$Brix <- d[,2]
results <- plsr(Brix ~ NIR, data=plsdata)
after the last string i have this error
> results <- plsr(Brix ~ NIR, data=plsdata)
Error in `[[<-.data.frame`(`*tmp*`, i, value = c(302053L, 305882L, 292704L,
:
replacement has 448346 rows, data has 746
In addition: Warning message:
In model.matrix.default(mt, mf) : variable 'Brix' converted to a factor
the data table have this structure
> str(plsdata)
'data.frame': 746 obs. of 2 variables:
$ NIR : 'AsIs' chr [1:746, 1:601] "0.0011030396" "0.0013019324"
"0.0005979965" "0.0012952804" ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr "X1100.0" "X1102.0" "X1104.0" "X1106.0" ...
$ Brix: chr "24.4" "24.8" "24.7" "20.1" ...
where am I wrong?
thanks for help
--
View this message in context: http://r.789695.n4.nabble.com/PLSR-error-tp3519805p3519805.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list