[R] factor or character

Silvano Cesar da Costa silvano at uel.br
Tue Oct 23 20:02:51 CEST 2012


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 are in a file. So I create a file to extract them with

(mod5.sig = with(mod5, data.frame(snps = SNP[pvalor < 5e-8])))
str(mod5.sig)
(snps = (mod5.sig))

The structure is:
'data.frame':	76 obs. of  1 variable:
 $ snps: Factor w/ 220 levels "rs10058955_A",..: 89 59 88 73 40 35 97 55
87 204 ...

But it doesn't work. The output is:
> Selec = todos[ , colnames(todos) %in% snps]
> head(Selec)
data frame with 0 columns and 6 rows

What's is wrong?

Thanks a lot,


---------------------------------------------
Silvano Cesar da Costa

Universidade Estadual de Londrina
Centro de Ciências Exatas
Departamento de Estatística

Fone: (43) 3371-4346



More information about the R-help mailing list