Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the column type of data frame

Tags:

dataframe

r

I have a data frame containing huge amount of values. The data frame is as follows

> datedPf
            date ticker quantity
96828 2013-01-11    ABT      700
96829 2013-01-11    AMD     9600
96830 2013-01-11    AMG      600
96831 2013-01-11   AGCO      800
96832 2013-01-11      A     1300
etc...

The type of the "ticker" and "quantity" columns are factor. I found this using class(datedPf$ticker) and class(datedPf$quantity) respectively. But the type of the "date" column is date. I want to change that type to factor. How can I change this?

like image 626
Dinoop Nair Avatar asked Mar 15 '13 12:03

Dinoop Nair


1 Answers

datedPf$date = as.factor(datePf$date) but are you sure that it is what you want to do ?

like image 106
statquant Avatar answered Oct 19 '22 05:10

statquant