-1

I have a large dataset which has the following format:

Unit     ZoneCode  
2119601  R1Z    
2119601  R1Z  
2119601  B1Z  
2119602  PUZ2  
2119602  R1Z 

I would like to produce output that lists - for each unit - each unique ZoneCode that is associated with that Unit.

The output would look like this

Unit     ZoneCode  
2119601  R1Z  
2119602  PUZ2  
2119602  R1Z    

I would appreciate assistance with R Code to do this

SimonG
  • 4,701
  • 3
  • 20
  • 31
Graham
  • 13
  • 1
  • 3
  • 2
    I have trouble understanding what you're trying to achieve. Shouldn't `2119601 B1Z` also be in the desired output? If you just want to delete duplicate rows in that dataset, have a look at `?duplicated`. – SimonG Aug 24 '14 at 12:35
  • 1
    @Graham Why don't you have `2119601 BIZ` in the expected output. Try `unique(dat)` – akrun Aug 24 '14 at 13:09

1 Answers1

0

The R function that produces a unique list is unique(df)

Thanks to @akrun

Graham
  • 13
  • 1
  • 3