"object of type 'closure' is not subsettable"

I'm currently trying to do a case study to receive my certificate.
This is the code I'm trying to run
df$sep_start <- as.data.frame(separate(all_trips, 'started_at', into=c('date_started', 'time_started'), sep=' '))
I'm a beginner in R and unfortunately I don't have a teacher to point me in the right direction. Any advice or input is very much appreciated because I feel so defeated.

It seems there is no data frame named df, so the df in df$sep_start is interpreted as the df() function, and you cannot subset a function with the $ operator.
The right side of

df$sep_start <- as.data.frame(separate(all_trips, 'started_at', 
                             into=c('date_started', 'time_started'), sep=' '))

doesn't make a lot of sense either. The separate() function from the tidyr package returns a tibble, so you do not need to wrap that in as.data.frame() and you should not assign the result to a single column.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.