r - Selecting & grouping dual-category data from a data frame -


I really need help with facing a problem. I have a data set that looks like this. .

  Name Sex Total Anna F10 Jamie M2 Jamie F7 Mike M13 Sam F6 Sam M3 Structure (List (name = c ("Anna", "Jamie", "Jamie "M", "Sam", "Sam"), Sex = C ("F", "M", "F", "M", "F", "M"), Total = C (10 L , Name = C ("name", "gender", "total"), class = "data.frame", line name = 2, 7L, 13L, 6L, 3L) (NA, -6L))  

Whatever I have to do, get the name, which are both men and women names, so the results will be shown ..

Name Gender Total Jamie M2 Jamie F7 Sam M3 Sam F6

But I'm really stumped on how to get in touch.

d :

In this way I can understand this Get the vector by the name of the data d pre> #, which are used by both M and F. Name & lt; # Intersect (d $ name [d $ gender == 'm'], d $ name [d $ sex == 'f']) # Use duplicate names to filter data [d $ name %% dual In .names,]


Comments

Popular posts from this blog

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

c# - Process.Kill() returns access denied -

c# - Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments -