Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

R has a very powerful array slicing ability that allows for some very slick data processing.

Suppose we have a data.frame “d“, and for every row where d$n_observations < 5 we wish to “NA-out” some other columns (mark them as not yet reliably available). Using slicing techniques this can be done quite quickly as follows.

library("wrapr")
d[d$n_observations < 5,
qc(mean_cost, mean_revenue, mean_duration)] <- NA

The above notation is very convenient, compact, and powerful. We are adding this as operator to our rquery query generator as assign_slice() (and a related method for directly dealing with NA/NULL).

Related

To leave a comment for the author, please follow the link and comment on their blog: R – Win-Vector Blog.