RE: [R] String in data frame

From: <>
Date: Sat 16 Apr 2005 - 15:31:54 EST

str <- as.character(d$name)

should do the trick. (damn... my shift key just broke as well...)

bill venables.

-----Original Message-----
[] On Behalf Of Cuichang Zhao Sent: Saturday, 16 April 2005 2:00 PM
Subject: [R] String in data frame

how can take the string in the data frame. right now i have a table that create as a data frame and stored in the file called "data.xls" and now i want to read data frame as a table in my another r program, i used the following command: the first column of the data frame is just one number called "num", but the second one a list of string, called "name".  

d <- read.table("data.xls", header = T);  

what i get for d is a table of 2 columns: num and name:  

the one for d$num is just a normal list without any levels with it, and this is what i want. but the second d$name is a list with a levels with it.
the list i have for d$name is: d$name = (bal bal bal bal bal bal), levlels:bal, however, when i want to have for following code, something different happens:
namelist <- NA;
a <- d$name[1]; #this will outputs a = bal, lelvels:bal  namelist <- c(namelist, a); #this does not outptu (NA, bal), instead it outputs (NA, 1), if i keep #adding a to the namelist, it keeps adding 1 to the namelist instead of bal. However, i want to add bal to the namelist, not 1, so how i can do this?  

Thank you very much.  

Cuichang Zhao  

April 15, 2005                 

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Sat Apr 16 15:40:38 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:12 EST