[R] Splitting variables

jim holtman jholtman at gmail.com
Tue Mar 17 00:52:50 CET 2009


y <- x[x<600]
z <- x[x>=600]

2009/3/16 Rickard Grönholm <gronholm.richard at gmail.com>:
> Dear R Users,I have a data set with several variables. One of these
> variables is the number of farms per county and I'd like to split this
> variable into two domains: (a) counties with fewer than 600 farms and (b)
> counties with 600 or more farms
> I've tried solving this problem for hours, but I'm new at R so I'm not
> getting there.
> if (x < 600) y <- x else z <- x
> didn't do it. All I accomplished was copying everything to z since the first
> county in my data set has 700+ farms
>
> Richard
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list