[R] NULL column

arun smartpink111 at yahoo.com
Thu Aug 9 00:06:26 CEST 2012


HI,
Try this:


dat1<-read.table(text="
                    beta0          beta1              pvalor        Crom
rs17      158.5980 12.252462 9.083193e-135        1
rs46      163.3730  3.304276  3.279925e-06          1
rs63      162.7924  2.084678  5.023893e-06          1
rs24      162.4252  1.837208  5.509042e-06          1
",sep="",header=TRUE)
 dat2<-data.frame(new=rownames(dat1),dat1)
> rownames(dat2)<-1:nrow(dat2)
> dat2
  # new    beta0     beta1        pvalor Crom
#1 rs17 158.5980 12.252462 9.083193e-135    1
#2 rs46 163.3730  3.304276  3.279925e-06    1
#3 rs63 162.7924  2.084678  5.023893e-06    1
#4 rs24 162.4252  1.837208  5.509042e-06    1


A.K.



----- Original Message -----
From: Silvano Cesar da Costa <silvano at uel.br>
To: r-help at r-project.org
Cc: 
Sent: Wednesday, August 8, 2012 3:22 PM
Subject: [R] NULL column

Hi,

I have a dataset where the first column has no name.

I would like to assign a name to this column to be able to use it

something like:

Cap <-  NULL


How can I do this?

                    beta0           beta1              pvalor        Crom
rs17      158.5980 12.252462 9.083193e-135        1
rs46      163.3730  3.304276  3.279925e-06           1
rs63      162.7924  2.084678  5.023893e-06           1
rs24      162.4252  1.837208  5.509042e-06           1


How can I do this?


Thanks,


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

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

Fone: (43) 3371-4346

______________________________________________
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