0

I have in one directory files with the extension part_a.csv and files with the extension part_b.csv. I want to merge them into two separate files. I tried to do it with a real bulk. At first, I merge all files into one file and then split with 'filter' into two separate files. The problem is that both groups have an RT column that actually relates to two different variables. So that the merged data files merge the results into a single column. Does anyone have a suggestion what can I do? This is the code I wrote (which does not match the situation):

MergeAll <- read_bulk(extension = '.csv') #Merge all files

MergePartB <- MergeAll %>% filter(grepl('part_b.csv',File))

MergePartA <- MergeAll %>% filter(grepl('part_a.csv',File))

dalitmil
  • 41
  • 4
  • 2
    It's pretty unclear to me exactly what you are trying to do. It would be easier to help if you provided a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input so we can see what's going on. Since you want to split the data after you read it in, seems like it would be just easier to read it in separately to begin with. – MrFlick Jan 18 '18 at 16:21
  • I'm not familiar with the `read_bulk` command (what package is it from??), but could't you do, e.g., `B = read_bulk(extension = 'b.csv')`? – Gregor Thomas Jan 18 '18 at 16:24
  • It's a package 'readbulk' - a really convenient and efficient package. In any case thank you very much for the answer. It's so simple, how I did not think about it myself..... I was sure that extension refers only to the type of file that is set to the right of a dot that I did not even bother to check. It works fine. – dalitmil Jan 18 '18 at 21:10

0 Answers0