user3363145
user3363145

Reputation:

What does "-" mean in R within []

For example:

stars(utilities[,-9], labels = as.character(utilities[,9]))

The utilities is a data.frame, and it has 9 columns and the 9th is the name.

What does -9 mean?

Upvotes: 1

Views: 151

Answers (1)

Spacedman
Spacedman

Reputation: 94162

This:

stars(utilities[,-9], labels = as.character(utilities[,9]))

will run stars on utilities without the 9th column, and use that column as the labels.

Negative indices in subscripts cause selection of everything except those items/rows/columns.

Upvotes: 3

Related Questions