[R] Merge the data from multiple text files

David Winsemius dwin@emiu@ @ending from comc@@t@net
Sat Jan 5 20:11:33 CET 2019


On 1/5/19 7:28 AM, Priya Arasu via R-help wrote:
> I have multiple text files, where each file has Boolean rules.
> Example of my text file 1 and 2
> Text file 1:
> A = not(B or C)
> B = A and C
> C = D
> Text file 2:
> A = D and E
> B = not(D)
>
> I want to merge the contents in text file as follows
> A = not(B or C) and (D and E)
> B = not(D) and (A and C)
> C = D
> Is there a code in R to merge the data from multiple text files?


There is a `merge` function. For this use case you would need to first 
parse your expressions so that the LHS was in one character column and 
the RHS was in another character column in each of 2 dataframes. Then 
merge on the LHS columns and `paste` matching values from the two 
columns. You will probably need to learn how to use `ifelse` and `is.na`.

> Thank you
> Priya
>
> 	[[alternative HTML version deleted]]


You also need to learn that R is a plain text mailing list and that each 
mail client has its own method for building mail in plain text.


-- 

David.

>
> ______________________________________________
> 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