Thanks, everybody!
*Felipe Nunes*
CAPES/Fulbright Fellow
PhD Student Political Science - UCLA
Web: felipenunes.bol.ucla.edu
On Mon, Jan 16, 2012 at 2:33 PM, Marc Schwartz wrote:
>
> On Jan 16, 2012, at 4:13 PM, Felipe Nunes wrote:
>
> > Dear all,
> >
> > I have a data set in which the same un
On Jan 16, 2012, at 4:13 PM, Felipe Nunes wrote:
> Dear all,
>
> I have a data set in which the same unit appears 2 or 3 or 4 times. I need
> to aggregate this data to maintain only one unit by row. But I need to do
> that based on a comparison between the values of such units. I can't find a
>
Hi Felipe,
Try
x <- structure(list(Units = c(1L, 1L, 2L, 2L, 2L, 3L, 3L, 4L, 4L,
4L), Var1 = structure(c(2L, 3L, 4L, 3L, 1L, 3L, 1L, 2L, 3L, 1L
), .Label = c("A", "B", "C", "D"), class = "factor"), Var2 = c(2L,
1L, 3L, 2L, 1L, 2L, 1L, 3L, 2L, 1L), Var3 = c(2L, 3L, 3L, 1L,
2L, 1L, 3L, 3L, 2L, 1L))
Hi,
Here's one option:
dat <- read.table(text = "Units Var1 Var2 Var3
1 B 22
1 C 1 3
2 D 33
2 C 21
2 A 12
3 C 21
3 A 13
4
Dear all,
I have a data set in which the same unit appears 2 or 3 or 4 times. I need
to aggregate this data to maintain only one unit by row. But I need to do
that based on a comparison between the values of such units. I can't find a
function to help me on that. I appreciate any help. Below I pro
5 matches
Mail list logo