I'd be willing to guess that some combination of
match()
%in%
unlist()
will get the job done, but without knowing what sort of data you have, I
can't write example code.
If you could, use the dput() function to turn your data into plain text and
let us work directly with it to help you out. If it's too huge, please break
off a byte-sized chunk before sending.
Michael
On Thu, Aug 25, 2011 at 1:38 PM, Serena105 <serena_tuc@hotmail.com> wrote:
>
> Hi!
> I am a beginner and I hope you will help me!
> I have one data frame with numbers as columns names that correspond to
> codes.
> In a list I have the codes and the corresponding state.
> Now I need to match the columns (codes) of the data.frame with the codes in
> the list, since not all the codes in the dataframe are also in the list and
> vice versa.
> As output I will need a table with just the columns( codes) that are in the
> list..
> How you think I could do that? I will really appreciate any help!
>
> Thanks a lot in advance!
>
> Serena
>
>
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/how-to-match-a-dataframe-and-a-list-tp3768914p3768914.html
> Sent from the R help mailing list archive at Nabble.com.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
[[alternative HTML version deleted]]