A Big Chalenge With xts Object

Hello to R professionals...
I wanted to run the hamilton code below:

df <- read.csv("E:/PhD Essay/Papers from my essay/Mofid/codes/Business cycle filter/Hamilton Filter/R Code/RGDP.csv", header=TRUE, sep=",") 
library(xts)
log_rgdp <- 100*log(xts::to.quarterly(df["1947/2016-6"], OHLC = FALSE))

rgdp_trend <- yth_filter(log_Employment, h = 8, p = 4, output = c("x", "trend"), family = gaussian)

plot.xts(rgdp_trend, grid.col = "white", legend.loc = "topleft", main = "Log of rgdp and trend")

Is it possible for you to see my data and make a Proportional code for me? :sob: :sob: :sob: :sob:

I can not undrestand the xts function.

please help me if you can.

the data is uploaded in CSV file below.

https://gofile.io/d/75nhuL

please first see my data and then write the code
I run a code but get the error below: :disappointed: :disappointed: :sob:

library(tidyverse)

df <- df %>%

column_to_rownames("year")


Error in  `.rowNamesDF<-` (x, value = value) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘1960’, ‘1961’, ‘1962’, ‘1963’, ‘1964’, ‘1965’, ‘1966’, ‘1967’, ‘1968’, ‘1969’, ‘1970’, ‘1971’, ‘1972’, ‘1973’, ‘1974’, ‘1975’, ‘1976’, ‘1977’, ‘1978’, ‘1979’, ‘1980’, ‘1981’, ‘1982’, ‘1983’, ‘1984’, ‘1985’, ‘1986’, ‘1987’, ‘1988’, ‘1989’, ‘1990’, ‘1991’, ‘1992’, ‘1993’, ‘1994’, ‘1995’, ‘1996’, ‘1997’, ‘1998’, ‘1999’, ‘2000’, ‘2001’, ‘2002’, ‘2003’, ‘2004’, ‘2005’, ‘2006’, ‘2007’, ‘2008’, ‘2009’, ‘2010’, ‘2011’, ‘2012’, ‘2013’, ‘2014’, ‘2015’, ‘2016’, ‘2017’, ‘2018’

> myxts <- as.xts(df)
> Error in as.POSIXlt.character(x, tz, ...) :
> character string is not in a standard unambiguous format

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