Quantcast
Channel: Active questions tagged r - Stack Overflow

rv init can't find R

I'm trying to use rv on Windows to manage R packages in a environment. I managed to install rv from the x86_64-pc-windows-msvc zip from Github. rv does run in the terminal like...

View Article


What is the Proper Syntax to Fit a Random Intercept Model Using NLMER [closed]

I am using NLMER and a custom formula to try and fit a random intercept model:nlmer (as.formula ("ptlt_logit ~ logistic.model(visibility, y0, y100B, dy100.F, a, x0B, dx0.F, isF_num) ~ 1|ID"), data =...

View Article


as.character applied to factors in tibbles does not work when specifying...

I have a rather idiotic problem. Some-one gave me a tibble that looks a bit like the example t below:#useable sample data:t <- tibble(name = factor(c("A", "B", "C")), number = factor(c(3, 5, 2))) so...

View Article

Pivoting multiple columns from wide to long

I've seen this example: R Pivot multiple columns from wide to long. I don't understand the regex well at all, and I am struggling with how the procedure worked in this example.I have the following...

View Article

GET request to an API endpoint comes back as 403 forbidden even with headers...

I obtained an API endpoint url from inspection of a webpage. That endpoint is: "https://www.sofascore.com/api/v1/sport/esports/scheduled-events/2025-03-14". If I copy and paste this into a browser, it...

View Article


Image may be NSFW.
Clik here to view.

How to have flextable display a multi-line equation involving fractions

I would like to display this in a cell of a flextable:I'm working in an RMarkdown document that will Knit to Word. From my research, equations in flextables can either be rendered by writing in MathJax...

View Article

Image may be NSFW.
Clik here to view.

Fit and Predict Arima in R

I am trying to fit a Arima model in R with an independent variable (ARIMAX). The model fit data contains both positive and negative numbers. The issue is that after fitting the model, the predict...

View Article

Combining Multiple Cycles with a Complex Survey Design

I'm working on a project that requires combining multiple years of Crash Investigation Sampling System (CISS) data. I've already constructed the combined data set, and I'd like to utilize the svyglm()...

View Article


Print out plot with unicode symbol to PDF

I am using a Unicode symbol in my plot. It looks fine in RStudio, but when I try to save them to PDF, it disappears. How one can keep the Unicode symbols in PDF?library(ggplot2)plot <-...

View Article


How to hide digits from a rhandsontable element in Shiny

I understood that rhandsontable is based on the general handsontable JS library itself using the numebro JS library.However, it seems that numebro does not allow for rounding the display in R of a...

View Article

2–6 day bandpass 61 day lanczos filter in r code?

I want to run a 2–6 day bandpass 61 day lanczos filter on some environmental timeseries data in rI cant find a package for lanczos filtering, does anyone have any code that can help?Thanks!

View Article

Find coefficients (linear regression) for sum over two variables

I am trying to find the coefficients for a linear regression given some data.The following R code gives the coefficients:m8 <- lm(T ~ X + Y, A)summary(m8)I would now like to include one coefficient...

View Article

R.utils::withTimeout function not working with stan_glm

I am running many Bayesian models in parallel and want to skip models that take longer than a certain amount of time (e.g., 10 seconds).To do this, I wrapped rstanarm::stan_glm() inside...

View Article


How do I avoid title and axis labels being cut off in PDF?

I'm having some difficulty getting the PDF version of my plot to show the title and axis labels. They show up fine in the RStudio plot window, but get cut off in the PDF. I've tried a few things,...

View Article

Recoding in R without typing the original variable values?

I have a large dataset with several observations from the same participants. The participant identifier variable values are very long complex strings. I'd like to recode this variable so that...

View Article


Image may be NSFW.
Clik here to view.

Is simr::makeLmer overly stochastic? [migrated]

I love using the simr package for comparing the power of study designs. I like to work from pilot data. Here is a example pilot data...

View Article

Image may be NSFW.
Clik here to view.

1 " on R when using Stargazer for 6 multiple regressions">Receiving this Error "in if (is.na(s)) { : the condition has length > 1 " on...

I am currently doing some panel data regressions in R and I am trying to put multiple models side-by-side using stargazerWhen I put 5 panel data models using stargazer I receive an outputreglogglobal2...

View Article


How to avoid overlapping labels and error bars on a stacked bar plot (ggplot)?

I am trying to create a stacked bar plot with both error bars and sample sizes in R, using ggplot, geom_bar, and geom_errorbar. The labels and error bars are overlapping, and I'm trying to avoid...

View Article

Error: Error in if (sum1 = 1 - beta) { : missing value where TRUE/FALSE needed

`There exists r such...

View Article

How to GeoCode a simple address using Data Science Toolbox

I am fed up with Google's geocoding, and decided to try an alternative. The Data Science Toolkit (http://www.datasciencetoolkit.org) allows you to Geocode unlimited number of addresses. R has an...

View Article

Where is the R default path for MAC

I have entered some codes on R in a MAC and before closing R, it asks "Save workspace image?" and I clicked "Save", thinking it would save my codes. But I cannot find where is my codes? So where is the...

View Article


Cannot run mlflow in Rstudio

I'm trying to run mlflow on Rstudio on win system. I install mlflow package using this command install.packages("mlflow"). And then I run the following code,library(mlflow)mlflow_ui()This error is...

View Article


Change position of plotly hover box R

I would like to change the position of the hover box in a plotly bar chart. Rather than have it popup on the left or right, I would like it to popup above the bar. Is this possible? I've been googling...

View Article

Image may be NSFW.
Clik here to view.

Single legend for separate lines and points with specified colors and linetypes

I have the following dataset:x = seq(1,10)df1 <- rbind(data.frame(x, y = x^2, style = "lineA:1"), data.frame(x, y = x^3, style = "lineA:2"), data.frame(x, y = x^2-50, style = "lineB:1"),...

View Article

Image may be NSFW.
Clik here to view.

Plot lines and points on same plot with legend

I have a melted dataframe called dat. It includes 4 lines and 1 point data.I'm trying to give each line (and points) a color and a confidence interval (geom_ribbon) and also create a legend. cols <-...

View Article


Image may be NSFW.
Clik here to view.

Adjusting geom_linerange with position_dodge in ggplot2 [duplicate]

I'm trying to plot lines just beneath a series of probability distributions using ggplot2. The data are held in two different data frames where a common ID column determines their position on the...

View Article

Image may be NSFW.
Clik here to view.

R Shiny + plotly legend in sidebar?

I'd like to put the legend to one of my graphs in the sidebar of my shiny fluid-page. I had two ideas for this:Get the legend grob via ggplotly and put in sidebar orRender a legend with the same colors...

View Article

Why my code is becoming slower over long loop?

I have below code,library(data.table)library(dplyr) Number = 10 iSimu = 1 dat = as.data.table(matrix(0, nr = 1, nc = Number)) while (iSimu <= 500000) { NEW = sort(sample(( 0 + 1 * 100) : ((100 - 1)...

View Article

DataTable allow selection of certain cells only

The following app allows the user to click in the table and select cells. Is there a possibility to restrict certain columns from being selected? For example, I would like the user to only be able to...

View Article



JSON text not showing when switching from plumber to plumber2 api package

I have a series of API endpoints that return JSON responses with details on the success of a process launched by the API, including the messages from the R functions. When run using plumber, the...

View Article


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>