[R] Dataframe by Serial ID
David Winsemius
dw|n@em|u@ @end|ng |rom comc@@t@net
Wed Jan 8 16:09:51 CET 2020
> On Jan 8, 2020, at 6:52 AM, Thomas Subia <tsubia using imgprecision.com> wrote:
>
> Colleagues,
>
> I have two data frames which look like this.
>
> Data frame 1
>
> Serial Pre.Hole Pre.flow Pre.Date
> 1 3036 1 0.24 19-Nov-19
> 2 3036 2 0.212 19-Nov-19
> 3 3036 3 1.292 19-Nov-19
> 4 3036 4 0.262 19-Nov-19
> 5 3036 5 1.291 19-Nov-19
> 6 3036 6 0.26 19-Nov-19
>
> Data frame 2
>
> Serial Post.Hole Post.flow Post.Date
> 62323 11024 44 -0.678 11-Dec-19
> 62324 11024 45 -0.659 11-Dec-19
> 62325 11024 46 -0.654 11-Dec-19
> 62326 11024 47 -0.699 11-Dec-19
> 62327 11024 48 -0.671 11-Dec-19
> 62328 11024 49 -0.687 11-Dec-19
>
> What I want is to create a data frame whose serials numbers are common to data frames 1 and 2.
> The resulting data frame 1st row would look like this.
>
> Serial Post.Hole Post.flow Post.Date Pre.Hole Pre.flow Pre.Date
Simply try:
new.df <- merge(df1,df2)
You should be aware that those columns with dates are actually factor or character values. R does have a Date class and you will likely want to look at using as.Date to make them more useful.
--
David.
>
> Any ideas on how to do this would be appreciated.
>
> Thomas Subia
> Statistician / Senior Quality Engineer
>
> IMG Companies
> 225 Mountain Vista Parkway
> Livermore, CA 94551
> T. (925) 273-1106
> F. (925) 273-1111
> E. tsubia using imgprecision.com
>
>
> Precision Manufacturing for Emerging Technologies
> imgprecision.com
>
> The contents of this message, together with any attachments, are intended only for the use of the individual or entity to which they are addressed and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please notify the original sender or IMG Companies, LLC at Tel: 925-273-1100 immediately by telephone or by return E-mail and delete this message, along with any attachments, from your computer. Thank you.
>
> ______________________________________________
> R-help using r-project.org 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.
More information about the R-help
mailing list