Sentiment analysis in R (not using tm.plugin.tags) - r

I'm using R version 3.0.2 and have installed the package tm. Previously, I also loaded a package called tm.plugin.tags. To get a measure of whether a text corpus was positive or negative I used the following approach:
library('tm')
library('tm.plugin.tags')
pos <- tm_tag_score(TermDocumentMatrix(corpus, control = list(removePunctuation = TRUE)), tm_get_tags("Positiv"))
tm.plugin.tags seems to be no longer available for R. This was based on the following classification system http://www.wjh.harvard.edu/~inquirer/homecat.htm and I'm wondering if there is any other package or approach that I can use to achieve a similar result.
I have emailed the package maintainer of tm so I will post an update here once/if I receive a response.

You can install tm.plugin.tags using the following command
install.packages("tm.plugin.tags", repos = "http://datacube.wu.ac.at", type = "source")
This installs without any problem
Thanks
Cheers

Related

Unable to install the package rmetadata in R

My primary goal is to extract metadata of an article using the title and journal name. To do so, rmetadata package is useful according to the blog https://ropensci.org/blog/2013/03/15/r-metadata/. However, I'm unable to install the package using the install_github() function. Any help? Thanks!
The repo is now archived at https://github.com/ropensci-archive/rmetadata
It does install though, try remotes::install_github("ropensci-archive/rmetadata")
However, that package is no longer maintained. You probably want to use rcrossref, see the docs at https://docs.ropensci.org/rcrossref/. e.g.,
install.packages("rcrossref")
res = cr_works(flq = c(`query.container-title` = 'Ecology',
`query.bibliographic` = 'An assessment of statistical methods for
nonindependent data in ecological meta-analyses'))
See the Crossref API docs http://api.crossref.org/swagger-ui/index.html#/Works/get_works as well

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.

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.

Canonical correlation analysis with ade4

Was the cca function deprecated in R's ade4 package?
library(ade4)
cca(mammals, environment)
outputs
could not find function "cca"
I can't find any documentation on this error.
There is no cca function in ade4 package version 1.7-10. However, you can use cancor from base R like below
pop <- LifeCycleSavings[, 2:3]
oec <- LifeCycleSavings[, -(2:3)]
cancor(pop, oec)
Edited
Install version 1.7-4 using the following code
library(devtools)
install_version("ade4", version = "1.7-4", repos = "http://cran.us.r-project.org")
and then run
library(ade4)
May be is not available for the newest versions of the package. Nevertheless it is suggested to use cca{vegan}, which is form the vegan library.

R could not find function "checkAtAssignment" while running rworldmap

I need your help with R not being able to run a function with rworldmap package.
When using rworldmap package in R and trying to 'joinCountryData2Map'
sPDF <- joinCountryData2Map (myframe, joinCode = "NAME", nameJoinColumn = "location", verbose = TRUE, suggestForFailedCodes = TRUE )
I get the following error:
Error in mapWithData#data <- cbind(mapWithData#data, dF[matchPosnsInUserData, :
could not find function "checkAtAssignment"
Calls: joinCountryData2Map
Execution halted
My guess is that R needs methods package, which I could not find for my R version.
Any suggestings why I 'could not find function "checkAtAssignment"'?
My R version is 3.0.2 Patched.
Using rworldmap package requires loading library(methods). I am writing it here because it was really not obvious.
Dunno what "R 3.0.2 Patched" means, but yes you are correct that somehow you don't have the methods package, which is included in the standard installation package. How about reinstalling R from the binaries or source tarball at CRAN -- that should solve your problem.

Resources