Tried Everying, Searched Everything, Issues installing Quantstrat package from Github - r

Installing Quantstrat Issues. I am running the latest versions of R, RStudio, and Rtools. I have installed devtools / remotes packages and cannot seem to get quantstrat installed. enter image description here

I had similar problems too. Installing quantstrat via cmd works well for me. Here are the steps:
Create a folder for packages i.e RPackages\
Download the file from github to that specific folder and extract the files to the library name. i.e RPackages\quantstrat\
go on command line and goto RPackages
Type" R CMD build quantstrat
If it was successful, you will get a message like "building 'package_name_version_number.tar.gz'"
Now type: R CMD INSTALL package_name_version_number.tar.gz
Let me know if you have any other challenges.

I get the following error at step 4:
'R' is not recognized as an internal or external command,
operable program or batch file.
what do I need to do to overcome this.

Here is the fix that worked for me:
There could be version issues depending on what version of R that you have especially for Blotter and PerformanceAnalytics. Since PerformanceAnalytics to install blotter, you must ensure that version force compatibility and the easiest way is just to install it fresh. Start by installing PerformanceAnalytics then blotter then quantstrat and you should be in good shape. Use the code below and let me know how your results turn out. Took me a few hours to solve it, but just got it done today (7/27/2020)
install.packages("PerformanceAnalytics")
remotes::install_github("braverock/blotter")
remotes::install_github("braverock/quantstrat", force = TRUE)

Related

Difficulty installing a package in R linux, dalton_rqi

Downloaded package from below URL.
Attempted to install using below command; response shown.
library(dalton.rqi,lib.loc='/home/X/Desktop/')
Error: package ‘dalton.rqi’ was built before R 3.0.0: please re-install it
https://my.clevelandclinic.org/departments/anesthesiology/depts/outcomes-research/risk-quantification
It appears this is a compiled package that maybe I don't have the source for? Is there a way to force install of the package? I'm unable to install using Rstudio GUI in its current form as a zip. Tried repackaging to tar.gz has Rstudio was looking for and also had a non-zero exit status error.
Any ideas?
I'm afraid this can't be achieved directly. The error message says it well: to use a package in R it needs to be built on an R version matching yours.
I can suggest two ways to move forward:
Contact the authors, ask for the R sources (it is somewhat surprising they did not make them available in the first place), and build the package yourself.
Downgrade your R version as far back as needed to match the one this pre-built package used.

Error: package or namespace load failed for 'ggplot2': package 'ggplot2' was installed before R 4.0.0: please re-install it Execution halted

I'm really stuck and need some help.
After installing R 4.0.2, I'm getting this error message on R visualizations in Power BI Desktop which were previously working
"Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it.
Execution halted"
I already tried to:
reinstall R 4.0.2
reinstall RStudio
reinstall ggplot2
reinstall all packages
reinstall Power BI Desktop. My version is August-2020
Still it does not work.
Considerations:
My visualizations were working well before I installed R 4.0.2
My visualizations are working well on other PCs
When I run the code on RStudio I don't get any error
Any thoughts?
You probably need to go here: https://powerbi.microsoft.com/en-us/support/, but some guesses:
When you did the reinstall, you didn't clean up the old one, so you now have a mix of old and new versions of things. If you can run R code, run
system.file(package="ggplot2")
That's where it is finding the bad version of ggplot2. Get rid of it, and reinstall. If that's not enough, run
.libPaths()
in the broken copy of R. Completely eradicate every directory mentioned there, and reinstall R and all of your contributed packages. (I don't use Power BI, so this might also require you to wipe out some part of it: do so, and reinstall it.)
After all of this, run
packageDescription("ggplot2")
In the last line (or close to it) of what gets printed, you should see something like this:
Built: R 4.0.2; ; 2020-07-16 22:49:23 UTC; unix
If you see that it was built before 4.0.2, then either you missed deleting something, or you (or Microsoft) reinstalled some old version. Then it's probably time to contact that URL above.

RStudio and devtools do not install static vignettes

I created an R package for an introductory course in remote sensing with R (github link) and want to provide the handouts as as static PDF vignettes (copy protected) as described here. With the standard Linux commandline "R CMD build FEglobaleOekologie && R CMD INSTALL FEglobaleOekologie_0.0.1.tar.gz" everything works fine. However, when I install it from within my RStudio project or under MS Windows with devtools::install_github" there are no vignettes. The later one is the target platform, where I would like to have them.
Sadly I could not find any thread, that solves my problem. Can anyone tell what's going wrong here or what I am doing wrong?
I've run into problems like this, too. I've found that build doesn't always build my vignettes (that generally happens with using build in the RStudio menu, since I believe that doesn't include the vignettes by default ). You might want to try also running build_vignettes() before uploading to GitHub; and when installing from GitHub, explicitly including build_vignettes = TRUE in the install_github function. Otherwise, you may have a path issue for the installed package.

How to upload arules package in R

I am not able to upload arules package
Below is the following command I am using
library(arules)
I have downloaded the file from http://cran.r-project.org/web/packages/arules/index.html still it is not able to upload it.
Can anyone help me out
install.packages("arules")
pls. find below GUI - Screen for Rcmdr Package
Open RStudio.
Go to the “Packages” tab and click on “Install Packages”. The first time you’ll do this you’ll be prompted to choose a CRAN mirror. R will download all necessary files from the server you select here. Choose the location closest to you (probably “USA CA 1” or “USA CA 2”, which are housed at UC Berkeley and UCLA, respectively).
Install packages in Windows
Start typing “Rcmdr” until you see it appear in a list. Select the first option (or finish typing Rcmdr), ensure that “Install dependencies” is checked, and click “Install”.
Install Rcmdr in Windows
Wait while all the parts of the R Commander package are installed.
I had a similar problem. I solve it using
#install and load devtools to install directly from github
install("devtools")
library("devtools")
install_github("mhahsler/arules")
If you want to install "arules" package, you may not be able to install it just using the code below.
<< install.packages("arules") >>
follow the steps in order to solve problem:
go to the package's address and download it manually.you will find it in the link below:
https://cran.r-project.org/web/packages/arules/index.html
If you are using R-Studio just install that package you have got, by "tools" menu in your IDE (R-studio)
Tools->Install packages->...
brows the file in your computer and install it.
go to the command line and using library(arules) function test the package. If there is still an error it could belong to incompatibility of the package with the version of R (Not R-Studio or any other IDE that you are using), just upgrade R and try installation period again.
I had a related problem where I could not install arules after being able to successfully install many libraries. I finally learned that I needed to update to 3.4 for arules. In order to do that, I followed duckmayr's answer HERE. Then, I was able to install arules with no issues, and it worked.

How can I access Windows COM objects in R v3?

Some time ago, you used to be able to install the rcom package in R to use COM scripting (eg, access to external programs.) Unfortunately, it seems to be discontinued:
Package ‘rcom’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
This depends on statconnDCOM, which nowadays restricts use, contrary
to the CRAN policy for a package with a FOSS licence. See
http://rcom.univie.ac.at/ and http://www.statconn.com/.
Following the archive and statconn links and installing one of the older versions in R version 3 gives the error:
“Error: package ‘rcom’ was built before R 3.0.0: please re-install
it”.
I am not very familiar with R, but there seems no way around this message - after all, it occurs when installing, so re-installing doesn't seem to be the answer. It appears as though rcom is simply not available for recent (3.0+) versions of R. I have also scanned the package list, although searching for "COM" there returns over a hundred results and it is possible I missed the right one when clicking through them.
How can I use the rcom package, or use COM from within R some other way?
(Note: I am asking this question on behalf of a colleague. I have no experience with R myself at all. Both of us, when searching for answers, could not find anything. I am sure that others are also using COM in the latest version of R, though!)
I looked at the rcom source code a few months ago. It seems I can get it to build and install OK on R3.0.1. Below is the procedure if it helps.
Get a checkout of the latest source code of rcom. I have rcom_2.2-5.tar.gz locally. I can google something at the following address, but I have no idea of the provenance, so up to you to check it is legit. http://cran.open-source-solution.org/web/packages/rcom/index.html
in R do install.packages('rscproxy')
install Rtools as per the instructions on the R web site (http://cran.r-project.org/bin/windows/Rtools),
open a Windows command prompt i.e. run "CMD"
go to the folder containing the 'rcom' folder, and at the command prompt:
set R="c:\Program Files\R\R-3.0.1\bin\i386\R.exe"
%R% CMD check --no-manual rcom
check it passes without too many complaints. Your call as to the --no-manual option (if you have MiKTeX installed you may remove it)
%R% CMD INSTALL rcom
should result in
installing to c:/Rlib/rcom/libs/i386
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
rcom requires a current version of statconnDCOM installed.
To install statconnDCOM type
installstatconnDCOM()
This will download and install the current version of statconnDCOM
You will need a working Internet connection
because installation needs to download a file.
* DONE (rcom)
in R:
library(rcom)
installstatconnDCOM()
I tried a comRegisterRegistry() ; comRegisterServer()
; x<-comGetObject("Excel.Application") but I get a NULL for x. I am not a user of rcom so while it all seems to compile fine; it may just not work anymore.
If you happen to need to access .NET code, a viable option (and yes I have a vested interest in mentioning it) may be the rClr package.
Hope this helps; I'd be interested to hear how you go.
This really should be a comment, but I don't have enough rep points yet to leave one.
I found that the above steps did not work for me, but the answer posted by Lisa Ann on this question, RExcel in R 3.0.x, did solve my problem installing rcom. Since you need rcom to run RExcel, the initial steps to install RExcel cover installing rcom on newer versions of R (such as 3.0.2).
Specifically, following the advice on statconn's wiki, http://homepage.univie.ac.at/erich.neuwirth/php/rcomwiki/doku.php?id=wiki:how_to_install
You also need to follow these instructions if you upgrade R, i.e. you install a new >release of R after you have installed RExcel.
Download the statconn DCOM server and execute the program you downloaded
Start R as administrator (on Windows 7 you need to right-click the R icon and click the >corresponding item)
In R, run the following commands (you must start R as administrator to do this)
install.packages(c("rscproxy","rcom"),repos="http://rcom.univie.ac.at/download",lib=.Library)
library(rcom)
comRegisterRegistry()
Now you have rcom installed, [instructions for installing RExcel follow...]
New versions of rcom and rscproxy (also for current versions of R) are available from a different repository. Just use http://rcom.univie.ac.at/download as the R repository to install from and you can download and install binary versions of statconn packages from there.
Hope this helps!

Resources