我正在尝试基于37条独立曲线绘制(在ggplot中)中值曲线。因此,我想创建一条曲线,作为这37条单独曲线的中值。曲线表示140年的年降水量。但是,尝试这样做时遇到了一些错误。到目前为止,这是我所做的:
RCP1pctCO2cumulativeMedian <- median(cbind(get, IPSL, IPSLMR, IPSL5,
MIROC,
HadGEM, MPI, MPI5, GFDL, GFDL5)) #To obtain the median of
among these x-variable objects
RCP1pctCO2ModelMedian <- median(cbind(Model2, Model10, Model18, Model26,
subset14, Model42, subset20, subset24, Model60, Model68)) #To obtain
median among these y-variable objects
x变量对象是1维的,而y变量对象是3维的。
以下是x变量对象之一的一些数据:
get
[1] 0.00000000 0.00644777 0.01250601 0.01746194 0.02656210 0.03360072
0.04399755 0.05404601 0.06154399 0.07105423
[11] 0.08315538 0.08925389 0.10060635 0.10833009 0.12196157 0.13730928
0.14890850 0.16087072 0.17361501 0.18310140
[21] 0.19810085 0.21316248 0.22423607 0.23529990 0.24695577 0.26119599
0.27643532 0.28517213 0.29978970 0.31870887
[31] 0.33418021 0.34585044 0.36071229 0.37379062 0.39324498 0.41099992
0.42437476 0.43643925 0.44687960 0.45864752
[41] 0.48055932 0.49634662 0.50779009 0.52861303 0.54971600 0.56138206
0.57472491 0.59202033 0.60975420 0.63057494
[51] 0.64653736 0.66088217 0.68168259 0.69649595 0.71363837 0.72988760
0.75010443 0.76776582 0.78613955 0.81099886
[61] 0.82979667 0.84431553 0.86824787 0.88447672 0.89909577 0.92162514
0.94854647 0.96631038 0.98120815 1.00357985
[71] 1.02769291 1.04733002 1.06585240 1.09083056 1.11592567 1.13627303
1.15866983 1.17941856 1.19748724 1.22012913
[81] 1.24142718 1.26937973 1.29283488 1.31011736 1.33134723 1.36014366
1.38395822 1.40615380 1.42895305 1.45046842
[91] 1.47504234 1.49920797 1.52142668 1.54559219 1.57354927 1.60000896
1.62449229 1.64506662 1.67100036 1.70185161
[101] 1.72964287 1.75235510 1.77455521 1.80183053 1.83121216 1.85619974
1.88188243 1.91002214 1.93333006 1.96133912
[111] 1.98944890 2.01225924 2.03804183 2.06614304 2.09558916 2.12400699
2.14846969 2.18011498 2.20532560 2.23031592
[121] 2.26106715 2.28796983 2.31954741 2.35274339 2.37794161 2.40643740
2.43963051 2.46948838 2.49733877 2.53035021
[131] 2.56229091 2.59265327 2.61934137 2.64592481 2.67754769 2.70779777
2.73824191 2.76880598 2.80077982 2.83057237
还有一个y变量对象之一的数据示例:
head(Model2)
X1 X2 X3 X4 X5 X6 X7
X8 X9 X10 X11
[1,] 7.395703 6.493830 7.432156 6.767403 11.66004 7.158040 13.968703
8.139962 7.927880 10.367045 8.560315
[2,] 7.277671 6.318810 8.406366 5.974478 12.51484 7.405914 15.350679
7.977879 8.039850 9.696597 9.374163
[3,] 6.919258 6.119063 9.485675 6.256432 13.44547 7.542754 10.846225
8.441847 8.155234 10.129576 10.074353
[4,] 6.633444 6.300559 10.349174 6.733875 14.35567 7.589797 12.452223
8.384633 8.697707 10.025741 10.589373
[5,] 6.986749 7.057785 11.202586 8.037964 15.08123 7.668468 11.838186
8.506311 8.978721 9.699996 10.256382
[6,] 7.287383 7.561100 12.091483 8.384658 15.56648 7.662876 8.925544
9.431210 8.979276 10.047477 10.898319
[7,] 7.957773 7.732338 13.998432 8.982379 15.50928 7.599275 8.548879
8.287948 8.745722 9.496011 10.861937
X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22
[1,] 5.533977 10.534669 12.136978 8.897428 10.07571 8.485538 7.731084
10.557160 15.36603 12.320665 11.274374
[2,] 6.010256 10.299062 12.703854 9.522287 11.08078 8.996936 6.919732
10.900610 14.44405 11.949420 11.202058
[3,] 6.590125 9.553597 12.781633 9.015289 11.35786 9.215069 6.888467
9.571572 13.47964 10.308230 9.772387
[4,] 7.042177 8.800974 12.292124 11.457335 11.96268 9.329095 7.078347
9.072567 13.90133 9.780438 9.901325
[5,] 7.613796 9.617242 11.511468 11.527631 12.94864 9.510409 7.504535
8.380163 14.01753 9.804405 10.389509
[6,] 8.146129 9.211740 11.250921 11.483143 13.93948 8.881543 7.888670
8.917588 13.32526 8.609215 9.584101
[7,] 8.551682 8.858268 10.417808 11.292067 15.19191 9.224810 8.231571
7.949825 12.58279 8.042569 9.816563
X23 X24 X25 X26 X27 X28 X29
X30 X31 X32 X33
[1,] 10.513864 8.677064 11.336663 11.084113 15.637074 13.123468 14.498341
13.51797 8.927792 14.52221 11.03152
[2,] 10.623553 8.147698 11.274687 12.041032 15.248861 13.756436 14.169821
13.79620 8.461634 15.35397 10.58920
[3,] 10.594422 8.186423 11.108800 12.970914 16.080630 14.150097 13.844690
13.69316 8.327290 15.16588 11.30961
[4,] 10.784767 9.066225 11.404947 13.629403 16.112210 14.288516 13.419332
13.71043 7.438301 16.47708 10.83828
[5,] 10.781204 9.304740 14.418004 14.179794 16.163543 14.191616 13.099246
13.87820 6.721719 15.93969 11.37129
[6,] 11.019292 8.095109 14.769319 14.600070 15.372641 13.857515 12.744865
13.72046 6.677809 15.19663 12.71773
[7,] 11.175167 8.448992 14.985946 16.607027 14.617119 13.294923 12.225447
14.06422 6.246394 14.85685 14.94957
X34 X35 X36 X37 X38 X39 X40
X41 X42 X43 X44
[1,] 8.131129 11.801102 18.951859 14.190050 9.619067 11.43727 22.074601
11.030509 10.845782 11.355555 9.374961
[2,] 7.979524 11.188282 19.859128 13.488418 10.101316 11.76011 21.521370
10.957966 10.862877 10.607779 9.435721
[3,] 7.504932 11.861029 19.413123 12.898233 10.127638 11.99824 22.105032
10.294022 10.285760 9.569095 9.398022
[4,] 7.992372 11.103917 18.788007 12.849739 10.220620 12.15974 21.764059
9.357552 10.002291 8.948819 9.141712
[5,] 7.851208 11.907234 15.143160 12.882132 10.237670 12.22654 21.963525
9.649481 9.620986 9.088402 9.195565
[6,] 8.832912 11.331580 14.178182 12.870300 10.144793 12.18748 21.492292
8.882704 9.460623 8.785204 9.070753
[7,] 8.684384 10.332696 13.160553 12.746462 10.016953 12.06621 21.615337
8.798162 9.652841 8.050861 8.867726
...
在x变量对象中运行中位数时没有错误,但是对y变量对象执行相同操作时却收到此错误,我不确定为什么:
Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) :
'x' must be atomic
是否可能需要按升序对这些对象进行排序?
在此方面提供的任何帮助将不胜感激!
谢谢