Reputation: 531
I would like to create a dataframe with id, year and month columns with all combinations of the values below.
id <- c(1002,463,546,9787,849,34)
years <- 2000:2009
months <- 1:12
In this simple example, the total number of rows of the dataframe I am looking to get should have 6*10*12
rows. Each one of the 6
ids should show up in 10*12
rows, each one referring to a given year-month.
Upvotes: 0
Views: 18