How can I create a Coincidence Matrix in R using R Studio? - r

I want to create a conincidence matrix using R Studio for a decision tree that I have generated. I have done the same in SPSS but am not able to figure out how to do the same in R. I am attaching an image of how it looks in SPSS. If you could point me to the right resource or link that can tell me what the quivalent of this in R is, that would be very helpful. Thank you!!

First, please try and ask targeted questions. What have you tried? What packages have you explored? Where are you getting stuck?
Nonetheless, I would start by reading through this, A Short Introduction to the caret Package. Then, do this:
install.packages("caret")
library(caret)
?confusionMatrix

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.

"imagesc" function belongs to which packages and libraries in r?

After forming the matrix( which is my resultant image ) from certain data I am trying to display the image using the "imagesc" in r. The same thing I already had done in Matlab. To do the same in r I found out "imagesc" in r. but when I use this function it is showing the following error message
No documentation for ‘imagesc’ in specified packages and libraries:
you could try ‘??imagesc’
Even I already incorporated
library(R.matlab)
please help me to resolve the issue? I am a beginner in r programming.
You are looking for the function imagesc in the wrong package.
The package R.matlab doesn't have such function (see R.matlab).
You can find it in the matlab package, though.
So just do:
install.packages("matlab")
library(matlab)
and you'll be good to go with imagesc.
That said, if your task is going to be a recurrent one, I think it's a good idea to use native R solutions, instead of Matlab's. In such case, you may want to check ggplot2::geom_tile.
Check this image, for instance:

Uploading a dataset in winbugs from R

I would like to know how to upload a data set from R packages to winbugs.
In particular, "LearnBayes" package in R has too many data sets. I would like to use one of them in Winbugs.
Can anyone help me with this?
I came across this link because I have no idea what WinBugs data is suppose to look like but I don't know if it works. It's an R Function that supposedly changes the typical dataset into this list thing and I got the function working but still not able to get the dataset working but I'm really stupid so you might have better luck.

Can I use genetic distances in form of a .csv file to create a tree in R using ape ?

It is my first time using R for phylogenetics work and I was wondering if I could do that. It seems a rather trivial job and I think there must be a very small code for this, but I am unable to get it done. Any help appreciated!

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