Dutta
Dutta

Reputation: 683

R dataframe column to character array

I am newbee to R.

Trying to play with this language a bit. All I am trying is

1) I have a dataframe "df", which has one column "desc" which is String 2) I did a load csv to create the dataframe

Issue:

1) when I am doing w <- df$desc
it is returning a object but I am unable to figure the object. I tried is.vector, is.charaecter(w) nothing returns "true". I was going thru a book and it mentioned it should be a vector.

2) I have to create a character array to do further processing can anyone please help me how to do the processing or conversion

Thanks, Amit

Upvotes: 0

Views: 298

Answers (1)

shirewoman2
shirewoman2

Reputation: 1928

If you want to know the class of an object, use this:

class(w)

or, if you want to know the classes of all the columns in a data.frame (called "X" in this example), try this:

sapply(X, class)

Upvotes: 1

Related Questions