time series questions

...Hi I'm a new with R.
I'm trying to figure it out how I can get time series in R.

I have data like this,

I wrote the year and months from 01.2013 to 12.2018.
I searched R-code a lot, but I think my data is wrong

Could you tell me how can I get an accurate date?

Thank you

Hello Hannah,

Welcome to the R community :slightly_smiling_face::slightly_smiling_face::slightly_smiling_face:

First of all, I would like to say that it does not help much to see a picture of your data. It would be much better if you provided a link to the data set or code to reproduce the data. Also, you say that "your data is wrong". If it actually is, then there is really nothing anybody in this forum could do for you.

Having said that, it seems that you have monthly data and the date column is in a format that you cannot easily manipulate. Here, I reproduce the dates you have in your data set and reformat them.

library(dplyr)
library(purrr)
library(readr)

# Generate data
my_data <- 
	tibble(
	date = paste0(rep(2013:2018, each = 12), sep = ",", toupper(month.abb))
) %>%
	bind_cols(rerun(5, sample(1:nrow(.))))

# Transform date column
my_data %>%
	mutate(date = parse_date(date, format = "%Y,%b"))

   date          V1    V2    V3    V4    V5
   <date>     <int> <int> <int> <int> <int>
 1 2013-01-01    33    54    19    24    62
 2 2013-02-01    50    16    32    52    68
 3 2013-03-01    59     2    59    42    31
 4 2013-04-01    48    55     8    22    27
 5 2013-05-01    18    51    39    64    51
 6 2013-06-01    42     9    67    39    12
 7 2013-07-01    64    71    43    53    20
 8 2013-08-01    70    44    11    56     2
 9 2013-09-01    55    15    71    49    71
10 2013-10-01    14    65    72    31    59

You may not understand the code if you are new to R but now your date column is in the correct format.

2 Likes

Thanks for the response. I'm a fairly new R user too and found this example helpful to better understanding building and modifying dates.

@herbf I am glad the answer helped. Hopefully your journey through R goes smoothly. R has a great community and tons of "free" resources online that can help you get up to speed quickly.

This is a path in your local machine so we don't have access to it, also, it seems like it's a pdf document not a csv or xlsx file.

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Sorry for I could not give an accurate file, but I could not upload my file because I am a new.
So an one thing that I can do is uploading pdf document.

Could you tell me how I can figure it out?

The picture in the original post looks like it's open in excel. Maybe you could upload the file on the cloud (e.g. Google Drive, Dropbox, ...) and post a link in here.

This topic was automatically closed 54 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.