getting Exponential dates while using as.yearqtr in R -


i have date set below.

created.date    supply.date  revenue 1/27/2014     8/1/2011        12232 1/27/2014     8/1/2011        45280 1/27/2013     8/1/2011        57512 8/27/2013     8/1/2011        102792 5/27/2013     8/1/2011        160304 5/27/2013     8/1/2011        263096 4/27/2014     8/1/2011        423400 11/20/2014    8/1/2011        686496 3/10/2015     8/1/2011        1109896 7/19/2015     8/1/2011        1796392 12/10/2012    8/1/2011        2906288 8/10/2012     8/1/2011        4702680 3/10/2012     8/1/2011        7608968 

i used following code:

require(zoo) df.cd.ssd$created.date = as.yearqtr(df.cd.ssd$created.date, format = "%yq%q") 

but output not of required format. output below.

created.date     supply.date     revenue 2.014e+01 q1e+00    6/19/2011   12232 2.013e+01 q1e+00    8/1/2011    45280 2.013e+05 q2e+00    8/1/2011    57512 2.013e+08 q3e+00    8/1/2011    102792 

i have output "2013 / q1", "2014 / q2".

any in resolving appreciated.

you try

df.cd.ssd$created.date <- as.yearqtr(df.cd.ssd$created.date, format="%m/%d/%y") 

but first part of solution. pointed out @g.grothendieck in comment, desired format if obtained using df.cd.ssd$created.date <- format(as.yearqtr(df.cd.ssd$created.date, "%m/%d/%y"),"%y / q%q")

#> head(df.cd.ssd) #   created.date supply.date revenue #1     2014 / q1    8/1/2011   12232 #2     2014 / q1    8/1/2011   45280 #3     2013 / q1    8/1/2011   57512 #4     2013 / q3    8/1/2011  102792 #5     2013 / q2    8/1/2011  160304 #6     2013 / q2    8/1/2011  263096 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -