Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does [1] mean in the output of any command executed on R command line?

Tags:

r

I think the question is self-explanatory.

Whenever we execute any command in R, the output is preceded by [1]. What does that [1] represent?

like image 530
Shaun Avatar asked Nov 22 '22 16:11

Shaun


1 Answers

I'm not sure why this question was only implicitly answered in the comments, but the answer would appear to be that the [1] and every similar number at the beginning of a line indicates that the adjacent element is the nth element printed.

It's not clear to me why this is needed for something as simple as:

a <- "alpha"
a

which outputs

[1] "alpha"

Nonetheless, it appears to be a consistent prefix on any line of data presented on the console.

like image 134
Andrew Avatar answered Nov 24 '22 06:11

Andrew