## Analysis of speaker genders at the 2018 ArcticNet Annual Scientific Meeting

Last week I was participating to the ArcticNet Annual Scientific Meeting 2018 in Ottawa. I was pleasantly surprised to see that there was a large proportion of women present at the conference. After the panel discussion on women in northern science which took place on Thursday night, I decided to see if I could use R to scan the scientific PDF program to determine how many men and women were giving scientific presentations. [Read More]

## Numerical integration in R

### Math 101

Although R in not a symbolic language like Mathematica, Maple or Matlab, it can be used for calculus operations. Let’s get started. For the shake of simplicity, we will integrate the following equation: $f(x) = \cos(x) + 2$ We first define the equation in the form of a function since it is a requirement to use the R integrate function. Then, plot the function curve between 0 and 4. [Read More]

## Calculating daylight in R

A little bit more than a year ago I moved in Denmark. So far, the last year has been quite fun and I have been working on interesting projects. The most difficult part has been the winter since the daylight is very short between November and February. I was curious to see what was the difference in daylight between my home country (Canada) and Denmark. This is a short post showing how to calculate daylight based on the latitude position and the day of the year (DOY). [Read More]

If you are like me, chances are that you update RStudio on a daily basis. Here is a small R script that automatically download and install the latest version of RStudio on your computer. Note this is for ubuntu64 based systems, but this can be easily modified for Windows or Mac platforms.

file <- regmatches(r, regexpr("https\\S+?deb", r))[1]
file

destfile <- paste("/tmp/", basename(file))

cmd <- sprintf("dpkg -i %s", destfile)
system(cmd)

## Introducing eemR

The eemR package implements various functions used calculate metrics from excitation-emission matrix (EEM) as well as to preform pre-processing corrections before PARAFAC analysis. All functions from this package start with the eem_ prefix. Please note this is a very alpha version of the package for testing purpose only. library(eemR) ls("package:eemR") ## [1] "absorbance" "eem_bind" ## [3] "eem_biological_index" "eem_coble_peaks" ## [5] "eem_cut" "eem_export_matlab" ## [7] "eem_extract" "eem_fluorescence_index" ## [9] "eem_humification_index" "eem_inner_filter_effect" ## [11] "eem_names" "eem_names<-" ## [13] "eem_peaks" "eem_raman_normalisation" ## [15] "eem_read" "eem_remove_blank" ## [17] "eem_remove_scattering" "eem_set_wavelengths" The package can be installed using the following command. [Read More]

## Quick tip

### How to remove elements that are not in a list

It is easy to verify if elements are within a list using the %in% operator in R. For example:

c("a", "b") %in% letters[1:5]
## [1] TRUE TRUE

However, I am often in a situation where I need to do the opposite. This can be easily achieved using the Negate() function.

%ni% <- Negate(%in%)
c("a", "b") %ni% letters[1:5]
## [1] FALSE FALSE

Voilà!

## R 101

Sometimes when you open a data file (lets say a .csv), variables will be recognized as factor whereas it should be numeric. It is therefore tempting to simply convert the variable to numeric using as.numeric(). Big mistake! If you use directly as.numeric() on a variable of the type factor, R will returns the levels of the factor rather the actual values. To overcome this hassle, you should first convert the variable into a string with as. [Read More]

## Visualizating olympics medals in R

Recently I have been more interested to perform web scraping to extract public data to perform data analysis. There are probably many R packages out there that do a good job at such task, but I found out that the rvest was among the most popular ones. Hence I decided to give it a try. In this post, I’m using the rvest library to visualize how many medals were obtained by each country during the summer Olympics 2016. [Read More]

## eemR 0.1.3 is now on CRAN

### With Shiny visualization!

eemR has been updated to v0.1.3 and brings a lot of new features. Among the most interesting ones: Shiny support: You can interactively visualize EEMS by using interactive = TRUE. Ex.: plot(X, interactive = TRUE). A vignette has been added. eem_remove_blank() and eem_raman_normalisation() can now try to implicitly use a blank eem from a eemlist object (#20). If blank is omitted (blank = NA), the functions will try to extract the blank from the eemlist object. [Read More]