edgarWebR started giving error related to xml2 package - r

This worked in mid-February, but stopped as of yesterday. It looks like there might have been some updates to xml2 subsequently, not sure if this is a factor.
library(edgarWebR)
filing_list <-
edgarWebR::company_filings(
as.character("AAPL"),
ownership = FALSE,
type = "10-K",
before = "2020207",
count = 40,
page = 1)
Error in xml2::url_absolute(res[[ref]], xml2::xml_url(doc)): Base URL must be length 1
Using xml2 1.3.0 and edgarWebR 1.0.1, but also tried previous versions of both.
Raised an issue with edgarWebR, but any pointers would be greatly appreciated.

I had the same exact problem and your post actually helped me fix it.
1: Go into 'packages' on RStudio and delete all versions of the xml2 package.
2: Restart R
3: Run these lines of code:
require(devtools)
install_version("xml2", version = "1.2.2", repos = "http://cran.us.r-project.org")
More info here https://support.rstudio.com/hc/en-us/articles/219949047-Installing-older-versions-of-packages

Author of edgarWebR here - I did a bit of debugging, here is the issue in xml2 I opened that, once fixed, should allow using a current version - https://github.com/r-lib/xml2/issues/300

Related

How to use function "get_data_structure"

I try to use the function "get_data_structure" but got an error as below.
Could anyone know how to fix it?
Thank you in advance
get_data_structure("DUR_D")
Error in data.frame(data_structure#concepts) :
trying to get slot "concepts" from an object (class "data.frame") that is not an S4 object
The problem appears to be a bug in the version of the OECD package on CRAN. If you install the development version, it works. First, close R and reopen a clean new session, then run this:
remotes::install_github("https://github.com/expersso/OECD")
library(OECD)
get_datasets()
get_data_structure("DUR_D")
remotes::install_github("https://github.com/expersso/OECD")
library(OECD)
dataset <- "DUR_D"
dstruc <- get_data_structure(dataset)
Try with get_dataset("DUR_D") i.e. without -s. as get_datasets() with -s will return a dataframe of available datasets.
It is a bug in the package OECD 0.2.5.
It works with the package version 0.2.4 which you can install from CRAN's archived package section (https://cran.r-project.org/src/contrib/Archive/OECD).
If you want to access the archived package version directly in R, use the following code:
devtools::install_version("OECD", version = "0.2.4", repos = "https://stat.ethz.ch/CRAN/")
Note that this requires the package 'devtools' to be installed.

Geomorph not functioning after update

I recently updated my MacBook air (2017) to the Mojave OS and proceeded to update my version of R and Rstudio. Unfortunately, ever since the 'plotTangentSpace' command no longer functions appropriately even when attempting to run the example 'plethodon' code from the Geomorph vingette, I always receive the following error in the output (bolded below):
data(plethodon)
Y.gpa<-gpagen(plethodon$land) #GPA-alignment
|====================================================================================| 100%
gp <- interaction(plethodon$species, plethodon$site)
plotTangentSpace(Y.gpa$coords, groups = gp)
Error in plotTangentSpace(Y.gpa$coords, groups = gp) :
unused arguments (Y.gpa$coords, groups = gp)
I have tried uninstalling and reinstalling R for a MacOS many times including versions 4.0.2, 3.6.3, 3.6.1, and 3.2.1. I have also uninstalled and reinstalled XQuartz several times.
If anyone has encountered a similar issue or has any other ideas I can try I would really appreciate the help. Thank you!
If you execute:
?plotTangentSpace
You should see that this is a deprecated function. That means you should not be using it. It says:
Notes for geomorph 3.3.0 and subsequent versions
I suspect you have not updated your copy of the vignette. There are instructions on the help page for an alternate approach. The example in the help page for the suggested function is:
data(plethspecies)
Y.gpa <- gpagen(plethspecies$land) #GPA-alignment
### Traditional PCA
PCA <- gm.prcomp(Y.gpa$coords)
summary(PCA)
plot(PCA, main = "PCA")
For the plethodon data they suggest:
PCA.w.phylo <- gm.prcomp(Y.gpa$coords, phy = plethspecies$phy)
summary(PCA.w.phylo)
plot(PCA.w.phylo, phylo = TRUE, main = "PCA.w.phylo")
So start a new session (to unload the currently loaded geomorph namespace, and execute this at the r session command line:
install.packages("geomorph")
You should be getting version 3.3.1 of the geomorph package.
I think I found the problem! In my case, the error was due to a old version of the package RRPP, which is required by Geomorph. After updating it, Geomorph is working perfectly! Hope this can be useful for you too.
I came across the same error but after updating the RRPP and rgl packages required for geomorph, the gm.prcomp() function worked for me. I hope this helps if you haven't figured it out already.

How do I deal with an error message while installing a package?

I am brand new to this so please forgive my inexperience...I'm trying to learn.
I'm attempting to install an R package called "Doublet Finder" using the specified code given on the Github site.
When I do this, I get this error immediately:
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
Being new to R, I'm not sure what this error means and when I google this something similar comes up and the individual removed and re-installed ALL of their libraries...that seems crazy. Does anyone have advice on what this could be, how to fix it, or why the package won't install?
Your problem seems to be fairly similar to this one. It might be the case that the dependencies (packages that Doublet Finder relies on) are outdated. What you can try is to follow these steps to uninstall and reinstall all packages with the hope that by updating packages there isn't a version mismatch.
This code is copied from the website above:
ip <- as.data.frame(installed.packages(lib.loc = .libPaths()[1]),
stringsAsFactors = FALSE)
head(ip)
str(ip)
path.lib <- unique(ip$LibPath)
# create a vector with all the names of the packages you want to remove
pkgs.to.remove <- ip[,1]
head(pkgs.to.remove)
str(pkgs.to.remove)
sapply(pkgs.to.remove, remove.packages, lib = path.lib)
sapply(pkgs.to.remove, install.packages, lib = path.lib)

how to add new R packages in azure machine learning for time series anomaly detection

I am trying to find out time series anomaly detection in which i need to install new R packages. In this i m following https://github.com/business-science/anomalize site. In this i needed to install 2 packages: tidyverse and anomalize.
can anyone help me on installing package mentioned above as I am getting
error "package or namespace load failed for tidyverse"
Also while adding zip of tidyverse and anomalize do I need to add any other packages and dependencies in that as I am adding only those 2 packages thinking there r no other dependencies I needed for those 2?
you can see in code that I created R_Package.zip and put tidyverse.zip and anomalize.zip in that that
dataset1 <- maml.mapInputPort(1)
data.set <- data.frame(installed.packages())
#install.packages(“src/R_Package/tidyverse_1.2.1.zip”, lib = “.”,
repos = NULL, verbose = TRUE);
#library(tidyverse, lib.loc=”.”, verbose=TRUE);
install.packages("src/tidyverse.zip",lib=".",repos=NULL,verbose=TRUE)
library(R_package, lib.loc = ".", verbose=TRUE);
install.packages("src/anomalize.zip",lib=".",repos=NULL,verbose=TRUE)
library(R_package, lib.loc = ".", verbose=TRUE);
#success <- library("tidyverse", lib.loc = ".",
logical.return = TRUE, verbose = TRUE)
#library(tidyverse)
maml.mapOutputPort("dataset1");
Regarding the error message, notice that it may take some time for the installed packages to become actually available; quoting from Adding R Packages In Azure ML blog post:
Note: In one instance, we ran into an issue where the package was not
loaded into the workspace immediately. We had to wait about half an
hour before we could use the package. You may be running into this
issue as well if you see a message that looks something like this
and you’ve used the above method to check which packages are in your
workspace and the package in question appears on that list. If this is
the case, we suggest waiting a bit before running your experiment
again.
AFAIK yes, you also need to add the package dependencies; the SO thread Install R Packages in Azure ML contains some useful hints.

Get the list of installed packages by user in R

How we can get the list of installed packages by user in R along with its version?
I know about the command installed.packages() which will give information about all packages (base or non-base). But how we can get those installed by user to have something like this:
Package Version
X 3.01
Y 2.0.1
Z 1.0.2
For all user installed packages (i.e. those package you installed via install.packages("X"))
ref
ip = as.data.frame(installed.packages()[,c(1,3:4)])
ip = ip[is.na(ip$Priority),1:2,drop=FALSE]
ip
I just found another ways to see the list of the packages without writing any code:
Open RStudio
Navigate to Help --> R Help (from the menu above)
You will see the help panel opened.
Then follow, Reference --> Packages
There you are.
OR
Open R console
Navigate to Help --> Html help
Then follow, Reference --> Packages
str(allPackage <- installed.packages(.Library, priority = "high"))
allPackage [, c(1,3:5)]
You will get all the active package List
Here's my solution.
tibble::tibble(
Package = names(installed.packages()[,3]),
Version = unname(installed.packages()[,3])
)
You can even filter some packages that you want to show.
pkg = tibble::tibble(
Package = names(installed.packages()[,3]),
Version = unname(installed.packages()[,3])
)
dplyr::filter(pkg, Package %in% c("tibble", "dplyr"))
If I develop an app or model and want to record the package versions used, I call sessionInfo()
One trick would be to use library() and a window with all the packages will pop up

Resources