반응형 분류 전체보기123 (R) Sorting vector, data frame / sort(), order(),xtfrm > x = c(1:3,9,7,4)> sort(x)[1] 1 2 3 4 7 9> sort(x, decreasing = TRUE)[1] 9 7 4 3 2 1 > head(Animals) body brainMountain beaver 1.35 8.1Cow 465.00 423.0Grey wolf 36.33 119.5Goat 27.66 115.0Guinea pig 1.04 5.5Dipliodocus 11700.00 50.0 > ani order1=order(row.names(ani)) > order1 [1] 15 7 26 11 24 2 6 8 12 4 19 13 3 5 9 14 23 18 27 1 20 28 10 21 25 17[27] 22 16 > ani_2 ani_2 body brainAfrican eleph.. 2020. 11. 8. (R) ANOVA TEST ANOVA TEST is abbreviation of 'analysis of variance.' I can explain it efficiently comparing with T-test. We use T-test in decision whether to accept the alternative hypothesis or not. Normally, we use T-test dealing with two groups which becomes the subject of comparison. When the number of groups for comparisons is more than 2, the type 1 error(significance level) becomes larger in multiple. S.. 2020. 11. 7. (R) reorganize data frames - stack, unstack, reshape function We sometimes need to reorganize data frames in a new form according to certain needs for making functions or statistical calculations. > dat1=data.frame(A=runif(20,0,0.7),B=runif(20,0,0.9),C=runif(20,0.8))> dat1 A B C1 0.60730714 0.34485044 0.80838562 0.43592037 0.68032657 0.85261013 0.41984612 0.89238618 0.94683204 0.48211414 0.06180126 0.94203135 0.62057361 0.44256735 0.96726916 0.65831211 0.2.. 2020. 11. 7. (R) Combining Data frame, matrix and vectors using rbind, cbind / Merging data frames using merge() Combining Data frame If you have the two data frame which has the same length of columns and same column names (x,y), you can combine the data frames in a data frame with the columns in common. If the name of variables in columns are different, it prints out the error. > dat2 = data.frame(x = 3:5, y = rep(2, 3))> dat1=data.frame(x=1:6, y=rep(1,6))> dat1 x y1 1 12 2 13 3 14 4 15 5 16 6 1> dat2 = .. 2020. 11. 7. 이전 1 ··· 7 8 9 10 11 12 13 ··· 31 다음 반응형