flagged | R Documentation |
Flags rows that have values above some threshold in at least one column.
flagged(df, threshold = 0.8, or.tied = TRUE)
df |
Data.frame with numeric values to be checked against the threshold. |
threshold |
Number that is the threshold that must be (met or) exceeded for a row to be flagged. Optional, default is 0.80 |
or.tied |
Logical, optional, default is TRUE, in which case a value equal to the threshold also flags the row. |
The use of na.rm=TRUE in this function means it will always ignore NA values in a given place and take the max of the valid (non-NA) values instead of returning NA when there is an NA in that row
Returns a logical vector or data.frame the shape of df
set.seed(999)
places <- data.frame(p1=runif(10, 0,1), p2=c(NA, runif(9,0,1)), p3=runif(10,0,1))
pctilecols <- c('p1','p2', 'p3')
x <- flagged(places[ , pctilecols], 0.80)
a <- cbind(any.over.0.8=x, round(places,2))
a[order(a[,1]),]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.