Time series with 4 lectures in each year

Hi community
Im want make a time series. But I dont understan how to put adecuate frecuency in my data. Because I have 4 lectures in each year.

Im run this code with different frecuency().

col <- ts(data, start=(2005), end=(2017), frecuency=3)

col2 <- ts(data, start=(2005), end=(2017), frecuency=4)

Appear this error in both frecuency:

Error in ts(data, start = (2005), end = (2017), frecuency = 3) :
unused argument (frecuency = 3)

Short example of data:

data<-dput(data2[1:50,c(1,5)])
structure(list(`Año(aaaa) Trimestre` = c("2005-I", "2005-II", 
"2005-III", "2005-IV", "2006-I", "2006-II", "2006-III", "2006-IV", 
"2007-I", "2007-II", "2007-III", "2007-IV", "2008-I", "2008-II", 
"2008-III", "2008-IV", "2009-I", "2009-II", "2009-III", "2009-IV", 
"2010-I", "2010-II", "2010-III", "2010-IV", "2011-I", "2011-II", 
"2011-III", "2011-IV", "2012-I", "2012-II", "2012-III", "2012-IV", 
"2013-I", "2013-II", "2013-III", "2013-IV", "2014-I", "2014-II", 
"2014-III", "2014-IV", "2015-I", "2015-II", "2015-III", "2015-IV", 
"2016-I", "2016-II", "2016-III", "2016-IV", "2017-I", "2017-II"
), Intereses = c(3487.7340796913, 2636.1720431842, 4098.7810605988, 
1127.7775577085, 3898.7200068568, 3173.4231650307, 5200.9872227416, 
2568.5529693648, 4563.7053724986, 3689.8479045882, 5328.9957833292, 
3027.943784559, 3216.4330560052, 3590.2597494772, 4921.7015570933, 
3509.2270647808, 3267.2335649236, 3752.591130593, 5309.6809854114, 
3640.7569827354, 2808.0944016763, 4384.7273283165, 5153.7080387692, 
3293.4313083865, 2888.6304625115, 5441.9009141676, 5345.4405829456, 
4035.0252381896, 3274.6679703078, 4440.9410689445, 5620.2510678808, 
3971.8280391794, 3137.8612868065, 4763.6464493441, 5098.6004975375, 
4370.5127517673, 2916.9675160472, 4461.8158321922, 6220.9851841919, 
3750.8295027979, 3173.8139113252, 4124.7981239368, 7800.2754718405, 
5112.4716690847, 4093.9792156983, 5224.9834134052, 10451.3900750738, 
3725.9879281201, 4051.180479499, 7013.2845555995)), row.names = c(NA, 
-50L), class = c("tbl_df", "tbl", "data.frame"))

Thanks

Hi,

Try this:

col <- ts(data$Intereses, start=2005, end=2017, frequency=3)
  • The ts object needs to be a vector
  • Note the spelling of frequency.

You could also try other packages too, like https://tsibble.tidyverts.org/

1 Like

Thanks @williaml, I dont see this error. Because this word is a false cognate with my mother tongue (Spanish). Because in Spanhis we said frecuencia but in English is frequency. Well check!!!

1 Like

You may also type freq = .

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.