"imagesc" function belongs to which packages and libraries in r? - 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:

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.

Is there a function that will tell me which packages other R functions are in?

How can I find what package a function is in?
I'm just learning R and sometimes know what function I want but can't remember which package it's in - is there another function or easy way to look this up? The github cheatsheets show which functions are in a package, but I'm looking for the reverse - I've been googling but looking for a function etc. to find this. Thanks!

Hierarchical bar charts in r

I'm working on a visualization project in R and thought of creating bar charts for hierarchical data (states with constituencies in it, each constituency possessing a numeric value).
I came across this web page (https://observablehq.com/#d3/hierarchical-bar-chart) which implements exactly this using library "d3" but for JavaScript.
Is there any similar library in R to do this?
I also had similar question before! But I couldn't find any package or code online that does the same thing in R, the closest thing I found was "r2d3" package which allows you to run javascript in R.
So by leveraging the "r2d3" package, I was able to replicate it and put it into a function call "hbar", you can directly source it from my github with the code below:
source("https://raw.githubusercontent.com/JohnnyPeng123/hierarchical_bar_chart-/master/hbar.r")
For more details and use case please follow the link below:
https://github.com/JohnnyPeng123/hierarchical_bar_chart-
Let me know if you need any help in terms of using this function.
You can use ggplot.
If you need more help, please share a reproductive example.

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

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

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!

Resources