I have a data like this
df<- structure(list(data = c("A", "AA", "AAA", "AB", "ABN", "AHG",
"ANBV"), G1_1 = c(1677.1, 956, 57.7, 44.5, 1578.2, 1184.8, 1958.5
), G1_2 = c(1296.9, 1230.2, 68.4, 57.5, 925.1, 1275.7, 2143.6
), G2_1 = c(7012.5, 2087.9, 146.7, 80, 6278.5, 3076.9, 808),
G2_2 = c(13470.8, 3926.6, 226.5, 212.6, 12569.4, 6569, 2479.8
), Vok3_1 = c(911, 832.8, 50.8, 34.8, 916.6, 1358.5, 1540.4
), Vok3_2 = c(5121.9, 1029.6, 108.9, 135, 3624.5, 1971.3,
1851.4), Vok4_1 = c(5136.7, 892.1, 78, 60.4, 3106.6, 1578.6,
1132.1), Vok4_2 = c(6313.4, 1180.8, 112, 163.4, 4639.8, 2506.4,
879.1)), class = "data.frame", row.names = c(NA, -7L))
what I am trying to do is to get the sd and median, I am unsuccessful
here is what I try and what I am looking to get
df_med <- as.data.frame(df %>% group_by(data = substr(data, 1, 2,3,4)) %>% summarise_all(funs(median)))
here is the way I want is to get the median or sd between each two column for each row , for instance the first two columns G1_1 and G1_2 and between G2_1 and G2_2 etc
The output that I look for is like this
data G1 G2 Vok3 Vok4
A 1487 10241.65 3016.45 5725.05
AA 1093.1 3007.25 931.2 1036.45
AAA 63.05 186.6 79.85 95
AB 51 146.3 84.9 111.9
ABN 1251.65 9423.95 2270.55 3873.2
AHG 1230.25 4822.95. 1664.9 2042.5
ANBV 2051.05 1643.9 1695.9 1005.6