Questions tagged [r]
R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.
289
questions
0
votes
0
answers
43
views
Element does not exist in dataset when selected via selectInput
In the shiny app below I try to group by selected input but I get:
Caused by error in `all_of()`:
! Can't subset elements that don't exist.
✖ Element `abs_edu` doesn't exist.
This is my code:
library(...
0
votes
0
answers
41
views
Problem with dynamic linear model -> lagged variable explains 100% of my model [closed]
I created a regression model, which regresses a cycle component onto a lagged cycle component and various other variables.
It looks like this:
regoffice4 <- dynlm(
diff(diff(officecycle,1),1) ~ ...
0
votes
0
answers
46
views
Create a function that converts a dataframe into a format suitable for a treemap structure
I want to create a treemap for a dataframe using the Plotly package. For this purpose, I need to create a function that converts the dataframe into a format suitable for a treemap structure. On the ...
0
votes
1
answer
19
views
How to adjust x axis in coefficient plot with sjPlot's plot_model when x value range is smaller than -1,1?
I'm plotting multiple regression coefficients with plot_model and the x axis is automatically set to -1,1 even though the possible range of my values is smaller, which makes the estimates hard to see ...
1
vote
1
answer
23
views
as.ggplot in dendextend does not leave enough room for leaf labels
I've been using ggplot2 for automated report generation, and had been using ggdendro for accompanying dendrograms. However, as ggdendro seem to no longer be actively supported and I encountered this ...
2
votes
2
answers
52
views
Ploting weekly data with base::plot with unique and evenly spaced labels
I am trying to create a simple scatter plot, so weeks on the x-axis and "cases" on the y with each indicated by a dot and note I can only use base R's plot(), no ggplot.
I have data with 156 ...
-1
votes
0
answers
10
views
Regression tree's predicted results interpretation for type = "vector" in R [closed]
I am using rpart to build a CART model (method = "anova") and predict.rpart with type = "vector to make a prediction. I understand that that way is building a regression tree, but I ...
-1
votes
2
answers
52
views
R, ggplot2 - time on x axis
In R I have a data frame with bid and ask prices for a single day. Here is an example:
TimeHM; Bid_Price1; Ask_Price1
08:12; 101; 102
08:13; 101; 102
08:14; 102; 104
...
17:05; 104; 105
So, each new ...
0
votes
0
answers
28
views
Indicator Species Analysis Long Run Time [closed]
I am using the indicspecies R package to run an indicator species analysis on a large dataset to see what species are indicators for 3 different regions over the years 2001 to 2021. My matrix is ~550 ...
0
votes
1
answer
44
views
Equation not rendered in helper files of function of html pages [closed]
I am building a package and an associated website (via Github Pages). Let's say I have a function funX. In R, when I do ?funXI have some equations (using \eqn{} or \deqn{}) in the description files, ...
-1
votes
1
answer
29
views
How to change the background color of a Datatable header using css?
My question is similar to this question, except that I would like to use a css rule in an external css file.
6
votes
2
answers
96
views
How to capture install.packages output in R with sink()?
I'd like to capture all output and errors when installing a packages. The steps when installing a package, however, do not seem to be captured by the sink() command. Here's an example:
A main.R file:
...
0
votes
0
answers
24
views
R shiny app - rendering is much slower when run on remote server compared to local server
I made an R shiny app which runs perfectly in my local browser on my local server, however the rendering is noticeably slower when I run the same app from my local browser on a remote server. A quick ...
3
votes
1
answer
41
views
Keep ggplot font size constant in different figure dimensions
I'm in a position that requires me to frequently change the dimensions of my plots via the fig.dim=c(...,...) option in each r chunk.
However, I have a problem that I haven't been able to solve yet.
...
0
votes
0
answers
30
views
Issue with Residual Plot Pattern after Fitting beta_family Model in glmmTMB
I'm working with proportion data and have tried several models to address issues of overdispersion and underdispersion. Initially, I used a binomial distribution model which showed overdispersion. ...