Category "r"

Set panel label size in R::multipanelfigure

I am creating a multi panel figure that includes a ComplexHeatmap object so I am using multi_panel_figure() instead of ggarrange(). I have tried to include an

RShiny Deployment, CMake issue

I have written an app, which I can deploy on shinyapps.io with no problem from my old laptop with Windows 10, R version 4.1.0. When I try to deploy the exact sa

Not able to install V8 package on ubuntu?

I am trying to install V8 package on ubuntu but i am getting below error: Warning in install.packages : installation of package ‘V8’ had non-zero

Simple aggregation by id variables in R

I'm having a problem with the aggregate function. My data.frame looks like this: **Region Sex SNI value** orebro Man 0 497 orebro

How to check file size before opening?

How can I check the size of a file before I load it into R? For example: http://math.ucdenver.edu/RTutorial/titanic.txt I'd like to use the optimal command to o

How to export multiple function or packages in foreach loop in "R"

I'm trying to decrease run time of my code by using doParallel package in R. I'm calling a function awareRateSIR that some extra packages are used in the body

combine rows in data frame containing NA to make complete row

I know this is a duplicate Q but I can't seem to find the post again Using the following data df <- data.frame(A=c(1,1,2,2),B=c(NA,2,NA,4),C=c(3,NA,NA,5),D

Rstudio does not recognize MacTeX MacOSx 10.7.5, can't preview pdf

I have created an .md file, but to preview it in pdf format Rstudio requires MacTeX installation. I've installed it, read README file, everything is there, the

How to remove '.' from column names in a dataframe?

My dataframe which I read from a csv file has column names like this abc.def, ewf.asd.fkl, qqit.vsf.addw.coil I want to remove the '.' from all the names and

Xgboost tweedie: Why is the formula to get the prediction from the link = exp(link)/ 2?

When I run a Tweedie GLM, one can get the prediction from the link by doing exp(link). To get the prediction for a Tweedie GLM, I get the prediction from the li

How do you reorder categories on R using fct_recode()

I keep trying to reorder my variables using this function: ces2019 <- mutate(ces2019,vote_intention = fct_recode(vote_intention,"Certain Not to vote" = "(4)

R - Correlation heatmap created with ggplot2: How can I flip the labels on the y-axis?

I found this easy way to create a correlation heatmap using ggplot2: data(attitude) library(ggplot2) library(reshape2) ggplot(melt(cor(attitude)), aes(Var1,

How to install multiple packages?

How would I got about installing multiple packages in R? I tried the following code: install.packages("EIAdata", "gdata", "ggmap", "ggplot2","gridExtra","ISO

least square regression model

What is behind Approx and approxfun? I know that these two functions perform a linear interpolation, however I didn't find any reference on how they do that. I

List xlsx sheetnames with R

Is it possible to generate a list of sheetnames within an xlsx file? Or perhaps, can I check if a sheet name exists, and if not, proceed with some designated fu

Solving Intermediate Microeconomics Problems in R

Right now im trying to figure out how to solve standard constrained optimization problems in R which would usually be solved by hand with the use of a lagrangia

How to add Latex code in ggplot2 legend labels?

Consider the following example: p <- ggplot(data = data.frame(A=c(1,2,3,4,5,6,7,8),B=c(4,1,2,1,3,2,4,1),C=c("A","B","A","B","A","B","A","B"))) p <- p + g

Extracting coeftest results into a data frame

I'm trying to extract model coefficients from R into a data frame that I can then combine into one large dataset with some other model results from Stata. Using

Getting bounding box from leaflet in R

I am using R, RStudio and the leaflet package to visualise a map. I would like to get the the min and max lat-longs of of the bounding box of a leaflet object.

Barplot/barchart in R [duplicate]

I have a data table with two small columns. I want to do a pairwise comparison between the values. The first column is results of one test an