我有一个很大的列表,我想做rowSums
这个列表的每个对象中的每一行。
这是我所拥有的:
> DFTYPE
[[1]]
[[1]][[1]]
DGDG.36.5 DGDG.36.6
1 978.4906 3585.613
1 1280.9531 8740.503
1 1228.3969 6082.900
1 5245.2437 18104.022
1 0.0000 827.650
[[1]][[2]]
DGDG.36.5 DGDG.36.6
2 0.0000 917.5844
2 513.5063 976.2344
2 516.5781 1540.6000
2 838.5406 3486.5563
2 1146.8812 3962.2906
2 0.0000 1050.5281
[[1]][[3]]
DGDG.36.5 DGDG.36.6
3 1755.0656 10924.975
3 713.2969 4681.759
3 946.1094 3319.722
3 1569.5281 6531.266
3 1827.9156 10501.375
3 0.0000 1973.325
[[2]]
[[2]][[1]]
MGDG.34.4 MGDG.34.5 MGDG.34.6 MGDG.36.4 MGDG.36.5 MGDG.36.6
1 891.950 1463.695 14266.34 0.000 1368.040 5015.425
1 2596.695 4228.470 38945.15 1531.350 5617.475 14647.965
1 1536.595 3273.335 30895.44 1610.060 4415.735 11106.930
1 4471.495 9894.595 71023.04 4086.105 9536.450 24968.695
[[2]][[2]]
MGDG.34.4 MGDG.34.5 MGDG.34.6 MGDG.36.4 MGDG.36.5 MGDG.36.6
2 0 0.0 2158.405 0.00 1478.710 2350.265
2 0 0.0 1409.740 0.00 1776.775 2110.440
2 0 0.0 1910.240 0.00 1044.570 2410.740
2 0 913.5 4558.720 1071.78 1499.770 3616.110
2 0 0.0 7980.890 1993.40 1044.855 8468.875
2 0 0.0 1593.260 792.46 0.000 1019.770
[[2]][[3]]
MGDG.34.4 MGDG.34.5 MGDG.34.6 MGDG.36.4 MGDG.36.5 MGDG.36.6
3 1225.095 1994.225 20028.34 1728.695 3503.870 11717.955
3 948.865 1284.680 9522.01 487.985 1702.520 4291.785
3 0.000 1396.415 10216.45 1062.240 1438.825 5163.490
3 1077.845 2422.845 20380.78 2904.935 3147.180 8760.835
3 1135.710 3821.430 29022.75 1555.960 3652.580 12318.555
3 0.000 870.055 12322.73 0.000 1652.525 5136.380
然后我创建一个新列表来获得总和的结果:
> DFttt<-list()
> DFttt<-rowSums(DFTYPE)
Error in rowSums(DFTYPE) :
'x' must be an array of at least two dimensions