I have three files containing weight, names and wins. I put them into 3 data.frames (held in one list). I am trying to get the 10 highest weights and the corresponding row's values in names and wins.
I know that there is a sort function, but if I sort, I lose the element for the corresponding row number of weight and wins. How am I able to get the highest elements as well as the corresponding rows in the other two lists?
I looked into creating one data.frame with three different columns(weight,names,wins), but I am unsure how to do that.
my.path <- list( "weights.csv","names.csv", "wins.csv")
my.data <- lapply(my.path, read.csv)
my.path2 <- list( "weights.csv","names.csv", "wins.csv")
my.d <- lapply(my.path, read.csv)
#newdata <- my.data[order(my.data[2])]
#print(newdata)
#lapply(my.data[1], function(x) x[order(x), ])
print(my.data[1])