Displaying 2 results from an estimated 2 matches for "datasetframe".
2017 Jun 19
3
How to Transform a Factor Variable into a Date
...the fashion mmm-yy (e.g.:
Apr-2013). However R does not recognize the field TransitDate as a date
field.
Here is the code:
library(lubridate)
Dataset <- read.table("U:/NEWCargoData.csv", header=TRUE, sep=",",
na.strings="NA", dec=".", strip.white=TRUE)
DatasetFrame <- data.frame(Dataset)
DatasetFrame$TransitDate <- as.Date(DatasetFrame$TransitDate, format =
"%b-%y")
Now, when I do DatasetFrame[1,1], the following happens:
> DatasetFrame[1,1]
[1] NA
>
> DatasetFrame[2,1]
[1] NA
>
Now when I do:
> Dataset[1,1] #this is the...
2017 Jun 19
0
How to Transform a Factor Variable into a Date
...does not recognize the field TransitDate as a date
> field.
>
> Here is the code:
>
> library(lubridate)
>
> Dataset <- read.table("U:/NEWCargoData.csv", header=TRUE, sep=",",
> na.strings="NA", dec=".", strip.white=TRUE)
>
> DatasetFrame <- data.frame(Dataset)
>
> DatasetFrame$TransitDate <- as.Date(DatasetFrame$TransitDate, format =
> "%b-%y")
>
>
> Now, when I do DatasetFrame[1,1], the following happens:
>
>
> > DatasetFrame[1,1]
> [1] NA
> >
> > DatasetFrame[2,1]
>...