Skip to content

Instantly share code, notes, and snippets.

View paulrougieux's full-sized avatar

Paul Rougieux paulrougieux

View GitHub Profile
@paulrougieux
paulrougieux / dplyrfilternse.R
Last active April 15, 2016 09:03
dplyr::filter nse
library(dplyr)
library(lazyeval)
Species <- "virginica"
# The Species variable is interpreted
# in the context of the data frame
iris %>%
filter_(Species == Species) %>%
nrow()
# 150
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass scrbook
\use_default_options true
\begin_modules
customHeadersFooters
\end_modules
\maintain_unincluded_children false
@paulrougieux
paulrougieux / warningerrorlog.R
Last active July 12, 2017 08:49 — forked from anonymous/warningerrorlog.R
Catch errors and warnings from log file
# Load the 2 functions below,
# then test errors with:
# downloadfile1(url="xxxx", destfile="/tmp/xxxx", logfile="~/rlog.txt")
# ~/rlog.txt contains
# Error in download.file(url = url, destfile = destfile, ...): cannot download all files
#
# then
#
# downloadfile2(url="xxxx", destfile="/tmp/xxxx", logfile="~/rlog.txt")
# ~/rlog.txt contains the warning message
@paulrougieux
paulrougieux / pythonvariables.Rmd
Created June 27, 2018 13:54
Variable do not persist in note book mode, but they persist when markdown is compiled
---
title: "R Notebook"
output:
html_document:
df_print: paged
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
Group: Controls 1
Sample Wells Values MeanValue CV Od-bkgd-blank
Anti-Hu Det A11 2.849 2.855 0.282 2.853
A23 2.860
Coat Control A12 0.161 0.160 0.530 0.159
A24 0.160
Diluent Standard 1 A9 0.114 0.113 1.379 0.104
A21 0.112
Diluent Standard 2 A8 0.012 0.013 2.817 0.012
A20 0.013
@paulrougieux
paulrougieux / License.md
Last active January 24, 2020 09:01 — forked from fbiga/License.md
Load data from faostat bulk download into R data frames

MIT

Copyright 2020 Paul Rougieux, 2019 fbiga

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE

@paulrougieux
paulrougieux / .vimrc
Created May 29, 2020 07:15
Git config
""""""""""""""""""""""""""
" Vundle package manager "
""""""""""""""""""""""""""
" Should be at the beginning
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@paulrougieux
paulrougieux / scraplinks.R
Last active October 3, 2021 06:29
Extract link texts and urls from a web page into an R data frame
@paulrougieux
paulrougieux / threeparttable.lyx
Last active February 23, 2022 03:57
Use of the package threeparttable with Lyx
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage[flushleft]{threeparttable}
\end_preamble
\use_default_options true
\begin_modules