Changing factor data Posted by Barbara Pavliakova Walters Data Society – Home › Forums › Clustering and finding patterns › Changing factor data This topic contains 2 replies, has 2 voices, and was last updated by Barbara Pavliakova Walters 2 years, 9 months ago. Viewing 3 posts - 1 through 3 (of 3 total) Author Posts November 10, 2015 at 9:37 pm EDT #9671 Barbara Pavliakova WaltersParticipant My Achievements So I did as.numeric(as.factor(data)) on my data, but it didn’t come out right – help! November 15, 2015 at 10:23 pm EDT #9712 siddhu25Participant My Achievements Hi Barbara, Could you please try below and let me know this is working for you. indx <- sapply(data, is.factor) data[indx] <- ldply(data[indx], function(x) as.numeric(as.character(x))) December 15, 2015 at 6:40 am EDT #10052 Barbara Pavliakova WaltersParticipant My Achievements Thank you! That works 🙂 Author Posts Viewing 3 posts - 1 through 3 (of 3 total) You must be logged in to reply to this topic.