George
George

Reputation: 5681

print variable in new line

I am listing for example :

test <- unique(df$sed)

"A"
"B"
"C"

In order to refer to knitr to the above variable, I am using:

r test .

But, the problem is that it prints : A,B,C

I want to print:

A
B
C

Upvotes: 1

Views: 205

Answers (2)

markdly
markdly

Reputation: 4534

Set the chunk option comment="", e.g.,

```{r comment=""}
cat(test, sep = "\n")  
```

Upvotes: 1

timfaber
timfaber

Reputation: 2070

Perhaps something like this?

cat(paste(test,collapse = "\n"))

Upvotes: 0

Related Questions