Sujay Shalawadi
Sujay Shalawadi

Reputation: 101

Invoking a UNIX command in R - join operation

system("join -o 1.2 <(sort new.txt) <(sort t.txt) > t20.txt;")

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `join -o 1.2 <(sort new.txt) <(sort t.txt) > t20.txt;'

How can I write this correctly?

Upvotes: 2

Views: 78

Answers (1)

Jerzy
Jerzy

Reputation: 760

As @nicola said, you can put the line into a file and run it as:

system("bash filename.sh")

If however you want to avoid creating the file, you can use the -c option on bash as follows:

system("bash -c 'join -o 1.2 <(sort new.txt) <(sort t.txt) > t20.txt'")

You can read more background on -c option in this answer.

Upvotes: 1

Related Questions