Making IsThisTaxiLegal–evolving from Proof of Concept

What we need first is automating some tasks – like downloading the authorizations pdf ( and parsing after) from http://www.pmb.ro/adrese_utile/transport_urban/autorizatii_taxi/autorizatii_TAXI.php .

For this I want to use R – because C# I know already and is a good occasion to learn R.

The file is on https://github.com/ignatandrei/IsThisTaxiLegal/blob/master/applications/RDownloadFile/Script.R 

Some ideas from here from a C# developer:

  • Very easy to work with R – as soon as you grasp the concepts
  • Nuget from C# = CRAN from R
  • Does not provide in VS something like nuget, but pacman is perfect

if (!require(“pacman”)) install.packages(“pacman”)
pacman::p_load(‘XML’, “magrittr”, “RCurl”, “rlist”, “rvest”, “pdftools”, “dplyr”, “devtools”)
#if (!require(XML)) install.packages(‘XML’)
#install.packages(“magrittr”)
#install.packages(“RCurl”)
#install.packages(“rlist”)
#install.packages(“rvest”)
library(stringr)
library(magrittr)
library(XML)
library(RCurl)
library(rlist)
library(rvest)

  • R is supports normal programing and  functional programming  and magrittr helps

Code example:

print(head(splitData))  # normal

splitData %>% head(10) %>% print # showing data # function

  • Some WTF ( paste function is concatenate strings  ,  return in function must have () )
  • Many , many WTF when you try to make something in R until you grasp it. ( partially)
  • CRAN have many libraries free – someones requires java on your PC …. C# has a good point here , because he has now Linux + Mac + Windows natively and self contained

You will find code at https://github.com/ignatandrei/IsThisTaxiLegal/blob/master/applications/RDownloadFile/Script.R