[R] NULL column

Silvano Cesar da Costa silvano at uel.br
Thu Aug 9 04:31:42 CEST 2012


Thank you all.

Your suggestions solved the problem.






> If you original read in the data with read.table, use its
> row.names=NULL argument so it doesn't turn the first
> character column with no duplicated entries into the
> row.names.
>
>> d <- read.table(text="
> + CAP 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,  row.names=NULL)
>> d
>    CAP    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
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> On Behalf
>> Of arun
>> Sent: Wednesday, August 08, 2012 3:06 PM
>> To: Silvano Cesar da Costa
>> Cc: R help
>> Subject: Re: [R] NULL column
>>
>> 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.
>>
>>
>> ______________________________________________
>> 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.
>
>


---------------------------------------------
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