0

I have a table that has a unique name, date and frequency. I want to separate every unique name in the table in its own separate table. I receive data monthly and the unique name always change; however, the heading remain the same. I provided an example below. Any help will be much appreciated.

Data Input
Unique Name    Date    Frequency
Mark           11/6        3
Dave           10/6        4
Mark            8/5        2
Tim             7/4        9
Mark            9/10       4
Tim             9/15       1

Data Output
Unique Name    Date    Frequency
Dave           10/6        4

Unique Name    Date    Frequency
Mark           11/6        3
Mark            8/5        2
Mark            9/10       4

Unique Name    Date    Frequency
Tim             7/4        9
Tim             9/15       1
G5W
  • 36,531
  • 10
  • 47
  • 80
MJ30
  • 13
  • 4
  • Please `dput()` the example data that you want us to use – Hack-R Dec 05 '16 at 20:06
  • 2
    You may want to look at `?split` to split the data frame by the Unique Name column into a list of data frames (each element corresponding to a unique value in Unique Name) – aichao Dec 05 '16 at 20:09
  • 3
    The answer [here](http://stackoverflow.com/questions/18527051/split-a-large-dataframe-into-a-list-of-data-frames-based-on-common-value-in-colu) demonstrates the `split` method @aichao notes. – Nick Criswell Dec 05 '16 at 20:36

1 Answers1

-1

Supposing your dataframe is called "data":

mark <- data[data[,1]=="Mark",] #so here you'll have all data for "Mark" tim <- data[data[,1]=="Tim",] #all data for "Tim" dave <- data[data[,1]=="Dave",] #all data for "Dave"

Hope it can help you out.