[R] filling data into objects

Henrique Dallazuanna wwwhsd at gmail.com
Wed Feb 6 21:05:39 CET 2008


Perhaps:

for(i in 1:100)assign(sprintf("Informative.data.class%s", i),
rnorm(100, 0.25,1))
for(i in 1:100)assign(sprintf("Uninformative.data.class%s", i), rnorm(900))

Or working with a list:

Informative <- replicate(100, rnorm(100, 0.25,1))
Uninformative <- replicate(100, rnorm(900))

On 06/02/2008, Nair, Murlidharan T <mnair at iusb.edu> wrote:
> I am trying to generate artificial data for feature selection.  Basically trying to generate a total of 1000 features with 100 that are informative and rest are uninformative.
> Informative.data.class1<-rnorm(100,0.25,1)
> Uninformative.data.class1<-rnorm(900,0,1)
> Informative.data.class2<-rnorm(100, -0.25,1)
> Uninformative.data.class2<-rnorm(900,0,1)
>
> The above will give me one set of data for the two classes. I am interested in generating about a 100 set for each class.  What is a neat way to write it in R?
> Thanks ../Murli
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list