[RkWard-devel] Good way to delete a row from a data.frame?

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Sep 2 11:20:32 UTC 2004


Hi R experts!

I'm trying to implement a function to remove a row from a data.frame. Suppose 
I want to remove row 20 in "my.data" (for simplicity let's just talk about 
the last row in a data.frame):

my.data[20,] <- NULL # won't work

my.data[20,] <- c (NA) # removes the data but not the row

my.data <- my.data[1:19,]

The last one works, but unfortunately it also removes all attributes the 
columns in the data.frame have (such as the RKWard-labels).
Is there a good way to remove a row, but preserve the attributes?

Thomas




More information about the Rkward-devel mailing list