, , data.frame.
ccsm.txt pwd R :
ms <- readLines('ccsm.txt',encoding='UTF-8');
ms;
#
#
#
#
#
#
#
d <- as.data.frame(ms);
d;
#
#
#
#
#
#
#
#
names(d);
#
dim(d);
#
sapply(d,class);
#
#
, readLines()/as.data.frame() 7--1 data.frame, .
read.table() ( , fread() data.table):
d <- read.table('ccsm.txt');
d;
#
#
#
#
#
#
#
names(d);
#
dim(d);
#
sapply(d,class);
#
#
, :
for (dcol in 2:length(ms)) {
temp <- d[,c(1,dcol)];
nlist <- temp[order(d[,dcol],decreasing=T)];
lname <- nlist[,1];
};
. -, ms , 7, . 6 . , d[,c(1,dcol)] , dcol 7.
dcol 7, temp[order(d[,dcol],decreasing=T)] . , temp - data.frame, d. temp, , , . order() 1 6, d ( 6 d), 3 6 - , temp data.frame.
:
apply(d,1,order,decreasing=T);
#
#
#
#
#
#
#
, , :
apply(d,1,function(x) names(d)[order(x,decreasing=T)]);
## V1 V2 V3 V4 V5 V6
## [1,] "V1" "V2" "V3" "V4" "V5" "V6"
## [2,] "V4" "V3" "V2" "V5" "V4" "V4"
## [3,] "V3" "V4" "V4" "V3" "V3" "V5"
## [4,] "V5" "V5" "V5" "V6" "V2" "V3"
## [5,] "V2" "V1" "V1" "V2" "V6" "V1"
## [6,] "V6" "V6" "V6" "V1" "V1" "V2"
, "" , ...[-1,].