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

arun smartpink111 at yahoo.com
Tue Apr 30 03:51:03 CEST 2013


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.




More information about the R-help mailing list