EvelynM comments on 2012 Survey Results - Less Wrong

80 Post author: Yvain 07 December 2012 09:04PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (640)

You are viewing a single comment's thread. Show more comments above.

Comment author: EvelynM 29 November 2012 09:23:21PM 0 points [-]

"iqt <- as.numeric(dat$IQTest)" The already numeric IQ is in dat$IQ, iqt is only the suspect, online IQtest.

Comment author: Douglas_Knight 02 December 2012 05:36:06AM 1 point [-]

A serious design flaw in S/R means that your code fails badly and silently. The man page suggests that you try as.numeric(factor(5:10)).

Matt Simpson's code is correct. The man page suggests slightly faster as.numeric(levels(dat$IQTest))[dat$IQTest]. That example also shows why they chose the the coercion that they did.