0

As indicated above, can't get the floor_date command to work. My code is the following:

new_data$month <- floor_date(new_data$datadate, "month")

To which I get the following error message:

Error in floor_date(new_data$datadate, "month") : could not find function "floor_date".

Not sure what the issue is. Any help is appreciated, thanks.

Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
  • 1
    `library(lubridate)` first? – r2evans Dec 10 '20 at 21:14
  • 2
    Adding to @r2evans comment. To use something in a package, you first have to install the package on your machine with `install.packages(pkg_name)`. You can then use the package-function combined syntax like so: `lubridate::floor_date()` or you call `library(lubridate)` to "attach" all objects in that package and then simply `floor_date()`. – DanY Dec 10 '20 at 21:17
  • Ahhh, package was installed but I didn't realize you had to use the library command before using it. Thank you for the help! – Liam Herriot Dec 10 '20 at 21:30

0 Answers0