0

I have a matrix of 5659 rows and 42 columns. The first column has the date as a numeric, and the rest columns consist of different country exchange rates also as numeric. firstly, I want to compare the First column(dates for a certain time) with 2nd column USD exchange rates and plot the graph; I am trying with this

date <- as.Date(x[, 1], origin = "2020-01-01"
# condition for date want to use is date >= "2020-01-01" & date <= "2020-12-31"
usd <- x[, "USD"]
z <- x[date >= "2020-01-01" & date <= "2020-12-31", "USD"]
plot(date, usd, type = "l", lty = 1,col = "blue" , main = "20-01-01 To 2020-12-31 Euro 
     to Usd Exchange Rate",xlab = "Date", ylab = "Exchange Rate")

Unable to get the desired output. Can someone guide me, please?

  • Could you provide some example data? – abreums Mar 29 '21 at 10:37
  • Date USD JPY BGN 18667 1.2104 126.58 1.9558 – Jatinder Singh Malhi Mar 29 '21 at 10:53
  • 1
    Welcome to SO! Please read the information at the top of the [tag:r] tag, where it suggests to *"Use `dput()` for data "*. Other good references for how to make a question more reproducible (meaning something we can actually try and get reasonable results): https://stackoverflow.com/q/5963269, [mcve]. Finally, *"unable to get the desired output"* means very little. What do you get and what is wrong with it? – r2evans Mar 29 '21 at 11:00

0 Answers0