Combining text files

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Combining text files

R help mailing list-2
Colleagues,
I've got several text files which contain data for each metric I need to report on.One text file contains the serial number data. Another has customer and work order number. Another has test data. All text files have the same number of rows but all have different numbers of columns.

I was thinking about using bind_cols() to do this.

Am I on the right track here?
All the best,
Thomas SubiaStatistician / Sr. Quality EngineerIMG Precision Inc.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Combining text files

Jeff Newmiller
Do you know for certain that the rows are in the same order? then yes... cbind or bind_cols would do it. I would be surprised to find such files... but it is possible.

On December 3, 2019 9:37:34 PM PST, Thomas Subia via R-help <[hidden email]> wrote:

>Colleagues,
>I've got several text files which contain data for each metric I need
>to report on.One text file contains the serial number data. Another has
>customer and work order number. Another has test data. All text files
>have the same number of rows but all have different numbers of columns.
>
>I was thinking about using bind_cols() to do this.
>
>Am I on the right track here?
>All the best,
>Thomas SubiaStatistician / Sr. Quality EngineerIMG Precision Inc.
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Combining text files

Eric Berger
Continuing with Jeff's point: do you know for certain that the serial
number in row 5 of one file corresponds to the 'work order number' in row 5
of a different file?
Ideally this could be verified based on some sort of identifier that
appears as a column in both files and you could match up corresponding rows
in the two files by matching this identifier (or possibly multiple
identifiers.)
This type of matching is called a join and joins are supported in the dplyr
package (which also provides the bind_cols() function you referred to.)
Check out
?dplyr::join

HTH,
Eric



On Wed, Dec 4, 2019 at 7:55 AM Jeff Newmiller <[hidden email]>
wrote:

> Do you know for certain that the rows are in the same order? then yes...
> cbind or bind_cols would do it. I would be surprised to find such files...
> but it is possible.
>
> On December 3, 2019 9:37:34 PM PST, Thomas Subia via R-help <
> [hidden email]> wrote:
> >Colleagues,
> >I've got several text files which contain data for each metric I need
> >to report on.One text file contains the serial number data. Another has
> >customer and work order number. Another has test data. All text files
> >have the same number of rows but all have different numbers of columns.
> >
> >I was thinking about using bind_cols() to do this.
> >
> >Am I on the right track here?
> >All the best,
> >Thomas SubiaStatistician / Sr. Quality EngineerIMG Precision Inc.
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >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.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.