Blog

Should You Develop an Application in R?

NO. Here’s why.

I’ve been developing in R for about 2 years now. It’s not my first programming language. I’ve developed professionally in C and perl and done many other smallish projects using Matlab, ruby, and java. R is awesome for smaller scripts for data exploration and analysis but is lacking as a general purpose programming language. Specifically …

IDE options are somewhat limited. Rstudio is nice, but not on par with PyCharm or InteliJDEA.

Debugging an R is difficult. It’s ok in interactive mode in R studio, but my application doesn’t run in interactive mode in R studio. It runs on a headless linux server and debugging options are very limited in this environment. I have to believe that most applications would be running in a similar environment as mine.

Error handling is problematic. Error handling is based on the common lisp condition system and is supposed to be more general, robust, etc. It doesn’t feel that way. Some have stated that the use of R’s tryCatch is equivalent to java error handling, but this is not correct. On error, R unwinds the stack to the tryCatch calling point and does not provide a file or line number where the error occurred. Java does not unwind the stack and make it impossible to know where the error occurred. On top of this, R’s error messages can be quite cryptic.

Documentation can be very hard to follow. R has a built in documentation system that provides information by using ‘?command’. There is a lot of information built into the system, but it is not always well written, can be hard to follow and the examples do not provide results. For example, the following details the examples for the ‘summary’ command:

summary(attenu, digits = 4) #-> summary.data.frame(…), default precision
summary(attenu $ station, maxsum = 20) #-> summary.factor(…)

lst <- unclass(attenu$station) > 20 # logical with NAs
## summary.default() for logicals — different from *.factor:
summary(lst)
summary(as.factor(lst))

You can run these examples by typing example(“summary”), but it would be much better if the output was in the documentation like most programming language documentation.

R is a functional language, but has had multiple OO systems bolted on over the years. The 2 main OO systems are method dispatch based systems which is probably not what most would consider to be OO. There are at least a few other OO systems that are more modern, but not so prevalent.

Scattered throughout the R documentation are warnings to discourage developers from using for loops due to speed problems. Developers are instead encouraged to use vectorized functions and the apply family of functions. Trying to avoid the use of for loops feels very unnatural and I have wasted way too much time trying to accomplish it and feel like it is an unnecessary objective. If you are developing an R library for S3/S4 functions then worry about speed if you need to. If you are writing your own application then worry about writing clean, easy to follow and understand logic as you should with any language and deal with performance issues if/when necessary.

R does have some nice attributes and an incredible number of packages available. But if I were to do things over I would use Python over R for anything besides single file analysis scripts.

Life in the GDR

I was able to spend 2 awesome weeks in Berlin this summer. We learned about “East Germany” when I was in school, but never really gave it much thought. It was just another Soviet puppet country to us. Being a little older, the history is much more interesting.

Maker:0x4c,Date:2017-12-11,Ver:4,Lens:Kan03,Act:Lar01,E-Y

The Wall, DDR and Stassi museums in Berlin provide great insight into what life was like in the GDR.

I found an interview with a British teacher that took a position teaching in the GDR. It’s a good read.

As I was going through the GDR museum I kept telling myself it was like Bizarro World.

The Stassi museum was a little creepy, but provided an incredible amount of information about the history of the organization, the leadership and activities. The museum is actually housed in the former headquarters main office.

Maker:0x4c,Date:2017-12-11,Ver:4,Lens:Kan03,Act:Lar01,E-Y

This is a picture of the desk of the former head of the Stassi, Erich Mielke. His office, on-site quarters and official meeting rooms have been immaculately preserved.

The biggest disappointment is at the end of the museum. They show that the leadership knew the end was near and started shredding incriminating evidence. They were able to shred large amounts of records before the citizens discovered what was happening and blocked access to many of the buildings.

If you are in Berlin be sure to build in time to tour the museums.

So What is it Good For?

From a Washington Post article:

Dennis Shea, the U.S. ambassador to the WTO, said the body was incapable of policing China’s behavior.

Many of the Chinese policies that the United States objects to — such as subsidies that promote excess capacity in steel and aluminum production — are not prohibited by WTO rules, Shea acknowledged.

and how long has it taken our politicians to figure this out and how much damage has been done to our economy during that period?

6 Months With Pixel 2XL on FI

I’ve wanted to try out google fi since first reading about it several years ago. For one reason or another the time wasn’t right, the phone wasn’t right, etc. Things finally aligned and I bought a Pixel 2XL and joined fi. Fi wasn’t technically available in my area and after doing some research I found that the phone should still activate fine, so I told it I was in a large Chicago suburb that is nearby. My last phone was an iPhone 6S+ on ATT unlimited. I have had several Samsung and Motorola droid phones in the past and so was familiar with Android.

There are many reviews of both fi and the Pixel 2XL and so I’m just noting my experiences so far. This is not an in-depth review.

FI

It works as advertised. I’ve traveled with it to several states and out of the country to South America (Peru) and Europe (Germany, France, Poland). I had an issue getting LTE when first arriving in Peru (Lima). I found wifi and did a chat with fi support and they got it working within a few minutes. My final destination was in the North part of the country and the phone had some issues retaining LTE. Many of the buildings are thick concrete and none of the phones are able to get signal. The issue with the Pixel and fi was that when I came out of the buildings it would not regain LTE and the only way I could get LTE back was by going into airplane mode or restart. The cellular service was very good though.

I was concerned with the amount of data I would use and the price ($10/GB). However, the phone does a very good job of minimizing data usage and my average has been around 1.5 GB/month without making much effort on my part.

Pixel 2XL

It doesn’t look as good as an S8/S9, but it is highly functional with absolutely 0 bloatware.  I use google docs for everything and the functionality and synchronization are perfect as you would expect from this phone. The swype typing keyboard is awesome. I’m not a photographer, but as far as I can tell the pictures are excellent. The best I have ever had from a phone camera.

The dimensions of the phone are about perfect. Good for reading for longer periods of time without going cross-eyed, but not so big that it is clumsy to use with one hand. Some people complained about a blue tint on the screen if you tilt it 170 degrees, yes it has a blue hue, so what, why do you care when it is tilted 170 degrees? It’s not like you could read anything on the screen anyway.

The battery life might not be as good as the 6S+ was. I don’t have objective measures, but it seems to deplete a lot faster than the 6S+ did. There were way too many notifications on initially and some of them were difficult to find the correct place to disable.

The OK Google / Hey Google voice activation of the assistant is not configured to work with the screen locked by default, you get the lock screen and PIN request which seems really weird. It is tough to find the place to configure it to unlock with your voice and unfortunately the setting seems to revert every time there is an android update. The voice activation of the assistant is also very picky, much more so than Siri or Alexa. If your voice isn’t quite right it displays the lock screen with PIN.

Airport (i.e. captive portal) logins always work with an iPhone (at least for me with the 6S+), but they can be problematic with this phone and chrome.

NFC is a cool feature that allows you to use your phone at most credit card readers. Unfortunately it seems to get turned off after android updates.

Overall

I’m happy with both fi and the Pixel 2XL. I wish I would have waited a little longer because it sounds like there will be a Pixel 3 released later this year.