[R] Deleting row labels in dataframe

arun smartpink111 at yahoo.com
Wed May 23 02:25:23 CEST 2012


Thanks Peter.  The code worked.


I was trying to print it in the console without rownames.

A.K.



----- Original Message -----
From: Peter Ehlers <ehlers at ucalgary.ca>
To: arun <smartpink111 at yahoo.com>
Cc: R help <r-help at r-project.org>
Sent: Tuesday, May 22, 2012 6:30 PM
Subject: Re: [R] Deleting row labels in dataframe

On 2012-05-22 13:55, arun wrote:
> Dear R group,
>
> I was working on an example dataset to see if the row labels can be deleted.   I know that header=TRUE could be used when we use read.table.  In the data.frame, I tried to delete row labels 1,2,..5, but so far not successful.  Is there a neat way to do it.
>

What are you trying to accomplish? Save the dataframe without
rownames?
Use write.table(..., row.names=FALSE)

Print it in the console without rownames?
Use print(..., row.names=FALSE)

Peter Ehlers

> Thanks.
> A.K.
>
>
> HousePriceT1<-structure(list(Price = c(52, 54, 57, 57, 59), Floor = c(111,
> 128, 101, 138, 93), Area = c(830, 710, 1000, 690, 780), Rooms = c(5,
> 5, 5, 5, 5), Age = c(5.2, 6.2, 3.8, 4.5, 6.8), Cent.heat = structure(c(1L,
> 1L, 1L, 1L, 2L), .Label = c("no", "yes"), class = "factor")), .Names = c("Price",
> "Floor", "Area", "Rooms", "Age", "Cent.heat"), row.names = c(NA,
> -5L), class = "data.frame")
>




More information about the R-help mailing list