An alternative to cat() is writeLines() :
> writeLines("File not supplied.\nUsage: ./program F=filename") File not supplied. Usage: ./program F=filename >
The advantage is that you do not need to remember adding "\n" to the line passed to cat() to get a new line after your message. For example. compare the above with the same cat() result:
> cat("File not supplied.\nUsage: ./program F=filename") File not supplied. Usage: ./program F=filename>
and
> cat("File not supplied.\nUsage: ./program F=filename","\n") File not supplied. Usage: ./program F=filename >
The reason print() does not do what you want is because print() shows you a version of an object from the R level - in this case it is a character string. To display the string, you need to use other functions, such as cat() and writeLines() . I say "version" because accuracy can be reduced in printed numbers, and the printed object can be supplemented with additional information, for example.
Gavin Simpson Nov 01 '10 at 19:07 2010-11-01 19:07
source share