Jan 11, 2016 - First steps with pixiedust

Comments

I’m a fond user of the xtable. There are many alternatives, as kable from kable, but I have still preferred my old golden standard. Nevertheless, I’m always trying to learn something new and the pixiedust package immediately caught my eye. It uses pipes, works for many outputs (see HERE ) and seems to be really flexible.

Dec 16, 2015 - r-devel imports

Comments

We are all aware of the change in r-devel, which requires package maintainers to declare all imports from default packages (aside from base package). Luckily, people from CRAN added convenient prompt at the R CMD CHECK of R-devel to remind us which functions should be imported into the namespace of our package. Unfortunately, this version is not compatible with the Roxygen documentation.

Below I present R script converting output from the prompt to Roxygen-friendly version.

library(dplyr)

# x must a text file containing only the information from R CMD CHECK about missing imports
cran2roxygen <- function(x)
  readLines(x) %>%
  gsub('"', " ", ., fixed = TRUE) %>%
  gsub("[(),]", " ", .) %>%
  gsub("[ ]{1,}", " ", .) %>%
  gsub("^ ", "", .) %>%
  gsub("importFrom", "\n#' @importFrom", .) %>%
  cat(., sep = "", file = "result.txt")

# see the example
cran2roxygen("https://raw.githubusercontent.com/michbur/silva_rerum/master/cran2roxygen/cran2roxygen_example.txt")

Nov 12, 2015 - First post

Comments

Very brief introduction

This blog is devoted to my experience with R. I will especially focus on obscure R packages that I found interesting and useful.

Below I’m testing some features of my blog, like:

MathJax

Embedding and printing R code

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
dat <- data.frame(x = -100:100) %>% 
  mutate(y = x^2 + x)

head(dat)
##      x    y
## 1 -100 9900
## 2  -99 9702
## 3  -98 9506
## 4  -97 9312
## 5  -96 9120
## 6  -95 8930

Tables

kable(head(dat))
x y
-100 9900
-99 9702
-98 9506
-97 9312
-96 9120
-95 8930

Figures

plot(dat, type = "l")

plot of chunk unnamed-chunk-3