根据列表元素R的长度排序列表

时间:2016-04-18 08:56:53

标签: r

我正在尝试对列表元素进行排序。但是我收到以下错误。

Error in order(rmnull) : unimplemented type 'list' in 'orderVector1'

导致错误的代码是:

order(rmnull) 

其中,
    rmnull

是我的清单。我有100个列表,在这里我发布了其中一个。

rmnull:
[[1]]
[[1]][[1]]
[1] "VEGFA"  "EPHB2"  "GRIN2B" "AP2M1"  "KCNJ11" "ABCC8" 

[[1]][[2]]
[1] "VEGFA" "VTN"   "PRKCA" "ADCY5"

[[1]][[3]]
[1] "VEGFA" "KDR"   "GRB2"  "ADRB1"

[[1]][[4]]
[1] "VEGFA" "AKT1"  "AKT2" 

[[1]][[5]]
[1] "VEGFA" "CTGF"  "AP3D1" "AP3S2"

[[1]][[6]]
[1] "VEGFA" "YBX1"  "SMAD3" "ATF3" 

[[1]][[7]]
[1] "VEGFA"  "AKT1"   "IRS1"   "ATP2A2"

我想要的输出如下:

[[1]][[4]]
[1] "VEGFA" "AKT1"  "AKT2" 

[[1]][[2]]
[1] "VEGFA" "VTN"   "PRKCA" "ADCY5"

[[1]][[3]]
[1] "VEGFA" "KDR"   "GRB2"  "ADRB1"

[[1]][[5]]
[1] "VEGFA" "CTGF"  "AP3D1" "AP3S2"

[[1]][[6]]
[1] "VEGFA" "YBX1"  "SMAD3" "ATF3" 

[[1]][[7]]
[1] "VEGFA"  "AKT1"   "IRS1"   "ATP2A2"

[[1]][[1]]
[1] "VEGFA"  "EPHB2"  "GRIN2B" "AP2M1"  "KCNJ11" "ABCC8" 

dput的输出如下:

list(list(c("VEGFA", "EPHB2", "GRIN2B", "AP2M1", "KCNJ11", "ABCC8"
), c("VEGFA", "VTN", "PRKCA", "ADCY5"), c("VEGFA", "KDR", "GRB2", 
"ADRB1"), c("VEGFA", "AKT1", "AKT2"), c("VEGFA", "CTGF", "AP3D1", 
"AP3S2"), c("VEGFA", "YBX1", "SMAD3", "ATF3"), c("VEGFA", "AKT1", 
"IRS1", "ATP2A2")), list(c("HHEX", "EFEMP2", "TP53", "ARIH2", 
"ENSA", "ABCC8"), c("HHEX", "TLE1", "POLB", "PRKCA", "ADCY5"), 
c("HHEX", "TLE1", "ATN1", "MAGI2", "ADRB1"), c("HHEX", "JUN", 
"ESR1", "AKT2"), c("HHEX", "TLE1", "CDK1", "BUB1", "AP3B1", 
"AP3S2"), c("HHEX", "JUN", "ATF3"), c("HHEX", "PML", "BCL2", 
"ATP2A2")), list(c("PPP1R3A", "RPS6KA1", "MAPK1", "TP53", 
"ARIH2", "ENSA", "ABCC8"), c("PPP1R3A", "PLN", "PRKACA", "ADCY5"
 ), c("PPP1R3A", "RPS6KA1", "GRB2", "ADRB1"), c("PPP1R3A", "RPS6KA1", 
"PDPK1", "AKT2"), c("PPP1R3A", "RPS6KA1", "MAPK1", "IRS1", "AP3S1", 
"AP3S2"), c("PPP1R3A", "RPS6KA1", "MAPK1", "SMAD3", "ATF3"), 
c("PPP1R3A", "PLN", "ATP2A2")), list(c("TCF7L2", "EP300", 
"TP53", "ARIH2", "ENSA", "ABCC8"), c("TCF7L2", "PSEN1", "PRKACA", 
"ADCY5"), c("TCF7L2", "CTNNB1", "MAGI2", "ADRB1"), c("TCF7L2", 
"EP300", "ESR1", "AKT2"), c("TCF7L2", "CSNK2A1", "ARR3", "AP3B1", 
"AP3S2"), c("TCF7L2", "EP300", "SMAD3", "ATF3"), c("TCF7L2", 
"CSNK2A1", "IRS1", "ATP2A2")), list(c("KCNQ1", "TRAF6", "SIGIRR", 
"ENO2", "ENSA", "ABCC8"), c("KCNQ1", "KCNE4", "PRKCA", "ADCY5"
), c("KCNQ1", "AKAP9", "GRIN1", "DLG4", "ADRB1"), c("KCNQ1", 
"TRAF6", "XIAP", "AKT2"), c("KCNQ1", "AKAP9", "GRIN1", "CLTC", 
"AP3B1", "AP3S2"), c("KCNQ1", "AKAP9", "PPP1CA", "TP53", "ATF3"
), c("KCNQ1", "AKAP9", "PPP1CA", "BCL2", "ATP2A2")), list(c("LIPC", 
"LRP1", "DLG4", "KCNJ2", "KCNJ8", "ABCC8"), c("LIPC", "LRP1", 
"PRKACA", "ADCY5"), c("LIPC", "LRP1", "DLG4", "ADRB1"), c("LIPC", 
"APOB", "HSP90AA1", "AKT2"), c("LIPC", "LRP1", "CTGF", "AP3D1", 
"AP3S2"), c("LIPC", "LRP1", "PRKACA", "NFKB1", "ATF3"), c("LIPC", 
"LRP1", "SHC1", "IRS2", "ATP2A2")), list(c("PRKCB", "DAB2", "AP2M1", 
"KCNJ11", "ABCC8"), c("PRKCB", "RGS2", "ADCY5"), c("PRKCB", "PTPN11", 
"GRB2", "ADRB1"), c("PRKCB", "GSK3B", "AKT2"), c("PRKCB", "OCLN", 
"CSNK1A1", "AP3B1", "AP3S2"), c("PRKCB", "BTK", "TP53", "ATF3"
 ), c("PRKCB", "PTPN11", "IRS2", "ATP2A2")), list(c("OGG1", "PRKCA", 
"DLG4", "KCNJ2", "KCNJ8", "ABCC8"), c("OGG1", "PRKCA", "ADCY5"
), c("OGG1", "PRKCA", "DLG4", "ADRB1"), c("OGG1", "PRKCA", "HSP90AA1", 
"AKT2"), c("OGG1", "PRKCA", "PICK1", "ARF1", "AP3D1", "AP3S2"
), c("OGG1", "PRKCA", "TP53", "ATF3"), c("OGG1", "PRKCA", "BCL2", 
"ATP2A2")))

任何帮助表示赞赏。感谢。

1 个答案:

答案 0 :(得分:0)

import { combineReducers } from 'redux';
import formFields from './reducer_form-fields';
import hintReducer from './reducer_hint-reducer';
import errorMessage from './reducer_error-message-submission';
import loggedIn from './reducer_logged-in';
import isAuthenticated from './reducer_isAuthenticated';

const rootReducer = combineReducers({
  formInput: formFields,
  hint: hintReducer,
  errorMessage,
  loggedIn,
  isAuthenticated
});

export default rootReducer;