Mastering Rstudio by Julian Hillebrand

Mastering Rstudio by Julian Hillebrand

Author:Julian Hillebrand
Language: eng
Format: epub
Publisher: Packt Publishing


--Bob Rudis (http://hrbrmstr.github.io/metricsgraphics/)

After installing the required htmltools package via CRAN, you need to install the metricsgraphics package from GitHub:

library(devtools) install_github("hrbrmstr/metricsgraphics") library(metricsgraphics)

The following code produces a D3 scatterplot of the mtcars dataset variables, wt and mpg, and adds a least square regression line within an R Markdown document. The interactivity is given by the fact that you can hover over the dots to get the exact values:

--- title: "My Interactive Report" author: "Your Name" output: html_document --- ## Using htmlwidgets & metricsgraphics ```{r} library(htmlwidgets) library(htmltools) library(metricsgraphics) ``` ```{r} # example was taken from http://rpubs.com/hrbrmstr/53741 mtcars %>% mjs_plot(x=wt, y=mpg, width=400, height=300) %>% mjs_point(least_squares=TRUE) %>% mjs_labs(x="Weight of Car", y="Miles per Gallon")



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.