1

When running knit on a rmarkdown file the system commands, particularly wc and grep, are not producing any output. The lines I am trying to produce output for are below:

system("wc -l /foo/bar.csv")
system("grep -F .12345 /foo/bar.txt | wc -w")

Has anyone encountered this or does anyone know why this might be? These lines produce the expected output if given to the interpreter. All of my other code runs as expected.

Thanks for any help.

John Siryj
  • 39
  • 1
  • 8

1 Answers1

1

You could try using the intern parameter of system as in the following example where "date" is called.

result <- system('date', intern = TRUE)
print(result)

The result will be capturing the output in result into an R vector.

steveb
  • 5,382
  • 2
  • 27
  • 36