motivation behind the fact that printing R vectors take equal (maximum one) amount of lines for each element

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

motivation behind the fact that printing R vectors take equal (maximum one) amount of lines for each element

gaurav arora
What is the motivation behind the fact that printing R vectors take equal
(maximum one) amount of lines for each element?
<https://stackoverflow.com/questions/65355999/what-is-motivation-behind-the-fact-that-printing-r-vectors-take-equal-maximum-o>

The vector x has a large string at index 2, while a small string at index
1. When we do a print, even the entry at index 1 takes two lines. In other
words, the element at index 2 is printed after leaving an empty line. When
we run a command using system using intern arg, there may be outputs of
varying length, and then output is clumsy, as maximum no of lines are used
for each element of the vector

x = c("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
x = c("2", x)
x
#Output
[1] "2"

[2] "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"

Why could printing with some delimiters, like a comma or space etc, not
suffice ? Similar args may apply for a vector containing some large
numbers, and some small numbers, but we will take more space to print

--
Gaurav Arora

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel