[R] Sampling problems

Petr PIKAL petr.pikal at precheza.cz
Thu Mar 8 10:49:20 CET 2012


Hi

I have only faint idea what was you problem as there is no context in you 
message but maybe

remainder<-MeanA[-mysample, ]

could work.

Regards
Petr

> 
> Hi, thank you but it does work for vectors and matrix but not 
dataframes, it
> gives me this message error:
> 
> MeanA <- read.csv("MeanAmf.csv",header=T)
> mysample <- MeanA[sample(1:nrow(MeanA), 20, replace=FALSE),]
> remainder<-MeanA[-mysample]
> Error in `[.default`(MeanA, -mysample) : invalid subscript type 'list'
> In Ops.factor(left) : - not meaningful for factors
> 
> Any other way?
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Sampling-
> problems-tp4453752p4455912.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list