traversc/qs

Suggestion: caching pipe

Closed this issue · 3 comments

I have written a pipe that essentially wraps qcache in a pipe. It might be of use for more people than me, or the idea can even be included in the package.

`%q>%` <- function(lhs, rhs){as.character(substitute(rhs)) -> name
  qcache(substitute(lhs), name = name) -> value
  assign(x = name, value = value, envir = .GlobalEnv)}

Thanks for the idea! I'm not quite seeing the value in this approach. Why wouldn't you use this?

x <- runif(10) %>% qcache("myvar")

Yes you have to type a bit more, but it's more straightforward and you might want to pass additional arguments to qcache.

Yeah, I didn't think of it being pipable...

I also want to say that this is a great package! It should be wider known!