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.

Python’s Ruler Steps Down

Somehow I missed this. I’ve been using both R and Python a lot lately and have been working on a post about why I would start all new software projects using Python instead of R.

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.

Android App Draft Blog Posts

I’m on planes a lot without internet access and sometimes want to start or work on a blog post. The WordPress app is great, but used to have issues with saving drafts locally (i.e. without internet access). Nice to see that has been resolved. The way that it works (for android anyway) is that your draft is saved to your phone. Unfortunately it is not automatically uploaded to your blog drafts when the phone is back online. You have to open each locally saved draft and resave it.

Not perfect, but at least it works.

WordPress 2017 Theme Broken

Unfortunately the front page of this website is a little broken. The parallax feature that scrolls images and text isn’t working anymore and you will only see the text unfortunately. Apparently the theme maintainers made an update at some point and it updates automatically and so broke. Hard to believe considering the number of blogs that probably use this feature. I was advised to find a new theme. Kind of a bummer because I really liked this theme and it fits my needs well and I don’t really have the time to work on a website.

 

Apple Notes

My memory sucks and so I have to compensate for it by taking good notes and staying organized. I have been through several progressions of note taking apps. The order has been approximately as follows:

  1. html files
  2. ruby wiki
  3. html files
  4. OneNote
  5. google docs
  6. Evernote
  7. OneNote
  8. Apple Notes

I briefly attempted to use google keep in between these someplace but gave up after a few weeks. It was early on in it’s release and so it may be much better today.

I use a MacBook laptop and iPhone now and so decided to give Apple notes a try. I really recommend it if you need a simple note taking app that just works and stays synced between your apple devices, or just on your iPhone. The developers hit a perfect medium between a simple text file and an everything bucket. Give it a try if you haven’t checked it out.

The Ubiquitous VIM

Read this yesterday from a link on google+. I started using vim years ago when I was learning Linux. It is a programmer’s text editor and I realized the full potential when I started working as a Software Engineer for Lockheed. You can move mountains with a few keystrokes if you put the time into learning. I finally started using an awesome IDE for java development, but I still use vim for miscellaneous things daily.

New MacBook Pro

I have had 2 13″ MacBook Pros in the last 10 years. They have both been good laptops and I have had very little, if any, complaints. The last 13″ was getting old and I really needed more screen space. The new MB Pros haven’t had the best reviews, but I really couldn’t wait another year so I bought one.

I have very little bad to say about the new 15″ MB Pro and really can’t understand all of the bad reviews and complaints. Some of the Pros:

  • Keyboard: the new keyboard has keys that travel very little and are very poppy. I have heard a LOT of people complain about it. I type A LOT and I really like it.
  • Touch Bar: Probably the most complained about new feature. Typically referred to as a gimmick. I actually like it and expect that it will improve tremendously over time.
  • Display: The new display is phenomenal. Very crisp, beautiful picture.
  • Larger trackpad: This is a real improvement over the previous smaller trackpad.
  • Sound: I could barely hear sound from the speaker(s?) on my last 13″. The sound has improved majorly and has plenty of volume.
  • Battery Life: I haven’t done anything to measure this technically, but my experience has been that it goes all day on a charge doing development work, web browsing, streaming music, etc. No complaints.
  • Weight: It’s about the same as my 13″ was. Very portable and won’t kill your shoulder from carrying it through airports all day.
  • Performance: Excellent. I have several heavy apps running at the same time without so much as a hiccup.
  • Color: I got the new space gray and think it looks awesome.
  • Fingerprint reader: After doing an initial logon you can use the fingerprint reader at the side of the bar to log in. Not that typing a password is a big deal, but it is convenient.

Here are a few very small cons with 1 exception:

  • 1 exception: The apple logo in the lid doesn’t light up anymore. This is not cool. It might be crossing a line.
  • The USB-C charger is not magsafe. But none of the dozen or so windoze laptops I’ve had ever were either and I never destroyed one because of it. I thought the mag connector was a nice feature, but no major loss.
  • The escape key on the touch bar is a little awkward to hit at times. I use the VI editor a lot and so I hit the escape key a lot. Probably not an issue for normal people.
  • There is a key for siri in the touch bar and it’s right above the delete key. I tend to over-reach and wake siri up every few hours.