You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since there is this strange "lcd" included in the class, any call to RawData gives this error:
dat <- dat %>%
mutate(RawData = map(RawData, ~mutate_all(., as.character)))
Error: Problem with `mutate()` input `RawData`.
x `x` must be a vector, not a `tbl_df/tbl/data.frame/lcd` object.
i Input `RawData` is `map(RawData, ~mutate_all(., as.character))`.
I can get around this error by converting RawData back to tibbles.
What is the reason for having the lcd function modify the object class?
Are you sure the problem is with lcd as part of the class info? I can't replicate your code (i dont know where crossing comes from). You're calling as.character() on a data.frame and the error is saying mutate expects a vector, which suggests to me it's expecting a vector of items, not a data.frame.
dat <- lcd(72658014922, 2000)
class(dat)
[1] "tbl_df" "tbl" "data.frame" "lcd"
The problem appears to be the modification of the class with the word "lcd". The source code for the lcd function shows that this modification happens in the last line of the lcd function:
The lcd package adds the word "lcd" to the object class, which causes problems when working with other R packages.
Here is a sample data set:
I use map to get NOAA's LCD records for each year in the data.
When I check class for the RawData, I get the following:
Since there is this strange "lcd" included in the class, any call to RawData gives this error:
I can get around this error by converting RawData back to tibbles.
What is the reason for having the lcd function modify the object class?
Here is my session information:
Session Info
The text was updated successfully, but these errors were encountered: