Hi,
I am a new R user, coming from SPSS. I have no coding background but have done reasonably well teaching myself how to do simple things in R.
One basic issue that I can't seem to find (probably because I'm not asking the right question or using the correct terminology in my search) is how to reference specific variables in my code without having to reference the dataset simultaneously.
For example, I have written the following:
ggplot(data,
aes(x=data$var1, y=data$var2)) +
geom_point()+
geom_smooth(method=lm)
Now, this does generate the scatterplot that I want, but it gets tedious having to write "data$. . ." with each instance of the variables. it would be so much easier for me if I were able to just directly write the variable name directly.
What am I missing? I know of the Attach() function but have been told this is not good practice.
Suggestions are welcome.