Error code with cut function

cut
#1

Sorry if I'm posting this in the wrong space. It's my first post. I keep getting the error code "Error: unexpected ',' in" even though my code looks fine to me. I'm probably missing something as I'm new to R

GINCTOT <- cut(data1$INCTOT, breaks=(0, 213300, 46153, 138460, 200000, Inf), labels=c("Poverty", "Low Income", "Middle Class", "High Income", "1%"))

I'm using income data from IPUMS CPS and am trying to break up the data. Any help I can get is appreciated

0 Likes

#2

never mind I figured it out

0 Likes

#3

If your problem is solved (even by you), will you please mark this thread as solved?

In case you don't know how, here's a helpful post:

1 Like

#4

Could you please edit your answer to include the actual solution to your problem (or the correct code used) this would be useful to others facing the same issue.

0 Likes

#5

I believe the problem was the absence of c in defining the breaks.

The correct code should be GINCTOT <- cut(data1$INCTOT, breaks=c(0, 213300, 46153, 138460, 200000, Inf), labels=c("Poverty", "Low Income", "Middle Class", "High Income", "1%"))

0 Likes

closed #6

This topic was automatically closed 7 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.

0 Likes