[R] Mapping file-Legend- from 2 Files/Tables
Edwin Sendjaja
edwin7 at gmx.net
Mon Apr 14 01:32:47 CEST 2008
Hello,
Because no one has answered this. I presume that no one knows the soluition.
Fortunately, I found the solution:
Keyword: merge()
----------------------------------------------------------------------
table1<-read.table("Salesman.data")
table2<-read.table("Employee.data")
data<-merge(table1, table2, by.x="User_ID", by.y="User_ID")
result<-data$Name (for example)
Thank you.
Kind Regards,
Edwin Sendjaja
Am Samstag, 12. April 2008 19:40:03 schrieb Edwin Sendjaja:
> Does anyone know how to solve this. I am so desperate.
>
> I'd be terribly grateful for any help.
>
> Am Samstag, 12. April 2008 05:19:16 schrieb Edwin Sendjaja:
> > Hello,
> >
> > I have got 2 Tables from different files:
> >
> > Table 1 (lets say file: Salesman.data)
> > ------------
> >
> > | ID | User_ID
> >
> > ---------------------------
> > 1 | 1 | 4
> > 2 | 2 | 6
> > 3 | 3 | 7
> > 4 | 4 | 2
> > 5 | 5 | 3
> >
> >
> > ############################
> > Table2 (file: Employee.data)
> > ----------
> >
> > | User_ID | Name
> >
> > ----------------------------------
> > 1 | 1 | Donna
> > 2 | 2 | John
> > 3 | 3 | Michael
> > 4 | 4 | Wolf
> > 5 | 5 | Tim
> > 6 | 6 | Edward
> > 7 | 7 | Shaun
> >
> >
> >
> > What i want do is:
> >
> >
> > I want to map the table 2 into table 1.
> > instead of User_ID I want to use the name of the person which is related
> > to the User_ID.
> >
> >
> >
> > The legend should look like this
> >
> > _________________
> >
> > | LEGEND |
> > |-----------------------------|
> > | -2- John |
> > | -3- Michael |
> > | -4- Wolf |
> > | -6- Edward |
> > | -7- Shaun |
> >
> > ------------------------------
> >
> >
> > Does anyone know how I can create such a mapping legend?
> > Is there any good command to do this?
> >
> > I've tried using "replace" but this is not a good solution. because it
> > replaces only 1 values.
> >
> >
> > Kind Regards,
> >
> > Edwin Sendjaja
> >
> > ______________________________________________
> > 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.
>
> ______________________________________________
> 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.
More information about the R-help
mailing list