Re: [R] can I add line breaks to the paste() function?
Thanks for the help. This solves my problem - I wanted to print out errors and warnings on separate lines with a single call. Thanks, David On Thu, Sep 30, 2010 at 3:42 PM, Jeremy Miles wrote: > Try using cat instead. Then "\n" is the new line character. > > E.g. > cat("1st line\n2nd line\n") > > Jeremy > > > > > On 30 September 2010 13:30, David LeBauer wrote: >> Can I add a line break to the paste() function to return the following: >> >> 'this is the first line' >> 'this is the second line' >> >> instead of >> 'this is the first line this is the second line' >> >> ? >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > Jeremy Miles > Psychology Research Methods Wiki: www.researchmethodsinpsychology.com > -- David LeBauer, PhD Energy Biosciences Institute University of Illinois Urbana-Champaign 1206 W. Gregory Drive Urbana, IL 61801, U.S.A. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] can I add line breaks to the paste() function?
Try using cat instead. Then "\n" is the new line character. E.g. cat("1st line\n2nd line\n") Jeremy On 30 September 2010 13:30, David LeBauer wrote: > Can I add a line break to the paste() function to return the following: > > 'this is the first line' > 'this is the second line' > > instead of > 'this is the first line this is the second line' > > ? > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] can I add line breaks to the paste() function?
Hello, Although on the surface a simple request, I think you need to be more specific. ?paste returns a character vector. The first question is: do you want a character vector of length 1 or 2? It sounds like you're trying to format text for display on screen or on a graphics device. Perhaps you're hoping to use ?cat instead with the sep argument set to "\n" ? David LeBauer wrote: Can I add a line break to the paste() function to return the following: 'this is the first line' 'this is the second line' instead of 'this is the first line this is the second line' ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] can I add line breaks to the paste() function?
Can I add a line break to the paste() function to return the following: 'this is the first line' 'this is the second line' instead of 'this is the first line this is the second line' ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.