Reputation: 1669
I have a dataframe which looks like that:
'data.frame': 3036 obs. of 751 variables:
$ X : chr "01.01.2002" "02.01.2002" "03.01.2002" "04.01.2002" ...
$ A: chr "na" "na" "na" "na" ...
$ B: chr "na" "1,827437365" "0,833922973" "-0,838923572" ...
$ C: chr "na" "1,825300613" "0,813299479" "-0,866639008" ...
$ D: chr "na" "1,820482187" "0,821374034" "-0,875963104" ...
...
I have converted the X
row into a date format.
dates <- as.Date(dataFrame$X, '%d.%m.%Y')
Now I want to replace this row. The thing is I cannot create a new dataframe because I after D
there are coming over 1000 more rows...
What would be a possible way to do that easily?
Upvotes: 0
Views: 1237
Reputation: 488
I think what you want is simply:
dataFrame$X <- dates
if you you want to do is replace column X
with dates
. If you want to remove column X
, simply do the following:
dataFrame$X <- NULL
(edited with more concise removal method provided by user @shujaa)
Upvotes: 3