Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I print each text element on a new line after a tab indent?

Tags:

r

I want to be able to print each text element on a new line after one tab indent.


Desired Results


   "A" 
   "B" 
   "C"

Code


LETTERS[1:3]

Output


[1] "A" "B" "C"
like image 906
MYaseen208 Avatar asked Jan 16 '14 13:01

MYaseen208


People also ask

How to print the output in next line in c?

The newline character ( \n ) is called an escape sequence, and it forces the cursor to change its position to the beginning of the next line on the screen. This results in a new line.

How to print new line in r language?

The most commonly used are "\t" for TAB, "\n" for new-line, and "\\" for a (single) backslash character.

How do you line break a string in HTML?

To do a line break in HTML, use the <br> tag.


1 Answers

You could use a combination of cat and paste (and the special characters \t (tab) and \n (newline)), e.g.:

cat(paste0("\t", LETTERS[1:3], "\n"))
like image 180
sgibb Avatar answered Sep 19 '22 00:09

sgibb