How to select the rows from data frame which has a value over 1 in a specific column ?
That's how my data looks like:
> dput(head(tbl_comp[,-1]))
structure(list(Meve_mean = c(7774.44229552491, 43374.1166119026,
585562.72426545, 3866.54724117546, 320338.197537275, 918368.01990607
), Mmor_mean = c(39113.5325249635, 119476.157216344, 1296530.34384725,
23511.2980313616, 209092.538981888, 577355.581852083), Mtot_mean = c(23443.9874102442,
81425.1369141232, 941046.53405635, 13688.9226362685, 264715.368259581,
747861.800879077), tot_meanMe = c(258492586.999527, NA, NA, NA,
NA, NA), tot_meanMm = c(246665241.110832, NA, NA, NA, NA, NA),
tot_sdMe = c(35569170.0311164, NA, NA, NA, NA, NA), tot_sdMm = c(30522099.9189256,
NA, NA, NA, NA, NA), Wteve_mean = c(10752.4381084666, 53658.8435672746,
715547.921685567, 3422.17220367207, 335384.199178456, 1013708.18845339
), Wtmor_mean = c(29254.6414790837, 98804.8007431987, 1001344.20496027,
11541.8862121394, 217110.411645861, 571826.157099177), Wttot_mean = c(18681.9538387311,
73007.110928385, 838032.04308901, 6902.04963587237, 284695.433093058,
824330.175015869), tot_meanwte = c(278901499.672313, NA,
NA, NA, NA, NA), tot_meanwtm = c(235415566.775308, NA, NA,
NA, NA, NA), tot_sdwte = c(16743477.4011497, NA, NA, NA,
NA, NA), tot_sdwtm = c(3922418.43271348, NA, NA, NA, NA,
NA), diff_eve = c(0.72303994843767, 0.808331185101342, 0.818341730189196,
1.12985174650959, 0.955138012828161, 0.905949098928778),
diff_mor = c(1.33700262752933, 1.20921408998001, 1.29478988086689,
2.03704122525771, 0.963070068343606, 1.00966976533735), diff_tot = c(1.25490018938172,
1.11530419268331, 1.12292428650774, 1.98331269093204, 0.929819510568173,
0.907235745512628)), .Names = c("Meve_mean", "Mmor_mean",
"Mtot_mean", "tot_meanMe", "tot_meanMm", "tot_sdMe", "tot_sdMm",
"Wteve_mean", "Wtmor_mean", "Wttot_mean", "tot_meanwte", "tot_meanwtm",
"tot_sdwte", "tot_sdwtm", "diff_eve", "diff_mor", "diff_tot"), row.names = c(NA,
6L), class = "data.frame")
In this data there are three columns which I am interested mostly in:
diff_eve diff_mor diff_tot
0.7230399 1.3370026 1.2549002
0.8083312 1.2092141 1.1153042
0.8183417 1.2947899 1.1229243
1.1298517 2.0370412 1.9833127
0.9551380 0.9630701 0.9298195
0.9059491 1.0096698 0.9072357
I would like to create new data frames selected by the value in each of those column. There should be 6 new data frames. Values below 1 in "diff_eve" column should be in new data frame, same goes to values above 1 = next data frame. Of course I would like to keep all of the columns from the data (tbl_comp).
Let me show the example of the new data frame. Selection by the values below 1 in the column diff_eve:
>newdata.frame
diff_eve diff_mor diff_tot .. ....... ..... rest of the columns from tbl_comp.
0.7230399 1.3370026 1.2549002
0.8083312 1.2092141 1.1153042
0.8183417 1.2947899 1.1229243
0.9551380 0.9630701 0.9298195
0.9059491 1.0096698 0.9072357
I hope some of you understand what I want to achieve.