Error in match.fun(asfn) : 'c("as.hms", "as.difftime")' is not a function, character or symbol

50 views Asked by At

I am trying to join two data frames and keep coming up with the same error message.

Error in match.fun(asfn) : 'c("as.hms", "as.difftime")' is not a function, character or symbol

One dataframe is a series of readings from a gas analyser and using the following code I combined the data and time columns from the raw data within that data frame.

ghg_load_df3 <- ghg_load_df2 %>% mutate(
  date= as.POSIXct(paste(date, time), format="%Y-%m-%d %H:%M:%S"))

The second data frame records the start and end times for specific gas readings. This data frame combines the sampling date and the start and end times as follows.

ancillary_df4 <- ancillary_df3 %>% mutate(
                        light_start_time_ghg= as.POSIXct(paste(sample_date, light_start_time_ghg), format="%Y-%m-%d %H:%M:%S")
                        ,light_end_time_ghg= as.POSIXct(paste(sample_date, light_end_time_ghg), format="%Y-%m-%d %H:%M:%S")
                        ,dark_start_time_ghg= as.POSIXct(paste(sample_date, dark_start_time_ghg), format="%Y-%m-%d %H:%M:%S")
                        ,dark_end_time_ghg= as.POSIXct(paste(sample_date, dark_end_time_ghg), format="%Y-%m-%d %H:%M:%S")
                        ,par=gsub('n/a',NA,par)
                        ,par=gsub('N/A',NA,par)
                        )

However when I use the following to combine the data frames I receive the error message set out above.

light_ghg_ancillary <- sqldf("SELECT * FROM ghg_load_df3
            INNER JOIN light_ghg
            on ghg_load_df3.date BETWEEN light_ghg.start_time_ghg AND light_ghg.end_time_ghg") 

As I understand it my date and times are not in a format that R can use so any help in getting these formatted in a way that I will be able to combine the data frames would be really appreciated.

Thanks

0

There are 0 answers