[R] Filtering few column from one data frame based on another data frame

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Sat Oct 13 18:22:04 CEST 2012

I suggest you go back to the Introduction to R document supplied with the software and read about indexing.

In particular, pay attention to indexing into a matrix or data frame using data1[rowspec,columnspec] syntax. There are three kinds of row and column specification types, and any of the the three can be used to solve your problem.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

siddu479 <onlyfordigitalstuff at gmail.com> wrote:

>Dear R-Users and experts,
>This is my first post in this forum.
>I have two csv files file1 and file2.
>file1(many rows and columns) is read into dataframe *data1*
>File2 is read into dataframe *data2* which have only one column of data
>which contains the column names that need to be removed from dataframe
>*data1*columns and update the *data1 *data frame.
>data1 <-read.csv(file1.......,header=T)
>data2<- read.csv(file2,......header=F)
>The output *data1.new* data frame  should be like this
>So I request the R code to accomplish this task.
>View this message in context:
>Sent from the R help mailing list archive at Nabble.com.
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list