Friday 7 August 2015

R: Print elements of vector one per line


Usually R prints members of a vector horizontally.

> data <- 1:6
> data
[1] 1 2 3 4 5 6

If you want to print each member in separate line, you can do this by using cat function.

> cat(data, sep="\n")
1
2
3
4
5
6
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment