Re: [R] factor or character

2012-10-24 Thread Silvano Cesar da Costa
Hi, still doesn't work. > Hello, > > I've just seen the error, you are _not_ searching for colnames in > mod5.sig$snps. Corrected: > > Selec = todos[ , colnames(todos) %in% mod5.sig$snps] > > Hope this helps, > > Rui Barradas > Em 23-10-2012 21:17, Silvano Cesar da Costa escreveu: >> Hi Rui, >>

Re: [R] factor or character

2012-10-24 Thread Rui Barradas
Hello, Sorry but, what doesn't work? What is the error message or result? As for stringsAsFactors not keeping character strings as character strings maybe this is from calling data.frame from within the environment used by with(), but you can use other ways of converting to character strings,

Re: [R] factor or character

2012-10-23 Thread Silvano Cesar da Costa
Hi Rui, it doesn't work: > (mod5.sig = with(mod5, data.frame(snps = SNP[pvalor<5e-8], stringsAsFactors=FALSE))) > str(mod5.sig) 'data.frame': 76 obs. of 1 variable: $ snps: Factor w/ 220 levels "rs10058955_A",..: 89 59 88 73 40 35 97 55 87 204 ... > Selec = todos[ , colnames(todos) %in% mod5

Re: [R] factor or character

2012-10-23 Thread Rui Barradas
Hello, I've just seen the error, you are _not_ searching for colnames in mod5.sig$snps. Corrected: Selec = todos[ , colnames(todos) %in% mod5.sig$snps] Hope this helps, Rui Barradas Em 23-10-2012 21:17, Silvano Cesar da Costa escreveu: Hi Rui, it doesn't work: (mod5.sig = with(mod5, dat

Re: [R] factor or character

2012-10-23 Thread Rui Barradas
Hello, When creating the data.frame of snps use the option stringsAsFactors = FALSE I believe your error comes from the fact that you are trying to find colnames in a variable coded as integers (a factor, like str shows). Hope this helps, Rui Barradas Em 23-10-2012 19:02, Silvano Cesar da Cos

[R] factor or character

2012-10-23 Thread Silvano Cesar da Costa
Hi, The program below work very well. (snps = c('rs621782_G', 'rs8087639_G', 'rs8094221_T', 'rs7227515_A', 'rs537202_C')) Selec = todos[ , colnames(todos) %in% snps] head(Selec) But, I have a data set with 1.000 columns and I need extract 70 to use (like snps in command above). This 70 snps ar