This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Hmisc Package error

Hi All,

I am working on a project which is based on R 4.0.3 and I am trying to install the packages the Hmisc is showing me below error.

Error: Error installing package 'Hmisc':
=================================

* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c Hmisc.c -o Hmisc.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c cidxcn.f -o cidxcn.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c cidxcp.f -o cidxcp.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c hoeffd.f -o hoeffd.o
gcc -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c init.c -o init.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c jacklins.f -o jacklins.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c largrec.f -o largrec.o
gcc -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c mChoice.c -o mChoice.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c maxempr.f -o maxempr.o
gcc -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c nstr.c -o nstr.o
gcc -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c ranksort.c -o ranksort.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c rcorr.f -o rcorr.o
gcc -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c string_box.c -o string_box.o
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2  -c wclosest.f -o wclosest.o
gcc -shared -L/opt/R/4.0.3/lib/R/lib -L/usr/local/lib -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o init.o jacklins.o largrec.o mChoice.o maxempr.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -lm -lquadmath -L/opt/R/4.0.3/lib/R/lib -lR
installing to /global/scripts/renv/staging/1/00LOCK-Hmisc/00new/Hmisc/libs

** R
Error in parse(outFile) : 
  /tmp/Rtmpg2BJKg/R.INSTALL2bc4f60b37c/Hmisc/R/describe.s:1442:63: unexpected '>'

1441:   
1442:   b <- gt::gt(a)                                             |>
                                                                              ^

ERROR: unable to collate and parse R files for package ‘Hmisc’
* removing ‘/global/scripts/renv/staging/1/Hmisc’
install of package 'Hmisc' failed [error code 1]  

Could anyone please help me with this? Any help or suggestions will be appreciated.

Thank you for your time and help!

r hmisc

1 answer

This is just a possible guess, but the |> is a somewhat-new (native) pipe operator in R (I think introduced in R v4.1.0?). Since you have a somewhat older R version, my guess is that it doesn't have this operator which seems to be used by Hmisc, hence causing the error when trying to install the package. Possibly try updating your R version to a more recent one and trying again to see if that might fix it.

Hi DGTools, thanks for the quick reply. I do check that and also find that |> this is in multiple places in Hmisc (describe.s file). But problem is that I have to do this project in R 4.0.3.

What you can do is try to install an older version of the package. From the changelog file (https://github.com/harrelfe/Hmisc/blob/ba7a280421f232d25342eb31e21a70f16aa9823c/NEWS#L16), it seems the new pipe operator was introduced in Hmisc v5.1-2, so you can try getting an earlier version than that. Posit has some instructions on this (e.g. https://support.posit.co/hc/en-us/articles/219949047-Installing-older-versions-of-packages) which could help with installing an older version of a package.

i.e.

packageurl <- "https://cran.r-project.org/src/contrib/Archive/Hmisc/Hmisc_5.1-0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

It worked with Hmisc v4.6-0 and also it required pammtools_0.5.7.

Thank you so much for your help.

Log in to answer this question.