1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 04:42:22 +02:00

prevent dplyr:row_number warning

This commit is contained in:
2018-05-31 14:19:25 +02:00
parent 7a6d5fb6b7
commit efdf5a3dc5
6 changed files with 22 additions and 12 deletions

View File

@ -44,7 +44,7 @@ as.rsi <- function(x) {
# remove all spaces
x <- gsub(' +', '', x)
# remove all MIC-like values: numbers, operators and periods
x <- gsub('[0-9.,<=>]+', '', x)
x <- gsub('[0-9.,;:<=>]+', '', x)
# disallow more than 3 characters
x[nchar(x) > 3] <- NA
# set to capitals

View File

@ -292,12 +292,15 @@ first_isolate <- function(tbl,
}
scope.size <- tbl %>%
filter(row_number() %>%
between(row.start,
row.end),
genus != '') %>%
filter(
suppressWarnings(
row_number() %>% between(row.start,
row.end)
),
genus != '') %>%
nrow()
# Analysis of first isolate ----
all_first <- tbl %>%
mutate(other_pat_or_mo = if_else(patient_id == lag(patient_id)
@ -336,13 +339,14 @@ first_isolate <- function(tbl,
mutate(
real_first_isolate =
if_else(
between(row_number(), row.start, row.end)
suppressWarnings(between(row_number(), row.start, row.end))
& genus != ''
& (other_pat_or_mo
| days_diff >= episode_days
| key_ab_other),
TRUE,
FALSE))
if (info == TRUE) {
cat('\n')
}
@ -351,7 +355,7 @@ first_isolate <- function(tbl,
mutate(
real_first_isolate =
if_else(
between(row_number(), row.start, row.end)
suppressWarnings(between(row_number(), row.start, row.end))
& genus != ''
& (other_pat_or_mo
| days_diff >= episode_days),

View File

@ -349,7 +349,6 @@ freq <- function(x,
' (',
(Count.rest / length(x)) %>% percent(force_zero = TRUE),
') ]\n', sep = '')
cat('\n')
} else {
print(

View File

@ -204,7 +204,12 @@ prettyprint_df <- function(x,
# class will be marked up per column
if (NROW(x.bak) > 0) {
rownames.x <- rownames(x)
x <- x %>% filter(row_number() == 1) %>% rbind(x, stringsAsFactors = FALSE)
x <- x %>%
filter(
suppressWarnings(
row_number() == 1)
) %>%
rbind(x, stringsAsFactors = FALSE)
rownames(x) <- c('*', rownames.x)
}