2

I received the following error while running the below mentioned code in jupyter notebook

Error in parse(text = x, srcfile = src): <text>:6:12: unexpected input 5: 6: z <- (xbar <e2> ^ Traceback: 

The code:

xbar <- 9900 # sample mean mu <- 10000 # hypothesized value sigma <- 120 # population standard deviation n <- 30 # sample size z <- (xbar − mu)/(sigma/sqrt(n)) 
0

1 Answer 1

1

The (minus sign) in your example looks like it might actually be the en dash character. Here is the character in your example, followed by the standard keyboard dash/hyphen character: −, -.

If you delete that character and type the standard dash character, does the code run as expected?

Here's a reproduction of your error in a regular R session. The first version is your original code. In the second, I've replaced the en dash with a standard dash. I haven't used code formatting below, because the two dashes look exactly the same after going through the code formatter.

(xbar − mu)/(sigma/sqrt(n))
Error: unexpected input in "(xbar �"

(xbar - mu)/(sigma/sqrt(n))
[1] -4.564355

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.