1

I am trying to convert a character date to date but result is somehow a double.

> x [1] "2017-10-31" > as.Date(x) [1] "2017-10-31" > as.Date(x) %>% typeof [1] "double" > as.Date(x,format="%Y-%m-%d") %>% typeof [1] "double" 
0

1 Answer 1

1

According to ?typeof

typeof determines the (R internal) type or storage mode of any object

Instead of typeof, check the class

library(magrittr) as.Date(x) %>% class # [1] "Date" 

Also, can be checked with inherits

as.Date(x) %>% inherits('Date') #[1] TRUE 

data

x <- "2017-10-31" 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.