-1

I have this function and it takes a few parameters. I have this part of the function here:

  sort.order <- order(inputs[,input.of.interest])

Iif I read inputs I get something like:

     Status Quo Vaccination
[1,]  10.409146   16.252537
[2,]   5.834875    9.373437
[3,]   5.784903   15.935623
[4,]  12.208484   18.654250
[5,]   9.786787   16.467321
[6,]   6.560276    9.689887

But what is input.of.interest supposed to be? What does it mean, how is this function used?

Should it be a number, i.e if it's 2, what would it do?

Thomas
  • 43,637
  • 12
  • 109
  • 140

2 Answers2

0

It chooses the column to sort by. If it's 1 it sorts by Status Quo and if it's 2 it sorts by Vaccination.

Sam Dickson
  • 5,082
  • 1
  • 27
  • 45
0
x <- seq(20, 11, -1)
x
# [1] 20 19 18 17 16 15 14 13 12 11
order(x)
# [1] 10  9  8  7  6  5  4  3  2  1
x[order(x)]
# [1] 11 12 13 14 15 16 17 18 19 20

Hope you see better how it works.

SESman
  • 238
  • 2
  • 9