Displaying 2 results from an estimated 2 matches for "newcargodata".
2017 Jun 19
3
How to Transform a Factor Variable into a Date
...ad into R, the .csv
file consistss of two fields (TransitDate and CargoTons).
The TransitDate I formatted from Excel in 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:...
2017 Jun 19
0
How to Transform a Factor Variable into a Date
...ds (TransitDate and CargoTons).
>
> The TransitDate I formatted from Excel in 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...