I was trying to answer a question on stack overflow (when I was stuck with the way to eliminate it)
This post did not make the user a reputable example but with whom I came here. I want to return the mail from the time of test and time of I'm not sure what you want to do, because you do not provide the expected results Do here Ps: Installing the package For: emtek_id in time and dataframe
emtek_file after the time in
hidenic_file $ hidenic_time each < The frame poster of code> hidenic_id did not mention it, but it seems that there is a possibility of coming back for each
emetk_id for each
hidenic_id . ("2001", sample (12, 10, 3), sample (28,10), sep = "-") time_string & lt; -
Library (zoo) date_string & lt; - C ("23:03:20", "22: 9 56", "01:03:30", "18:21:03", "16:56:26", "23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26") entry_metex & lt; - striptime (paste (date_string, time_string), "% Y-% m-% d% H:% M:% S") entry_emtek & lt; - entry_emtek [command (entry_emtek)] exit_emtek & lt; - entry_emtek + 3600 * 24 emtek_file & lt; - data.frame (emtek_id = 1:10, entry_emtek, exit_emtek) hidenic_id & lt; - 110,380: 110,479 DATE_STRING & lt; - Paste ("2001", sample (12, 100, replace = TRUE), sample (28,100, replaced = T) September = "-") TIME_STRING & lt; - Representative (C ("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26", "23:03: 20 "," 22:29:56 "," 01:03:30 "," 18:21:03 "," 16:56:26 "), 10) hidenic_time & lt; - Stripman (paste (date_string, time_string), "% Y-% m-% d% H:% M:% S") hidenic_time & lt; - hidenic_time [command (hidenic_time)] hidenic_file & lt; - data.frame (hidenic_id, hidenic_time) ## Here is where I write to fail from conci and work code to find what i want. Combined_file & lt; - For the list () (in seq (hidenic_file [, 1])) {for (in emtek_file [, 1]) (if in seq) {if (length (zoo (1, emtek_file [j, 2: 3] (Zoo (1, hidenic_file [i, 2])) == 0 {Next} if (length (zoo (1, emtek_file [j, 2: 3]) + zoo (1, hidenic_file [i, 2])) == 1) {joint_file [[i]] & lt; c (joint file [[i]], emtek_file [j, 1])}} name (combined_file) [i] <- hidenic_file [i, 1]}
iranges pai It is not easy to understand on reading but it is very useful to find overlap for continuous intervals.
Library (Iranges) ## Create a time interval topic & Lt; - Arranges (e.g. numerical (emtek_file $ entry_emtek), as.numeric (emtek_file $ exit_emtek)) ## Create a time interval (start = end here) query & lt; - IRanges (as.numeric (hidenic_file) $ Hidenic_time), as.numeric (hidenic_file $ hidenic_time)) ## Overlap and remove rows (both time point and interval) emt .ids & lt; - ThemeList (findOverlaps (Query, Topic)) hid.ids & lt; - queryHits (findOverlaps (query, subject)) cbind (hidenic_file [hid.ids,], emtek_file [emt.ids,]) hidenic_id hidenic_time emtek_id entry_emtek exit_emtek 8 110387 2001-03-13 22:29:56 3 2001-03- 13 22:29:56 2001-03-14 22:29: 56 9 110388 2001-03-14 01:03:30 3 2001-03-13 22:29:56 2001-03-14 22:29:56 41 110420 2001-06-09 16:56:26 7 2001- 06-09 16:56:26 2001-06-10 16:56:26
Source ("http: // bioconduct Or.org /biocLite.R") Bioclite ("Iranges")
No comments:
Post a Comment