Error in parse(text = x) : <text>:1:5: unexpected symbol

Hi, I'm new to R studio and trying to do a scatterplot on variables with high correlation in a dataset. The code should be correct but I'm still getting errors.

ggplot(data = combined_survey) + 
+         aes_string(x = "SAT Math Avg. Score", y = "avg_sat_score") +
+             geom_point(alpha = 0.3) +
+      theme(panel.background = element_rect(fill = "white"))

Error in parse(text = x) : <text>:1:5: unexpected symbol
1: SAT Math
        ^

What could be causing this error? Everything has been working up to this moment. Thank you very much for your help!

I think your aes_string() function should be inside of the ggplot() call.

ggplot(data = combined_survey, aes_string(x = "SAT Math Avg. Score", y = "avg_sat_score")) +
     geom_point(alpha = 0.3) +
     theme(panel.background = element_rect(fill = "white"))

I'm still getting this error :frowning:

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

I suggest you check whether the column name SAT MathAvg. Score is correct. If it is, change it so it does not contain any spaces.
If that does not fix the problem, please post a reprex as requested by andresrcs.

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