Skip to content

Instantly share code, notes, and snippets.

Paul Rougieux paulrougieux

Block or report user

Report or block paulrougieux

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View spectrophotometer.txt
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 / pythonvariables.Rmd
Created Jun 27, 2018
Variable do not persist in note book mode, but they persist when markdown is compiled
View pythonvariables.Rmd
---
title: "R Notebook"
output:
html_document:
df_print: paged
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
@paulrougieux
paulrougieux / warningerrorlog.R
Last active Jul 12, 2017 — forked from anonymous/warningerrorlog.R
Catch errors and warnings from log file
View warningerrorlog.R
# 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 / scraplinks.R
Created Jul 7, 2017
Extract link texts and urls from a web page into an R data frame
View scraplinks.R
View testpagenumbers.lyx
#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 / dplyrfilternse.R
Last active Apr 15, 2016
dplyr::filter nse
View dplyrfilternse.R
library(dplyr)
library(lazyeval)
Species <- "virginica"
# The Species variable is interpreted
# in the context of the data frame
iris %>%
filter_(Species == Species) %>%
nrow()
# 150
@paulrougieux
paulrougieux / threeparttable.lyx
Last active Dec 12, 2016
Use of the package threeparttable with Lyx
View threeparttable.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
@paulrougieux
paulrougieux / knitrchunk
Last active Nov 19, 2015
Add a footnote in a table generated by xtable inside a Lyx document (answer from http://stackoverflow.com/a/13676007/2641825)
View knitrchunk
<<1stgenerationxtunitroot, results='asis'>>=
library(xtable)
x <- matrix(rnorm(60), ncol = 10)
x.big <- xtable(x,label='tabbig', caption='Example of longtable')
names(x.big) <- LETTERS[1:10]
names(x.big)[9] <- paste('I','footnote') # I put the tag on I letter
print(x.big,tabular.environment='longtable',floating=FALSE,
sanitize.text.function=function(str)gsub("footnote","\\footnote{my tricky footnote !!}",str,fixed=TRUE))
@
@paulrougieux
paulrougieux / hyphen.lyx
Last active Nov 5, 2015
Hyphens are not printed when printing from the evince PDF viewer on Debian
View hyphen.lyx
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\use_default_options true
\begin_modules
knitr
\end_modules
\maintain_unincluded_children false
@paulrougieux
paulrougieux / countwordpersentence.R
Last active Oct 30, 2015
Count the number of words per sentence
View countwordpersentence.R
#' Separate the input text in sentences and count the number of words per sentence
#' @param blabla character vector containing a single text string.
#' @param minwordpersentence number minimum of word that a sentence should
#' have so that it is taken into account
#' @return a list countaining the number of sentence, wordcount,
#' mean number of words per sentence and total word count.
#' @export
countwordpersentence <- function(blabla, minwordpersentence = 2){
blabla <- strsplit(blabla,"\\.")[[1]]
You can’t perform that action at this time.