Re: [R] How to Transform a Factor Variable into a Date

2017-06-19 Thread David L Carlson
David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Paul Bernal Sent: Monday, June 19, 2017 2:07 PM To: r-help@r-project.org Subject: [R] How to Tr

Re: [R] How to Transform a Factor Variable into a Date

2017-06-19 Thread Rui Barradas
Hello, Another way of getting dates, of class 'Date', is to paste a day "01" into what the op has. To the op: 1) Your attachment didn't come through, R-Help doesn't accept the extension .csv, use .txt 2) When you read your data in using function read.csv the result already is a data.frame so

Re: [R] How to Transform a Factor Variable into a Date

2017-06-19 Thread Christopher W Ryan
A couple thoughts: 1. converting factors into dates often requires that they be converted to character first. 2. you don't really have dates; you have just months and years 3. therefore perhaps the as.yearmon() function in the zoo package could help library(zoo) my.factor <- factor("Feb 2017")

[R] How to Transform a Factor Variable into a Date

2017-06-19 Thread Paul Bernal
Dear all, Hope you are doing great. I have a .csv file that I read 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