xts coding error

Hello to R language Professionals.
I am new to this language. a part of my paper needs this language. i wanted to run Hamilton Filter but softwares ignore to run the codes and stress on changing the data type to xts one!
actually i calculated my data on Excel for a panel of 25 countries and saved on my drive as a csv file.
time period for each country is: 1960 to 2018.
how should i treat with this 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)
RGDP <- 100*log(xts::to.quarterly(df1["1960/2018-6"], OHLC = FALSE))

the error is below:

Error in [.data.frame(df, "1960/2018-6") : undefined columns selected

please help me to fix the problem

You can turn a dataframe into an xts using as.xts(df).
The rownames of the data frame must be the times of the data.

library(tidyverse)
df <- df %>%
   column_to_rownames("time")  
myxts <- as.xts(df)

Hello.
thank you for your attention.
Is it possible for you to see my data and make a Proportional code for me?

I can not undrestand the xts function.

please help me if you can.

the data is uploaded in csv file below.

I run the code and 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