When system() has the parameter input, a tmp file f is written, and the final command line is given by:
command <- paste(command, "<", f).
I think this would work more as expected if it were
command <- paste("<", f,command)
The issue is that if command is a pipeline, such as "cat | wc", then the final command from system() gives the input to wc, rather than cat, which is probably not the expected behavior. In particular, the following command hangs, because cat is waiting for stdin:
system("cat | wc",input=c("a","b"))
If we group the commands, like
system("(cat | wc)",input=c("a","b"))
it works... but I can't think of any reason not to just be the stdin redirection first, so things work as expected in the natural way.
The designers here took a minimal view of the shell (if any) invoked by the C-level 'system' command. POSIX requires a shell that allows redirections in the 'shell execution environment' as well as of commands (Utilities volume §2.7), but a POSIX shell is not required (whereas all C-based commands support redirection, so redirecting commands is known to work).
It is likely that POSIX-compliant shells are now universal on Unix-alike R platforms (there are many fewer than there used to be), so we will test this.
Seems to have passed testing on the platforms available to me.