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.