This question already has answers here:
Select the top N values by group
(10 answers)
Closed 1 year ago.
I have data.frame TeamFourFactorsRAPM consisting of 44 columns, I want to subset data frame base on two columns
column 41 teamName (consist of team names for all players in the NBA)
column 44 mp (consist of how many minutes a player played throughout season)
I want to get the 8 players with the highest minutes played, for every team
'data.frame': 539 obs. of 44 variables:
$ playerId : int 101108 1628415 101150 1627783 1627846 1629620 1626153 1629641 1628021 1628035 ...
$ playerName : chr "Chris Paul" "Dillon Brooks" "Lou Williams" "Pascal Siakam" ...
$ LA_RAPM : num 1.37 1.33 -0.82 1.91 -0.45 -0.48 0.65 -0.7 0.96 -0.08 ...
$ LA_RAPM_Rank : int 37 42 463 20 386 400 104 439 73 268 ...
$ LA_RAPM__Def : num 0.58 0.84 -0.69 0.47 0.1 -0.33 0.44 0.11 0.4 0.05 ...
$ LA_RAPM__Def_Rank: int 76 39 486 100 198 401 102 197 112 237 ...
$ LA_RAPM__Off : num 0.79 0.49 -0.14 1.44 -0.55 -0.15 0.2 -0.81 0.56 -0.13 ...
$ LA_RAPM__Off_Rank: int 63 105 322 15 443 333 166 489 94 318 ...
$ RA_EFG : num 0.42 0.88 -0.57 0.48 0.09 -0.22 -1.08 0.05 -0.03 -0.02 ...
$ RA_EFG_Rank : int 117 37 460 99 207 357 518 229 259 258 ...
$ RA_EFG__Def : num 0.08 0.36 -0.17 -0.04 0.13 -0.09 -0.69 0.25 0.35 0.19 ...
$ RA_EFG__Def_Rank : int 208 84 387 297 169 346 522 110 88 132 ...
$ RA_EFG__Off : num 0.33 0.52 -0.4 0.52 -0.05 -0.13 -0.4 -0.2 -0.37 -0.21 ...
$ RA_EFG__Off_Rank : int 109 70 449 71 264 329 448 366 443 372 ...
$ RA_FTR : num -0.12 -0.24 0.55 0.26 -0.18 0.05 1.18 -0.42 0.39 -0.19 ...
$ RA_FTR_Rank : int 315 356 90 161 337 247 19 414 124 340 ...
$ RA_FTR__Def : num 0.53 -0.2 0.01 0.34 0.08 -0.04 0.69 -0.08 -0.09 -0.75 ...
$ RA_FTR__Def_Rank : int 61 373 241 102 201 276 41 302 315 522 ...
$ RA_FTR__Off : num -0.64 -0.04 0.53 -0.08 -0.26 0.09 0.48 -0.34 0.47 0.56 ...
$ RA_FTR__Off_Rank : int 504 289 53 305 397 218 65 430 68 49 ...
$ RA_ORBD : num -0.02 -0.3 -1.06 0.01 -0.63 -0.7 -1.59 -0.13 -0.67 0.68 ...
$ RA_ORBD_Rank : int 269 357 485 253 437 446 522 300 441 103 ...
$ RA_ORBD__Def : num 0.83 0.06 -0.82 -0.25 0.38 -0.78 -1.05 0.08 -0.73 0.01 ...
$ RA_ORBD__Def_Rank: int 40 236 506 373 123 502 524 227 496 264 ...
$ RA_ORBD__Off : num -0.85 -0.35 -0.23 0.26 -1.01 0.08 -0.54 -0.2 0.06 0.69 ...
$ RA_ORBD__Off_Rank: int 496 392 355 169 511 220 437 341 227 65 ...
$ RA_TOV : num 0.93 0.41 0.13 0.93 -0.24 -0.39 1.84 -0.51 0.1 0.51 ...
$ RA_TOV_Rank : int 11 82 191 12 412 457 1 482 211 60 ...
$ RA_TOV__Def : num 0.5 0.51 -0.27 0.4 0.09 -0.16 1.12 -0.28 0.17 0.36 ...
$ RA_TOV__Def_Rank : int 36 33 452 55 193 394 2 456 139 66 ...
$ RA_TOV__Off : num 0.43 -0.1 0.4 0.52 -0.32 -0.24 0.72 -0.23 -0.08 0.15 ...
$ RA_TOV__Off_Rank : int 51 358 62 26 466 438 10 433 336 154 ...
$ RAPM : num 1.67 1.84 -0.43 1.68 -0.02 -0.76 -0.02 -0.48 -0.08 0.21 ...
$ RAPM_Rank : int 44 34 356 43 248 421 246 368 274 197 ...
$ RAPM__Def : num 0.92 1 -0.64 0.22 0.5 -0.51 0.03 0.2 0.44 0.43 ...
$ RAPM__Def_Rank : int 53 41 457 177 112 440 248 189 121 122 ...
$ RAPM__Off : num 0.75 0.84 0.21 1.46 -0.53 -0.25 -0.04 -0.68 -0.53 -0.23 ...
$ RAPM__Off_Rank : int 94 81 179 38 406 342 250 440 407 331 ...
$ season : chr "2020-21" "2020-21" "2020-21" "2020-21" ...
$ teamId : int 1610612756 1610612763 1610612746 1610612761 1610612756 1610612760 1610612765 1610612738 1610612745 1610612747 ...
$ teamName : chr "PHX" "MEM" "LAC" "TOR" ...
$ primaryKey : chr "101108_2020-21" "1628415_2020-21" "101150_2020-21" "1627783_2020-21" ...
$ playerRole : chr "Ball Handler, Primary Playmaker" "Wing, Shooter" "Ball Handler, Primary Playmaker" "Wing, Playmaker" ...
$ mp : num 2199 1997 2846 2006 355 ...
If every player has only 1 row this should work -
result <- TeamFourFactorsRAPM %>%
group_by(teamName) %>%
slice_max(mp, n = 8) %>% ungroup
Related
I have the following data set (which I import from a 6-column Excel file with a .csv file extension):
treas <- read.csv(file = 'treas.csv', header = TRUE, stringsAsFactors = FALSE)
2YR 3YR 5YR 7YR 10YR 30YR
0.41 0.85 1.65 2.18 2.6 3.43
0.41 0.85 1.65 2.2 2.61 3.45
0.4 0.82 1.63 2.17 2.59 3.44
0.41 0.86 1.66 2.19 2.6 3.44
0.43 0.88 1.69 2.22 2.62 3.45
0.45 0.93 1.71 2.24 2.64 3.47
0.44 0.91 1.7 2.23 2.65 3.47
0.42 0.88 1.66 2.17 2.58 3.41
0.45 0.93 1.7 2.21 2.6 3.41
0.49 0.95 1.71 2.21 2.61 3.4
0.51 0.99 1.77 2.27 2.66 3.44
0.48 0.95 1.71 2.21 2.61 3.43
0.48 0.94 1.71 2.22 2.64 3.47
0.5 0.94 1.71 2.22 2.63 3.44
0.48 0.96 1.72 2.23 2.63 3.45
0.49 0.95 1.7 2.19 2.59 3.41
0.48 0.92 1.68 2.17 2.57 3.38
0.46 0.9 1.64 2.14 2.53 3.35
0.45 0.88 1.64 2.14 2.54 3.36
0.47 0.88 1.62 2.13 2.53 3.34
0.47 0.9 1.66 2.17 2.58 3.4
0.49 0.95 1.71 2.22 2.64 3.46
0.52 0.98 1.74 2.25 2.65 3.47
0.52 1 1.74 2.24 2.63 3.44
0.51 0.99 1.7 2.19 2.58 3.38
0.51 0.97 1.68 2.17 2.57 3.37
0.46 0.93 1.66 2.15 2.55 3.38
0.48 0.92 1.65 2.13 2.53 3.34
0.48 0.95 1.68 2.17 2.55 3.36
When I call the cov() method on the the treas data frame, I see the following error message:
Error: is.numeric(x) || is.logical(x) is not TRUE
To check the data types, I use:
sapply(treas, typeof)
The result is:
2YR 3YR 5YR 7YR 10YR 30YR
"character" "character" "character" "character" "character" "character"
Calling str(treas) reveals:
str(treas)
'data.frame': 1252 obs. of 6 variables:
$ 2YR : Factor w/ 235 levels ".","0.34","0.35",..: 8 8 7 8 10 12 11 9 12 16 ...
$ 3YR : chr w/ 219 levels ".","0.66","0.69",..: 18 18 15 19 21 26 24 21 26 28 ...
$ 5YR : chr w/ 207 levels ".","0.94","0.95",..: 67 67 65 68 71 73 72 68 72 73 ...
$ 7YR : chr w/ 192 levels ".","1.19","1.20",..: 96 98 95 97 100 102 101 95 99 99 ...
$ 10YR : chr w/ 178 levels ".","1.37","1.38",..: 118 119 117 118 120 122 123 116 118 119 ...
$ 30YR : chr w/ 125 levels ".","2.11","2.14",..: 121 123 122 122 123 125 125 120 120 119 ...
I've tried to force the data frame to numeric using:
lapply(treas, as.numeric)
But, doing so results in:
Warning messages:
1: In lapply(treas, as.numeric) : NAs introduced by coercion
2: In lapply(treas, as.numeric) : NAs introduced by coercion
3: In lapply(treas, as.numeric) : NAs introduced by coercion
4: In lapply(treas, as.numeric) : NAs introduced by coercion
5: In lapply(treas, as.numeric) : NAs introduced by coercion
6: In lapply(treas, as.numeric) : NAs introduced by coercion
Then, I still get the same error when calling cov(treas):
Error: is.numeric(x) || is.logical(x) is not TRUE
Anyone see what I'm doing incorrectly here? Thanks!
I am learning biplot with wine data set. How does R know Barolo, Grignolino and Barbera are wine.class while we don't see the wine class column in the data set?
More details about the wine data set are in the following links
ggbiplot - how not to use the feature vectors in the plot
https://github.com/vqv/ggbiplot
Thanks very much
In the wine dataset, you have 2 objects, one data.frame wine with 178 observations of 13 quantitative variables:
str(wine)
'data.frame': 178 obs. of 13 variables:
$ Alcohol : num 14.2 13.2 13.2 14.4 13.2 ...
$ MalicAcid : num 1.71 1.78 2.36 1.95 2.59 1.76 1.87 2.15 1.64 1.35 ...
$ Ash : num 2.43 2.14 2.67 2.5 2.87 2.45 2.45 2.61 2.17 2.27 ...
$ AlcAsh : num 15.6 11.2 18.6 16.8 21 15.2 14.6 17.6 14 16 ...
$ Mg : int 127 100 101 113 118 112 96 121 97 98 ...
$ Phenols : num 2.8 2.65 2.8 3.85 2.8 3.27 2.5 2.6 2.8 2.98 ...
$ Flav : num 3.06 2.76 3.24 3.49 2.69 3.39 2.52 2.51 2.98 3.15 ...
$ NonFlavPhenols: num 0.28 0.26 0.3 0.24 0.39 0.34 0.3 0.31 0.29 0.22 ...
$ Proa : num 2.29 1.28 2.81 2.18 1.82 1.97 1.98 1.25 1.98 1.85 ...
$ Color : num 5.64 4.38 5.68 7.8 4.32 6.75 5.25 5.05 5.2 7.22 ...
$ Hue : num 1.04 1.05 1.03 0.86 1.04 1.05 1.02 1.06 1.08 1.01 ...
$ OD : num 3.92 3.4 3.17 3.45 2.93 2.85 3.58 3.58 2.85 3.55 ...
$ Proline : int 1065 1050 1185 1480 735 1450 1290 1295 1045 1045 ...
There is also one vector wine.class that contains 178 observations of the qualitative wine.class variable:
str(wine.class)
Factor w/ 3 levels "barolo","grignolino",..: 1 1 1 1 1 1 1 1 1 1 ...
The 13 quantitative variables are used to compute the PCA:
wine.pca <- prcomp(wine, scale. = TRUE)
while the wine.class variable is just used to color the points on the plot
Hi I'm pushing data into a matrix so I can create a heatmap. The code I am using identical to what is published here (http://sebastianraschka.com/Articles/heatmaps_in_r.html). For some of my datasets, when I push the data into the matrix format I am getting strange behaviour in that some of the values are changing. Some of my datasets work fine but others do not and I am unsure what the primary differences are that is underlying this strange behaviour.
Example code;
data <- read.csv("mydata.txt", sep="\t", header =TRUE)
rnames <- data[,1]
mat_data <- data.matrix(data[,2:ncol(data)])
rownames(mat_data) <- rnames
Now example dataframes..
head(data)
1 1.108029 0.42 0.19 0.04 0.47 -0.08 0.47 0.04 0.10
2 1.108029 0.34 0.40 0.25 0.56 -0.08 -0.06 0.11 0.20
3 1.121099 0.1 -0.45 0.11 -0.22 -0.07 -0.40 0.24 -0.17
4 1.123857 0.26 -0.15 0.15 0.31 0.2 -0.24 -0.27 0.40
5 1.129303 0.11 0.13 0.01 -0.11 0.38 0.29 -0.15 -0.18
6 1.135904 0.4 0.07 0.11 0.03 0.6 -0.32 0.14 -0.12
head(mat_data)
tg_q2_rep_A tg_q2_rep_B tg_q2_rep_C tg_q2_rep_D tg_q4_rep_A tg_q4_rep_B tg_q4_rep_C tg_q4_rep_D
1.10802929 70 0.19 0.04 0.47 5 0.47 0.04 0.10
1.1080293 65 0.40 0.25 0.56 5 -0.06 0.11 0.20
1.12109912 49 -0.45 0.11 -0.22 4 -0.40 0.24 -0.17
1.12385707 62 -0.15 0.15 0.31 53 -0.24 -0.27 0.40
1.12930344 50 0.13 0.01 -0.11 65 0.29 -0.15 -0.18
1.1359041 69 0.07 0.11 0.03 69 -0.32 0.14 -0.12
You can see the rownames have had numbers appended to the ends and the first data for tg_q2_rep_A and tg_q4_rep_A have been changed.
If anyone can suggest how to approach this I'd appreciate it. I've been trying to figure this out for days :/
EDIT
As requested ..
> str(data)
'data.frame': 137 obs. of 33 variables:
$ CpG_id.chr.pos.: num 1.11 1.11 1.12 1.12 1.13 ...
$ tg_q2_rep_A : Factor w/ 75 levels "-0.01","-0.02",..: 70 65 49 62 50 69 71 63 57 7 ...
$ tg_q2_rep_B : num 0.19 0.4 -0.45 -0.15 0.13 0.07 0.5 -0.33 0.23 -0.22 ...
$ tg_q2_rep_C : num 0.04 0.25 0.11 0.15 0.01 0.11 0.16 0.03 0.23 -0.32 ...
$ tg_q2_rep_D : num 0.47 0.56 -0.22 0.31 -0.11 0.03 0.31 0.21 0 0.06 ...
$ tg_q4_rep_A : Factor w/ 73 levels "-0.04","-0.05",..: 5 5 4 53 65 69 50 53 59 46 ...
$ tg_q4_rep_B : num 0.47 -0.06 -0.4 -0.24 0.29 -0.32 0.07 -0.23 0.1 -0.09 ...
$ tg_q4_rep_C : num 0.04 0.11 0.24 -0.27 -0.15 0.14 0.14 0.36 0.1 -0.05 ...
$ tg_q4_rep_D : num 0.1 0.2 -0.17 0.4 -0.18 -0.12 0.15 0.18 -0.21 -0.14 ...
$ tg_q6_rep_A : Factor w/ 79 levels "-0.02","-0.03",..: 46 3 7 67 65 77 64 61 41 12 ...
$ tg_q6_rep_B : Factor w/ 87 levels "-0.01","-0.03",..: 68 79 34 11 82 1 63 1 36 32 ...
$ tg_q6_rep_C : num 0.22 0.5 -0.32 0.13 0.24 0.25 0.35 0.07 0.01 -0.44 ...
$ tg_q6_rep_D : Factor w/ 82 levels "-0.04","-0.05",..: 55 50 27 74 71 68 73 61 5 31 ...
$ tg_q8_rep_A : Factor w/ 73 levels "-0.01","-0.02",..: 49 9 2 52 45 50 13 55 48 9 ...
$ tg_q8_rep_B : num 0.05 0.07 -0.31 0.02 0 -0.33 0.03 -0.05 0.08 0.1 ...
$ tg_q8_rep_C : num 0.35 0.5 -0.06 -0.1 0.24 -0.45 -0.27 0.1 0.15 -0.29 ...
$ tg_q8_rep_D : num 0.15 0.08 -0.08 0.31 0.28 0.43 0.41 0.25 -0.05 -0.04 ...
$ tg_w2_rep_A : Factor w/ 72 levels "-0.01","-0.02",..: 49 16 24 66 60 62 62 68 52 49 ...
$ tg_w2_rep_B : num 0.11 0.24 -0.03 -0.43 0.67 -0.13 0.05 -0.4 -0.13 -0.18 ...
$ tg_w2_rep_C : num 0 0.33 -0.09 0 0.12 -0.35 0.06 0.33 0.15 -0.19 ...
$ tg_w2_rep_D : num -0.04 0 -0.03 0.44 0.04 0.23 0.28 0.19 -0.21 -0.17 ...
$ tg_w4_rep_A : Factor w/ 69 levels "-0.0","-0.01",..: 55 58 53 50 52 67 68 63 27 8 ...
$ tg_w4_rep_B : num 0.29 0.63 -0.37 0.09 0.22 -0.21 0.1 -0.14 -0.04 -0.09 ...
$ tg_w4_rep_C : num 0.09 0.13 -0.08 0.17 0.15 -0.33 0 0.38 0.1 -0.62 ...
$ tg_w4_rep_D : num 0.11 0.33 -0.32 0.41 -0.1 0.07 0.23 0.22 0.1 0.06 ...
$ tg_w6_rep_A : Factor w/ 74 levels "-0.01","-0.02",..: 56 45 4 69 59 47 2 40 47 12 ...
$ tg_w6_rep_B : num 0.07 0.13 -0.14 0.15 0.13 -0.17 0.33 0.12 0.07 -0.15 ...
$ tg_w6_rep_C : num 0.13 0.22 0.31 0.08 0.16 -0.33 -0.05 0.43 0.43 -0.06 ...
$ tg_w6_rep_D : num 0.28 0.11 -0.2 0.66 -0.18 0.16 0.26 0.27 0.06 -0.02 ...
$ tg_w8_rep_A : Factor w/ 67 levels "-0.01","-0.02",..: 52 40 37 44 48 61 48 53 39 63 ...
$ tg_w8_rep_B : num 0.3 0.09 -0.22 -0.1 0.14 -0.25 0.1 -0.49 0.19 0.15 ...
$ tg_w8_rep_C : num 0.23 0.27 0.11 -0.25 0.17 -0.13 0.23 0.47 0.33 -0.09 ...
$ tg_w8_rep_D : num -0.04 0.1 -0.25 0.37 -0.09 0.18 0.26 0.2 -0.35 -0.11 ...
The problem with your rownames is that they aren't unique. R requires unique identifiers for each row, and you have multiple rows with the same value in the data.frame "data". When you try to force it to make the values in that first column rownames, it's trying to make them unique, and it looks as though it's rounding some numbers to accomplish that.
I'm not entirely certain what's going on with columns tg_q2_rep_A and tg_q4_rep_A, but it looks as though those values have been converted to ranks. That can happen if the class of those columns in your original data.frame, data, was "factor" rather than "numeric". Try this to check the classes:
sapply(data, class)
If you've got a mixture of numbers and letters in that column, for example, R will set the data class as factor by default. When you convert those columns to numeric format, which is what data.matrix() does, the output will be the rank of that factor.
I didn't get the same problem for those two columns when I copied and pasted your data into a csv file and loaded it into R, but I'm guessing that you haven't given us all the data there. My first step to figure this out would be to check the classes of the columns.
I am new to R and one thing I have been told again and again is that there really is no need for for loops. I have had some success with apply but could not figure out how to use it in this instance.
Here is the data I am working with:
Bid Ask Exp Strike Price V6
51 4.95 5.15 NOV1 13 335 5.050 3.08
52 3.40 3.50 NOV1 13 340 3.450 NA
53 2.28 2.42 NOV1 13 345 2.350 NA
54 1.51 1.57 NOV1 13 350 1.540 NA
55 0.99 1.07 NOV1 13 355 1.030 NA
56 0.66 0.71 NOV1 13 360 0.685 NA
57 0.46 0.51 NOV1 13 365 0.485 NA
58 0.33 0.37 NOV1 13 370 0.350 NA
59 0.25 0.28 NOV1 13 375 0.265 NA
60 0.18 0.24 NOV1 13 380 0.210 NA
61 0.11 0.20 NOV1 13 385 0.155 NA
62 0.05 0.17 NOV1 13 390 0.110 NA
63 0.05 0.16 NOV1 13 395 0.105 NA
64 0.07 0.13 NOV1 13 400 0.100 NA
In column 6 (called V6), I want the values to be twice the value in the price column in the cell that is 3 below the current row. For example, Row 1 in Col 6 is 3.08 which is 2*1.54 which is in column 5, row 4. I would like to do this for every cell in row 6 until it runs out in row 12. NA is fine in column 6 after this row.
Here is how I accomplished this:
for (i in 1:11){
data[i,6] <- 2*data[i+3,5]}
Is there a faster/easier/ more appropriate way to do this?
Here is the final data as I want it.
Bid Ask Exp Strike Price V6
51 4.95 5.15 NOV1 13 335 5.050 3.08
52 3.40 3.50 NOV1 13 340 3.450 2.06
53 2.28 2.42 NOV1 13 345 2.350 1.37
54 1.51 1.57 NOV1 13 350 1.540 0.97
55 0.99 1.07 NOV1 13 355 1.030 0.70
56 0.66 0.71 NOV1 13 360 0.685 0.53
57 0.46 0.51 NOV1 13 365 0.485 0.42
58 0.33 0.37 NOV1 13 370 0.350 0.31
59 0.25 0.28 NOV1 13 375 0.265 0.22
60 0.18 0.24 NOV1 13 380 0.210 0.21
61 0.11 0.20 NOV1 13 385 0.155 0.20
62 0.05 0.17 NOV1 13 390 0.110 NA
63 0.05 0.16 NOV1 13 395 0.105 NA
64 0.07 0.13 NOV1 13 400 0.100 NA
Thank you.
use mydata$V6 <- 2 * c(mydata$Price[-(1:3)], rep(NA, 3))
df1 is your data. I used sapply here which should be faster than for loop
df1$V6<-sapply(1:nrow(df1),function(x) 2*df1[x+3,5])
I have wavelenghts from 350 to 2500 each one have data:
x350 x351 x352 x353 x354 ...... x2500
0.18 0.17 0.17 0.17 0.16 ...... 0.3
0.16 0.15 0.15 0.15 0.15 ...... 0.47
0.14 0.14 0.13 0.13 0.13 ...... 0.35
I need to make one column without the name of the wavelenght and give to this new colum a name:
Wave
0.18
0.16
0.14
0.17
0.15
0.14
0.17
0.15
0.13
0.16
0.15
0.13
.
.
.
0.3
0.47
0.35
m is my file and the columns of the wavelenghts are from 17 col to 2167 col. I tried:
a <- list(m[1:16,17:2167])
but I get the list with the names of the columns in between:
list(structure(list(X350 = c(0.15723315, 0.138406682, 0.174909807,
0.143139974, 0.123193808, 0.154449448, 0.163255619, 0.126194713,
0.14327512, 0.066265248, 0.139851395, 0.158271497, 0.158060045,
0.145313933, 0.143890661), X351 = c(0.154324452, 0.135509959,
0.173350322, 0.139867145, 0.121439474, 0.15276091, 0.160391152,
0.125592826, 0.140349489, 0.065316491, 0.137927937, 0.158400317,
0.156211611, 0.142498763, 0.141353986), X352 = c(0.151243533....
How can I get just one column with one name from 2465 columns?
More info
str(m)
'data.frame': 16 obs. of 2167 variables:
$ pott : int 48 49 50 51 52 53 54 55 56 57 ...
$ b : chr "B1" "B1" "B1" "B1" ...
$ F : int 1 1 1 1 1 1 1 1 1 1 ...
$ G : chr "Sunstar" "Quarrion" "Nacozari" "W130114" ...
$ R : int 3 3 3 3 3 3 3 3 3 3 ...
$ D : int 80 80 81 80 81 80 82 82 82 82 ...
$ W: num 1.8 1.5 1.3 1.9 1.8 1.25 1.85 2.1 1.6 2.4 ...
$ S : num 43.4 35.7 44.7 48.6 45.3 35.5 49.2 49.1 46.8 41.5 ...
$ R : num -0.327 1.149 2.348 1.636 1.952 ...
$ V : num 76.4 49 118.9 108 114.5 ...
$ J : num 158 114 191 169 183 ...
$ P: num 19.9 10.6 24.1 21.1 23.6 ...
$ Ce : num 0.367 0.13 0.466 0.36 0.462 ...
$ Ci : num 273 246 280 263 272 ...
$ S : num 23.5 29 30.9 29.4 24.1 ...
$ L : num 42.5 34.4 32.4 34 41.4 ...
$ X350 : num 0.176 0.157 0.138 0.175 0.143 ...
$ X351 : num 0.172 0.154 0.136 0.173 0.14 ...
$ X352 : num 0.169 0.151 0.133 0.172 0.138 ...
$ X353 : num 0.167 0.147 0.132 0.17 0.137 ...
$ X354 : num 0.165 0.147 0.13 0.167 0.133 ...
$ X355 : num 0.162 0.146 0.127 0.166 0.13 ...
$ X356 : num 0.159 0.144 0.126 0.164 0.128 ...
$ X357 : num 0.158 0.14 0.125 0.161 0.125 ...
$ X358 : num 0.155 0.138 0.123 0.159 0.124 ...
$ X359 : num 0.153 0.137 0.121 0.157 0.123 ...
$ X360 : num 0.15 0.135 0.12 0.154 0.122 ...
....$2500
I guess your data are in a text file
data <- read.table("your_file", header=T, quote="\"")
so, data will look like
structure(list(x350 = c(0.18, 0.16, 0.14), x351 = c(0.17, 0.15,
0.14), x352 = c(0.17, 0.15, 0.13), x353 = c(0.17, 0.15, 0.13)), .Names = c("x350",
"x351", "x352", "x353"), class = "data.frame", row.names = c(NA,
-3L))
and
result <- data.frame(Wave = unlist(data,use.names=FALSE))
will produce
Wave
1 0.18
2 0.16
3 0.14
4 0.17
5 0.15
6 0.14
7 0.17
8 0.15
9 0.13
10 0.17
11 0.15
12 0.13