newbie
newbie

Reputation: 907

Manipulate Time Stamp

Given the following time stamp

timeind <- c("Q1/2005", "Q2/2005", ... "Q4/2012")

I expect that the return would be as follows:

1st column represent time in quarter

2nd column represent time in year

How do I manipulate the data to obtain the result ?

Thank you

Upvotes: 0

Views: 89

Answers (1)

akrun
akrun

Reputation: 887118

Not sure about your expected result.

  timeind <- c("Q1/2005", "Q2/2005", "Q4/2012")

 library(zoo)
 as.yearqtr(timeind, "Q%q/%Y")
 #[1] "2005 Q1" "2005 Q2" "2012 Q4"

Update.

Based on the new info.

 read.table(text=timeind,sep="/",header=F,stringsAsFactors=F)
#  V1   V2
#1 Q1 2005
#2 Q2 2005
#3 Q4 2012

Upvotes: 4

Related Questions