filter function in R

how do I solve this problem?

By running line 20 code I get this error:

" object of type 'closure' is not subsettable"

description$reason<-NA
tibble(head(description,10))
names<-first$Variable_name
df<-dff %>% select(any_of(names))
description<-as.data.frame(names(df))
description<-left_join(description, first[,], by=c("names(df)"="Variable name"))

The error is due to the fact that first is a function in the dplyr package and $ is used to select a column in a data frame. The combination first$ does not make sense; you cannot select a column from a function. Also, having Variable name within the parentheses of the first function would also cause an error. You cannot have a space in a variable name. What are you trying to do with line 20?

I am new to r and I apologize in advance if my question is stupid. I wrote this code on mac and it did work but now that I use the script on windows it doesn't work. the symbol around the variable name has changed.
so what should I do?

It looks like you intend to have a data frame named first but it does not exist. Without seeing the whole script, I cannot guess why that is. I suggest you post the entire script. Instead of posting an image, please post the actual text of the script. Place a line with three back ticks just before and after your code, like this:
```
Your code here
```

I will be off line for several hours but someone else can probably help you.

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.