Skip to content
Prev 322687 / 398500 Next

Is there a function that print a string vertically (by adding "\n")?

Hi,
May be this helps:

?cat(paste(strsplit("abcd","")[[1]],collapse="\n"))
#a
#b
#c
#d 
A.K.


----- Original Message -----
From: jpm miao <miaojpm at gmail.com>
To: r-help <r-help at r-project.org>
Cc: 
Sent: Monday, April 29, 2013 9:41 PM
Subject: [R] Is there a function that print a string vertically (by adding
	"\n")?

Hi,

? I'd like to print a string vertically. For example, I would like to print
"abcd" as? "a\nb\nc\nd"

? Is there a function in R such that

Input: "abcd"
Output: "a\nb\nc\nd"?

?  Thanks,

Miao

??? [[alternative HTML version deleted]]

______________________________________________
R-help at 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.