Please Help Me Error in UseMethod("left_join") : no applicable method for 'left_join' applied to an object of class "function"

> # Input Data
> data = read.csv("pkb dan bbn.csv", header =TRUE, sep=";")
> #membuat barisan tanggal
> awal=as.Date("2021-01-02")
> akhir=as.Date("2022-02-11")
> tanggal=seq(from=awal, to=akhir,by = "days" )
> df1=data.frame(Date1=tanggal)
> df2=data.frame(Date2=as.Date(data$Tanggal, format="%d/%m/%y"),
+                pkb=data$PKB, bbn=data$BBNKB)
> #mencocokan df1 dan df2 dengan left join
> library(dplyr)
> df3 = left_join(df, df2, by = c("Date1" = "Date2"))
Error in UseMethod("left_join") : 
  no applicable method for 'left_join' applied to an object of class "function"

The function left_join() is being applied to df and df2, but df does not appear to have been defined yet. I think you might have meant df1?

you define df1 and df2
but your left_join is called for df and df2 , when it should be df1 and df2

df is a built in function in R, hence the complaint. if you typo'd something else that is not a function name, it would give you a plain object missing error.

1 Like

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.