Error in View : undefined columns selected - r

Below is a subsample of my data set (only 2 rows by 215 columns). I am trying to view them on RStudio but it gives me the following error:
Error in View : undefined columns selected
Do not really know what is going on. The whole set is 7786 rows by 215 columns. Viewing it works fine, however, when doing any kind of subsetting or removing one row it is no longer want to view.
structure(list(`NA` = structure(c(16343, 16344), class = "Date"),
AVON = c("615.5", "621.5"), BA. = c("471.5", "463.2"), CMRG = c("224.5",
"224.5"), COB = c("291.10000000000002", "283.5"), MGGT = c("451.2",
"444.7"), QQ. = c("224.5", "223.5"), RR. = c("953.65", "933.38"
), SNR = c("268.2", "264.7"), ULE = c("1771", "1746"), GKN = c("319.2",
"311.5"), BRAG = c("617", "603"), BVIC = c("668", "661"),
CCH = c("1333", "1327"), DGE = c("1785", "1760.5"), SAB = c("3428",
"3383"), STCK = c("291.60000000000002", "294"), ALNT = c("328",
"321"), CAR = c("125", "124.5"), CRDA = c("2053", "1990"),
ELM = c("255.5", "254.5"), JMAT = c("2919", "2825"), SYNT = c("212",
"210.8"), VCTA = c("1606", "1605"), DIA = c("901", "924"),
DNO = c("611", "611"), E2V = c("161", "160.5"), HLMA = c("612",
"598.5"), HTY = c("309.8", "308"), MGAM = c("296.8", "289.40000000000003"
), OXFD = c("1020", "1035"), RSHW = c("1630", "1625"), SXS = c("1808",
"1778"), TTG = c("166.75", "167.5"), XAR = c("376", "367"
), X = c("1527", "1520"), ABF = c("2679", "2654"), AE = c("633.5",
"640"), CARM = c("1647", "1637"), CWK = c("1328", "1320"),
DCG = c("383.75", "369"), DVO = c("237.75", "231"), GNCL = c("234",
"229.6"), HFG = c("416", "411"), FD = c("36.5", "34.75"),
TATE = c("591.5", "585"), MNDI = c("1011", "1012"), BI = c("616",
"620"), REX = c("491.8", "483.5"), RC = c("559", "540"),
SMDS = c("266.3", "257"), SMIN = c("1264", "1250"), VSVS = c("451.8",
"438.40000000000003"), AGA = c("163.25", "160.25"), BDEV = c("396.1",
"389.3"), BKG = c("2250", "2224"), BLWY = c("1567", "1558"
), BVS = c("779", "771"), CRST = c("325", "314.60000000000002"
), GLSN = c("393.5", "388.5"), MCB = c("83.53", "83.29"),
SN = c("1334", "1309"), RB. = c("5350", "5305"), RDW = c("280.7",
"273.8"), TW. = c("112.8", "111.8"), BODY = c("668.5", "647"
), FENR = c("317.60000000000002", "313.10000000000002"),
GDWN = c("3500", "3500"), HILS = c("561", "561.5"), IMI = c("1230",
"1206"), MRO = c("247.70000000000002", "246"), VAR = c("304",
"300.75"), RNO = c("56", "54.5"), RTRK = c("2765", "2736"
), SFR = c("63.5", "64"), SRX = c("2826", "2812"), TRI = c("105.75",
"105"), VTC = c("613.5", "612"), WEIR = c("2502", "2430"),
EVR = c("130", "123.60000000000001"), FXO = c("112.3", "105.10000000000001"
), BBA = c("325", "326"), BMS = c("494.38", "492"), CKN = c("2350",
"2341"), FSHR = c("1326", "1294"), RMG = c("392.2", "399.7"
), STOB = c("111", "109"), UKM = c("473.88", "467"), WIN = c("136.25",
"137.5"), GAW = c("597.5", "585"), HTM = c("131.5", "129.25"
), `NA` = c(NA_character_, NA_character_), AAL = c("1384",
"1363.5"), ABG = c("218.8", "209.1"), ANTO = c("721", "702"
), AF = c("131.5", "130.25"), AQ = c("18.5", "18.75"), ARMS = c("69",
"62.25"), BLT = c("1715", "1690.5"), CEY = c("61.15", "61"
), FRES = c("760", "747"), GEMD = c("192", "191.75"), GLEN = c("343.2",
"336.45"), HOC = c("135.30000000000001", "130.19999999999999"
), KAZ = c("263.39999999999998", "260.10000000000002"), KMRL = c("9.5",
"9.3000000000000007"), LMI = c("185.8", "176.8"), NWR = c("1.97",
"1.82"), `NA` = c(NA_character_, NA_character_), DL = c("190.20000000000002",
"190"), OG = c("22", "24"), OLY = c("516", "496.6"), RIO = c("3031.5",
"3020"), RRS = c("4209", "4154"), VED = c("998.5", "974.5"
), AFR = c("103.5", "109.4"), BG. = c("1140", "1093"), B. = c("453.45",
"452.75"), CNE = c("176.5", "171.6"), ENQ = c("109.60000000000001",
"107.8"), EXI = c("157", "150"), HDY = c("102", "99.75"),
JKX = c("48.25", "47"), OHR = c("229.3", "220.9"), MO = c("333",
"324.7"), RDSA = c("2358.5", "2331"), RDSB = c("2437", "2418.5"
), SIA = c("381", "377.90000000000003"), SMDR = c("100",
"98.5"), TLW = c("644.5", "631"), AMEC = c("1104", "1077"
), CIU = c("283.5", "275.75"), GMS = c("157", "157"), HTG = c("892.5",
"876"), LAM = c("163.25", "160"), FC = c("1037", "1011"),
WG. = c("759.5", "743"), BRBY = c("1511", "1476"), ZC = c("365.7",
"366"), SG = c("1133", "1126"), TED = c("1863", "1862"),
ULVR = c("2585", "2547"), AZN = c("4441.5", "4360.5"), BTG = c("700",
"697.5"), CIR = c("304", "300"), DH = c("758", "753"), GNS = c("1130",
"1130"), GSK = c("1413", "1414"), HIK = c("1733", "1715"),
SH = c("5340", "5310"), SK = c("329.25", "319"), VEC = c("132",
"132"), AGK = c("1548", "1528"), AHT = c("1043", "1024"),
ATK = c("1317", "1323"), BAB = c("1092", "1085"), BNZL = c("1610",
"1597"), BRAM = c("376", "374"), BRSN = c("980", "979"),
CLLN = c("304.60000000000002", "304.3"), CMS = c("59.75",
"59.5"), CNCT = c("149.25", "151"), CI = c("1164", "1165"
), CTR = c("259.5", "255"), DCC = c("3422", "3405"), DLAR = c("477",
"478"), DLM = c("689.5", "685"), ECOM = c("223", "219.8"),
ESNT = c("797.5", "792.5"), EXO = c("176.5", "180"), EXN = c("983.5",
"968"), GFS = c("250.70000000000002", "251.6"), GFTU = c("626",
"616"), HAS = c("116.3", "115.7"), HRG = c("45.75", "45.75"
), HSV = c("319.7", "319"), HWDN = c("339.1", "335"), HYC = c("749",
"748"), IRV = c("599.5", "592.5"), ITRK = c("2621", "2631"
), LVD = c("201.75", "201.5"), MER = c("435", "436.75"),
MMC = c("25.25", "25"), MNZS = c("569", "575.5"), MI = c("418.6",
"421"), MTO = c("287.90000000000003", "286.60000000000002"
), NTG = c("483.8", "481.3"), AY = c("983.5", "989"), FL = c("182",
"180.1"), RCDO = c("671", "667.5"), RENT = c("117.8", "116"
), RGU = c("169.70000000000002", "169.9"), RS = c("261",
"251.6"), RWA = c("302.5", "302.5"), SDY = c("70.5", "69.75"
), SERC = c("286.10000000000002", "279.8"), SHI = c("166.6",
"161.1"), SIV = c("199.75", "200"), SKS = c("90", "92"),
STHR = c("350.25", "358.5"), TK = c("1664", "1635"), TRB = c("170.5",
"172"), V. = c("609.5", "600"), WOS = c("3242", "3243"),
XCH = c("188", "184.75"), ARM = c("906", "887.5"), BVC = c("16.38",
"16.25"), CSR = c("758", "756"), IMG = c("188.5", "184.75"
), LRD = c("309.7", "306.7"), IC = c("298.10000000000002",
"299"), SEU = c("141", "141"), ST = c("104.60000000000001",
"99.9"), BATS = c("3482", "3480"), IMT = c("2664", "2679"
)), .Names = c("NA", "AVON", "BA.", "CMRG", "COB", "MGGT",
"QQ.", "RR.", "SNR", "ULE", "GKN", "BRAG", "BVIC", "CCH", "DGE",
"SAB", "STCK", "ALNT", "CAR", "CRDA", "ELM", "JMAT", "SYNT",
"VCTA", "DIA", "DNO", "E2V", "HLMA", "HTY", "MGAM", "OXFD", "RSHW",
"SXS", "TTG", "XAR", "X", "ABF", "AE", "CARM", "CWK", "DCG",
"DVO", "GNCL", "HFG", "FD", "TATE", "MNDI", "BI", "REX", "RC",
"SMDS", "SMIN", "VSVS", "AGA", "BDEV", "BKG", "BLWY", "BVS",
"CRST", "GLSN", "MCB", "SN", "RB.", "RDW", "TW.", "BODY", "FENR",
"GDWN", "HILS", "IMI", "MRO", "VAR", "RNO", "RTRK", "SFR", "SRX",
"TRI", "VTC", "WEIR", "EVR", "FXO", "BBA", "BMS", "CKN", "FSHR",
"RMG", "STOB", "UKM", "WIN", "GAW", "HTM", NA, "AAL", "ABG",
"ANTO", "AF", "AQ", "ARMS", "BLT", "CEY", "FRES", "GEMD", "GLEN",
"HOC", "KAZ", "KMRL", "LMI", "NWR", NA, "DL", "OG", "OLY", "RIO",
"RRS", "VED", "AFR", "BG.", "B.", "CNE", "ENQ", "EXI", "HDY",
"JKX", "OHR", "MO", "RDSA", "RDSB", "SIA", "SMDR", "TLW", "AMEC",
"CIU", "GMS", "HTG", "LAM", "FC", "WG.", "BRBY", "ZC", "SG",
"TED", "ULVR", "AZN", "BTG", "CIR", "DH", "GNS", "GSK", "HIK",
"SH", "SK", "VEC", "AGK", "AHT", "ATK", "BAB", "BNZL", "BRAM",
"BRSN", "CLLN", "CMS", "CNCT", "CI", "CTR", "DCC", "DLAR", "DLM",
"ECOM", "ESNT", "EXO", "EXN", "GFS", "GFTU", "HAS", "HRG", "HSV",
"HWDN", "HYC", "IRV", "ITRK", "LVD", "MER", "MMC", "MNZS", "MI",
"MTO", "NTG", "AY", "FL", "RCDO", "RENT", "RGU", "RS", "RWA",
"SDY", "SERC", "SHI", "SIV", "SKS", "STHR", "TK", "TRB", "V.",
"WOS", "XCH", "ARM", "BVC", "CSR", "IMG", "LRD", "IC", "SEU",
"ST", "BATS", "IMT"), row.names = 7785:7786, class = "data.frame")
I am on Mac OS 10.10, R 3.1.1 and RStudio 0.98.1060.

One of your column names is NA. If d is your data defined above, then try names(d)[92]. Try replacing with a non-missing column name.

As allready mentioned by DMC, but with a short version of your example code.
a <- structure(list(`NA` = structure(c(16343, 16344), class = "Date"),
AVON = c("615.5", "621.5"),
BA. = c("471.5", "463.2"),
`NA` = c(NA_character_, NA_character_), AAL = c("1384", "1363.5")),
.Names = c(NA, "AVON", "BA.", "NA", "AAL"), row.names = 7785:7786, class = "data.frame")
View(a)
Error in View : undefined columns selected
names(a)
[1] NA "AVON" "BA." "NA" "AAL"
a <- structure(list(`NA` = structure(c(16343, 16344), class = "Date"),
AVON = c("615.5", "621.5"),
BA. = c("471.5", "463.2"),
`NA` = c(NA_character_, NA_character_), AAL = c("1384", "1363.5")),
.Names = c("NA", "AVON", "BA.", "NA", "AAL"), row.names = 7785:7786, class = "data.frame")
View(a)
names(a)
[1] "NA" "AVON" "BA." "NA" "AAL"
You need to have proper names in the data frame to View it.

Related

R: Integrate two lists subelements

Each element of the pp list has five subelements, each containing a vector of values called expr. Also, list iid contains one element with the same number and length of sub-elements of each element in pp. In order to integrate two lists, I want for each element of pp, the characters in the iid become a column name and the corresponding values in the pp to become rows like a data frame. At the end, all the values should be comncatenated and divided in five as it is in the inputs.
## pp list
pp <- list(ENSG00000141956 = list(foldSet_1 = structure(list(expr = c(0.3803048,
-0.1005805, -0.1388998, -0.439475, 0.3326845, -0.6787136, -0.8862647,
0.5526945, 0.4432067, -0.4434515862, -0.3608854, 0.0120686657,
0.09344841, 0.400137, 0.7890199, -0.492058, 0.07042376, 0.3025703,
0.1189347, -0.795448, -0.102853, 0.677594, -0.4110812)), row.names = c(NA,
-23L), class = c("tbl_df", "tbl", "data.frame")), foldSet_2 = structure(list(
expr = c(0.3910626, 0.4011977, -0.5375317082, 1.118997, -0.714867812,
0.7692958314, -0.7411604, -0.105918, -0.06774316, 0.37792,
-1.50101, 0.4659521, 0.05462016, 0.8191656, 0.2534708, -0.7851615,
0.06491725, -0.1145606, 0.2031628, -0.3784291, 1.75129, -0.2781814
)), row.names = c(NA, -22L), class = c("tbl_df", "tbl", "data.frame"
)), foldSet_3 = structure(list(expr = c(0.1346737, -0.3018867,
2.008637597, 0.2174854, 0.1817713, 0.2068479, 0.4385861, -0.6867911553,
-0.04973609, 0.9683988, -0.004377791, 0.4063974, -0.08958473,
0.2791352, -0.6540139556, 0.2491497, -0.3315336, 0.5217149, -0.3263807,
-0.4260331, 0.2909981, 0.2420486, 0.03705211)), row.names = c(NA,
-23L), class = c("tbl_df", "tbl", "data.frame")), foldSet_4 = structure(list(
expr = c(0.01042395, -0.4773195, 0.08209318, -0.7586276,
0.1575954, -0.7206272, 0.2283236, -0.1310485, 0.422618, 0.0108831611,
0.5423006, -0.1537052, -0.206502, 0.196586, -0.8410328, 0.09204746,
-0.7454582, 0.1416914, -0.8276129, 0.8363268, -0.7257737,
0.3657267)), row.names = c(NA, -22L), class = c("tbl_df",
"tbl", "data.frame")), foldSet_5 = structure(list(expr = c(1.265001,
-0.8963425427, 0.2428121, 0.2942902, -0.01086715, 0.5085538,
0.6372121, 0.8329305, 0.1185538, -0.5767332, 0.3843823, 0.2350104,
-0.2325683, -0.1219577, 0.6623785, -0.5607696, -1.5371637259,
-1.657621852, -0.01256456, 0.4563003, -0.7890026, -1.197397,
0.3742298)), row.names = c(NA, -23L), class = c("tbl_df", "tbl",
"data.frame"))), ENSG00000141959 = list(foldSet_1 = structure(list(
expr = c(-0.3003046, 0.005579603, -0.2596373, -0.3522028,
0.1879026, 0.1967071, -0.4713157, -0.3310353, -0.1003091,
0.3832126993, -0.05301061, -0.3635412607, 0.4025212, 0.1362349,
-0.1587811, 0.3373843, 0.1998857, 0.4367898, -0.5611188,
0.02719134, -0.1471497, 0.12489, 0.6190356)), row.names = c(NA,
-23L), class = c("tbl_df", "tbl", "data.frame")), foldSet_2 = structure(list(
expr = c(0.0579663, 0.3904131, 0.2544079194, -0.1574236,
0.69677048, -0.0876293718, -0.5368353, 0.225058, -0.5255409,
-0.3314226, -1.622316, 0.1064199, 0.1061926, 0.3527317, -0.4675344,
0.1723076, -0.1159002, -0.006312083, -0.2083593, -0.00007146444,
0.1268512, -0.07700766)), row.names = c(NA, -22L), class = c("tbl_df",
"tbl", "data.frame")), foldSet_3 = structure(list(expr = c(0.1401876,
-0.3250818, 0.5946272517, -0.2694272, -0.2912538, -0.0780406,
0.3063621, 0.0676218118, -0.2015818, 0.1549354, 0.5281673, 1.037816,
-0.3362126, -0.4971578, -0.0889611491, -0.0641598, 0.7628252,
-0.2208091, -0.7417216, -0.3509665, 0.07412728, -0.4002744, -0.5406274
)), row.names = c(NA, -23L), class = c("tbl_df", "tbl", "data.frame"
)), foldSet_4 = structure(list(expr = c(-0.350688, 0.5425585,
0.2550953, 0.6242607, 0.6671248, -0.3640666, 0.3625934, -0.02385531,
0.2368257, -0.1671464501, 0.1443962, 0.2876699, 0.5233608, 0.411042,
-0.6771724, 0.04496645, -0.7915447, -0.4581436, -0.008061834,
0.156641, 0.5718667, -0.8583139)), row.names = c(NA, -22L), class = c("tbl_df",
"tbl", "data.frame")), foldSet_5 = structure(list(expr = c(0.5290703,
-0.1029373935, 0.1481799, -0.3074795, 0.825576, 0.3023727, 0.2402515,
0.09724703, 0.09133488, 0.5141968, 0.362571, -0.1941567, -0.09751567,
-0.9363854, -0.03207956, 0.6985924, -0.6445457624, -0.0887025618,
0.01355917, 0.002195536, -0.05979083, 0.1404834, -0.2035347)), row.names = c(NA,
-23L), class = c("tbl_df", "tbl", "data.frame"))))
## iid list
iid <- list(foldSet_1 = c("GTEX-11EQ9", "GTEX-12WSJ", "GTEX-1EKGG",
"GTEX-1EU9M", "GTEX-1EWIQ", "GTEX-1F5PK", "GTEX-1GMRU", "GTEX-1GTWX",
"GTEX-S95S", "GTEX-SN8G", "GTEX-T5JC", "GTEX-T6MO", "GTEX-TKQ2",
"GTEX-U3ZM", "GTEX-V1D1", "GTEX-WFG7", "GTEX-WFG8", "GTEX-WFJO",
"GTEX-WOFM", "GTEX-Y5V6", "GTEX-Y8LW", "GTEX-ZC5H", "GTEX-ZXES"
), foldSet_2 = c("GTEX-11EM3", "GTEX-11EMC", "GTEX-11ZTT", "GTEX-1212Z",
"GTEX-12696", "GTEX-1269C", "GTEX-1GF9U", "GTEX-1GMR8", "GTEX-1I4MK",
"GTEX-S4Q7", "GTEX-U3ZG", "GTEX-WWTW", "GTEX-WZTO", "GTEX-X4EO",
"GTEX-XPT6", "GTEX-Y5V5", "GTEX-YB5K", "GTEX-YEC4", "GTEX-ZF3C",
"GTEX-ZG7Y", "GTEX-ZP4G", "GTEX-ZT9W"), foldSet_3 = c("GTEX-11I78",
"GTEX-11VI4", "GTEX-12C56", "GTEX-13111", "GTEX-1399R", "GTEX-1FIGZ",
"GTEX-1GN2E", "GTEX-RUSQ", "GTEX-T5JW", "GTEX-UPJH", "GTEX-V955",
"GTEX-VUSG", "GTEX-W5WG", "GTEX-WRHK", "GTEX-XBED", "GTEX-XMK1",
"GTEX-XQ3S", "GTEX-XXEK", "GTEX-Y8DK", "GTEX-ZEX8", "GTEX-ZPCL",
"GTEX-ZQG8", "GTEX-ZTPG"), foldSet_4 = c("GTEX-1122O", "GTEX-1211K",
"GTEX-12WSL", "GTEX-T6MN", "GTEX-TMZS", "GTEX-UPK5", "GTEX-WFON",
"GTEX-WHSB", "GTEX-WHWD", "GTEX-WY7C", "GTEX-WYVS", "GTEX-X15G",
"GTEX-XGQ4", "GTEX-Y9LG", "GTEX-YEC3", "GTEX-ZDTS", "GTEX-ZDTT",
"GTEX-ZF2S", "GTEX-ZLV1", "GTEX-ZPIC", "GTEX-ZT9X", "GTEX-ZUA1"
), foldSet_5 = c("GTEX-12WSN", "GTEX-1F48J", "GTEX-1F52S", "GTEX-1GMR3",
"GTEX-SUCS", "GTEX-U3ZH", "GTEX-U3ZN", "GTEX-WEY5", "GTEX-WH7G",
"GTEX-X4EP", "GTEX-X4LF", "GTEX-X5EB", "GTEX-XBEW", "GTEX-XLM4",
"GTEX-Y5LM", "GTEX-Y8E4", "GTEX-YF7O", "GTEX-ZF29", "GTEX-ZTSS",
"GTEX-ZTTD", "GTEX-ZV6S", "GTEX-ZVT2", "GTEX-ZVZP"))
The desired output looks like this:
pp_out <- list(ENSG00000141956 = structure(list(`GTEX-11EQ9` = 0.00272564851305302,
`GTEX-12WSJ` = 0.00272564851305302, `GTEX-1EKGG` = 0.0202754075985887,
`GTEX-1EU9M` = 0.00676249893692591, `GTEX-1EWIQ` = 0.00336835547752925,
`GTEX-1F5PK` = 0.00336835547752925, `GTEX-1GMRU` = 0.0191065491234794,
`GTEX-1GTWX` = 0.00272564851305302, `GTEX-S95S` = 0.00503517684692274,
`GTEX-SN8G` = 0.0150945626471007, `GTEX-T5JC` = 0.00602406792927852,
`GTEX-T6MO` = 0.00272564851305302, `GTEX-TKQ2` = 0.00272564851305302,
`GTEX-U3ZM` = 0.00272564851305302, `GTEX-V1D1` = 0.00300074743348399,
`GTEX-WFG7` = 0.00300074743348399, `GTEX-WFG8` = 0.00327584635391496,
`GTEX-WFJO` = 0.00300074743348399, `GTEX-WOFM` = 0.00272564851305302,
`GTEX-Y5V6` = 0.00614716297153329, `GTEX-Y8LW` = 0.0208907435639813,
`GTEX-ZC5H` = 0.00879692835036466, `GTEX-ZXES` = 0.00574896900884754,
`GTEX-11EM3` = -0.0149845730327965, `GTEX-11EMC` = -0.013847280341284,
`GTEX-11ZTT` = -0.0275325515044248, `GTEX-1212Z` = -0.0141988014913753,
`GTEX-12696` = -0.0136176647967972, `GTEX-1269C` = -0.0275325515044248,
`GTEX-1GF9U` = -0.0153360941828878, `GTEX-1GMR8` = -0.0136116558238996,
`GTEX-1I4MK` = -0.0138532893141817, `GTEX-S4Q7` = -0.0151539874321891,
`GTEX-U3ZG` = -0.0138532893141817, `GTEX-WWTW` = -0.027416654871718,
`GTEX-WZTO` = -0.0215030592385638, `GTEX-X4EO` = -0.0205524436634252,
`GTEX-XPT6` = -0.0136116558238996, `GTEX-Y5V5` = -0.0174136560129391,
`GTEX-YB5K` = -0.0138532893141817, `GTEX-YEC4` = -0.0136176647967972,
`GTEX-ZF3C` = -0.0208273881822836, `GTEX-ZG7Y` = -0.0136176647967972,
`GTEX-ZP4G` = -0.0250634259373212, `GTEX-ZT9W` = -0.0136176647967972,
`GTEX-11I78` = -0.037929571081887, `GTEX-11VI4` = -0.0352737894666712,
`GTEX-12C56` = -0.0364115473528404, `GTEX-13111` = -0.0353679266239015,
`GTEX-1399R` = -0.0376033957001448, `GTEX-1FIGZ` = -0.0308210759870506,
`GTEX-1GN2E` = -0.0376033957001448, `GTEX-RUSQ` = -0.0376033957001448,
`GTEX-T5JW` = -0.0420643633134619, `GTEX-UPJH` = -0.0360853719710982,
`GTEX-V955` = -0.037929571081887, `GTEX-VUSG` = -0.0360853719710982,
`GTEX-W5WG` = -0.0330565450632938, `GTEX-WRHK` = -0.037929571081887,
`GTEX-XBED` = -0.037929571081887, `GTEX-XMK1` = -0.0352737894666712,
`GTEX-XQ3S` = -0.0350417512421593, `GTEX-XXEK` = -0.0376033957001448,
`GTEX-Y8DK` = -0.0376033957001448, `GTEX-ZEX8` = -0.0360853719710982,
`GTEX-ZPCL` = -0.0364115473528404, `GTEX-ZQG8` = -0.0381176463621845,
`GTEX-ZTPG` = -0.037929571081887, `GTEX-1122O` = 0.0311974749143465,
`GTEX-1211K` = 0.0302892560510041, `GTEX-12WSL` = 0.0310530889747851,
`GTEX-T6MN` = 0.0253053324056306, `GTEX-TMZS` = 0.0251609464660692,
`GTEX-UPK5` = 0.0250389673364521, `GTEX-WFON` = 0.0251609464660692,
`GTEX-WHSB` = 0.0310530889747851, `GTEX-WHWD` = 0.0253053324056306,
`GTEX-WY7C` = 0.0310530889747851, `GTEX-WYVS` = 0.0360370126201587,
`GTEX-X15G` = 0.0253053324056306, `GTEX-XGQ4` = 0.0254497183451919,
`GTEX-Y9LG` = 0.0236698466255728, `GTEX-YEC3` = 0.0250389673364521,
`GTEX-ZDTS` = 0.0302892560510041, `GTEX-ZDTT` = 0.02716525500288,
`GTEX-ZF2S` = 0.0302892560510041, `GTEX-ZLV1` = 0.0250389673364521,
`GTEX-ZPIC` = 0.0254497183451919, `GTEX-ZT9X` = 0.0302892560510041,
`GTEX-ZUA1` = 0.0311974749143465, `GTEX-12WSN` = 0.0196357496993677,
`GTEX-1F48J` = 0.0167271490318362, `GTEX-1F52S` = 0.0168263419569211,
`GTEX-1GMR3` = 0.0199993991223454, `GTEX-SUCS` = 0.0167271490318362,
`GTEX-U3ZH` = 0.0166279561067514, `GTEX-U3ZN` = 0.0168263419569211,
`GTEX-WEY5` = 0.0218122431555806, `GTEX-WH7G` = 0.0169603561059156,
`GTEX-X4EP` = 0.0167271490318362, `GTEX-X4LF` = 0.0168263419569211,
`GTEX-X5EB` = 0.0231724562877696, `GTEX-XBEW` = 0.0187383789152412,
`GTEX-XLM4` = 0.0167271490318362, `GTEX-Y5LM` = 0.0168263419569211,
`GTEX-Y8E4` = 0.0121019992430171, `GTEX-YF7O` = 0.0168263419569211,
`GTEX-ZF29` = 0.0168980287283542, `GTEX-ZTSS` = 0.0166279561067514,
`GTEX-ZTTD` = 0.0168263419569211, `GTEX-ZV6S` = 0.0199993991223454,
`GTEX-ZVT2` = 0.0195049035328895, `GTEX-ZVZP` = 0.0199993991223454), class = "data.frame", row.names = c(NA,
-1L)), ENSG00000141959 = structure(list(`GTEX-11EQ9` = 0.00386794757219419,
`GTEX-12WSJ` = 0.00331068544990299, `GTEX-1EKGG` = 0.00549727349038067,
`GTEX-1EU9M` = -0.00220598881051638, `GTEX-1EWIQ` = -0.00220598881051638,
`GTEX-1F5PK` = -0.00047576052598424, `GTEX-1GMRU` = -0.000019400770038708,
`GTEX-1GTWX` = -0.00265461664506892, `GTEX-S95S` = -0.000205735129200752,
`GTEX-SN8G` = -0.00148165048282797, `GTEX-T5JC` = -0.00164872668822519,
`GTEX-T6MO` = -0.0013787012914417, `GTEX-TKQ2` = -0.00265461664506892,
`GTEX-U3ZM` = -0.00164872668822519, `GTEX-V1D1` = -0.00220598881051638,
`GTEX-WFG7` = -0.00103302264827544, `GTEX-WFG8` = -0.000205735129200752,
`GTEX-WFJO` = 0.00659503688105354, `GTEX-WOFM` = 0.00169406666058391,
`GTEX-Y5V6` = 0.00659503688105354, `GTEX-Y8LW` = 0.00269498140995324,
`GTEX-ZC5H` = 0.00225132878287511, `GTEX-ZXES` = 0.00549727349038067,
`GTEX-11EM3` = 0.0210024880281395, `GTEX-11EMC` = 0.0171347306001959,
`GTEX-11ZTT` = 0.018137007193539, `GTEX-1212Z` = 0.0228033435746737,
`GTEX-12696` = 0.0205811017648125, `GTEX-1269C` = 0.0168279586537404,
`GTEX-1GF9U` = 0.0205811017648125, `GTEX-1GMR8` = 0.0175495081991909,
`GTEX-1I4MK` = 0.0183843909485424, `GTEX-S4Q7` = 0.0211578279565913,
`GTEX-U3ZG` = 0.0177114567919747, `GTEX-WWTW` = 0.0204149125032887,
`GTEX-WZTO` = 0.0164914915754566, `GTEX-X4EO` = 0.0178224278158885,
`GTEX-XPT6` = 0.0198274900394434, `GTEX-Y5V5` = 0.0177114567919747,
`GTEX-YB5K` = 0.0180479238702585, `GTEX-YEC4` = 0.0168279586537404,
`GTEX-ZF3C` = 0.0214942950348751, `GTEX-ZG7Y` = 0.0171347306001959,
`GTEX-ZP4G` = 0.0171347306001959, `GTEX-ZT9W` = 0.0246041991212079,
`GTEX-11I78` = 0.00746714052332263, `GTEX-11VI4` = 0.00818008340245513,
`GTEX-12C56` = 0.0123095880229919, `GTEX-13111` = 0.00943601338470202,
`GTEX-1399R` = 0.00897187247388116, `GTEX-1FIGZ` = 0.00795749001625596,
`GTEX-1GN2E` = 0.00943601338470202, `GTEX-RUSQ` = 0.00780432935650995,
`GTEX-T5JW` = 0.00563415692477041, `GTEX-UPJH` = 0.00671924314064018,
`GTEX-V955` = 0.00904257623212573, `GTEX-VUSG` = 0.00994736151433579,
`GTEX-W5WG` = 0.00971976985656361, `GTEX-WRHK` = 0.00671924314064018,
`GTEX-XBED` = 0.00941833027807091, `GTEX-XMK1` = 0.00780432935650995,
`GTEX-XQ3S` = 0.00977320221788934, `GTEX-XXEK` = 0.00671924314064018,
`GTEX-Y8DK` = 0.00818008340245513, `GTEX-ZEX8` = 0.00795749001625596,
`GTEX-ZPCL` = 0.0100569586897509, `GTEX-ZQG8` = 0.00746714052332263,
`GTEX-ZTPG` = 0.00904257623212573, `GTEX-1122O` = -0.0148396051801961,
`GTEX-1211K` = -0.0141597831410679, `GTEX-12WSL` = -0.0141750601473065,
`GTEX-T6MN` = -0.0141133976650269, `GTEX-TMZS` = -0.012512044067443,
`GTEX-UPK5` = -0.0141133976650269, `GTEX-WFON` = -0.0143460749121506,
`GTEX-WHSB` = -0.0139271058939441, `GTEX-WHWD` = -0.00993393444101102,
`GTEX-WY7C` = -0.00920772692584177, `GTEX-WYVS` = -0.0144923036878726,
`GTEX-X15G` = -0.00993393444101102, `GTEX-XGQ4` = -0.0135798044016206,
`GTEX-Y9LG` = -0.0148396051801961, `GTEX-YEC3` = -0.0150722824273198,
`GTEX-ZDTS` = -0.0144923036878726, `GTEX-ZDTT` = -0.0143060119167898,
`GTEX-ZF2S` = -0.00955502841816534, `GTEX-ZLV1` = -0.0141133976650269,
`GTEX-ZPIC` = -0.0135798044016206, `GTEX-ZT9X` = -0.00920772692584177,
`GTEX-ZUA1` = -0.0152185112030418, `GTEX-12WSN` = -0.0151287367580205,
`GTEX-1F48J` = -0.0164455761832253, `GTEX-1F52S` = -0.016964848400182,
`GTEX-1GMR3` = -0.0151522926443206, `GTEX-SUCS` = -0.0126712489200476,
`GTEX-U3ZH` = -0.0144246945509821, `GTEX-U3ZN` = -0.0151522926443206,
`GTEX-WEY5` = -0.0155466417925569, `GTEX-WH7G` = -0.0113544094948428,
`GTEX-X4EP` = -0.0151287367580205, `GTEX-X4LF` = -0.0142298023673521,
`GTEX-X5EB` = -0.0164220202969252, `GTEX-XBEW` = -0.0106503672878044,
`GTEX-XLM4` = -0.0156480089749772, `GTEX-Y5LM` = -0.0164220202969252,
`GTEX-Y8E4` = -0.0140893159157665, `GTEX-YF7O` = -0.0164220202969252,
`GTEX-ZF29` = -0.0156480089749772, `GTEX-ZTSS` = -0.0156715648612773,
`GTEX-ZTTD` = -0.0170940674370707, `GTEX-ZV6S` = -0.0142298023673521,
`GTEX-ZVT2` = -0.0170940674370707, `GTEX-ZVZP` = -0.01773885972213), class = "data.frame", row.names = c(NA,
-1L)))

create a column and index it with an ID in R

I have several datasets that needs label (i.e., ID1 .. IDn). For example the following code belongs to a certain dataset where I just want to add an extra column that labels all the observations with IDx.
In total I got 42 datasets. This means that I need to label al of those 42 datasets with an unique ID.
structure(list(X = 1:5, x1.time = c("00:00:00", "00:01:00", "00:02:00",
"00:03:00", "00:04:00"), x1.AI_mean = c(0.323351574525762, 0.284159071937747,
0.239749146757921, 0.230766586001914, 0.244456920325771), x1.MAD_mean = c(0.00341506508299082,
0.00302928679541095, 0.00278424196850715, 0.00269385572703841,
0.00270493856606347), x1.SD_mean = c(0.00477593690534784, 0.00405971881709533,
0.00354415353173061, 0.00350825365755234, 0.00361817148789133
), x1.ENMO_t_mean = c(0.0239268821264327, 0.0237063614378219,
0.0237014797190142, 0.0239896011495783, 0.0243401417506231),
x2.AI_mean = c(0.294080313622427, 0.477944468152524, 0.260808829802468,
0.456214057286552, 0.84614872784907), x2.MAD_mean = c(0.00263194956522427,
0.00393549027910995, 0.00242397010624937, 0.00473452632379309,
0.00967936115719858), x2.SD_mean = c(0.00620183543213348,
0.00897436349787661, 0.00376656976842411, 0.0102128144373202,
0.026857971881988), x2.ENMO_t_mean = c(0.0152786778953128,
0.0134201176591068, 0.0105504453766938, 0.0126154127095435,
0.0194672090503613), x3.AI_mean = c(0.0735792814229227, 0.0514050450635112,
0.105131723525748, 0.128627572902289, 0.402271889323791),
x3.MAD_mean = c(0.00139436591181368, 0.000712147674432812,
0.00119105634569394, 0.00119348650394604, 0.00356665669204264
), x3.SD_mean = c(0.00199624824940588, 0.00120092927705721,
0.00193145315212752, 0.0019283335835232, 0.00656874765265735
), x3.ENMO_t_mean = c(0.0139865818700652, 0.0139851935882149,
0.0139915889947178, 0.01398633901765, 0.0144706584272194),
x4.AI_mean = c(0.0156678651943813, 0.0486531274165618, 0.033482857018396,
0.0377258494079243, 0.0678175492814511), x4.MAD_mean = c(0.000251120428854605,
0.000562880039987649, 0.000528793978359871, 0.00124991974998928,
0.000757489838974229), x4.SD_mean = c(0.000533766751727111,
0.00134959539056406, 0.000857977081466285, 0.00213180063264727,
0.00127973763932144), x4.ENMO_t_mean = c(0.0207155829098077,
0.020761171880961, 0.0207540203103165, 0.0202677052046802,
0.0198891636700763), x5.AI_mean = c(0.117604774640621, 0.0670305430061501,
0.0341376355863943, 0.13364297618809, 0.306972659040445),
x5.MAD_mean = c(0.0014759342409207, 0.000989910934380608,
0.000403358793801372, 0.00146211525459881, 0.00279101071524453
), x5.SD_mean = c(0.00332215932515048, 0.00195612286464375,
0.00100728633289468, 0.00269074473283573, 0.00460104621279968
), x5.ENMO_t_mean = c(0.0154521138471442, 0.0154613646883262,
0.0154478187295753, 0.0157331526286594, 0.0158523807067694
), x6.AI_mean = c(0.100509771506111, 0.0758254065303984,
0.116304451335499, 0.128055772822219, 0.121857857811461),
x6.MAD_mean = c(0.000820743353091489, 0.000853723738604472,
0.00106905689779995, 0.00125348246046243, 0.00132633070226373
), x6.SD_mean = c(0.00122240006684591, 0.00122098986196308,
0.00200131128161969, 0.00174469241955932, 0.00180918568232773
), x6.ENMO_t_mean = c(0.0105689413754299, 0.0104679319373477,
0.0106510201902777, 0.0105852542321717, 0.0110441830680727
), x7.AI_mean = c(0.0286478750449268, 0.0515922904718244,
0.0711332148199368, 0.05020475938917, 0.0830762493042348),
x7.MAD_mean = c(0.000363376272209463, 0.000480238540942994,
0.000628916162718124, 0.000594606941057317, 0.000878481811277494
), x7.SD_mean = c(0.000583562490557928, 0.000759472323982701,
0.00117176811747496, 0.00112513562674996, 0.00137098279570074
), x7.ENMO_t_mean = c(0.0179026688120152, 0.0178767746038774,
0.0174193867673969, 0.0172732431081777, 0.0173507218269879
)), row.names = c(NA, 5L), class = "data.frame")

How to make a nice 3D plot in R for time series spectral data

I am trying to do a nice 3D plot using time series UV-Vis spectral data, like the first 3D graph below.
I used dput() function to show my data as below.
dput(head(Data))
and get:
structure(list(Wavelength = c(250, 252.5, 255, 257.5, 260, 262.5
), Date = structure(c(1365465600, 1365552000, 1365638400, 1365724800,
1365811200, 1365897600), class = c("POSIXct", "POSIXt"), tzone = "UTC"),
X250 = c(25.736217791411, 25.1182597222222, 24.8889567642957,
24.4881150070126, 24.2313916666667, 24.0346564673157), X252.5 = c(25.2168558282209,
24.6022625, 24.375429567643, 23.979541374474, 23.7248569444444,
23.5341668984701), X255 = c(24.6049539877301, 23.9896638888889,
23.7649888423989, 23.3753758765778, 23.1248263888889, 22.9342726008345
), X257.5 = c(24.0257944785276, 23.4037875, 23.1804435146443,
22.795541374474, 22.5493486111111, 22.35478581363), X260 = c(23.5917024539877,
22.9615486111111, 22.7389818688982, 22.3544109396914, 22.1091222222222,
21.9127635605007), X262.5 = c(23.1529110429448, 22.5264,
22.3051380753138, 21.924920056101, 21.6777583333333, 21.4858831710709
), X265 = c(22.5382085889571, 21.918125, 21.6982092050209,
21.3252145862553, 21.0800125, 20.8941794158554), X267.5 = c(21.8748957055215,
21.2488722222222, 21.0308619246862, 20.6643941093969, 20.4225541666667,
20.2340041724617), X270 = c(21.2791380368098, 20.6435263888889,
20.4248619246862, 20.0633674614306, 19.823075, 19.6308664812239
), X272.5 = c(20.7223159509202, 20.0815388888889, 19.8637377963738,
19.5049382889201, 19.2644375, 19.0733532684284), X275 = c(20.1307699386503,
19.4878583333333, 19.2719930264993, 18.9178920056101, 18.6778583333333,
18.487123783032), X277.5 = c(19.4758159509202, 18.8334013888889,
18.6168423988842, 18.2683702664797, 18.0308791666667, 17.8428414464534
), X280 = c(18.8002392638037, 18.1555375, 17.9391743375174,
17.5960126227209, 17.3601361111111, 17.1767204450626), X282.5 = c(18.1441809815951,
17.4953208333333, 17.2798758716876, 16.9426002805049, 16.7091777777778,
16.5276926286509), X285 = c(17.5349570552147, 16.8845097222222,
16.6697126917713, 16.337541374474, 16.1053763888889, 15.9246383866481
), X287.5 = c(16.8937300613497, 16.2423861111111, 16.0298493723849,
15.7046171107994, 15.4740472222222, 15.2938845618915), X290 = c(16.2328404907975,
15.582175, 15.3718940027894, 15.0537826086957, 14.8253291666667,
14.646668984701), X292.5 = c(15.5751472392638, 14.9258291666667,
14.7170446304045, 14.4051360448808, 14.1804194444444, 14.0051933240612
), X295 = c(14.9421717791411, 14.2904180555556, 14.0835034867504,
13.778301542777, 13.5566902777778, 13.3817329624478), X297.5 = c(14.4052392638037,
13.7537152777778, 13.5474421199442, 13.2471725105189, 13.0260375,
12.8530055632823), X300 = c(13.9050889570552, 13.2578347222222,
13.0537364016736, 12.7592973352034, 12.5405888888889, 12.3732670375522
), X302.5 = c(13.401036809816, 12.7586194444445, 12.5570264993026,
12.2684992987377, 12.0533902777778, 11.8884353268428), X305 = c(12.902717791411,
12.2623319444444, 12.0613933054393, 11.7787826086956, 11.5651972222222,
11.4043337969402), X307.5 = c(12.4249355828221, 11.7857791666667,
11.5858940027894, 11.3107840112202, 11.0999777777778, 10.9374005563282
), X310 = c(11.9935245398773, 11.3549347222222, 11.1571324965133,
10.8868260869565, 10.67955, 10.5179193324061), X312.5 = c(11.6203098159509,
10.9819680555556, 10.7849539748954, 10.516744740533, 10.3119236111111,
10.156892906815), X315 = c(11.2705674846626, 10.63485, 10.4406555090656,
10.177301542777, 9.97497638888889, 9.82023783031989), X317.5 = c(10.9098711656442,
10.2797055555556, 10.0875216178522, 9.82828471248247, 9.62720138888889,
9.47325173852573), X320 = c(10.5516625766871, 9.922075, 9.73211157601116,
9.47973772791024, 9.28055, 9.12974826147427), X322.5 = c(10.2039049079755,
9.57341805555556, 9.38568758716876, 9.13822159887798, 8.94393888888889,
8.79378581363004), X325 = c(9.86461042944785, 9.23893472222222,
9.05190516039052, 8.80583450210379, 8.61297777777778, 8.46346731571627
), X327.5 = c(9.5730490797546, 8.95366388888889, 8.76786750348675,
8.52597615708275, 8.33285972222222, 8.18865924895688), X330 = c(9.29567791411043,
8.67920416666667, 8.49494421199442, 8.25632117812062, 8.06634305555556,
7.92368984700974), X332.5 = c(9.0010981595092, 8.38594305555556,
8.20200139470014, 7.96879803646564, 7.78189166666667, 7.63967593880389
), X335 = c(8.71511349693252, 8.09972916666667, 7.92145885634589,
7.69297335203366, 7.50750694444444, 7.3643421418637), X337.5 = c(8.45265644171779,
7.84026666666667, 7.66316178521618, 7.43814305750351, 7.25333333333333,
7.11477607788595), X340 = c(8.19838036809816, 7.59187361111111,
7.41271827057183, 7.19209256661992, 7.00985416666667, 6.87590959666203
), X342.5 = c(7.95462883435583, 7.34913194444444, 7.17332914923291,
6.95607433380084, 6.77643055555556, 6.64161752433936), X345 = c(7.72929754601227,
7.12695138888889, 6.95060669456067, 6.7338920056101, 6.55681388888889,
6.42844089012517), X347.5 = c(7.50222699386503, 6.90189583333333,
6.72852022315202, 6.51498036465638, 6.33897916666667, 6.21110848400556
), X350 = c(7.2898527607362, 6.69248472222222, 6.52281171548117,
6.3138920056101, 6.13989722222222, 6.00979554937413), X352.5 = c(7.07927300613497,
6.48439166666667, 6.31443514644351, 6.10986956521739, 5.93754583333333,
5.81149652294854), X355 = c(6.86355214723926, 6.26889861111111,
6.09972524407252, 5.89783450210379, 5.72706527777778, 5.60363838664812
), X357.5 = c(6.6658527607362, 6.07161111111111, 5.90622873082287,
5.70649649368864, 5.53700833333333, 5.41251877607789), X360 = c(6.47400613496932,
5.88162777777778, 5.71633472803347, 5.5187713884993, 5.35024444444444,
5.22833796940195), X362.5 = c(6.30347852760736, 5.71433888888889,
5.54859414225942, 5.3527587657784, 5.1863375, 5.06425173852573
), X365 = c(6.16322699386503, 5.57911527777778, 5.41753835425384,
5.22367601683029, 5.05854027777778, 4.94001390820584), X367.5 = c(6.02653067484663,
5.44968333333333, 5.29124267782427, 5.10030294530154, 4.93744305555556,
4.82315020862309), X370 = c(5.86248466257669, 5.28735277777778,
5.12692747559275, 4.93981065918654, 4.77878055555556, 4.6638066759388
), X372.5 = c(5.68123006134969, 5.10715, 4.94811854951185,
4.764904628331, 4.60323333333333, 4.48933379694019), X375 = c(5.53815644171779,
4.96720416666667, 4.81097350069735, 4.62871388499299, 4.46926944444445,
4.35810987482615), X377.5 = c(5.40510429447853, 4.8370625,
4.68262761506276, 4.50320617110799, 4.34814444444444, 4.23741724617524
), X380 = c(5.30138343558282, 4.73901805555556, 4.5846889818689,
4.40751612903226, 4.25314444444444, 4.14589847009736), X382.5 = c(5.20306134969325,
4.64154722222222, 4.49053417015342, 4.31611079943899, 4.16125138888889,
4.05445757997218), X385 = c(5.07416871165644, 4.515375, 4.3646959553696,
4.19456802244039, 4.04227222222222, 3.93332127955494), X387.5 = c(4.96219325153374,
4.40868194444444, 4.25931520223152, 4.0922889200561, 3.9414,
3.83277607788595), X390 = c(4.83940797546012, 4.29276527777778,
4.14653974895398, 3.97920196353436, 3.82955277777778, 3.72600834492351
), X392.5 = c(4.71031288343558, 4.16622083333333, 4.02140446304045,
3.85572510518934, 3.70953194444445, 3.60538386648122), X395 = c(4.62059202453988,
4.07360138888889, 3.92935564853556, 3.76849228611501, 3.62277638888889,
3.51784283727399), X397.5 = c(4.49155521472393, 3.95385972222222,
3.81216178521618, 3.65344039270687, 3.50810833333333, 3.4116926286509
), X400 = c(4.37370858895706, 3.84129861111111, 3.70030125523013,
3.5432286115007, 3.39975277777778, 3.30254659248957), X402.5 = c(4.27044171779141,
3.738875, 3.59841562064156, 3.4434095371669, 3.30132638888889,
3.20369819193324), X405 = c(4.15562883435583, 3.6327375,
3.49318270571827, 3.33822159887798, 3.19675555555555, 3.10537273991655
), X407.5 = c(4.09877607361963, 3.57864305555556, 3.44027057182706,
3.28816129032258, 3.14875138888889, 3.05293602225313), X410 = c(4.01044785276074,
3.48679444444444, 3.35288842398884, 3.20463534361851, 3.06820833333333,
2.9671752433936), X412.5 = c(3.87490797546012, 3.35905694444444,
3.2244839609484, 3.07484291725105, 2.93775416666667, 2.8437983310153
), X415 = c(3.79108282208589, 3.28507361111111, 3.14952161785216,
3.00085273492286, 2.86421805555555, 2.77412378303199), X417.5 = c(3.68693558282209,
3.17824583333333, 3.04701394700139, 2.9043366058906, 2.76995972222222,
2.67318358831711), X420 = c(3.56437116564417, 3.05670972222222,
2.92747419804742, 2.786095371669, 2.65226666666667, 2.55702225312935
), X422.5 = c(3.51319018404908, 3.00990694444444, 2.87744769874477,
2.73367180925666, 2.60142361111111, 2.51227399165508), X425 = c(3.43132208588957,
2.92941805555555, 2.80041562064156, 2.65933099579243, 2.52816388888889,
2.43237969401947), X427.5 = c(3.31023926380368, 2.81629166666667,
2.68912831241283, 2.54957363253857, 2.41817777777778, 2.33177051460362
), X430 = c(3.26191717791411, 2.77505833333333, 2.64634030683403,
2.50681767180926, 2.37668055555556, 2.29549374130737), X432.5 = c(3.22984662576687,
2.74605555555556, 2.61894979079498, 2.48168022440393, 2.35282083333333,
2.26610987482615), X435 = c(3.13996932515337, 2.65807916666667,
2.5333179916318, 2.39782187938289, 2.26921388888889, 2.18432684283727
), X437.5 = c(3.08235582822086, 2.60515833333333, 2.4803249651325,
2.34626928471248, 2.21812083333333, 2.13608901251739), X440 = c(3.01686809815951,
2.54044583333333, 2.41671548117155, 2.2833842917251, 2.16062083333333,
2.07232267037552), X442.5 = c(2.93285889570552, 2.46135694444444,
2.33697489539749, 2.20531837307153, 2.08016805555556, 1.99902225312935
), X445 = c(2.8908773006135, 2.42607361111111, 2.30482426778243,
2.17530014025245, 2.04767916666667, 1.97140194714882), X447.5 = c(2.85198466257669,
2.38861111111111, 2.2694839609484, 2.14013884992987, 2.01676111111111,
1.93308901251738), X450 = c(2.8046472392638, 2.34394583333333,
2.22286750348675, 2.09689481065919, 1.97544444444445, 1.89651043115438
), X452.5 = c(2.77545705521472, 2.31733333333333, 2.20150627615063,
2.07733800841515, 1.95440277777778, 1.87571627260083), X455 = c(2.71198159509203,
2.26175277777778, 2.14609483960948, 2.02168022440393, 1.90238194444444,
1.82506536856745), X457.5 = c(2.69071779141104, 2.24759861111111,
2.1283709902371, 2.0067461430575, 1.88878055555556, 1.81217802503477
), X460 = c(2.63857055214724, 2.19480416666667, 2.07814365411437,
1.95862833099579, 1.84296111111111, 1.76875243393602), X462.5 = c(2.55233742331288,
2.10490416666667, 1.99411854951185, 1.87502664796634, 1.76141805555556,
1.68473435326843), X465 = c(2.54993251533742, 2.10804166666667,
1.99814644351464, 1.88111360448808, 1.76530277777778, 1.68772322670375
), X467.5 = c(2.54192944785276, 2.10937638888889, 1.99570990237099,
1.88144319775596, 1.76786666666667, 1.69657162726008), X470 = c(2.45424233128834,
2.02388472222222, 1.91476011157601, 1.80086255259467, 1.68827638888889,
1.61762865090403), X472.5 = c(2.38808588957055, 1.96169583333333,
1.85649232914923, 1.74286956521739, 1.63194444444444, 1.56048400556328
), X475 = c(2.40716871165644, 1.98333055555556, 1.8761589958159,
1.7647840112202, 1.65609861111111, 1.58707093184979), X477.5 = c(2.38796012269939,
1.96411527777778, 1.85740725244073, 1.74938990182328, 1.64029444444444,
1.57306258692629), X480 = c(2.32367484662577, 1.90594027777778,
1.80042677824268, 1.69331276297335, 1.58667777777778, 1.51872322670375
), X482.5 = c(2.26839877300614, 1.85602638888889, 1.75232914923291,
1.64626928471248, 1.542725, 1.47292350486787), X485 = c(2.24077914110429,
1.82308194444444, 1.72304323570432, 1.61980925666199, 1.5158,
1.44215159944367), X487.5 = c(2.19346625766871, 1.77742916666667,
1.67717712691771, 1.57596213183731, 1.46934861111111, 1.39640751043115
), X490 = c(2.1796226993865, 1.77528611111111, 1.67270432357043,
1.56773772791024, 1.46491111111111, 1.39967732962448), X492.5 = c(2.19796932515337,
1.79399861111111, 1.69254253835425, 1.58660028050491, 1.48578888888889,
1.42326842837274), X495 = c(2.16203067484663, 1.75784722222222,
1.66087866108787, 1.56017812061711, 1.45659583333333, 1.39502364394993
), X497.5 = c(2.12128220858896, 1.72433055555556, 1.62827615062762,
1.52875175315568, 1.42800833333333, 1.36483727399165), X500 = c(2.10455214723926,
1.71279027777778, 1.61463458856346, 1.51266058906031, 1.41571388888889,
1.35290403337969), X502.5 = c(2.09321779141104, 1.70464027777778,
1.60352022315202, 1.50263674614306, 1.40064722222222, 1.34636300417246
), X505 = c(2.06455828220859, 1.67302916666667, 1.57388145048815,
1.47552734922861, 1.37514166666667, 1.31759944367177), X507.5 = c(2.01607975460123,
1.62675138888889, 1.53272524407252, 1.43562692847125, 1.34284444444444,
1.27975660639777), X510 = c(1.97671165644172, 1.59260694444444,
1.50193444909344, 1.41013043478261, 1.31677916666667, 1.25430876216968
), X512.5 = c(1.96352147239264, 1.57798472222222, 1.48636262203626,
1.39764375876578, 1.30225555555556, 1.23669680111266), X515 = c(1.92503987730061,
1.54797083333333, 1.45469456066946, 1.36199298737728, 1.26766805555556,
1.21219749652295), X517.5 = c(1.90465030674847, 1.53300555555556,
1.44391352859135, 1.35238569424965, 1.2612375, 1.20831293463143
), X520 = c(1.87689570552147, 1.50217916666667, 1.4149330543933,
1.32729733520337, 1.23678194444445, 1.17577329624478), X522.5 = c(1.83759202453988,
1.46538888888889, 1.37917015341702, 1.29119775596073, 1.20174861111111,
1.14477607788595), X525 = c(1.83651533742331, 1.46525, 1.38037935843794,
1.29450490883591, 1.2079125, 1.15156189151599), X527.5 = c(1.82067791411043,
1.45758472222222, 1.36769874476987, 1.28326788218794, 1.19442916666667,
1.13923365785814), X530 = c(1.7854754601227, 1.42325833333333,
1.33740446304045, 1.25485553997195, 1.16439166666667, 1.11009457579972
), X532.5 = c(1.72706134969325, 1.36137083333333, 1.28353277545328,
1.20330014025245, 1.1164875, 1.05959248956885), X535 = c(1.73546012269939,
1.37703333333333, 1.2953570432357, 1.21220617110799, 1.12938333333333,
1.07361335187761), X537.5 = c(1.75189570552147, 1.39752083333333,
1.3135160390516, 1.23146283309958, 1.15030416666667, 1.10116133518776
), X540 = c(1.70230061349693, 1.35148888888889, 1.2665369595537,
1.18725666199158, 1.10636944444444, 1.06070792767733), X542.5 = c(1.71566564417178,
1.36359027777778, 1.28287029288703, 1.20369565217391, 1.1235375,
1.07357719054242), X545 = c(1.66589877300613, 1.31230416666667,
1.23633891213389, 1.15782889200561, 1.07775833333333, 1.01979972183588
), X547.5 = c(1.62098466257669, 1.27635555555556, 1.19730962343096,
1.11939270687237, 1.03757361111111, 0.990175243393602), X550 = c(1.64088650306749,
1.30173333333333, 1.22275592747559, 1.14718793828892, 1.06357916666667,
1.02470931849791), X552.5 = c(1.65776687116564, 1.31616944444444,
1.23976708507671, 1.16367180925666, 1.08286944444444, 1.03624200278164
), X555 = c(1.64775766871166, 1.30469861111111, 1.23003905160391,
1.15642496493689, 1.07983611111111, 1.02301529902643), X557.5 = c(1.57864417177914,
1.24234861111111, 1.16718131101813, 1.09518373071529, 1.01922638888889,
0.966821974965229), X560 = c(1.55608895705521, 1.22404166666667,
1.14994979079498, 1.07797896213184, 0.998729166666667, 0.953904033379694
), X562.5 = c(1.57327300613497, 1.24271111111111, 1.17039748953975,
1.10076437587658, 1.02429722222222, 0.982093184979138), X565 = c(1.54155828220859,
1.21247638888889, 1.14011994421199, 1.06987377279102, 0.995325,
0.950226703755216), X567.5 = c(1.5184754601227, 1.19163194444444,
1.11808926080893, 1.04673772791024, 0.969984722222222, 0.920390820584145
), X570 = c(1.52191104294479, 1.19953472222222, 1.12552022315202,
1.05369144460028, 0.979043055555555, 0.936059805285118),
X572.5 = c(1.49422699386503, 1.17113333333333, 1.09843793584379,
1.02884291725105, 0.956215277777778, 0.914119610570236),
X575 = c(1.48120552147239, 1.16091666666667, 1.08878382147838,
1.02371248246844, 0.950745833333333, 0.903524339360223),
X577.5 = c(1.49473312883436, 1.17405, 1.10468340306834, 1.04081346423562,
0.967102777777778, 0.918347705146036), X580 = c(1.45893558282209,
1.13822638888889, 1.07150488145049, 1.004904628331, 0.931488888888889,
0.888706536856745), X582.5 = c(1.40335889570552, 1.08981666666667,
1.02136262203626, 0.955345021037868, 0.882438888888889, 0.842457579972184
), X585 = c(1.41981901840491, 1.11120277777778, 1.04046164574617,
0.976112201963534, 0.902045833333333, 0.854774687065369),
X587.5 = c(1.44122085889571, 1.13389722222222, 1.06531938633194,
0.998193548387097, 0.927052777777778, 0.884666203059805),
X590 = c(1.43262883435583, 1.12188472222222, 1.05589539748954,
0.991642356241234, 0.923915277777778, 0.883214186369958),
X592.5 = c(1.39457668711656, 1.08495694444444, 1.01676150627615,
0.954368863955119, 0.886066666666667, 0.842401947148818),
X595 = c(1.39473006134969, 1.09030138888889, 1.02193584379358,
0.95813744740533, 0.889866666666667, 0.851438108484006),
X597.5 = c(1.39176380368098, 1.08874305555556, 1.02160251046025,
0.960784011220196, 0.891755555555556, 0.851367176634214),
X600 = c(1.32321472392638, 1.02342361111111, 0.958054393305439,
0.896713884992987, 0.828456944444444, 0.789112656467316),
X602.5 = c(1.3699754601227, 1.06539861111111, 1.00389818688982,
0.94194950911641, 0.875038888888889, 0.832920723226704),
X605 = c(1.39004294478528, 1.0856125, 1.02410460251046, 0.964893408134642,
0.897881944444444, 0.851397774687065), X607.5 = c(1.33887423312883,
1.04344305555556, 0.978672245467225, 0.918176718092567, 0.853443055555556,
0.810876216968011), X610 = c(1.34292944785276, 1.04911111111111,
0.98465690376569, 0.922030855539972, 0.858780555555556, 0.820618915159944
), X612.5 = c(1.32123006134969, 1.02857083333333, 0.962319386331939,
0.899249649368864, 0.834901388888889, 0.797037552155772),
X615 = c(1.30576380368098, 1.01544166666667, 0.949560669456067,
0.889232819074334, 0.824005555555556, 0.787675938803894),
X617.5 = c(1.30801840490798, 1.01950138888889, 0.959458856345886,
0.902255259467041, 0.839116666666667, 0.80459388038943),
X620 = c(1.25273619631902, 0.963565277777778, 0.903634588563459,
0.845955119214586, 0.781859722222222, 0.751739916550765),
X622.5 = c(1.24233742331288, 0.951993055555556, 0.889652719665272,
0.832720897615708, 0.765165277777778, 0.728485396383866),
X625 = c(1.3115736196319, 1.020975, 0.960577405857741, 0.902300140252454,
0.835329166666667, 0.789098748261474), X627.5 = c(1.32251840490798,
1.03869861111111, 0.977846582984658, 0.916507713884993, 0.852429166666667,
0.812655076495132), X630 = c(1.26833435582822, 0.9928125,
0.93086750348675, 0.87539270687237, 0.812751388888889, 0.775739916550765
), X632.5 = c(1.24898773006135, 0.965934722222222, 0.908059972105997,
0.85682889200561, 0.794722222222222, 0.751435326842837),
X635 = c(1.28299386503067, 0.995876388888889, 0.936375174337517,
0.881263674614306, 0.819331944444444, 0.78326842837274),
X637.5 = c(1.2784018404908, 1.00060833333333, 0.939645746164575,
0.880981767180926, 0.821463888888889, 0.792333796940195),
X640 = c(1.24037116564417, 0.960616666666667, 0.905357043235704,
0.846816269284712, 0.787144444444444, 0.744055632823366),
X642.5 = c(1.19373619631902, 0.907856944444444, 0.852075313807531,
0.797594670406732, 0.732779166666667, 0.684244784422809),
X645 = c(1.17663190184049, 0.898422222222222, 0.835518828451883,
0.782708274894811, 0.717233333333333, 0.684310152990264),
X647.5 = c(1.21073619631902, 0.943138888888889, 0.879875871687587,
0.826015427769986, 0.7630125, 0.737840055632823), X650 = c(1.20088036809816,
0.934829166666667, 0.877008368200837, 0.821608695652174,
0.760254166666667, 0.727004172461752), X652.5 = c(1.18600920245399,
0.915881944444444, 0.860887029288703, 0.80358064516129, 0.744027777777778,
0.705867872044506), X655 = c(1.22061349693252, 0.951930555555556,
0.896224546722455, 0.840730715287518, 0.784806944444444,
0.750878998609179), X657.5 = c(1.19243865030675, 0.924801388888889,
0.865479776847978, 0.81258064516129, 0.757759722222222, 0.721283727399165
), X660 = c(1.10550920245399, 0.841702777777778, 0.780730822873082,
0.731366058906031, 0.673393055555556, 0.638547983310153)), row.names = c(NA,
6L), class = "data.frame")
My code:
Data <- data.frame(Data)
library(rgl)
library(pls)
x <- as.POSIXct(Data$Date, format = "2013-01-10", tz = "Australia/Adelaide")
y <- Data$Wavelength
z <- as.matrix(Data[,3:167])
open3d()
plot3d(x, y, z,col="purple", size=3, xlab = "Date", ylab = "Wavelength", zlab = "Absorbance (/cm)")
I get a not very nice plot as shown in the second graph.
The x-axis has labels in numerical dates, but I want the actual dates in the format like "1 June 2013" or "1/6/2013".
I also don't know how to make a nice rainbow colour looking 3D graph.
Any help is welcome :)
a typical UV-Vis spectrum looks like graph 3 below
using the codes provided by Marco Sandri,
library(tidyr)
library(ggplot2)
library(plotly)
Data %>%
gather(Series, y, X250:X660, factor_key=TRUE) %>%
plot_ly(x = ~Date, y = ~Wavelength, z = ~y,
type = 'scatter3d', mode = 'lines', color = ~Series)
The graph 4 is the plot I get.
A solution based on the plotly package:
library(tidyr)
library(plotly)
Data %>%
gather(Series, y, X250:X660, factor_key=TRUE) %>%
plot_ly(x = ~Date, y = ~Wavelength, z = ~y, type = 'scatter3d', mode = 'lines', color = ~Series)
You may omit and redraw the axes using bbox3d. In bbox3d just xat= and xlab= specifications are needed, where we use x.
open3d()
plot3d(x, y, z, col="purple", size=3, xlab="Date", ylab="Wavelength",
zlab="Absorbance (/cm)", axes=FALSE, top=TRUE)
bbox3d(xat=x, xlab=x, col="black", front="line", back="line", lit=FALSE)

Delete elements with specific field from list (r language)

I have a vector of lists in it. Every list contain field category
I need delete all lists with fields category == resource.
I tried
for(i in 1:length(myList)){
if(myList[[as.numeric(i)]]$data$category == "resource"){
myList[[as.numeric(i)]]<-NULL
}
}
Is it correct?
> dput(myList[1:2])
list(structure(list(data = structure(list(device = "iPad2,4",
os_version = "ios 7.1.2", connection_type = "wifi", category = "user",
platform = "ios", session_num = 2, ios_idfv = "E12AA218-4061-4BA1-AFA3-47FEE1511C2E",
client_ts = 1454926346, sdk_version = "unity 2.4.3", limited_ad_tracking = TRUE,
user_id = "436E8588-B2FA-411A-896C-5757E7A2A377", manufacturer = "apple",
jailbroken = TRUE, ios_idfa = "436E8588-B2FA-411A-896C-5757E7A2A377",
build = "1.0", session_id = "558910f2-7c2c-4280-84fc-2fef1a50d291",
v = 2, engine_version = "unity 4.6.9"), .Names = c("device",
"os_version", "connection_type", "category", "platform", "session_num",
"ios_idfv", "client_ts", "sdk_version", "limited_ad_tracking",
"user_id", "manufacturer", "jailbroken", "ios_idfa", "build",
"session_id", "v", "engine_version")), first_in_batch = TRUE,
country_code = "RO", arrival_ts = 1454926344, game_id = 24540,
ip = "93.168.249.0"), .Names = c("data", "first_in_batch",
"country_code", "arrival_ts", "game_id", "ip")), structure(list(
data = structure(list(os_version = "ios 9.2.1", engine_version = "unity 4.6.9",
category = "user", v = 2, ios_idfa = "F06962FE-FCE5-475F-8CC2-83FF1F89E573",
sdk_version = "unity 2.4.3", user_id = "F06962FE-FCE5-475F-8CC2-83FF1F89E573",
session_num = 2, platform = "ios", connection_type = "wifi",
manufacturer = "apple", client_ts = 1454925528, limited_ad_tracking = TRUE,
session_id = "3ab1fbbb-5103-4ad8-bf56-94f70fea94a7",
device = "iPad4,1", ios_idfv = "2C940E82-B074-4A15-B9A7-A5983759042F",
build = "1.0"), .Names = c("os_version", "engine_version",
"category", "v", "ios_idfa", "sdk_version", "user_id", "session_num",
"platform", "connection_type", "manufacturer", "client_ts",
"limited_ad_tracking", "session_id", "device", "ios_idfv",
"build")), first_in_batch = TRUE, country_code = "AU", arrival_ts = 1454925528,
game_id = 24540, ip = "110.175.52.0"), .Names = c("data",
"first_in_batch", "country_code", "arrival_ts", "game_id", "ip"
)))
You could use rlist package :
library(rlist)
filtered_list <- list.exclude(myList, data$category == "ressource")
We could use Filter from base R
Filter(function(x) x$data$category!="resource", myList)

Error when using adaptive resampling (CARET package)

Code:
library(caret)
#adaptative control resampling method for fitting svr
ctrlada <- trainControl(method = "adaptive_cv", number = 10, returnResamp = "final",
adaptive = list(min = 5,
alpha = 0.05,
method = "gls",
complete = TRUE),
allowParallel = TRUE) #10 separate 10-fold cross-validations are used as the resampling scheme
set.seed(100)
marsFitacv <- train(R ~ ., data = trainSet,
method = "earth",
tuneGrid = expand.grid(degree = 2, nprune = 40:80),
trControl = ctrlada)
error:
x parameter filtering failed
Error in `$<-.data.frame`(`*tmp*`, "nprune", value = NA) :
replacement has 1 row, data has 0
data:
dput(head(trainSet))
structure(list(fy = c(317.913756282, 365.006253069, 392.548100067,
305.350697829, 404.999341917, 326.558279739), fu = c(538.962896683,
484.423120589, 607.974981919, 566.461909098, 580.287855801, 454.178316794
), E = c(194617.707566, 181322.455065, 206661.286272, 182492.029532,
189867.929239, 181991.379749), eu = c(0.153782620813, 0.208857408687,
0.29933255604, 0.277013319499, 0.251278125174, 0.20012525805),
imp_local = c(1555.3450957, 1595.41614044, 763.56392418,
1716.78277731, 1045.72429616, 802.742305814), imp_global = c(594.038972858,
1359.48216529, 1018.89209367, 850.887850177, 1381.3557372,
1714.66351462), teta1c = c(0.033375064111, 0.021482368218,
0.020905367537, 0.006956337817, 0.034913536977, 0.03009770223
), k1c = c(4000921.55552, 4499908.41979, 9764999.26902, 9273400.46159,
6163057.88855, 12338543.5703), k2_2L = c(98633499.5682, 53562216.5496,
51597126.6866, 79496746.0098, 54060378.6334, 88854286.5457
), k2_3L = c(53752551.0262, 125020222.794, 124021434.482,
125817803.431, 75021821.6702, 35160224.288), k2_4L = c(56725106.5978,
126865701.893, 145764489.664, 64837586.8755, 49128911.0832,
70088564.0166), bmaxc = c(3481281.32908, 4393584.00639, 2614830.02391,
3128593.72039, 3179348.29527, 4274637.35956), dfactorc = c(2.5474729895,
2.94296926288, 2.79505551368, 2.47882735165, 2.46407943564,
1.41121223341), amaxc = c(73832.9746763, 99150.5068997, 77165.4338508,
128546.996471, 53819.0447533, 54870.9707106), teta1s = c(0.015467320192,
0.013675755546, 0.031668366149, 0.028898297322, 0.019211801086,
0.013349768955), k1s = c(5049506.54552, 11250622.6842, 13852560.5089,
18813117.5726, 18362782.7372, 14720875.0829), k2_ab1s = c(276542468.441,
275768806.723, 211613299.608, 264475187.749, 162043062.526,
252936228.465), k2_ab2s = c(108971516.033, 114017918.32,
248886114.151, 213529935.615, 236891513.077, 142986118.909
), k2_ab3s = c(33306211.9166, 28220338.4744, 40462423.2281,
23450400.4429, 46044346.1128, 23695405.2598), bmaxab1 = c(4763935.86742,
4297372.01966, 3752983.00638, 4861240.46459, 4269771.8481,
4162098.23435), bmaxab2 = c(1864128.647, 1789714.6047, 2838412.50704,
2122535.96812, 2512362.60884, 1176995.61871), ab1 = c(66.4926766666,
42.7771212442, 45.4212664748, 50.3764074404, 35.4792060556,
34.1116517971), ab2 = c(21.0285105309, 23.5869838719, 18.8524808986,
10.1121885612, 10.9695055644, 12.1154127169), dfactors = c(2.47803921947,
0.874644748155, 0.749837099991, 1.96711589185, 2.5407774352,
1.28554379333), teta1f = c(0.037308451805, 0.035718600749,
0.012495093438, 0.000815957999, 0.002155991091, 0.02579104469
), k1f = c(14790480.9871, 17223538.1853, 19930679.8931, 3524230.46974,
15721827.0137, 13599317.0371), k2f = c(55614283.976, 54695745.7762,
86690362.7036, 99857853.7312, 63119072.711, 37510791.5472
), bmaxf = c(2094770.19484, 3633133.51482, 1361188.05421,
2001027.51219, 2534273.6726, 3765850.14143), dfactorf = c(0.745459795314,
2.04869176933, 0.853221909609, 1.76652410119, 0.523675021418,
1.0808768613), k2b = c(1956.92858062, 1400.78738327, 1771.23607857,
1104.05501369, 1756.6767193, 1509.9294956), amaxb = c(38588.0915097,
35158.1672213, 25711.062782, 21103.1603387, 27230.6973685,
43720.3558889999), dfactorb = c(0.822346959126, 2.34421354848,
0.79990635332, 2.99070447299, 1.76373031599, 1.38640223249
), roti = c(16.1560390049, 12.7223971386, 6.43238062144,
15.882552267, 16.0836252663, 18.2734832893), rotmaxbp = c(0.235615453341,
0.343204895932, 0.370304533553, 0.488746319999, 0.176135112774,
0.46921999001), R = c(0.022186087, 0.023768855, 0.023911029,
0.023935705, 0.023655335, 0.022402726)), .Names = c("fy",
"fu", "E", "eu", "imp_local", "imp_global", "teta1c", "k1c",
"k2_2L", "k2_3L", "k2_4L", "bmaxc", "dfactorc", "amaxc", "teta1s",
"k1s", "k2_ab1s", "k2_ab2s", "k2_ab3s", "bmaxab1", "bmaxab2",
"ab1", "ab2", "dfactors", "teta1f", "k1f", "k2f", "bmaxf", "dfactorf",
"k2b", "amaxb", "dfactorb", "roti", "rotmaxbp", "R"), row.names = c(7L,
8L, 20L, 23L, 28L, 29L), class = "data.frame")
Data has no equal rows or NaNs

Resources