Error in data$t : object of type 'closure' is not subsettable

Hey R community, I keep getting the R error "Error in data$t : object of type 'closure' is not subsettable"
my R code is below, do you guys know why this would be?

Thank you, I look forward to hearing from you guys.

#..splitting the time variable.
Time = str_split_fixed(data$t, ":", n= 3)
datatime = cbind(Time, data)

It seems the object data is not what you expect it to be. What code produces it? What happens if you execute


To add to @FJCC's excellent points, data() is a built-in function in R. So if you haven't successfully assigned your own object to the name data, R falls back on trying to use that function. Internally, R calls functions "closures", which is why it's complaining that it can't subset an object of that type.

1 Like

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