0

I have a set of code which is ID: 1, 2, 3, ..., 100, ... 150, ... X: 0.01, 0.02, 0.01, ..., 0.02, ..., 0.04, ...

I want to create a new column with values that correspond to the values of ID for example I want a new column "month" whose values from ID 1-100 are called "May" and from 101-150 is called "June" and so on. So the new data frame would look like this...

ID: 1, 2, 3, ..., 100, ... 150, ... X: 0.01, 0.02, 0.01, ..., 0.02, ..., 0.04, ... Month: May, May, May, May, May, June, June, July, July, ...

How can I do so using the tidyverse package?

Thank you

MTrinca
  • 1
  • 1
  • Please provide reproducible example data - https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – zx8754 Nov 11 '20 at 08:15
  • 1
    Try this example: `x <- 1:400; cut(x, breaks = seq(0, 400, 100), labels = month.abb[ 5:8 ])` – zx8754 Nov 11 '20 at 08:23

0 Answers0