Trying R

After a bit of looking around, I’ve decided to give the “R” programming language a try as the FORTRAN replacement. It has the math orientation, and most importantly, it looks like it is set up with fairly direct functions for reading and writing Fixed Width Files and TAB and CSV Comma Separated Values files, along with a trivial to use COS function.

As that’s all the FORTRAN program really does, convert FWF to TAB separators (well, it also breaks up some compound fields and glues some together but all languages can do that); R ought to be able to quickly and easily deal with it.

To install R you do not just say “apt-get install R”. No, that would be too simple… So you must know it’s hiding under another name:

root@rockpro64:/home/chiefio# which R
root@rockpro64:/home/chiefio# which r

root@rockpro64:/home/chiefio# apt-get install r
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package r

root@rockpro64:/home/chiefio# apt-get install R
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package R

root@rockpro64:/home/chiefio# apt-get install rstudio
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package rstudio is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'rstudio' has no installation candidate

I often will just give it a try under a given product common name, and often it works, for doing an install. For many packages, they have some unknown qualifiers on them. There are tools to search the repositories for the actual name, but I’ve generally just done a web search on “install FOO” or in this case “Debian install R” and you tend to get the answer in the results. This link Poo-Poos the standard R in Debian, sets up some alternative path, and then issues the command. As I’m on an ARM chip, I doubt their alternative path is the right one, so just snarfed up the name of the package as “r-base”.

https://linuxize.com/post/how-to-install-r-on-debian-9/

Once the repository is added, update the packages list and install the R package by typing:

sudo apt update
sudo apt install r-base

Running that install, all sorts of interesting and largely irrelevant output is produced. It does look like it references the same cran stuff as the link above:

root@rockpro64:/home/chiefio# apt-get install r-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpaper-utils r-base-core r-cran-boot r-cran-class r-cran-cluster
  r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass
  r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart
  r-cran-spatial r-cran-survival r-recommended zip
Suggested packages:
  ess r-doc-info | r-doc-pdf r-mathlib r-base-html
Recommended packages:
  r-base-html r-doc-html r-base-dev
The following NEW packages will be installed:
  libpaper-utils r-base r-base-core r-cran-boot r-cran-class r-cran-cluster
  r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass
  r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart
  r-cran-spatial r-cran-survival r-recommended zip
0 upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 39.6 MB of archives.
After this operation, 59.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com bionic/main arm64 libpaper-utils arm64 1.1.24+nmu5ubuntu1 [8,178 B]
Get:2 http://ports.ubuntu.com bionic/main arm64 zip arm64 3.0-11build1 [146 kB]
Get:3 http://ports.ubuntu.com bionic/universe arm64 r-base-core arm64 3.4.4-1ubuntu1 [22.9 MB]
Get:4 http://ports.ubuntu.com bionic/universe arm64 r-cran-boot all 1.3-20-1.1 [613 kB]
Get:5 http://ports.ubuntu.com bionic/universe arm64 r-cran-cluster arm64 2.0.6-2build1 [496 kB]
Get:6 http://ports.ubuntu.com bionic/universe arm64 r-cran-foreign arm64 0.8.69-1build1 [221 kB]
Get:7 http://ports.ubuntu.com bionic/universe arm64 r-cran-mass arm64 7.3-49-1 [1,099 kB]
Get:8 http://ports.ubuntu.com bionic/universe arm64 r-cran-kernsmooth arm64 2.23-15-3build1 [88.1 kB]
Get:9 http://ports.ubuntu.com bionic/universe arm64 r-cran-lattice arm64 0.20-35-1build1 [712 kB]
Get:10 http://ports.ubuntu.com bionic/universe arm64 r-cran-nlme arm64 3.1.131-3build1 [2,174 kB]
Get:11 http://ports.ubuntu.com bionic/universe arm64 r-cran-matrix arm64 1.2-12-1 [2,278 kB]
Get:12 http://ports.ubuntu.com bionic/universe arm64 r-cran-mgcv arm64 1.8-23-1 [2,469 kB]
Get:13 http://ports.ubuntu.com bionic/universe arm64 r-cran-survival arm64 2.41-3-2build1 [5,140 kB]
Get:14 http://ports.ubuntu.com bionic/universe arm64 r-cran-rpart arm64 4.1-13-1 [876 kB]
Get:15 http://ports.ubuntu.com bionic/universe arm64 r-cran-class arm64 7.3-14-2build1 [85.4 kB]
Get:16 http://ports.ubuntu.com bionic/universe arm64 r-cran-nnet arm64 7.3-12-2build1 [108 kB]
Get:17 http://ports.ubuntu.com bionic/universe arm64 r-cran-spatial arm64 7.3-11-2build1 [125 kB]
Get:18 http://ports.ubuntu.com bionic/universe arm64 r-cran-codetools all 0.2-15-1.1 [46.1 kB]
Get:19 http://ports.ubuntu.com bionic/universe arm64 r-recommended all 3.4.4-1ubuntu1 [2,820 B]
Get:20 http://ports.ubuntu.com bionic/universe arm64 r-base all 3.4.4-1ubuntu1 [9,312 B]
Fetched 39.6 MB in 23s (1,722 kB/s)                                            
Selecting previously unselected package libpaper-utils.
(Reading database ... 76203 files and directories currently installed.)
Preparing to unpack .../00-libpaper-utils_1.1.24+nmu5ubuntu1_arm64.deb ...
Unpacking libpaper-utils (1.1.24+nmu5ubuntu1) ...
Selecting previously unselected package zip.
Preparing to unpack .../01-zip_3.0-11build1_arm64.deb ...
Unpacking zip (3.0-11build1) ...
Selecting previously unselected package r-base-core.
Preparing to unpack .../02-r-base-core_3.4.4-1ubuntu1_arm64.deb ...
Unpacking r-base-core (3.4.4-1ubuntu1) ...
Selecting previously unselected package r-cran-boot.
Preparing to unpack .../03-r-cran-boot_1.3-20-1.1_all.deb ...
Unpacking r-cran-boot (1.3-20-1.1) ...
Selecting previously unselected package r-cran-cluster.
Preparing to unpack .../04-r-cran-cluster_2.0.6-2build1_arm64.deb ...
Unpacking r-cran-cluster (2.0.6-2build1) ...
Selecting previously unselected package r-cran-foreign.
Preparing to unpack .../05-r-cran-foreign_0.8.69-1build1_arm64.deb ...
Unpacking r-cran-foreign (0.8.69-1build1) ...
Selecting previously unselected package r-cran-mass.
Preparing to unpack .../06-r-cran-mass_7.3-49-1_arm64.deb ...
Unpacking r-cran-mass (7.3-49-1) ...
Selecting previously unselected package r-cran-kernsmooth.
Preparing to unpack .../07-r-cran-kernsmooth_2.23-15-3build1_arm64.deb ...
Unpacking r-cran-kernsmooth (2.23-15-3build1) ...
Selecting previously unselected package r-cran-lattice.
Preparing to unpack .../08-r-cran-lattice_0.20-35-1build1_arm64.deb ...
Unpacking r-cran-lattice (0.20-35-1build1) ...
Selecting previously unselected package r-cran-nlme.
Preparing to unpack .../09-r-cran-nlme_3.1.131-3build1_arm64.deb ...
Unpacking r-cran-nlme (3.1.131-3build1) ...
Selecting previously unselected package r-cran-matrix.
Preparing to unpack .../10-r-cran-matrix_1.2-12-1_arm64.deb ...
Unpacking r-cran-matrix (1.2-12-1) ...
Selecting previously unselected package r-cran-mgcv.
Preparing to unpack .../11-r-cran-mgcv_1.8-23-1_arm64.deb ...
Unpacking r-cran-mgcv (1.8-23-1) ...
Selecting previously unselected package r-cran-survival.
Preparing to unpack .../12-r-cran-survival_2.41-3-2build1_arm64.deb ...
Unpacking r-cran-survival (2.41-3-2build1) ...
Selecting previously unselected package r-cran-rpart.
Preparing to unpack .../13-r-cran-rpart_4.1-13-1_arm64.deb ...
Unpacking r-cran-rpart (4.1-13-1) ...
Selecting previously unselected package r-cran-class.
Preparing to unpack .../14-r-cran-class_7.3-14-2build1_arm64.deb ...
Unpacking r-cran-class (7.3-14-2build1) ...
Selecting previously unselected package r-cran-nnet.
Preparing to unpack .../15-r-cran-nnet_7.3-12-2build1_arm64.deb ...
Unpacking r-cran-nnet (7.3-12-2build1) ...
Selecting previously unselected package r-cran-spatial.
Preparing to unpack .../16-r-cran-spatial_7.3-11-2build1_arm64.deb ...
Unpacking r-cran-spatial (7.3-11-2build1) ...
Selecting previously unselected package r-cran-codetools.
Preparing to unpack .../17-r-cran-codetools_0.2-15-1.1_all.deb ...
Unpacking r-cran-codetools (0.2-15-1.1) ...
Selecting previously unselected package r-recommended.
Preparing to unpack .../18-r-recommended_3.4.4-1ubuntu1_all.deb ...
Unpacking r-recommended (3.4.4-1ubuntu1) ...
Selecting previously unselected package r-base.
Preparing to unpack .../19-r-base_3.4.4-1ubuntu1_all.deb ...
Unpacking r-base (3.4.4-1ubuntu1) ...
Setting up libpaper-utils (1.1.24+nmu5ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Setting up zip (3.0-11build1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Setting up r-base-core (3.4.4-1ubuntu1) ...

Creating config file /etc/R/Renviron with new version
Setting up r-cran-nnet (7.3-12-2build1) ...
Setting up r-cran-spatial (7.3-11-2build1) ...
Setting up r-cran-mass (7.3-49-1) ...
Setting up r-cran-cluster (2.0.6-2build1) ...
Setting up r-cran-boot (1.3-20-1.1) ...
Setting up r-cran-codetools (0.2-15-1.1) ...
Setting up r-cran-lattice (0.20-35-1build1) ...
Setting up r-cran-nlme (3.1.131-3build1) ...
Setting up r-cran-foreign (0.8.69-1build1) ...
Setting up r-cran-class (7.3-14-2build1) ...
Setting up r-cran-kernsmooth (2.23-15-3build1) ...
Setting up r-cran-matrix (1.2-12-1) ...
Setting up r-cran-mgcv (1.8-23-1) ...
Setting up r-cran-survival (2.41-3-2build1) ...
Setting up r-cran-rpart (4.1-13-1) ...
Setting up r-recommended (3.4.4-1ubuntu1) ...
Setting up r-base (3.4.4-1ubuntu1) ...

You may notice I’m doing this on the RockPro64, and not on the Raspberry Pi M3. That is entirely an accidental decision based on what I’m using for browsing at the moment. I’ll get to do all this all over again on the R.Pi M3 and on the Odroid XU4. I’m assuming that if it is running on the latest and greatest newest and strangest hardware, it is also running on the older and much more widely used hardware / OS combinations.

Yet Ubuntu will sometimes have ported codes that the Debian folks have not yet ported, or not ported to the ARM chip. So sometimes it’s the OS rather than the hardware that is the gate. We’ll see. (But some time later…)

Testing that it works:

root@rockpro64:/home/chiefio# R --version
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.

The link goes on to say that to get packages and such you need to install build-essential. As I do that as part of every one of my system builds, I doubt I’ll need it, but on the off chance it might detect something from the R installation, I tried it anyway:

root@rockpro64:/home/chiefio# sudo apt install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

As expected, I’m already ready.

The Introduction to R page I’d been reading to get a handle on the language advocated using R-studio. I expect that to be a MicroSoft Universe package just due to the name of it.
https://cran.rstudio.com/bin/linux/debian/
doesn’t list it as a regular package under Debian, but it does exist per this link:
https://www.r-studio.com/Disk_Recovery_Articles/Install_Uninstall_Linux/
at least as an Ubuntu thing:

This install/uninstall instructions are applicable to the Debian/Ubuntu Linux platform. The Ubuntu Linux is used as an example.

Install:
1. Double-click the downloaded installation file.

2. Click the Install button on the Ubuntu Software Center.
Ubuntu Software Center

It looks like I can get it “with some work” and outside the standard package repositories. OK, I’ll bypass that for now and come back to it later.

Yes, I’m running Ubuntu unchanged on the RockPro64 so all this is from the Ubuntu repositories. It will be interesting to see if they are in basic Debian and / or Devuan too, but that will be later and likely as an update to this posting (since it takes a reboot, reconfigure, etc. and that’s a ways away in time…)

That prior “Linuxize.com” link mentions an R Development package in their installation instructions, so I’m going to add that too. I doubt I’ll really need it, but since disk is plentiful and not having something can cause confusion later, I’m going to add it now.

Installation
With an appropriate entry in /etc/apt/sources.list (see below for Debian branches other than sid/unstable), the newest R release including recommended packages can be installed using a command sequence like

apt-get update
apt-get install r-base r-base-dev

While updating your package lists you might get a warning about a missing key, telling you that the integrity of packages can not be verified. You can ignore this if you trust the CRAN servers and continue with the installation. Otherwise, please refer to the section on secure apt below.

You only need r-base-dev if you want to compile R packages yourself or other software depending on R (see section below on administration and maintenance). Be aware that you may also have to install build dependencies (typically -dev packages containing headers). The list r-sig-debian is a good place to ask if you run into problems.

You may want to install the automatically tuned Atlas or the multi-threaded OpenBlas library in order to get higher performance for linear algebra operations

root@rockpro64:/home/chiefio# apt-get install r-base-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  autopoint cdbs debhelper dh-autoreconf dh-strip-nondeterminism
  dh-translations gettext gfortran gfortran-7 gir1.2-harfbuzz-0.0 icu-devtools
  intltool intltool-debian jq libarchive-zip-perl libblas-dev libbz2-dev
  libencode-locale-perl libfile-listing-perl libfile-stripnondeterminism-perl
  libfile-which-perl libgfortran-7-dev libglib2.0-bin libglib2.0-dev
[...]
Need to get 25.4 MB of archives.
After this operation, 111 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
[...]
E: Failed to fetch http://ports.ubuntu.com/pool/main/g/glib2.0/libglib2.0-bin_2.56.4-0ubuntu0.18.04.3_arm64.deb  404  Not Found [IP: 91.189.88.150 80]
E: Failed to fetch http://ports.ubuntu.com/pool/main/g/glib2.0/libglib2.0-dev-bin_2.56.4-0ubuntu0.18.04.3_arm64.deb  404  Not Found [IP: 91.189.88.150 80]
E: Failed to fetch http://ports.ubuntu.com/pool/main/g/glib2.0/libglib2.0-dev_2.56.4-0ubuntu0.18.04.3_arm64.deb  404  Not Found [IP: 91.189.88.150 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Yes, I was a lazy dolt and had skipped the apt-get update hoping things were “up to date enough”, but no…

root@rockpro64:/home/chiefio# apt-get update
Hit:1 http://ports.ubuntu.com bionic InRelease
Get:3 http://ports.ubuntu.com bionic-security InRelease [88.7 kB]   
[...]
t:18 http://ports.ubuntu.com bionic-backports/universe armhf Packages [3,740 B]                                                                       
Get:19 http://ports.ubuntu.com bionic-backports/universe arm64 Packages [3,732 B]                                                                       
Fetched 5,242 kB in 7s (795 kB/s)                                                                                                                       
Reading package lists... Done

So now with that out of the way, we try again, and it works. Even if it is a very large listing of stuff that’s installed:

oot@rockpro64:/home/chiefio# apt-get install r-base-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  autopoint cdbs debhelper dh-autoreconf dh-strip-nondeterminism dh-translations gettext gfortran gfortran-7 gir1.2-harfbuzz-0.0 icu-devtools intltool
  intltool-debian jq libarchive-zip-perl libblas-dev libbz2-dev libencode-locale-perl libfile-listing-perl libfile-stripnondeterminism-perl
  libfile-which-perl libgfortran-7-dev libglib2.0-0 libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libgraphite2-dev libharfbuzz-dev
  libharfbuzz-gobject0 libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-date-perl libhttp-message-perl
  libhttp-negotiate-perl libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libio-html-perl libio-socket-ssl-perl libjpeg-dev libjpeg-turbo8-dev
  libjpeg8-dev libjq1 liblapack-dev liblwp-mediatypes-perl liblwp-protocol-https-perl liblzma-dev libncurses5-dev libnet-http-perl libnet-ssleay-perl
  libonig4 libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpng-dev libreadline-dev libtimedate-perl libtinfo-dev libtool libtry-tiny-perl
  liburi-perl libwww-perl libwww-robotrules-perl libxml-parser-perl perl-openssl-defaults pkg-config po-debconf python3-distutils python3-lib2to3
  python3-scour scour zlib1g-dev
Suggested packages:
  devscripts dh-make dwz gettext-doc libasprintf-dev libgettextpo-dev gfortran-doc gfortran-7-doc libgfortran4-dbg libcoarrays-dev liblapack-doc
  libglib2.0-doc libgraphite2-utils libdata-dump-perl icu-doc libcrypt-ssleay-perl liblzma-doc ncurses-doc readline-doc libtool-doc gcj-jdk
  libauthen-ntlm-perl libmail-box-perl texlive-base texlive-latex-base texlive-generic-recommended texlive-fonts-recommended texlive-fonts-extra
  texlive-extra-utils texlive-latex-recommended texlive-latex-extra texinfo gir1.2-rsvg-2.0
Recommended packages:
  bzip2-doc libarchive-cpio-perl libhtml-format-perl libpng-tools libltdl-dev libdata-dump-perl libhtml-form-perl libhttp-daemon-perl libmailtools-perl
  libmail-sendmail-perl
The following NEW packages will be installed:
  autopoint cdbs debhelper dh-autoreconf dh-strip-nondeterminism dh-translations gettext gfortran gfortran-7 gir1.2-harfbuzz-0.0 icu-devtools intltool
  intltool-debian jq libarchive-zip-perl libblas-dev libbz2-dev libencode-locale-perl libfile-listing-perl libfile-stripnondeterminism-perl
  libfile-which-perl libgfortran-7-dev libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libgraphite2-dev libharfbuzz-dev libharfbuzz-gobject0
  libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl
  libicu-dev libicu-le-hb-dev libicu-le-hb0 libiculx60 libio-html-perl libio-socket-ssl-perl libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libjq1
  liblapack-dev liblwp-mediatypes-perl liblwp-protocol-https-perl liblzma-dev libncurses5-dev libnet-http-perl libnet-ssleay-perl libonig4 libpcre16-3
  libpcre3-dev libpcre32-3 libpcrecpp0v5 libpng-dev libreadline-dev libtimedate-perl libtinfo-dev libtool libtry-tiny-perl liburi-perl libwww-perl
  libwww-robotrules-perl libxml-parser-perl perl-openssl-defaults pkg-config po-debconf python3-distutils python3-lib2to3 python3-scour r-base-dev
  scour zlib1g-dev
The following packages will be upgraded:
  libglib2.0-0
1 upgraded, 76 newly installed, 0 to remove and 49 not upgraded.
Need to get 2,441 kB/26.4 MB of archives.
After this operation, 111 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com bionic-security/main arm64 libglib2.0-0 arm64 2.56.4-0ubuntu0.18.04.4 [982 kB]
Get:2 http://ports.ubuntu.com bionic-security/main arm64 libglib2.0-bin arm64 2.56.4-0ubuntu0.18.04.4 [61.9 kB]
Get:3 http://ports.ubuntu.com bionic-security/main arm64 libglib2.0-dev-bin arm64 2.56.4-0ubuntu0.18.04.4 [99.6 kB]
Get:4 http://ports.ubuntu.com bionic-security/main arm64 libglib2.0-dev arm64 2.56.4-0ubuntu0.18.04.4 [1,297 kB]
Fetched 2,441 kB in 3s (834 kB/s)         
Extracting templates from packages: 100%
(Reading database ... 78255 files and directories currently installed.)
Preparing to unpack .../00-libglib2.0-0_2.56.4-0ubuntu0.18.04.4_arm64.deb ...
Unpacking libglib2.0-0:arm64 (2.56.4-0ubuntu0.18.04.4) over (2.56.4-0ubuntu0.18.04.3) ...
Selecting previously unselected package autopoint.
Preparing to unpack .../01-autopoint_0.19.8.1-6ubuntu0.3_all.deb ...
Unpacking autopoint (0.19.8.1-6ubuntu0.3) ...
Selecting previously unselected package libtool.
Preparing to unpack .../02-libtool_2.4.6-2_all.deb ...
Unpacking libtool (2.4.6-2) ...
Selecting previously unselected package dh-autoreconf.
Preparing to unpack .../03-dh-autoreconf_17_all.deb ...
Unpacking dh-autoreconf (17) ...
Selecting previously unselected package libarchive-zip-perl.
Preparing to unpack .../04-libarchive-zip-perl_1.60-1ubuntu0.1_all.deb ...
Unpacking libarchive-zip-perl (1.60-1ubuntu0.1) ...
Selecting previously unselected package libfile-stripnondeterminism-perl.
Preparing to unpack .../05-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb ...
Unpacking libfile-stripnondeterminism-perl (0.040-1.1~build1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../06-libtimedate-perl_2.3000-2_all.deb ...
Unpacking libtimedate-perl (2.3000-2) ...
Selecting previously unselected package dh-strip-nondeterminism.
Preparing to unpack .../07-dh-strip-nondeterminism_0.040-1.1~build1_all.deb ...
Unpacking dh-strip-nondeterminism (0.040-1.1~build1) ...
Selecting previously unselected package gettext.
Preparing to unpack .../08-gettext_0.19.8.1-6ubuntu0.3_arm64.deb ...
Unpacking gettext (0.19.8.1-6ubuntu0.3) ...
Selecting previously unselected package intltool-debian.
Preparing to unpack .../09-intltool-debian_0.35.0+20060710.4_all.deb ...
Unpacking intltool-debian (0.35.0+20060710.4) ...
Selecting previously unselected package po-debconf.
Preparing to unpack .../10-po-debconf_1.0.20_all.deb ...
Unpacking po-debconf (1.0.20) ...
Selecting previously unselected package debhelper.
Preparing to unpack .../11-debhelper_11.1.6ubuntu2_all.deb ...
Unpacking debhelper (11.1.6ubuntu2) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../12-liburi-perl_1.73-1_all.deb ...
Unpacking liburi-perl (1.73-1) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../13-libencode-locale-perl_1.05-1_all.deb ...
Unpacking libencode-locale-perl (1.05-1) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../14-libhttp-date-perl_6.02-1_all.deb ...
Unpacking libhttp-date-perl (6.02-1) ...
Selecting previously unselected package libfile-listing-perl.
Preparing to unpack .../15-libfile-listing-perl_6.04-1_all.deb ...
Unpacking libfile-listing-perl (6.04-1) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../16-libhtml-tagset-perl_3.20-3_all.deb ...
Unpacking libhtml-tagset-perl (3.20-3) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../17-libhtml-parser-perl_3.72-3build1_arm64.deb ...
Unpacking libhtml-parser-perl (3.72-3build1) ...
Selecting previously unselected package libhtml-tree-perl.
Preparing to unpack .../18-libhtml-tree-perl_5.07-1_all.deb ...
Unpacking libhtml-tree-perl (5.07-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../19-libio-html-perl_1.001-1_all.deb ...
Unpacking libio-html-perl (1.001-1) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../20-liblwp-mediatypes-perl_6.02-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.02-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../21-libhttp-message-perl_6.14-1_all.deb ...
Unpacking libhttp-message-perl (6.14-1) ...
Selecting previously unselected package libhttp-cookies-perl.
Preparing to unpack .../22-libhttp-cookies-perl_6.04-1_all.deb ...
Unpacking libhttp-cookies-perl (6.04-1) ...
Selecting previously unselected package libhttp-negotiate-perl.
Preparing to unpack .../23-libhttp-negotiate-perl_6.00-2_all.deb ...
Unpacking libhttp-negotiate-perl (6.00-2) ...
Selecting previously unselected package perl-openssl-defaults:arm64.
Preparing to unpack .../24-perl-openssl-defaults_3build1_arm64.deb ...
Unpacking perl-openssl-defaults:arm64 (3build1) ...
Selecting previously unselected package libnet-ssleay-perl.
Preparing to unpack .../25-libnet-ssleay-perl_1.84-1ubuntu0.1_arm64.deb ...
Unpacking libnet-ssleay-perl (1.84-1ubuntu0.1) ...
Selecting previously unselected package libio-socket-ssl-perl.
Preparing to unpack .../26-libio-socket-ssl-perl_2.060-3~ubuntu18.04.1_all.deb ...
Unpacking libio-socket-ssl-perl (2.060-3~ubuntu18.04.1) ...
Selecting previously unselected package libnet-http-perl.
Preparing to unpack .../27-libnet-http-perl_6.17-1_all.deb ...
Unpacking libnet-http-perl (6.17-1) ...
Selecting previously unselected package liblwp-protocol-https-perl.
Preparing to unpack .../28-liblwp-protocol-https-perl_6.07-2_all.deb ...
Unpacking liblwp-protocol-https-perl (6.07-2) ...
Selecting previously unselected package libtry-tiny-perl.
Preparing to unpack .../29-libtry-tiny-perl_0.30-1_all.deb ...
Unpacking libtry-tiny-perl (0.30-1) ...
Selecting previously unselected package libwww-robotrules-perl.
Preparing to unpack .../30-libwww-robotrules-perl_6.01-1_all.deb ...
Unpacking libwww-robotrules-perl (6.01-1) ...
Selecting previously unselected package libwww-perl.
Preparing to unpack .../31-libwww-perl_6.31-1ubuntu0.1_all.deb ...
Unpacking libwww-perl (6.31-1ubuntu0.1) ...
Selecting previously unselected package libxml-parser-perl.
Preparing to unpack .../32-libxml-parser-perl_2.44-2build3_arm64.deb ...
Unpacking libxml-parser-perl (2.44-2build3) ...
Selecting previously unselected package intltool.
Preparing to unpack .../33-intltool_0.51.0-5ubuntu1_all.deb ...
Unpacking intltool (0.51.0-5ubuntu1) ...
Selecting previously unselected package libonig4:arm64.
Preparing to unpack .../34-libonig4_6.7.0-1_arm64.deb ...
Unpacking libonig4:arm64 (6.7.0-1) ...
Selecting previously unselected package libjq1:arm64.
Preparing to unpack .../35-libjq1_1.5+dfsg-2_arm64.deb ...
Unpacking libjq1:arm64 (1.5+dfsg-2) ...
Selecting previously unselected package jq.
Preparing to unpack .../36-jq_1.5+dfsg-2_arm64.deb ...
Unpacking jq (1.5+dfsg-2) ...
Selecting previously unselected package libfile-which-perl.
Preparing to unpack .../37-libfile-which-perl_1.21-1_all.deb ...
Unpacking libfile-which-perl (1.21-1) ...
Selecting previously unselected package dh-translations.
Preparing to unpack .../38-dh-translations_138.18.04.1_all.deb ...
Unpacking dh-translations (138.18.04.1) ...
Selecting previously unselected package python3-scour.
Preparing to unpack .../39-python3-scour_0.36-2_all.deb ...
Unpacking python3-scour (0.36-2) ...
Selecting previously unselected package scour.
Preparing to unpack .../40-scour_0.36-2_all.deb ...
Unpacking scour (0.36-2) ...
Selecting previously unselected package cdbs.
Preparing to unpack .../41-cdbs_0.4.156ubuntu4_all.deb ...
Unpacking cdbs (0.4.156ubuntu4) ...
Selecting previously unselected package libgfortran-7-dev:arm64.
Preparing to unpack .../42-libgfortran-7-dev_7.4.0-1ubuntu1~18.04.1_arm64.deb ...
Unpacking libgfortran-7-dev:arm64 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package gfortran-7.
Preparing to unpack .../43-gfortran-7_7.4.0-1ubuntu1~18.04.1_arm64.deb ...
Unpacking gfortran-7 (7.4.0-1ubuntu1~18.04.1) ...
Selecting previously unselected package gfortran.
Preparing to unpack .../44-gfortran_4%3a7.4.0-1ubuntu2.3_arm64.deb ...
Unpacking gfortran (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package gir1.2-harfbuzz-0.0:arm64.
Preparing to unpack .../45-gir1.2-harfbuzz-0.0_1.7.2-1ubuntu1_arm64.deb ...
Unpacking gir1.2-harfbuzz-0.0:arm64 (1.7.2-1ubuntu1) ...
Selecting previously unselected package icu-devtools.
Preparing to unpack .../46-icu-devtools_60.2-3ubuntu3_arm64.deb ...
Unpacking icu-devtools (60.2-3ubuntu3) ...
Selecting previously unselected package libblas-dev:arm64.
Preparing to unpack .../47-libblas-dev_3.7.1-4ubuntu1_arm64.deb ...
Unpacking libblas-dev:arm64 (3.7.1-4ubuntu1) ...
Selecting previously unselected package libbz2-dev:arm64.
Preparing to unpack .../48-libbz2-dev_1.0.6-8.1ubuntu0.2_arm64.deb ...
Unpacking libbz2-dev:arm64 (1.0.6-8.1ubuntu0.2) ...
Selecting previously unselected package libglib2.0-bin.
Preparing to unpack .../49-libglib2.0-bin_2.56.4-0ubuntu0.18.04.4_arm64.deb ...
Unpacking libglib2.0-bin (2.56.4-0ubuntu0.18.04.4) ...
Selecting previously unselected package python3-lib2to3.
Preparing to unpack .../50-python3-lib2to3_3.6.8-1~18.04_all.deb ...
Unpacking python3-lib2to3 (3.6.8-1~18.04) ...
Selecting previously unselected package python3-distutils.
Preparing to unpack .../51-python3-distutils_3.6.8-1~18.04_all.deb ...
Unpacking python3-distutils (3.6.8-1~18.04) ...
Selecting previously unselected package libglib2.0-dev-bin.
Preparing to unpack .../52-libglib2.0-dev-bin_2.56.4-0ubuntu0.18.04.4_arm64.deb ...
Unpacking libglib2.0-dev-bin (2.56.4-0ubuntu0.18.04.4) ...
Selecting previously unselected package libpcre16-3:arm64.
Preparing to unpack .../53-libpcre16-3_2%3a8.39-9_arm64.deb ...
Unpacking libpcre16-3:arm64 (2:8.39-9) ...
Selecting previously unselected package libpcre32-3:arm64.
Preparing to unpack .../54-libpcre32-3_2%3a8.39-9_arm64.deb ...
Unpacking libpcre32-3:arm64 (2:8.39-9) ...
Selecting previously unselected package libpcrecpp0v5:arm64.
Preparing to unpack .../55-libpcrecpp0v5_2%3a8.39-9_arm64.deb ...
Unpacking libpcrecpp0v5:arm64 (2:8.39-9) ...
Selecting previously unselected package libpcre3-dev:arm64.
Preparing to unpack .../56-libpcre3-dev_2%3a8.39-9_arm64.deb ...
Unpacking libpcre3-dev:arm64 (2:8.39-9) ...
Selecting previously unselected package pkg-config.
Preparing to unpack .../57-pkg-config_0.29.1-0ubuntu2_arm64.deb ...
Unpacking pkg-config (0.29.1-0ubuntu2) ...
Selecting previously unselected package zlib1g-dev:arm64.
Preparing to unpack .../58-zlib1g-dev_1%3a1.2.11.dfsg-0ubuntu2_arm64.deb ...
Unpacking zlib1g-dev:arm64 (1:1.2.11.dfsg-0ubuntu2) ...
Selecting previously unselected package libglib2.0-dev:arm64.
Preparing to unpack .../59-libglib2.0-dev_2.56.4-0ubuntu0.18.04.4_arm64.deb ...
Unpacking libglib2.0-dev:arm64 (2.56.4-0ubuntu0.18.04.4) ...
Selecting previously unselected package libgraphite2-dev:arm64.
Preparing to unpack .../60-libgraphite2-dev_1.3.11-2_arm64.deb ...
Unpacking libgraphite2-dev:arm64 (1.3.11-2) ...
Selecting previously unselected package libharfbuzz-gobject0:arm64.
Preparing to unpack .../61-libharfbuzz-gobject0_1.7.2-1ubuntu1_arm64.deb ...
Unpacking libharfbuzz-gobject0:arm64 (1.7.2-1ubuntu1) ...
Selecting previously unselected package libicu-le-hb0:arm64.
Preparing to unpack .../62-libicu-le-hb0_1.0.3+git161113-4_arm64.deb ...
Unpacking libicu-le-hb0:arm64 (1.0.3+git161113-4) ...
Selecting previously unselected package libiculx60:arm64.
Preparing to unpack .../63-libiculx60_60.2-3ubuntu3_arm64.deb ...
Unpacking libiculx60:arm64 (60.2-3ubuntu3) ...
Selecting previously unselected package libicu-le-hb-dev:arm64.
Preparing to unpack .../64-libicu-le-hb-dev_1.0.3+git161113-4_arm64.deb ...
Unpacking libicu-le-hb-dev:arm64 (1.0.3+git161113-4) ...
Selecting previously unselected package libicu-dev.
Preparing to unpack .../65-libicu-dev_60.2-3ubuntu3_arm64.deb ...
Unpacking libicu-dev (60.2-3ubuntu3) ...
Selecting previously unselected package libharfbuzz-dev:arm64.
Preparing to unpack .../66-libharfbuzz-dev_1.7.2-1ubuntu1_arm64.deb ...
Unpacking libharfbuzz-dev:arm64 (1.7.2-1ubuntu1) ...
Selecting previously unselected package libjpeg-turbo8-dev:arm64.
Preparing to unpack .../67-libjpeg-turbo8-dev_1.5.2-0ubuntu5.18.04.1_arm64.deb ...
Unpacking libjpeg-turbo8-dev:arm64 (1.5.2-0ubuntu5.18.04.1) ...
Selecting previously unselected package libjpeg8-dev:arm64.
Preparing to unpack .../68-libjpeg8-dev_8c-2ubuntu8_arm64.deb ...
Unpacking libjpeg8-dev:arm64 (8c-2ubuntu8) ...
Selecting previously unselected package libjpeg-dev:arm64.
Preparing to unpack .../69-libjpeg-dev_8c-2ubuntu8_arm64.deb ...
Unpacking libjpeg-dev:arm64 (8c-2ubuntu8) ...
Selecting previously unselected package liblapack-dev:arm64.
Preparing to unpack .../70-liblapack-dev_3.7.1-4ubuntu1_arm64.deb ...
Unpacking liblapack-dev:arm64 (3.7.1-4ubuntu1) ...
Selecting previously unselected package libtinfo-dev:arm64.
Preparing to unpack .../71-libtinfo-dev_6.1-1ubuntu1.18.04_arm64.deb ...
Unpacking libtinfo-dev:arm64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libncurses5-dev:arm64.
Preparing to unpack .../72-libncurses5-dev_6.1-1ubuntu1.18.04_arm64.deb ...
Unpacking libncurses5-dev:arm64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libpng-dev:arm64.
Preparing to unpack .../73-libpng-dev_1.6.34-1ubuntu0.18.04.2_arm64.deb ...
Unpacking libpng-dev:arm64 (1.6.34-1ubuntu0.18.04.2) ...
Selecting previously unselected package libreadline-dev:arm64.
Preparing to unpack .../74-libreadline-dev_7.0-3_arm64.deb ...
Unpacking libreadline-dev:arm64 (7.0-3) ...
Selecting previously unselected package liblzma-dev:arm64.
Preparing to unpack .../75-liblzma-dev_5.2.2-1.3_arm64.deb ...
Unpacking liblzma-dev:arm64 (5.2.2-1.3) ...
Selecting previously unselected package r-base-dev.
Preparing to unpack .../76-r-base-dev_3.4.4-1ubuntu1_all.deb ...
Unpacking r-base-dev (3.4.4-1ubuntu1) ...
Setting up libhtml-tagset-perl (3.20-3) ...
Setting up libtool (2.4.6-2) ...
Setting up libtry-tiny-perl (0.30-1) ...
Setting up libbz2-dev:arm64 (1.0.6-8.1ubuntu0.2) ...
Setting up libarchive-zip-perl (1.60-1ubuntu0.1) ...
Setting up libfile-which-perl (1.21-1) ...
Setting up libencode-locale-perl (1.05-1) ...
Setting up gettext (0.19.8.1-6ubuntu0.3) ...
Setting up libblas-dev:arm64 (3.7.1-4ubuntu1) ...
update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so to provide /usr/lib/aarch64-linux-gnu/libblas.so (libblas.so-aarch64-linux-gnu) in auto mode
Setting up libtimedate-perl (2.3000-2) ...
Setting up perl-openssl-defaults:arm64 (3build1) ...
Setting up libglib2.0-0:arm64 (2.56.4-0ubuntu0.18.04.4) ...
Setting up libio-html-perl (1.001-1) ...
Setting up libonig4:arm64 (6.7.0-1) ...
Setting up libicu-le-hb0:arm64 (1.0.3+git161113-4) ...
Setting up libtinfo-dev:arm64 (6.1-1ubuntu1.18.04) ...
Setting up python3-scour (0.36-2) ...
Setting up scour (0.36-2) ...
Setting up libncurses5-dev:arm64 (6.1-1ubuntu1.18.04) ...
Setting up libjq1:arm64 (1.5+dfsg-2) ...
Setting up intltool-debian (0.35.0+20060710.4) ...
Setting up pkg-config (0.29.1-0ubuntu2) ...
Setting up libjpeg-turbo8-dev:arm64 (1.5.2-0ubuntu5.18.04.1) ...
Setting up liblwp-mediatypes-perl (6.02-1) ...
Setting up libjpeg8-dev:arm64 (8c-2ubuntu8) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up gir1.2-harfbuzz-0.0:arm64 (1.7.2-1ubuntu1) ...
Setting up libjpeg-dev:arm64 (8c-2ubuntu8) ...
Setting up liburi-perl (1.73-1) ...
Setting up libhtml-parser-perl (3.72-3build1) ...
Setting up libiculx60:arm64 (60.2-3ubuntu3) ...
Setting up libgfortran-7-dev:arm64 (7.4.0-1ubuntu1~18.04.1) ...
Setting up libreadline-dev:arm64 (7.0-3) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up gfortran-7 (7.4.0-1ubuntu1~18.04.1) ...
Setting up libpcrecpp0v5:arm64 (2:8.39-9) ...
Setting up libpcre32-3:arm64 (2:8.39-9) ...
Setting up libnet-http-perl (6.17-1) ...
Setting up icu-devtools (60.2-3ubuntu3) ...
Setting up libpcre16-3:arm64 (2:8.39-9) ...
Setting up liblzma-dev:arm64 (5.2.2-1.3) ...
Setting up python3-lib2to3 (3.6.8-1~18.04) ...
Setting up libglib2.0-bin (2.56.4-0ubuntu0.18.04.4) ...
Setting up libgraphite2-dev:arm64 (1.3.11-2) ...
Setting up libwww-robotrules-perl (6.01-1) ...
Setting up libharfbuzz-gobject0:arm64 (1.7.2-1ubuntu1) ...
Setting up python3-distutils (3.6.8-1~18.04) ...
Setting up autopoint (0.19.8.1-6ubuntu0.3) ...
Setting up zlib1g-dev:arm64 (1:1.2.11.dfsg-0ubuntu2) ...
Setting up libfile-stripnondeterminism-perl (0.040-1.1~build1) ...
Setting up liblapack-dev:arm64 (3.7.1-4ubuntu1) ...
update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so to provide /usr/lib/aarch64-linux-gnu/liblapack.so (liblapack.so-aarch64-linux-gnu) in auto mode
Setting up gfortran (4:7.4.0-1ubuntu2.3) ...
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode
Setting up jq (1.5+dfsg-2) ...
Setting up libpcre3-dev:arm64 (2:8.39-9) ...
Setting up libhttp-date-perl (6.02-1) ...
Setting up po-debconf (1.0.20) ...
Setting up libglib2.0-dev-bin (2.56.4-0ubuntu0.18.04.4) ...
Setting up libnet-ssleay-perl (1.84-1ubuntu0.1) ...
Setting up libglib2.0-dev:arm64 (2.56.4-0ubuntu0.18.04.4) ...
Setting up libio-socket-ssl-perl (2.060-3~ubuntu18.04.1) ...
Setting up libhtml-tree-perl (5.07-1) ...
Setting up libfile-listing-perl (6.04-1) ...
Setting up libhttp-message-perl (6.14-1) ...
Setting up libpng-dev:arm64 (1.6.34-1ubuntu0.18.04.2) ...
Setting up libhttp-negotiate-perl (6.00-2) ...
Setting up libhttp-cookies-perl (6.04-1) ...
Setting up dh-strip-nondeterminism (0.040-1.1~build1) ...
Setting up libharfbuzz-dev:arm64 (1.7.2-1ubuntu1) ...
Setting up libwww-perl (6.31-1ubuntu0.1) ...
Setting up dh-autoreconf (17) ...
Setting up libicu-le-hb-dev:arm64 (1.0.3+git161113-4) ...
Setting up liblwp-protocol-https-perl (6.07-2) ...
Setting up libicu-dev (60.2-3ubuntu3) ...
Setting up libxml-parser-perl (2.44-2build3) ...
Setting up debhelper (11.1.6ubuntu2) ...
Setting up intltool (0.51.0-5ubuntu1) ...
Setting up dh-translations (138.18.04.1) ...
Setting up cdbs (0.4.156ubuntu4) ...
Setting up r-base-dev (3.4.4-1ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@rockpro64:/home/chiefio# 

So let’s try it the Linuxize way with their directions:

For demonstration purposes, we’ll install a package named stringr, which provides fast, correct implementations of common string manipulations.

When started as root the packages will be installed globally and available for all system users. If you start R without sudo, a personal library will be set up for your user.

Start by opening the R console as root:

sudo -i R
Copy
R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 

All the following commands are executed within the R console.
To install the stringr package simply type:

install.packages("stringr")

As I’m already running as root, the “sudo” is redundant, and likely some command like “R -i” would be fine, but just to stay on script I’m going to run it as they list it.

root@rockpro64:/home/chiefio# sudo -i R

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 

And hey, that worked too!

Now we install a “package”. It worked, but produced an enormous volume of output to the screen so I’m not going to put all that here. Do note that it pegged one of the BIG cores on the RockPro64 long enough to type all this while it was running. I learned that the system can up-regulate the speed on a BIG core while leaving the .little. cores at low clock. Nice touch, that.

Along they way was reminded that R uses a “.” as a part of a function name, so may need to use my readers when using R…

> install packages("stringer")
Error: unexpected symbol in "install packages"
> install packages("stringr")
Error: unexpected symbol in "install packages"

So first noticed the E was not there…. Then that the “.” was…

> install.packages("stringr")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘glue’, ‘magrittr’, ‘stringi’

trying URL 'https://cloud.r-project.org/src/contrib/glue_1.3.1.tar.gz'
Content type 'application/x-gzip' length 122950 bytes (120 KB)
==================================================
downloaded 120 KB
[...]
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I.    -UDEBUG -DNDEBUG -DU_HAVE_ELF_H    -fpic -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-gng3mN/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c stri_utils.cpp -o stri_utils.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I.    -UDEBUG -DNDEBUG -DU_HAVE_ELF_H    -fpic -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-gng3mN/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c stri_wrap.cpp -o stri_wrap.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o stringi.so stri_brkiter.o stri_collator.o stri_common.o stri_compare.o stri_container_base.o stri_container_bytesearch.o stri_container_listint.o stri_container_listraw.o stri_container_listutf8.o stri_container_regex.o stri_container_usearch.o stri_container_utf16.o stri_container_utf8.o stri_container_utf8_indexable.o stri_encoding_conversion.o stri_encoding_detection.o stri_encoding_management.o stri_escape.o stri_exception.o stri_ICU_settings.o stri_join.o stri_length.o stri_pad.o stri_prepare_arg.o stri_random.o stri_reverse.o stri_search_class_count.o stri_search_class_detect.o stri_search_class_extract.o stri_search_class_locate.o stri_search_class_replace.o stri_search_class_split.o stri_search_class_startsendswith.o stri_search_class_subset.o stri_search_class_trim.o stri_search_common.o stri_search_coll_count.o stri_search_coll_detect.o stri_search_coll_extract.o stri_search_coll_locate.o stri_search_coll_replace.o stri_search_coll_split.o stri_search_coll_startsendswith.o stri_search_coll_subset.o stri_search_boundaries_count.o stri_search_boundaries_extract.o stri_search_boundaries_locate.o stri_search_boundaries_split.o stri_search_fixed_count.o stri_search_fixed_detect.o stri_search_fixed_extract.o stri_search_fixed_locate.o stri_search_fixed_replace.o stri_search_fixed_split.o stri_search_fixed_subset.o stri_search_fixed_startsendswith.o stri_search_in.o stri_search_other_split.o stri_search_regex_count.o stri_search_regex_detect.o stri_search_regex_extract.o stri_search_regex_locate.o stri_search_regex_match.o stri_search_regex_replace.o stri_search_regex_split.o stri_search_regex_subset.o stri_sort.o stri_stats.o stri_stringi.o stri_sub.o stri_test.o stri_time_zone.o stri_time_calendar.o stri_time_symbols.o stri_time_format.o stri_trans_casemap.o stri_trans_other.o stri_trans_normalization.o stri_trans_transliterate.o stri_ucnv.o stri_uloc.o stri_utils.o stri_wrap.o -L/usr/lib/aarch64-linux-gnu -licui18n -licuuc -licudata -L/usr/lib/R/lib -lR
installing via 'install.libs.R' to /usr/local/lib/R/site-library/stringi
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (stringi)
* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (stringr)

The downloaded source packages are in
	‘/tmp/Rtmp127GZc/downloaded_packages’

So I’d say it’s there, and it is working.

Installation will take some time and once completed, load the library:

library(stringr)

Create a simple character vector named tutorial:

tutorial <- c("How", "to", "Install", "R", "on", "Debian", "9")

Run the following function which prints the length of a string:

str_length(tutorial)

[1] 3 2 7 1 2 6 1

You can find more R packages at Available CRAN Packages By Name and install them with install.packages().

So I tried that, but changed a few of the specific strings just to assure I had a handle on things that could be changed and how (and saw all the ‘.’ that might be there…)

Note that the use of the <- for assignment causes issues with ‘cut / paste’ of the result as the line is taken down to the following > by WordPress and when it isn’t HTML gets dropped on the floor. One must resort to Unicode to get the result to display properly. &lt; and &gt;

> library(stringr)
> test_string <- c("How","to","install","R","in","Ubuntu")
> str_length(test_string)
[1] 3 2 7 1 2 6
> 

shows up as:

> library(stringr)
> test_string  str_length(test_string)
[1] 3 2 7 1 2 6
> 

if you don’t…

But this isn’t a “How To” on unicode in WordPress… so I think with this I’ll take a break for tying some basic “R” code and seeing what I think of it.

Eventually I’ll repeat all this on the R.Pi M3 and the Odroid XU4 and add those results as either an UPDATE here, or as comments if they are longer chunks. This also means I’m ready to look over that FORTRAN code and try a hand drawn “FORTRAN to R Translation” ;-) We’ll see how that goes, too ;-)

In Conclusion

So there you have it. How to install, test, and do something in the “R” language on an Ubuntu SBC. Not all that bad, really. I do hope it is just as easy on the Pi (even if it will be much slower in that modestly long install step. It did a bunch of CPU limited g++ compliles so it’s going to take some time on the Pi. Still, compiling from sources it ought to work without too much grief.

There’s a nice online book / introduction or programming in R here:

https://r4ds.had.co.nz/introduction.html

In it there is a reference to both FWF reading and TAB file writing functions. It also covers COS(foo) though note that it expects radians and the data are in degrees. I had the same “issue” in the FORTRAN, so it already does the Pi/180 math, but for anyone unfamiliar with the “issue”:

https://www.dummies.com/programming/r/how-to-use-trigonometric-functions-in-r/

Instead, use a special variable called pi. This variable contains the value of — you guessed it — π (3.141592653589 . . .).

The correct way to calculate the cosine of an angle of 120 degrees, then, is this:

> cos(120*pi/180)
[1] -0.5

So looks like R has a built in constant for Pi. Nice, that.

Subscribe to feed

Advertisements

About E.M.Smith

A technical managerial sort interested in things from Stonehenge to computer science. My present "hot buttons' are the mythology of Climate Change and ancient metrology; but things change...
This entry was posted in NCDC - GHCN Issues, Tech Bits and tagged , , , , , , . Bookmark the permalink.

29 Responses to Trying R

  1. YMMV says:

    A little hint at history: R came from S, and S came from the place of C and UNIX.

  2. cdquarles says:

    If I am remembering correctly, R will take Fortran back end code as a named function. It has been a while, and sadly for me, my neurologist told me that I am showing signs of cognitive (memory primarily) impairment. (Such does run in the family. Mom and two grandparents had strokes and died from the complications).

  3. jim2 says:

    Here’s a nice little summary of R and many of it’s many libraries ;)

    https://www.cs.upc.edu/~robert/teaching/estadistica/TheRBook.pdf

  4. sandy mcclintoclk says:

    You might like ggplot2 library which is currently the main plotting routine in R. The ‘Author/Maintainer’ is a friend’s son. These days ggplot2 is big!
    Here is a link to the manual https://github.com/tidyverse/ggplot2

  5. H.R. says:

    @cdquarles – Break the mold! Live to 100 with a reasonably to-be-expected mind (eh, a little forgetfulness) . I’m rooting for you. You’ve forgotten more in your field than a lot of us will ever learn in our remaining years.

    “The poison is the dose.” ~cdquarles

    If there is one thing that you have hammered home with me, it is that, and I pull myself up and say “Whoa!” every time I read, “Known to the State of California to possibly, maybe, might, just could maybe, possibly cause cancer or harm to unborn fetuses” (never mind the State of California promotes, nay, encourages abortion when it comes to harming fetuses).

    Keep on posting, bro. It is not time for you to sit in the rocker on the porch of the Old Folks Home just yet.

    P.S. If you do ever get bored, put Vaseline on the steps of the Old Folks Home and yell “FIRE!!!” It will provide you with a few hours of amusement… Hours? It takes awhile for those geezers to evacuate ;o)

  6. E.M.Smith says:

    Well this is a bummer…

    I’d settled on the functions in the library named “tidyverse” as everyone seems to use them. So did the install of it:

    install.packages("tidyverse")
    

    After about a full half hour of often 100% on a BIG core of the RockPro64, it finally completed.

    With an error message:

    * installing *source* package ‘modelr’ ...
    ** package ‘modelr’ successfully unpacked and MD5 sums checked
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (modelr)
    ERROR: dependencies ‘httr’, ‘rvest’, ‘xml2’ are not available for package ‘tidyverse’
    * removing ‘/usr/local/lib/R/site-library/tidyverse’
    
    The downloaded source packages are in
    	‘/tmp/RtmpnD899a/downloaded_packages’
    Warning messages:
    1: In install.packages("tidyverse") :
      installation of package ‘curl’ had non-zero exit status
    2: In install.packages("tidyverse") :
      installation of package ‘xml2’ had non-zero exit status
    3: In install.packages("tidyverse") :
      installation of package ‘httr’ had non-zero exit status
    4: In install.packages("tidyverse") :
      installation of package ‘rvest’ had non-zero exit status
    5: In install.packages("tidyverse") :
      installation of package ‘tidyverse’ had non-zero exit status
    > 
    

    No idea why.

    The package “curl” exists on the machine. Perhaps it doesn’t like that?

    So no idea now if this path is viable. I’ll address it again tomorrow. Perhaps on a different platform.

    I’d already sketched out the code to replace the ccodes.f program (the simplest one, it just picks out the Region (continent) from the Country Code 3 digits, then prints out the Country Code, Region and the CNAME (country name) with tabs between them.)

    It looked like I could get the read and the write down to one sentence each, and the wrapper code around it not a lot more. Now not so much…

    Sigh.

    And folks wonder why I like FORTRAN. Perhaps because it is either already installed or is simple to install, does not then hand you a 1/2 hour of “build more stuff” before it will think about working, and then fail to build… Then, in operation, it is fast and efficient with low memory consumption, while being simple and easy to understand and write.

    Oh Well. I’m not the only one. It is still one of THE most widely used languages for Science and Engineering. For a reason.

    I know, I’m just being grumpy right now due to the install failing… I’ll get over it… Eventually…

    But it IS one of my most frequent experiences / gripes about the “New” “Modern” “Trendy” languages: They are typically NOT complete when installed. There’s a huge chunk of “stuff you usually do” that is in some packages or libraries or God Only Knows What / Where that you must a) Know about, b) Find, c) install, d) configure AND all before you can even begin to write your program.

    I know, I know… Either you can make the language painfully FAT to install or you can let folks pick the packages they need for their purpose. Even FORTRAN has a load of math libraries available….

    Yet here I am doing a 1/2 hour install to get what OUGHT to be a basic function of any language: The ability to read in & wrote out files in fixed, csv, or tab delimited format. And then it fails.

    What is THE core flow of ALL programming?

    Read in data.
    Process it.
    Write out results.

    So 2 out of the 3 basic functions of a programming language take a massive library that fails to build? Really?

    Sigh.

    Maybe it will work on the Raspberry Pi…

    Though this build took a little over 1 GB and that was after 250 MB was rolled out to swap. In fairness, it’s a 2 GB machine and it rolled that to swap when I launched the install with a browser open. I then exited the browser and memory use dropped to about 600 MB… but then rose again to a little over 1 GB while that 250 MB on swap stayed about constant… This is likely to be a slow point on the R. Pi with only 1 GB total. I expect it will swap a lot and this install step will take a few hours…

    IFF I can’t get these common and widely used basic packages installed and working, I’ll need to abandon R for some other language that (claims it) has fixed format file read in not too painful a way…

  7. E.M.Smith says:

    Well, it “only” took an hour and a half on the Pi M3

    date
    Fri Jul 26 06:28:30 UTC 2019
    chiefio@PiM3Devuan2:~$ !!
    date
    Fri Jul 26 08:07:09 UTC 2019
    chiefio@PiM3Devuan2:~$ 
    

    And using about 1/2 GB of swap

    root@PiM3Devuan2:/# !!
    swapon -s
    Filename				Type		Size	Used	Priority
    /dev/sda12                             	partition	2117628	88648	128
    /dev/sdb2                              	partition	1048572	464356	256
    

    To also fail.

    Though this time, it being slower by a lot, I was able to catch some errors from in the middle of the build. I don’t know if these were in the other build too and I just missed them, or unique to the Pi:

    Using PKG_LIBS=-lxml2
    ------------------------- ANTICONF ERROR ---------------------------
    Configuration failed because libxml-2.0 was not found. Try installing:
     * deb: libxml2-dev (Debian, Ubuntu, etc)
     * rpm: libxml2-devel (Fedora, CentOS, RHEL)
     * csw: libxml2_dev (Solaris)
    If libxml-2.0 is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
    --------------------------------------------------------------------
    ERROR: configuration failed for package ‘xml2’
    * removing ‘/usr/local/lib/R/site-library/xml2’
    
    
    ------------------------- ANTICONF ERROR ---------------------------
    Configuration failed because openssl was not found. Try installing:
     * deb: libssl-dev (Debian, Ubuntu, etc)
     * rpm: openssl-devel (Fedora, CentOS, RHEL)
     * csw: libssl_dev (Solaris)
     * brew: openssl@1.1 (Mac OSX)
    If openssl is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
    --------------------------------------------------------------------
    
    ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
    * removing ‘/usr/local/lib/R/site-library/httr’
    * installing *source* package ‘progress’ ...
    ** package ‘progress’ successfully unpacked and MD5 sums checked
    ** R
    ** inst
    
    
    ** testing if installed package can be loaded
    * DONE (reprex)
    ERROR: dependencies ‘xml2’, ‘httr’ are not available for package ‘rvest’
    * removing ‘/usr/local/lib/R/site-library/rvest’
    * installing *source* package ‘tibble’ ...
    ** package ‘tibble’ successfully unpacked and MD5 sums checked
    
    * installing *source* package ‘ggplot2’ ...
    ** package ‘ggplot2’ successfully unpacked and MD5 sums checked
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
    * DONE (ggplot2)
    
    
    * installing *source* package ‘readr’ ...
    ** package ‘readr’ successfully unpacked and MD5 sums checked
    ** libs
    
    :
    *** installing help indices
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (modelr)
    ERROR: dependencies ‘httr’, ‘rvest’, ‘xml2’ are not available for package ‘tidyverse’
    * removing ‘/usr/local/lib/R/site-library/tidyverse’
    
    The downloaded source packages are in
    	‘/tmp/RtmpGkoF5d/downloaded_packages’
    Warning messages:
    1: In install.packages("tidyverse") :
      installation of package ‘curl’ had non-zero exit status
    2: In install.packages("tidyverse") :
      installation of package ‘xml2’ had non-zero exit status
    3: In install.packages("tidyverse") :
      installation of package ‘openssl’ had non-zero exit status
    4: In install.packages("tidyverse") :
      installation of package ‘httr’ had non-zero exit status
    5: In install.packages("tidyverse") :
      installation of package ‘rvest’ had non-zero exit status
    6: In install.packages("tidyverse") :
      installation of package ‘tidyverse’ had non-zero exit status
    > 
    

    So at this point it looks like the heavy math users are not interested in doing things on the Pi / ARM chips; or at least not enough to get these libraries ported, tested, and working well.

    So, I think it unlikely that other libraries will work OK either.

    So I’m going to “push back from the R table” for a while and have a bit of a think about some other language to try…

    Or maybe leaving it in FORTRAN isn’t such a bad idea after all ;-)

  8. CoRev says:

    Keeping It Simple S(U no what this is)ing it is never a bad idea. Unless, of course, the challenge of learning is the goal. ;-)

  9. Bill in Oz says:

    I know not a single computer language EM. By dint of hard effort I’ve avoided them all since 1968. There just no my thing.
    But the question does pop up in my head “What is so wrong with old fashioned Fortran ? If it does the job simply why bother with change ?”

  10. jim2 says:

    Normally, I would recommend using the GUI IDE RKward. But running that on top of R might be more than a smaller computer can handle.

  11. E.M.Smith says:

    @Bill In Oz:

    Like in all things involving people, there are fads and fashions in computer languages. You can be part of the “in” crowd, or in the outs. Like showing up at a Sting Rave in spats and High Hat, folks look at you a bit oddly and if polite, do their Fling Poo in whispers in the hallway, if not, as shouts and hoots.

    As one of my goals is to make this kind of project available to as many people as possible, I’d like it in more than one language and in those languages most likely to be received without statements whispered in the back ally of the blogs like “Did you see he used FORTRAN?? Just OMG…what era of dinosaur is he?”.

    Now I know that FORTRAN is one of THE most widely used languages for Scientific and Engineering purposes. But most people do not. Furthermore, a lot of that use is old code that isn’t changing. I.e. nobody wants to translate it to some other language.

    Now season this with the last 20 years or so of ALL the graduates of computer programming being indoctrinated into Object Oriented and similar PITA programming “styles” and you can see that a procedural thing written in a half century old language will get some large part of the folks nattering and what is worse, uninterested in looking at it or using it. (O.O. programming is sometimes more ‘terse” but also depends on knowing what a large body of “methods” in a library will do to a data item. So instead of stating, in your program, where it is visible, to do a series of steps to the block of data, you hand this block to a function and it “does some stuff” that “the experienced programmer will know happens” but where to everyone else it is a black box without an explanation…)

    There are literally thousands of computer languages. Some are specialized in teaching roles, or for specific types of problems. Others are “general purpose”. There is always a competition to remain relevant and there are fans, factions, status, reputations, and sometimes big $bucks on the line. Never mind that languages really break down into just a few “paradigms” and inside a paradigm, the various languages are much more alike than different.

    Look at “Rust” as an example. I posted a complaint that FireFox had turned into a fat obnoxious thing and speculated it was related to (caused by?) the move to Rust with an LLVM backend. The “backend” is where a given language picks up a bunch of standard library functions that do things like access disk drives and load objects into memory. LLVM is “new”, so while most stuff on your system will be sharing the “old” library (gcc or GNU C Compiler versions) a duplicate of those functions but in an incompatible “language” source will need to be loaded, duplicating memory consumed. Rust has “automatic memory management” and the Rust “fanboys” just love it. In C (the most common alternative that Rust is trying to replace) you do your own memory management. Do it well, it is superior in some ways. But a lot of folks do not do i t well. My speculation that perhaps Rust wasn’t cleaning up after itself fast enough, so was using a lot of memory, was met with attack and derision. How dare I wear spats to a Sing concert?!?… /sarc

    So now the Rust Fanboyz want to re-write all of Linux in Rust. (At present, most of it is in C with growing chunks in Python and some bits in a half dozen other languages.) Will they “win”? I doubt it. It’s a gigantic project. I DO expect some parts will be rewritten in Rust as the FanBoyz take over a few projects (much like FireFox…) and I also expect that the Clang / LLVM combo (C Lang(uage) compiler / newer libraries ) will replace gcc in many places as the C compiler of choice (mostly because gcc has grown so large and is often so slow and fat as to be a PITA and a good bit of pruning out old cruft is in order).

    So if you want to be Cool, and With It, and be the center of conversation at conventions, get speaking gigs at Linux conferences, and generally be The Object Of Admiration: You talk up Rust / LLVM and your new project using it. If you want to be dull and uninteresting at all, you have a nice little project in boring old gcc C. If you want to be shunned and have folks actively avoid you, you write in ALGOL or COBOL or, yes, FORTRAN.

    Now I don’t mind that at all.

    BUT…

    Other people do. So my goal is to make this approachable to lots of folks without the “Groan Factor” getting in their way.

    That simple. Really.

    FWIW, while pondering this last night as I drifted off to sleep, I pretty much decided to just rewrite the FORTRAN parts in C. It’s THE most widely used language in the Linux world. It has little baggage to it (even if lacking current trendy bits). There is also an O.O. extension to it called C++ so I could even assure the code worked both ways and make it more trendy ;-)

    I already know C even if it’s been a while, and I’ve written Fixed Width Format parsing routines before ( I just don’t like it… you suck in a line of text to a buffer string, then get to chop it up and assign bits to variables via your own code. All you get from the language is a crude “read a character” or “read a line” function and then you get to make the rest from scratch…). But it works and everyone has to deal with it to some extent so it isn’t an “issue” of “Yet Another Language”…

    Finally, there had been an interest in re-writing the report writers / graphic programs from Python into R so it was very reasonable for me to look at R and ask “can it replace the FORTRAN too?” and thus reduce the code from 2 languages to one. (Always a feature, IMHO). But it looks like the libraries R uses have not been given a full and complete port effort to the ARM chip. Not surprising in that heavy compute problems of the statistical sort that R is aimed at are likely to be compute hogs and want big iron (or at least their users will ;-)

    Yet it is surprising in that the low cost SBC (Single Board Computers) are intended to be learning tools. What is the poor kid in Africa or back woods Bolivia who dreams of being a Scientist going to learn on if not something they can buy? How will they learn R if the libraries are full of error fails? So it burdens my heart a bit folks only got it half done – the basic R language is working, but the libraries not so much. ( I ran into something similar with Python 3 on the newer SBCs where they would not produce legends properly on graphs).

    Yet the whole Linux Universe is based on volunteer labor of an extremely technical and valuable sort. IF I really cared enough I could “go fix it myself”… or so the theory goes…

    Oh Well….

    So in any case, that’s the (long winded) explanation.

    And with that, I’m going to curtail my dive into R until some future time when I revisit the report writing / graphing steps. Sometimes if you just wait a while “somebody” fixes the bugs and you can use the language and library after all ;-)

    So now, for me, it’s back to “clean up mode” and finishing the database rework, convert the FORTRAN to C, and come up with a clean “install from scratch”. At a minimum that will avoid the need to install the FORTRAN compiler as C is always present…

  12. jim2 says:

    There aren’t many hard and fast rules for OO programming as far as the form of the code goes. Visual Studio allows very long names for methods and classes, so I give them as descriptive a name as possible. That way, to a large extent, the code is self-documenting. In addition to that, there are IDE macros that allow for the easy (read fast) inclusion of a summary of the code and parameters. This can be easily extracted from source as XML for further documentation of the program. I’m a fan :)

    R is primary a statistics application, but there are tons of libraries that allow it to do more. The graphics libraries are particularly impressive. Once you have the knack of R Data Frames, it is relatively easy to produce world maps to display various data.

    I use it on a full fledged, non-arm desktop, so my experience with it has been relatively pleasant. Also, use it in the RKWard IDE, which is also nice and integrates easily with GIT, local or internet repository as you wish.

  13. jim2 says:

    The budding African scientists might be able to use an on-line R IDE, such as …

    https://repl.it/languages/rlang

  14. E.M.Smith says:

    @Jim2:

    I’d hoped to use R, and fully expect to get decent at it “some day”. As this is just one library (albeit a major one…) I still have hope the graphic bits (library) will be fine. Also, as noted, over time it ought to get fixed. Heck, it might be something simple in my installation I could fix, if I had time and interest enough.

    So it isn’t like I’m walking away from R forever. Just until I get to the report writing / graphing step in this “do over”.

    The expedient “just turn the FORTRAN into C” is simply to get the (trivial) half dozen programs I rapid prototyped in a quick bit of FORTRAN into something much more common, and out of the way (i.e. off the rewrite plate) so I can get on to the database polishing and the report writing / graphing bits.

    Per O.O:

    I’ve managed projects in it, and written some small bits of code in it. I know the advantages of it and wouldn’t mind at all managing more projects written in OO style / languages. I just find it a much harder “barrier to entry” for the nooby to get over. It also tends to much fatter and slower programs (yes, you can get around that if you avoid reusing a 100 mb Method for the 1 mb you need… but then what’s the point of OO if not to reuse methods?…) So I’m not a fan of it.

    Then again, I’m not a fan of most of the stuff I use and depend on every day… Maybe I’m just a Grump… ;-)

  15. jim2 says:

    I have no problem with Fortran, C, or C++. I’ve dabbled in all of them.

    In Visual Studio, I believe it is all the languages compile to an intermediate language. It is then compiled again using a just-in-time compiler to machine language and executed. So, how efficient or inefficient the code becomes depends mostly on the compiler. That said, one can still write an inefficient program.

    https://www.geeksforgeeks.org/common-language-runtime-clr-in-c-sharp/

    https://www.developer.com/net/csharp/article.php/1456911/C-and-Intermediate-Language-IL.htm

  16. cdquarles says:

    Pretty sure R’s back end is a C run time and, again, if I am remembering correctly, you can just call your Fortran as a named function in R, without having to translate it; though I’ve never found the need to do that. FORTRAN (IV/66) was the first computer language I learned, followed quickly by BASIC and then assembler. C took some getting used to, until I mapped {} to BEGIN END ;P.

  17. E.M.Smith says:

    @CDQuarles:

    The FORTRAN doesn’t need to be called by anything. It is a stand alone simple format converter. Suck in Fixed Position spit out TAB separated values. The only reason to rewrite it is to eliminate one language from the set of stuff needed to make the system go. Basically, I’m recognizing that most folks do not program in FORTRAN and are uninterested in it…

    So that step can be in any language, regardless of how things are called. It doesn’t interact with anything other than an input text file and an output text file. I could probably rewrite it in SHELL (sh, csh, ksh, bash, etc.) for that matter… which is an interesting idea ;-)

  18. jim2 says:

    If the goal is simply to make the code available to more programmers, you MIGHT be able to use a Fortran to Java converter. Most of these appear to be prototypes, but more diligent searching might turn up ones that are tried and true.

    https://www.startpage.com/row/search?q=fortran+to+java+converter&l=english

  19. Pouncer says:

    https://xkcd.com/2180/ Oc coding and the alternatives.

  20. E.M.Smith says:

    Just for grins, I converted the FORTRAN that inserts tabs into the “Country” data into a shell script. It ends up remarkably short. One line, the echo, is even commented out. It has “issues” in that it removes some white space in the fields. The printf version will be more portable anyway.

    It is largely identical output to the FORTRAN, but does still have a couple of country names where the trailing blanks are not in the original data (but FORTRAN padded it out to full field length). Still, with the tab separator in it, the white space isn’t that important.

    This is far from ideal or polished. Just the first cut at it that worked:

    The Bash script:

    #!/bin/bash
    ascen="7Sept2015"
    abrev="XX"
    version="Gv3.3"
    while IFS='' read -r line; do
    #    echo -e ${line:0:3}'\t'$abrev'\t'${line:0:1}'\t'${line:4:56}'\t'$version'\t'$ascen
            printf "%s\t%s\t%s\t%s\t%s\t%s\n" "${line:0:3}" "$abrev" "${line:0:1}" "${line:4:56}" "$version" "$ascen"
    done < "$1"        
    

    Here’s the FORTRAN:

    chiefio@PiM3Devuan2:~/SQL/v3$ cat ccodesv3.f 
    C FORTRAN to read the country.codes v2 GHCN file and insert Tabs
    C in the output.  Also divides "country" into Continent and Country
    C
    C Variable declarations...
    C
          CHARACTER * 1 TAB
          CHARACTER * 5 VERSION
          CHARACTER * 10 ASCEN
          CHARACTER * 56 CNAME
          CHARACTER * 1 CONT
          CHARACTER * 2 COUNTRY
          CHARACTER * 2 ABREV
    C
    C Set the TAB character
          TAB=CHAR(09)
          ABREV="XX"
    C
    C Set some constants
          ASCEN="7Sept2015"
          VERSION="Gv3.3"
    C
    C Read in one line of data...
    C
        9 OPEN(1, FILE='v3.country-codes', STATUS='OLD', ACTION='READ')
       10 READ (1, 11, END=99) CONT, COUNTRY,CNAME
    C
       11 FORMAT (A1, A2, X, A56)
    C
    C Write out one line of data with TAB between fields
    C
          WRITE (6, 6) CONT,COUNTRY,TAB,ABREV,TAB,CONT,TAB,CNAME,           &
         &TAB,VERSION,TAB, ASCEN
    C
        6 FORMAT (A1,A2,A1,A2,A1, A1,A1, A56,A1, A5,A1, A10)
    C
    C Retrieve another line of data...
    C
          GO TO 10
    C
    C If end of file, then stop...
    C
       99 STOP
          END
    

    Here you can see the difference in the output. Mostly white space at the end of country names that is likely irrelevant. First the sh script::

    [...]
    639	XX	6	SERBIA                                  	Gv3.3	7Sept2015
    641	XX	6	SLOVAKIA                                	Gv3.3	7Sept2015
    642	XX	6	SLOVENIA	Gv3.3	7Sept2015
    643	XX	6	SPAIN                                   	Gv3.3	7Sept2015
    645	XX	6	SWEDEN                                  	Gv3.3	7Sept2015
    646	XX	6	SWITZERLAND                             	Gv3.3	7Sept2015
    647	XX	6	SYRIA                                   	Gv3.3	7Sept2015
    648	XX	6	MACEDONIA                               	Gv3.3	7Sept2015
    649	XX	6	TURKEY                                  	Gv3.3	7Sept2015
    650	XX	6	UKRAINE                                 	Gv3.3	7Sept2015
    651	XX	6	UNITED KINGDOM                          	Gv3.3	7Sept2015
    652	XX	6	FAROE ISLANDS (DENMARK)                 	Gv3.3	7Sept2015
    653	XX	6	GIBRALTAR (U.K.)                        	Gv3.3	7Sept2015
    654	XX	6	MADEIRA ISLANDS (PORTUGAL)              	Gv3.3	7Sept2015
    700	XX	7	ANTARCTICA                              	Gv3.3	7Sept2015
    701	XX	7	ARGENTINE BASE IN ANTARCTICA	Gv3.3	7Sept2015
    800	XX	8	SHIP STATIONS                           	Gv3.3	7Sept2015
    

    Then the original FORTRAN:

    639	XX	6	SERBIA                                                  	Gv3.3	7Sept2015 
    641	XX	6	SLOVAKIA                                                	Gv3.3	7Sept2015 
    642	XX	6	SLOVENIA                                                	Gv3.3	7Sept2015 
    643	XX	6	SPAIN                                                   	Gv3.3	7Sept2015 
    645	XX	6	SWEDEN                                                  	Gv3.3	7Sept2015 
    646	XX	6	SWITZERLAND                                             	Gv3.3	7Sept2015 
    647	XX	6	SYRIA                                                   	Gv3.3	7Sept2015 
    648	XX	6	MACEDONIA                                               	Gv3.3	7Sept2015 
    649	XX	6	TURKEY                                                  	Gv3.3	7Sept2015 
    650	XX	6	UKRAINE                                                 	Gv3.3	7Sept2015 
    651	XX	6	UNITED KINGDOM                                          	Gv3.3	7Sept2015 
    652	DE	6	FAROE ISLANDS (DENMARK)                                 	Gv3.3	7Sept2015 
    653	XX	6	GIBRALTAR (U.K.)                                        	Gv3.3	7Sept2015 
    654	PO	6	MADEIRA ISLANDS (PORTUGAL)                              	Gv3.3	7Sept2015 
    700	XX	7	ANTARCTICA                                              	Gv3.3	7Sept2015 
    701	XX	7	ARGENTINE BASE IN ANTARCTICA                            	Gv3.3	7Sept2015 
    800	XX	8	SHIP STATIONS                                           	Gv3.3	7Sept2015 
    

    Note that Faroe Islands and Madiera Islands get the default XX ABREV assignment in the bash version. That is a “left over” of the prior ideas, later replaced when I ran into v4 loading issues, so I’ve not bothered to “fix it” to match the FORTRAN. IF I move forward with just using bash or even in C, I’ll likely dump that in v3.3 anyway

  21. E.M.Smith says:

    Well that was fun (NOT!)… Getting a bash script to do COS math on substrings was an interesting experience in the oddities of where you must have spaces and what is the allowed syntax for simple math not always working with embedded results returned from a call the the calculator and…

    Eventually I got it down to “just do it ll in bc”…. and here’s the resultant script. The VERY long print command is all one line but I’m putting in line breaks so you don’t have to scroll off to the right forever to see it… That number of 0.01745329… is the result of the Pi/180 conversion factor for degrees to radians. At some point in the debugging I decided to just calculate it once and avoid that complication in the computing… “scale=4” sets the digits after the decimal point. To exactly match the FORTRAN i’d need to set that to 2.

    #!/bin/bash
    ascen="7Sept2015"
    version="Gv3.3"
    type="QCU"
    
    while IFS='' read -r Z; do
            coslong=`echo "scale=4; ${Z:21:9} * c(0.017453292*${Z:12:8})" | bc -l` 
    	printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t
    %s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" 
    "${Z:0:11}" "$version" "$ascen" "$type" "${Z:0:1}" "${Z:0:3}" 
    "${Z:3:5}" "${Z:8:3}" "${Z:12:8}" "${Z:21:9}" "${Z:31:6}" 
    "${Z:38:30}" "${Z:69:4}" "${Z:73:1}" "${Z:74:5}" "${Z:79:2}" 
    "${Z:81:2}" "${Z:83:2}" "${Z:85:2}" "${Z:87:1}" "${Z:88:2}" 
    "${Z:90:16}" "${Z:111:11}" "$coslong"
    done < "$1"
    

    Last couple of lines of the FORTRAN output:

    80099912001	Gv3.3	7Sept2015 	QCU 	8	800	99912	001	 50.0000	-145.0000
    	-999.0	SHIP P                        	   0	R	   -9	FL	xx	CO	 1	x	-9	
    WATER           	A	 -93.20
    80099913001	Gv3.3	7Sept2015 	QCU 	8	800	99913	001	 47.0000	 -17.0000	
    -999.0	SHIP R                        	   0	R	   -9	FL	xx	CO	 1	x	-9	
    WATER           	A	 -11.59
    80099914001	Gv3.3	7Sept2015 	QCU 	8	800	99914	001	 34.0000	 164.0000
    	-999.0	SHIP V                        	   0	R	   -9	FL	xx	CO	 1	x	-9	
    WATER           	A	 135.96
    

    Same lines from the BASH script (note the 2 extra digits of precision on the last field):

    80099912001	Gv3.3	7Sept2015	QCU	8	800	99912	001	 50.0000	-145.0000
    	-999.0	SHIP P                        	   0	R	   -9	FL	xx	CO	 1	x	-9	
    WATER           		-93.2205
    80099913001	Gv3.3	7Sept2015	QCU	8	800	99913	001	 47.0000	 -17.0000	
    -999.0	SHIP R                        	   0	R	   -9	FL	xx	CO	 1	x	-9	
    WATER           		-11.5957
    80099914001	Gv3.3	7Sept2015	QCU	8	800	99914	001	 34.0000	 164.0000
    	-999.0	SHIP V                        	   0	R	   -9	FL	xx	CO	 1	x	-9	
    WATER           		135.9724
    

    Oddly, despite being shorter and already knowing what it was to do, making this in BASH took about as long as was more frustrating as it is a trickier language AND it was easier to make minor typos that were hard to see.

    Here’s the FORTRAN:

    chiefio@PiM3Devuan2:~/SQL/v3$ cat 3inven.f 
    C FORTRAN to read the inventory files v3 GHCN file and insert Tabs
    C in the output.  Also divides "country" into Continent and Country
    C
    C Variable declarations...
    C
          CHARACTER * 11 stationID
          CHARACTER * 1  TAB
          CHARACTER * 5  VERSION
          CHARACTER * 10 ASCEN
          CHARACTER * 4  TYPE, GRIDELEV
          CHARACTER * 1  CONT,POPC,AIR,POPNL
          CHARACTER * 2  COUNTRY,TOPOT,VEG,PROXW,DISTW,DISTAU
          CHARACTER * 5  WMO,PSIZE
          CHARACTER * 3  NEAR
          CHARACTER * 6  STNELEV
          CHARACTER * 8  LATITUDE
          CHARACTER * 9  LONGITUDE
          CHARACTER * 16 VEGGRID
          CHARACTER * 30 NAME
          REAL COSLONG,FLAT,FLONG
          REAL PI,RAD
    
          PI=3.1415926
          RAD=PI/180.0
    
    C
    C Set the TAB character
          TAB=CHAR(09)
    C
    C Set some constants
          VERSION="Gv3.3"
          ASCEN="7Sept2015"
          TYPE="QCU"
    C
    C Read in one line of data...
    C
        9 OPEN(1, FILE='inventory.in', STATUS='OLD', ACTION='READ')
       10 READ (1, 11, END=99) CONT, COUNTRY, WMO, NEAR,LATITUDE,           &
         &LONGITUDE,STNELEV,NAME,GRIDELEV,POPC,PSIZE,TOPOT,VEG,PROXW,       &
         &DISTW,AIR,DISTAU,VEGGRID,POPNL
    C
       11 FORMAT (A1,A2,A5,A3,X,A8,X,A9,X,A6,X,A30,X,A4,A1,A5,A2,A2,A2,     &
         &A2,A1,A2,A16,A1)
    C
    C Convert CHAR  to Float 
    
             READ (LATITUDE,*) FLAT
             READ (LONGITUDE,*) FLONG
    C       WRITE (6,22) LATITUDE,FLAT,LONGITUDE,FLONG
    C   22  FORMAT (A8,X,F7.2,X,A9,XF7.2)
    
           COSLONG=FLONG*COS(RAD*FLAT)
           stationID=CONT//COUNTRY//WMO//NEAR
    C       WRITE (6,23) COSLONG
    C   23  FORMAT (F7.2)
    C
    C Write out one line of data with TAB between fields
    C
    C      WRITE (6, 6) StationID,VERSION,ASCEN,TYPE,CONT,COUNTRY,WMO,NEAR,  &
    C     &LATITUDE,LONGITUDE,STNELEV,NAME,GRIDELEV,POPC,PSIZE,TOPOT,VEG,    &
    C     &PROXW,DISTW,AIR,DISTAU,VEGGRID,POPNL,COSLONG
    
    C    6 FORMAT (A11,A5,A10,A4,A1,A2,A5,A3,A8,A9,A6,A30,A4,A1,A5,A2,A2,A2, &
    C     &A2,A1,A2,A16,A1,F7.2)
    
          WRITE (6, 7) StationID,TAB,VERSION,TAB,ASCEN,TAB,TYPE,TAB,CONT,   &
         &TAB,CONT,COUNTRY,TAB,WMO,TAB,NEAR,TAB,LATITUDE,TAB,LONGITUDE,TAB, &
         &STNELEV,TAB,NAME,TAB,GRIDELEV,TAB,POPC,TAB,PSIZE,TAB,TOPOT,TAB,   &
         &VEG,TAB,PROXW,TAB,DISTW,TAB,AIR,TAB,DISTAU,TAB,VEGGRID,TAB,POPNL, &
         &TAB,COSLONG
    
        7 FORMAT (A11,A1,A5,A1,A10,A1,A4,A1,A1,A1,A1,A2,A1,A5,A1,A3,A1,A8,  &
         &A1,A9,A1,A6,A1,A30,A1,A4,A1,A1,A1,A5,A1,A2,A1,A2,A1,A2,A1,        &
         &A2,A1,A1,A1,A2,A1,A16,A1,A1,A1,F7.2)
    
    C Retrieve another line of data...
    C
          GO TO 10
    C
    C If end of file, then stop.
    C
       99 STOP
          END
    

    You decide which is clearer as to what it is doing…

    Yeah, it’s less work to just pick out a substring and stick a tab in it with BASH, but there’s no idea what those substrings are or what the program does. And forget the idea of how it does it. Either you KNOW bash and bc and the details of the syntax quirks, or it’s just hieroglyphics…

  22. Bill in Oz says:

    E M Thanks for run down on Fortran, C R etc…As you clearly explain it is all about ‘fashion”..
    And that I clearly get.

    In fact the whole global warming non science ‘industry’ is basically just another ‘fashionable’ thing to worry about. In the 1950-60’s it was nuclear armaggeden. Then in the 1970’s it was Global catastrophe due to over population as well as nuclear war. ( Take your choice !. ) In the 1980’s it was feminism and ‘women’s enpowerment’. In the 1990’s it was the Millennium Bug.

    At times I’ve been worried or involved in all of these worriting ‘fashions’. But at 72 I think I see the pattern.

    But of course nowadays in our cool western civilisation, olde timers are seen.by the ignorant youngsters as ignorant & passe.

  23. invisnet says:

    EM – you said about C:
    > you suck in a line of text to a buffer string, then get to chop it up and assign bits to variables via your own code. All you get from the language is a crude “read a character” or “read a line” function and then you get to make the rest from scratch…

    IFF you have trusted input you can use `sscanf()`. Because people kept using it on unsafe input it got a bad reputation – much like `goto` – but it’s still there and still useful in the right situations.

    You then went on to talk about writing it in bash; I’m now convinced you’re a masochist ;-)

    Why wouldn’t you just use AWK? ISTM it’s the perfect tool for this job, and just to make life even easier, from the man page:

    cos(x) Return the cosine of x, where x is in radians

  24. E.M.Smith says:

    @invisnet:

    So, a pedantic point: The function libraries are not part of the language. They are a glue on.

    Yes, I’ve used sscanf and that is likely how I’d approach it. But someone (using the Royal You when I said “you have to create it from scratch”) had to create that library function to quasi-fix the deficit in the basic language definition.

    Compare FORTRAN where input format handling is built in and constant across all implementations and does not require loading libraries.

    It is a tiny hot button of mine that language designers try to make the SMALLEST language spec that does what they want, often shorting the IO facilities, then leave it for someone else to fix it via library functions. Yes, it makes the compiler easier to write, smaller, and faster. BUT at the expense of having a load of junk that must be inserted into every program everyone writes forever… Include stdio much?…..

    Since input and output are FUNDAMENTAL functions of every language and program, just design it in…

    This trend has gotten worse over time, so clearly I’m the odd one out.

    Why not awk: there are a dozen languages that work, awk would be fine. As would Perl, or Ruby, or… Not a lot of awk users in the non-*nix world… (nor bash users…) so that’s why I was mostly looking for a generic language.

    Per masochistic bash programming:

    I’m as much a sick puppy as any programmer when it come to curiosity about writing obfuscated code… I like the obfuscated C contests and have occasionally indulged my desire to write VERY compact code. (See above bash example using substrings of string Z…) I just usually manage to suppress it… but not always. :-)

    So FWIW, I’m most likely to write the conversion code in 3 or 4 languages. FORTRAN, C, bash, and maybe something else too. Give folks choice. But that will be after I’ve finished the redesign process so I have the minimal set needed defined. (The above bash was just to satisfy my masochistic obfuscated code urge :-) and may or may not make it to the final version…)

  25. E.M.Smith says:

    Just to clarify my complaint about C and the “roll your own” problem with extracting, say, positions 12-36 of a string and stuffing it into another variable. Say you are using sscanf:

    (note that I’m ignoring the up-front need to decide to investigate scanf, fscanf, strcpy, strncpy, strtok, sscanf, etc. etc. to figure out what all of them do and which ones might, maybe, be useful for what you want done. It is assumed that “the experienced programmer” will have already done that a few times in the prior years of programming so is past that workload… you noobs are just out of luck, though; so go make more coffee as you have a lot of reading of man pages to do…)

    https://www.tutorialspoint.com/c_standard_library/c_function_sscanf

    In the sscanf function, the string specifier “%s” has this behaviour:

    String of characters. This will read subsequent characters until a whitespace is found (whitespace characters are considered to be blank, newline and tab).

    So unlike FORTRAN where you just say “read in positions 12-36 into variable FOO. Now I’ve got to skip over / handle / undo the behaviour of assuming “whitespace” is a field delimiter. I don’t have field delimiters in my FIxed Format Data… So I’m off to “go fish” land again…

    There are ways to handle this (there are ways to handle everything in C, just painful ways is all..)

    Anyone who cares to watch someone try to work through this process can look here:
    https://www.daniweb.com/programming/software-development/threads/285233/make-sscanf-skip-whitespace-characters

    Simple and easy it ain’t…

    So why not just suck out a substring? It was all of a couple of colons and length digits in bash above? Surely it’s something simple…

    https://www.linuxquestions.org/questions/programming-9/extract-substring-from-string-in-c-432620/

    Of course you can do this in C. Have a look at the following link where you will find all standard C string functions:
    http://www.cppreference.com/stdstring/index.html
    For your purpose you should use the function ‘strncpy’
    Here an example:
    Code:

    #include <string.h&*gt;
    #include <stdlib.h>
    
    main(){
      const char* from = "12345678";
      char *to = (char*) malloc(6);
      strncpy(to, from+2, 5);
    }
    

    […]
    charleykadet
    You have to put ‘\0’ at the end of the string…
    […]
    bgeddy

    Quote:

    You have to put '\0' at the end of the string...
    

    Yeah – but using strndup you don’t have to worry about null termination as it adds it and allocating memory as it does the malloc for you so ..

    Code:

    #include 
    
    main(){
      const char* from = "12345678";
      char *to;
      to=strndup(from+2, 5);
    }
    

    […]
    dwhitney67
    You also have to free any allocated memory, including if you use strdup().

    Here’s another take on what otherwise should have been a simple exercise:
    [long example left out -E.M.Smith]

    aryagaurav001

    //simple program to extract substring from a given string
    
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    
    void extract(char *,char *,char *,int,int);
    void main()
    {
    
    char s[50]="working with strings is fun";
    char t[50];
    char d[50];
    int pos,len;
    
    printf("enter the position and length to be extracted= ");
    scanf("%d%d",&pos,&len);
    
    
    printf("\n\n");
    extract(s,t,d,pos,len);
    puts(d);
    getch();
    }
    void extract(char *s,char *t,char *d,int pos,int len)
    {
    
    s=s+(pos-1);
    t=s+len;
    while(s!=t)
    {
    *d=*s;
    s++;
    d++;
    }
    *d='\0';
    }
    

    Doesn’t all that complexity and running in circles and having a dozen choices most of which don’t do the job for you make you feel all warm and important and like a Real Programmer? Not just some Crusty Old Fart doing
    FORMAT x11, A24
    and calling it done…

    Which is all a more painful but more complete way to illustrate my “complaint” about doing this in C. What ought to be a simple, regular, built in “Handle Fixed Format Data” function in the language instead has a whole gaggle of library functions that all do slightly different things, most of which are not what is needed, and trying to work around their quirks (like implicit white space as field separator) is more work than it is worth, while “rolling your own” isn’t simple (note the arguing among experienced programmers about how, and malloc and more).

    Heck, I’ve done it before and at this point I’ll need to reinvent that as it was several years ago and I blissfully tried to forget the experience…

    And like all things in my “love hate relationship” with C and *Nix: I love what it lets me do, and I hate how it forces me to do it. But once you have it done, you can pop it out again easy peasy… unless it’s been a few years and then you get sucked back into the 1001 ways and which one is the one that worked and where are the pit-falls and….

    So I knocked out that bash example in about 5 minutes just as a fun “I bet I can do this in just a few lines” bit of playing. Getting it working in C AND debugging it enough to assure no memory leaks and that I’m not doing something strange or stupid and… Well, that’s a bit of work.

    BTW, in FORTRAN I was done in about 2 minutes… Most of it spent making sure I knew where things were in the input string… Then spent the next few minutes adding “diagnostic prints” and comments so that, should I ever need to come back to it to fix something that changed, I’d be able to quickly inspect the input and output strings and have commentary about what was supposed to be going on.

    FWIW, this is one of my fairly few complaints about C. It does an awful lot of stuff really really well, especially down at the hardware and bit twiddle levels. But string handling and especially fixed format data not so much…

  26. Octave Fiddler says:

    I read somewhere that Jeff Id had written his entire business operation in R. He had some ‘interesting’ commentary on the experience. He manufactures LED luminaires, if I recall correctly.
    Unlikely he would have chosen to host it on your target machines…
    I guess the point of this is that he might be a guy to inspire you to soldier onward, but,
    having written the prior text, I imagine this doesn’t address your goals or motivations.
    I guess it is ‘interesting’ as an example of non-obvious deployment, ~functional non-obviousnes in his case.
    He was the guy who led me to you from a link on his page, albeit as cheifio until someone complained. I still misppelll it to this day.
    In some sense you guys are each heroic figures to me.

    OF

  27. E.M.Smith says:

    @Octave Fiddler:

    I’m not giving up on R and expect to see it return in the data analysis / plotting sections (currently in Python which has syntax much less attractive than R… but widely used so I “went there”…)

    It is just this tiny “glue ware” part that takes a flat file and inserts tabs where I’m likely to just skip over it. It is also the case that, having almost written it in R and then finding out I can’t run / debug as those libraries don’t work on the Pi…, I’m very likely to try it on the old x86 box I’ve got (also running Debian). That way I’d have the R version shown to work and “whenever” the libraries catch up on the ARM chips the code would be there; while folks on x86 / AMD64 PCs would be able to use “all R”…

    I mean, really, we’re talking about maybe 1/2 dozen active lines in most languages (C slightly more …) so why not?

    My major interest in providing an alternative to FORTRAN / Python is just to have a broader entry point. Folks with different language preferences able to use their language of choice both in this glue-ware stage and in the report writer. (The middle being all SQL ought to be pretty comfortable to just about any database person, and is the most common entry level database experience for folks new to database programming anyway; so no need to change it. There’s SQL versions on everything from ARM SBC’s to all of Linux / Unix to MicroSoft to Oracle / Sun / Big Iron; so no need to look for something that will work on whatever hardware folks have… since SQL already does ;-)

    IMHO, having exemplar reports / graphs in both Python and R ought to pretty much cover it for broad acceptance / flexible reporting. In the Scientific Analysis area, they are the two most used to replace FORTRAN and similar codes. (The Experienced C Programmer will be able to roll their own anyway and C++ is just C with some glued on O.O. Decorations ;-) so they are covered too…)

    Which lands us back at the Fixed Format to Tab Delimited glue-ware. Yes, FORTRAN works, but ask 10 people (mix of programmers and not) if they would like to install and use a FORTRAN compiler you are highly likely to be looked at very oddly before the laughter begins… Stupid, I know, but that’s what normy people are like.

    So OK, I’ve got it in inscrutable bash. That covers all of the *Nix world easily enough. Adding “some other language” ought to cover the rest of the non-Nix world (i.e. M.S. et. al.). Maybe I ought to write it in BASIC for them ;-) (I wonder if Debian has a BASIC compiler…. usually it is interpreted…)

    Oh well, it is what it is. Not exactly the biggest issue to look at / change.

    FWIW, I’ve been going over the database design. There’s a few “polish points” that clearly need doing (like putting fields in a consistent order between V3 and V4 versions of the same basic tables – anom3/anom4 mstats3/mstats4 etc.). One issue I’m struggling with is just the whole idea of leaving things as “one table per version” vs one BIG table with a functional version key field.

    Using discrete tables is cleaner and traversing any one table is fast with all the data local (no long seeks). It can make joins easier and updates are slower when adding the 2nd version (into a table with one version already loaded) than is the direct first load of data into a dedicated table by version.

    Using a functional key of version reduces the table count. At present only from 2 to 1 for any given function. But with v1 and v2 added, that’s 4 tables to one. And if I start adding minor digits? 2.3 vs 2.1 vs 2.0… So it is more extensible and in some ways “neater”; but at the expense of needing to put a ‘version test” in all sorts of places (joins, extracts, reports, graphs…)

    I did the “combine” in the yrcastats file (YeaRCountryAnomayStatisticS) and it was significantly harder to get the update to run in other than glacially slow time. Not that important on Big Iron but a big deal on the R. Pi. and similar small systems. Programming updates and reports / graphs was complicated in some cases too.

    So basically I’m looking at yrcastats and the anom3/4 temps3/4 mstats3/4 … and pondering which is “better”. For inventory, the two versions are dramatically different so combining them is not reasonable. Even for anom3/4 and temps3/4 the Station ID fields have dramatically different contents, so it will all be duplicated entries anyway (so not 2 temps in 2 versions under ONE stationID for any given station, but under 2 very different stationIDs for the same station / location).

    Given that it’s two entries in any case, I’m not seeing a lot of “upside” to combining the values into one table…

    What I’m thinking I’ll do is try the combined form when I add v2 (as it has the same stationID format / entries as v3 versions…) and see how that works out. Sort of “half a loaf” and then test the experience…

    Back on v1 the stationID is different yet again. Simpler than v2/v3 (and v4 is just an alien construct in comparison to prior versions…) but seems to have the same WMO number as the basic key.

    So that’s what I’m working on now. Chewing over how much table redesign and combining to do so that v2 (and maybe v1) can just be sucked in and added to the mix. (Each with their own ‘glue ware” too I expect…)

  28. E.M.Smith says:

    FWIW, an interesting listing of all the ways C and FORTRAN disagree and how to make them “all just get along…” together.

    https://www.math.utah.edu/software/c-with-fortran.html

    I’ve used this site before as it helps get past some of the “interaction” issues…

Anything to say?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.