0

I'm quiet new in R and especially in time analysis. I try to be concise, I want to learn some time series analysis and from my original dataframe (in the first picture) I want to obtain a dataframe with 2 columns, time and x value. There is some quick method to do this, I tried to use unlist but after that I got stuck. Thanks in advance for your help. basically the columns with x1.22.20 are date

George
  • 1
  • 1
    Please do not post images of data or code. Instead use `head` and `dput` and formatted code. Also it's always excellent to add provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610). It makes it easier for others to find and test a answer to your question. That way you can help others to help you! – dario Mar 07 '20 at 20:55
  • George, that image looks like your method for reading in the file is flawed. Instead of trying to fix the `data.frame`, I suggest you look at how to read it in right the first time. If you used `read.csv` before, then perhaps try `read.csv("filename.csv", header = FALSE)` and see if it looks any better. From there, you will still need to reshape it, but at least it will be a little more accommodating (not having to parse out the `x`, for instance). For that part, you might just to use `t` (for transpose) and then `as.Date` and `as.numeric` for the two columns. Good luck! – r2evans Mar 07 '20 at 22:33

0 Answers0