I'm trying to tidy a large dataset from a text file (.txt).
importing the dataset with read_delim I'm trying to convert different columns in the right format such as datetime and factor
my date are in the format "2008-12-01 13:44:00" (ex with date_maj column name)
when automatically guessing the format when importing these have been recognized as character vectors.
when trying the code :
dataset %>% parse_datetime(date_maj)
I receive the error message
Error: is.character(x) is not TRUE
however when typing is.character(date_maj) it's TRUE
I try to retype as.character(date_maj) and other manipulation and did not get any other things than the message error. I had the same type of error in the column I want to convert as factors.
is there any clue/documentation on that type of error and how to solve the problem?
I try to google this error message but did not had a clear answer
thanks for your time!
Using the pipe here, it is as if you're asking for
If you read the doc,
parse_datetime does not work that way with a data.frame as first argument.
You did not provide a reproductible example so I can't check, but this should work like that
library(dplyr) dataset %>% mutate(date_maj2 = parse_datetime(date_maj))
parse_datetime function works on vector only.
Hope it helps
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.