Fixing "unexpected '=' error

Hi all,

I'm using the following code to visualize my data but I keep getting the error: "Error: unexpected '=' in: ". Could someone please help?

Here's the code:

ggboxplot (mydata, x = "familiarity", y = "transparency",color = "familiarity", palette = c("#00AFBB", "#E7B800"),ylab = "transparency", xlab = "familiarity")

Thanks in advance!

Your code runs for me, as shown below. I suggest you restart your R session and retype your code.

mydata <- data.frame(familiarity = rep(c("A","B"),50),
                     transparency = rnorm(100))
#> Loading required package: ggplot2
ggboxplot (mydata, x = "familiarity", y = "transparency",color = "familiarity", palette = c("#00AFBB", "#E7B800"),
           ylab = "transparency", xlab = "familiarity")

Created on 2024-02-17 with reprex v2.0.2

1 Like


Thank you so much for your response. I tried doing that but the error persists :frowning:

@FJCC 's solution also worked for me, but why don't you try changing to

1 Like

Still the same error unfortunately.

Have you tried running the code from my last post. That is, copy it from my post into your code pane and running those lines. Does that work.

1 Like

Odd. After trying @FJCC's suggestion, you might try reinstalling the package.

1 Like

@ New2Stats

Both your code and FJCC's code work for me. I think @ startz's suggestion sounds good.

1 Like

I did yes, still the same error. I tried reinstalling the package, also restarted R session a few times but nothing is working which is quite odd.

Restarting R might be scuppered if you have your RStudio configured to auto load your previous workspace image, in which case restarting R is effectively not doing anything. Just a thought.

1 Like

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.