18 Apr

Online LaTeX diff tool

Hi PubliGISer,

You want to publish the revision of your awesome paper but you need a track change to meet reviewers’ requirements and you do not know how to get it? You are desperate and think that you will not be able to realize your dream of a successful research career?

Online LaTeX diff tool is the TOOL you are looking for.

Just copy paste the old and the new latex files and this tool will automatically compute the difference between the 2 documents.

Problem solved.

22 Mar

Download files from Dropbox via shareable link

Hello there!

I have a nice piece of code for today on how to download a file from a dropbox shareable link (I reckon it adapted slightly a code found here). Here is how it works. Argument x is the document name, d the document key, and outfile is the desired filename and location.

dl_from_dropbox <- function(x, key, outfile) {
  require(RCurl)
  bin <- getBinaryURL(paste0("https://dl.dropboxusercontent.com/s/", key, "/", x),
                      ssl.verifypeer = FALSE)
  con <- file(outfile, open = "wb")
  writeBin(bin, con)
  close(con)        
}
 
# Example:
dl_from_dropbox("GViewer_Embeds.txt", "06fqlz6gswj80nj", '/home/GViewer_Embeds.txt')
15 May

Load googlesheet data in R

Dear R-addict,

At the era of cloud-based computing, functions such as read.csv, read.xls or even fread are really old-fashioned.
Here is a chunk of code that will allow you to load data from a googlesheet:

 
install.packages("gsheet")
library(gsheet)
# Download a sheet
 
# Download a sheet
url <- 'https://docs.google.com/spreadsheets/d/1XBs7p44-djCPmN4TnPEgboUVAdB2mChbAlCjqnVOyQ0'
a <- gsheet2tbl(url)
10 Mar

Efficient manuscript revision with latexdiff

Hi there,

Here is a nice tip to highlight the revisions in your manuscripts before resubmitting to your favorite journals: use latexdiff!

latexdiff --type=CTRADITIONAL old_shitty_manuscript.tex new_shiny_manuscript.tex > diff.tex

You can then easily customize how differences appear in your pdf by changing the commands in the preamble.
Here are my settings:

\providecommand{\DIFadd}[1]{{\protect\color{blue} #1}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{} %DIF PREAMBLE

New text appears in blue and old text is simply removed.

03 Apr

How to speed up R code?

Dear codeRs,

I recently found a very comprehensive document on how to speed up R code and wanted to share it with you!
It covers various aspects such as identifying where is your code slowing down, parallel computing, interfacing C code with R etc.
Don’t hesitate and go have a look here

27 Nov

Minimum function documentation with Roxygen2

How to document your function in order to produce nice documentation without doing anything?
Use roxygen! Thanks to a bunch of tags, it will automatically read your code and produce a documentation file.

Here is a minimum example that should accompany all your functions from now on:

#' Goal of you function
#' 
#' This function is awesome because it takes that and return this
#' 
#' @param x a n x p matrix of n observations and p predictors
#' @param y a vector of length n representing the response
#' @param t a tuning parameter
#' @return a vector of parameters 
#' @author White Guru
#' @details
#' This function is awesome and here is an comprehensive explanation of why it is so
#' @seealso \code{related packages}
#' @export
#' @importFrom list of the packages used (related packages)

Ow and I almost forget to say that you need to install.packages(‘roxygen2’) and build your code to produce the documentation.

24 Oct

Stack Exchange: towards a better internet

You are lost and tired to ask your questions on old dusty forum where you have to wait 1 month to get an approximate answer ?!

Stack Exchange is for you. StackExchange is a network of forum 2.0 (even 3.0 or 4.0) on diverse topics in many different fields, each site covering a specific topic. Each question, answer, and user is subject to a reputation award process that allow the sites to be self-moderating.

Stack Overflow, the forum decicated to computer programming questions, was the original site in this network and its community is still the most active. Since I have posted on the website, I never had one question without an answer or a relevant comment in the first hour following the posting. This is not rare to have an answer in the 5 first minutes (!!). Furthermore, due to the self-moderating system, the level of quality of the answer is very high.

GIS Stack Exchange is the GIS version of Stack Overflow, even if the community is less important than Stack Overflow, some users are very skilled and you will probably find an answer to a lot of things.

As a new user, you have to follow some rules in order to get an answer to your questions. First, do your job and show that you have tried to find the solution by yourself, the community does not like to be exploited and will not do the job for you. Second, be sure that the question has not been already asked, show some research efforts to find the solution on the web. Finally when you ask a question, pay attention to its quality. It has to be understandable easily and, if it is possible, propose a reproducible example that can be used by the community to solve your problem.

Last thing, share your knowledge. Try also to answer some questions, it is not always an easy exercise but it will help you to improve your skills in your field of expertise and I am sure that you have a contribution to make to pave the way for a better internet.

11 Oct

Useful R libraries

Here is a list of useful R libraries for GIS analysis.

Data handling

Provides bindings to Frank Warmerdam’s Geospatial Data Abstraction Library (GDAL).

library(rgdal)

Reading, writing, manipulating, analyzing and modeling of gridded spatial data.
Set of tools for manipulating and reading geographic data, in particular ESRI shapefiles.

library(maptools)

Reading, writing, manipulating, analyzing and modeling of gridded spatial data. The package implements basic and high-level functions. Processing of very large files is supported.

library(raster)

Classification

Read More