This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
type: post | |
title: "Data Wrangling" | |
subtitle: "For Stoat control in Beech forest paper" | |
author: "Anthony Davidson" | |
date: '2019-05-16' | |
output: rmarkdown::html_vignette | |
vignette: > | |
%\VignetteIndexEntry{Vignette Title} | |
%\VignetteEngine{knitr::rmarkdown} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(xml2) | |
page_post_links = function( | |
page = 1, baseurl = 'https://www.rstudio.com/rviews', | |
xpath = '//h2[@class="entry-title"]/a' | |
) { | |
html = read_html(sprintf('%s/page/%d/', baseurl, page)) | |
xml_attr(xml_find_all(html, xpath), 'href') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Curated stuff: | |
## * MetaCran: http://www.r-pkg.org/ | |
## * List of Packages gathered by Garret G.: https://github.com/rstudio/RStartHere | |
## * List of popular packages https://awesome-r.com/ | |
## * List of DataScience R tutorials https://github.com/ujjwalkarn/DataScienceR | |
## * List of machine elearning tutorials by subject: https://ujjwalkarn.github.io/Machine-Learning-Tutorials/ | |
## Reproducible package management for R: | |
install.packages("devtools") | |
install.packages("tidyverse") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
iris_char <- iris %>% | |
mutate(Species=as.character(Species), | |
char_column=sample(letters[1:5], nrow(iris), replace=TRUE)) | |
sum(sapply(iris_char, is.character)) # 2 | |
iris_factor <- iris_char %>% | |
mutate_if(sapply(iris_char, is.character), as.factor) | |
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species char_column | |
# "numeric" "numeric" "numeric" "numeric" "character" "character" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RPROJ <- list(PROJHOME = getwd()) | |
attach(RPROJ) | |
cat("sourcing Project-specific .Rprofile\n") | |
cat('retrieve the top-level Project directory at any time with PROJHOME or via get("PROJHOME", "RPROJ"):\n', | |
get("PROJHOME", "RPROJ"), "\n") | |
rm(RPROJ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
book_filename: "anova-book" | |
language: | |
ui: | |
chapter_name: " " | |
output_dir: "docs" | |
rmd_files: ["index.Rmd","01-outcome.Rmd","02-survey-design.Rmd","01-intro.Rmd","07-outcome.Rmd", "06-references.Rmd"] | |
delete_merged_file: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bookdown::gitbook: | |
css: style.css | |
config: | |
toc: | |
before: | | |
<li><a href="./">Simple tests for seed and mouse dynamics</a></li> | |
after: | | |
<li><a href="https://github.com/davan690/simple-anova-beech" target="blank">Published with bookdown</a></li> | |
download: ["pdf", "epub", "docx"] | |
bookdown::pdf_book: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myPaths <- .libPaths("C:/Program Files/R/R-3.6.2/library") | |
myPaths <- c(myPaths) | |
.libPaths(myPaths) # add new path | |
.libPaths() |
OlderNewer