+ 2

Unexpected '{' in "{" (R programming)

idk why it is happened, this code is already closed perfectly with "}" this code: y=lynx y summary(y) outlier <- funtion(x) { n = length(x) for (k in 1 : n) { if (x[k] < quantile(x, 0.25) - 1.5 * IQR(x)) print(c("작아서 이상치", x[k])) else if (x[k] > quatile(x, 0.75) + 1.5 * IQR(x)) print(c("커서 이상치", x[k])) } } outlier(y)

16th May 2020, 5:03 PM
通流
通流 - avatar
3 Antworten
+ 3
I think that function (x) = Without curly bracket
16th May 2020, 6:18 PM
Mohammed Qadir Khan
Mohammed Qadir Khan - avatar
+ 3
Your example has typos in "function" and "quantile". Does it change anything if you set the {} for if and else explicitly?
16th May 2020, 6:54 PM
Lisa
Lisa - avatar
+ 1
omg... i typed wrong word lol...
17th May 2020, 12:31 AM
通流
通流 - avatar