R functions using SentiWordNet - r

I am doing sentiment analysis and text mining on an e-mail box dedicated for client feedback. I use R for this work. I based the sentiment analysis on the work done by Jeffrey Breen. It works fine but I want to take it a step further. During my research I came across SentiWordnet.
I searched for R-code/functions to be able to apply SentiWordNet but only came up with Java and Python resources. I am not at all familiar with either of these.
Is there someone who applied SentiWordNet in R? I will appreciate any assistance.

As of 2019 the Lexicon package by Tyler Rinker (available on CRAN) contains the SentiWordnet dataset.

I can't find any example of SentiWordNet accessed solely from R, however you could call the Python package from R using rPython, or the Java implementation using rJava (some notes provided here). Unfortunately the python implementation is not currently available for Windows.

Related

Using ConsRank in R Studio

Installed both R studio and ConsRank package but i have little R and Math knowledge.
I need to understand how to calculate and reach the result of the formula in attached files.
To solve this problem, correlation coefficient τx used which is intruduced by Emond and Mason (2002)
I tried to use ConsRank functions but my R knowledge was not enough.
FormulaFormula
MatrixMatrix
ResultResult
The first step is to install and load the package ConsRank using the following codes:
install.packages('ConsRank', dependencies=T)
library(ConsRank)
If you successfully load the package, you are good to go. The next step is to read the documentation of the package (Click Here) in which you will learn about what functions you will need and there are some different examples that help you understand the input and outputs.
Let me know if you needed any help running your scripts. Good Luck.

Importing quiz questions created using the R exams package into canvas

I have been using the R exams package to create exams for my introductory statistics course this semester. It is really a great tool! I've been able to create several questions from scratch & import them to canvas without issue. However, there are some questions that give me problems when I try to import them (e.g., the anova and boxplot examples that are included in the package). I can successfully import if I use:
R> library("exams")
R> set.seed(1)
R> exams2canvas("anova.Rmd")
However, I sometimes run into problems when trying to create many versions of the same question:
R> library("exams")
R> exams2canvas("anova.Rmd", n=50)
TL;DR
The source of the problems are multiple-choice exercises with no correct alternative. These are not supported by learning management systems like Canvas or Moodle and hence exercises for these systems must assure at least one correct alternative and one wrong alternative.
Demo exercises
Some of the demo exercises in R/exams did not restrict the number of correct/wrong alternatives to a minimum of one. So from time to time it could happen that no alternative is correct. Up to version 2.3-6 of R/exams this affects the following exercises:
anova,
automaton,
boxplots,
cholesky,
relfreq,
scatterplot.
All of these have been adapted in version 2.4-0 (which was the development version of the package at the time of writing this answer).
Background
Multiple-choice exercises without correct alternatives are straightforward to handle without partial credits when the entire answer pattern must be fully correct. However, when using partial credits, no positive points can be obtained when there are no correct alternatives.
When we created the demo exercises in R/exams we adapted exercises from an environment where we did not use partial credits. But learning management systems like Moodle or Canvas expect at least one correct (and typically also one wrong) alternative for scoring it correctly with partial credits.

Bivariate Poisson Regression in R?

I found a package 'bivpois' for R which evaluates a model for two related poisson processes (for example, the number of goals by the home and the away team in a soccer game). However, this package seems to no longer be useable in newer versions of R.
Is there a reasonable way to modify the glm() function to do a similar process, or run this older package on my new version of R? I have found very little literature on these sorts of processes and have found very little in terms of easy implementation in other statistical packages like STATA.
Any suggestions would be much appreciated.
While CRAN does not host a current binary of bivpois, you can build the package from the archived source code (see http://cran.r-project.org/doc/manuals/R-exts.html#Checking-and-building-packages ). Building bivpois 0.50-3.1 from source (available at http://cran.r-project.org/src/contrib/Archive/bivpois/) works for me on R 2.15.0 Windows x64. The zipped Windows binary I built is available here: http://commondatastorage.googleapis.com/jthetzel-public/bivpois_0.50-3.1.zip .
You can feel free to refer to odds modelling and testing inefficiency of sports-bookmakersas I had modified the relevant functions inside bivpois package.

Namespaces in R packages

How do people learn about giving an R package a namespace? I find the documention in "R Extensions" fine, but I don't really get what is happening when a variable is imported or exported - I need a dummy's guide to these directives.
How do you decide what is exported? Is it just everything that really shouldn't required the pkg:::var syntax? What about imports?
Do imports make it easier to ensure that your use of other package functions doesn't get confused when function names overlap?
Are there special considerations for S4 classes?
Packages that I'm familiar with that use namespaces such as sp and rgdal are quite complicated - are there simple examples that could make things clearer?
I have a start on an answer on the devtools wiki: https://r-pkgs.org/Metadata.html
Few years later here....
I consolidated findings from Chambers, other StackOverflow posts, and lots of tinkering in R:
https://blog.thatbuthow.com/how-r-searches-and-finds-stuff/
This is less about implementing NAMESPACE/IMPORTS/DEPENDS and more about the purpose of these structures. Answers some of your questions.
The clearest explanation I've read is in John Chambers' Software for Data Analysis: Programming with R, page 103. I don't know of any free online explanations that are better than what you've already found in the R Extensions manual.
You could also pick an easy, small package and follow it.
I semi-randomly looked at digest which is one of my smaller packages. I loads a (small) dynamic library and exports one symbol, the digest() function. Here is the content of the NAMESPACE file:
## package has dynamic library
useDynLib(digest)
## and one and only one core function
export(digest)
Have a look at the rest of the source files and maybe try to read Writing R Extensions alongside looking at the example, and do some experiments.
http://www.stat.uiowa.edu/~luke/R/namespaces/morenames.pdf

Step-by-Step How-to on Mediation Analysis in R

I'd like to know if anybody can provide a step-by-step how to on how to use mediation analysis using Keele, Tingley, Yamamoto and Imai's mediation package. I think there are two approaches to this - the classic Baron and Kenny (1986) and the new one by Preacher, Rucker and Hayes (2007) - I'd like to know how to do both approaches in R
In case you not familiar with R and packages, start with
install.packages(mediation)
to download and install the package from CRAN. Then do
library(help=mediation)
for a high-level view of the package, and available help files. Then use
library(mediation)
help(mediate)
to load the package and read the help page. The example can be run via
example(mediate)
and you can run the other example for sensitivity analysis via
example(medsens)
This vignette is what you are looking for, if the above answer isn't enough.
It's about as hand-holdy as you can get with this sort of thing.

Resources