search for: fun_denes

Displaying 4 results from an estimated 4 matches for "fun_denes".

2017 Nov 29
0
dplyr - add/expand rows
...ap(seq, from, to)) res0 <- with(d, Map(data.frame, station=station, record=record, year=year, MoreArgs = list(stringsAsFactors = FALSE))) do.call(rbind, unname(res0)) } ## Denes - simple data.table fun_denes <- function(d) { out <- d[, .(year = from:to), by = .(station, from, record)] out[, from := NULL] } ## Check equality ################################ all.equal(fun_bill(d_df), fun_bert(d_df), check.attributes = FALSE) all.equal(fun_bill(d_df), fun_martin(d_df), c...
2017 Nov 29
2
dplyr - add/expand rows
...data.frame, > ????????????????????? station=station, > ????????????????????? record=record, > ????????????????????? year=year, > ????????????????????? MoreArgs = list(stringsAsFactors = FALSE))) > ? do.call(rbind, unname(res0)) > } > > ## Denes - simple data.table > fun_denes <- function(d) { > ? out <- d[, .(year = from:to), by = .(station, from, record)] > ? out[, from := NULL] > } > > ## Check equality ################################ > all.equal(fun_bill(d_df), fun_bert(d_df), > ????????? check.attributes = FALSE) > all.equal(fun_bi...
2017 Nov 29
0
dplyr - add/expand rows
...station=station, >> record=record, >> year=year, >> MoreArgs = list(stringsAsFactors = FALSE))) >> do.call(rbind, unname(res0)) >> } >> >> ## Denes - simple data.table >> fun_denes <- function(d) { >> out <- d[, .(year = from:to), by = .(station, from, record)] >> out[, from := NULL] >> } >> >> ## Check equality ################################ >> all.equal(fun_bill(d_df), fun_bert(d_df), >> check.attributes = F...
2017 Nov 28
2
dplyr - add/expand rows
Or with the Bioconductor IRanges package: df <- with(input, DataFrame(station, year=IRanges(from, to), record)) expand(df, "year") DataFrame with 24 rows and 3 columns station year record <character> <integer> <character> 1 07EA001 1960 QMS 2 07EA001 1961 QMC 3 07EA001 1962 QMC 4