Reputation: 13
I have dataset with a header (of years) and four columns that designate different characteristica
For each year, I want to divide all observations by 10^6, except for the first four columns. I know one can do
Data[,-1]/(10^6)
if one wants the first column to be left out, but what about if one needs four.
Best,
ID
Upvotes: 0
Views: 2295
Reputation: 886938
We can use the sequence of 1:4, wrap it inside (..)
and use the -
.
Data[, -(1:4)] <- Data[,-(1:4)]/(10^6)
Upvotes: 4