Stay up to date
We'll highlight new content in your collectives with a blue activity indicator on navigation items and posts.
Manage preferences
Questions
Browse questions with relevant R Language tags
73,512 questions
No answer
0
votes
0
answers
16
views
Download satellite data using http::GET but the files are incomplete
I'm trying to download lots of satellite data from a government website. When I download each file individually, by manually clicking the download button on the site, the files are about 13 MB each. ...
0
votes
0
answers
15
views
Pairwise T-test for Welch's F ANOVA
I need help with pairwise comparison following Welch's F test.
For your convenience, my minimal example is drawn from the example given in the R documentation.
df <- ToothGrowth
df$dose <- as....
-1
votes
0
answers
29
views
Query about DSEq2 package in R
I'm facing a problem to construct a DESeqDataSetFromMatrix data object. The code was
dds <- DESeqDataSetFromMatrix ( + countData = counts_data, + colData = col_data, + design = ~dex + )
# Error in ...
0
votes
0
answers
17
views
Repeated measures in RDA (aka "fixed" or "random" effects): why does Condition remove the contraints?
I'm running an RDA on a set of measures that have been taken in a landscape. For each landscape window, we've some parameters that describe the landscape there, and we've conducted, say, 10 measures ...
0
votes
0
answers
31
views
Customize flextable XML in Word documents using officer and flextable with new versions
I've extensively worked with older versions of the officer and flextable packages in R to create Word documents with tables. To achieve custom table formatting beyond the packages' default ...
1
vote
0
answers
46
views
Extracting polar coordinates from contour image in R for GAMMS
I am working with thousands of contour images that I will later use in a GAMMS analysis, so the output has to be structured as such. I'm struggling finding a way to do this, I DO know how to do data ...
2
votes
0
answers
84
views
Results changed after updating R
I just finishing a manuscript and getting ready for publication. However, when I updated r from 4.4.2 to 4.5.0 today, I triple checked some results and got different numbers. I am running latent ...
0
votes
0
answers
43
views
R Package doesn't show dataset tooptip message
I'm developing a package that contains datasets, but I can't see the tooltip of each dataset, despite the fact it's well documented, the documentation is right but I can't see it.
Here's a screenshot -...
0
votes
0
answers
31
views
Slingshot: no NA values but still 'Error in if (!useNames) { : missing value where TRUE/FALSE needed'
I am trying to run slingshot on my snRNA-seq data, but I keep getting the following error:
sce <- slingshot(sce, clusterLabels = sce$seurat_clusters, reducedDim = "UMAP")
Error in if (!...
0
votes
0
answers
27
views
Problem with foreach(). Why my simulation function works outside foreach()?
I have a 300-line script that defines the function sim(pars, n.sim).
The problem is in my attempt to use more than one core of my laptop.
I run my simulation, wrapping the right parameters like this:
...
0
votes
0
answers
37
views
ggplot2: use dynamic nudge_y with geom_text and facet_wrap for later converting with ggplotly()
I want to plot several time series against a benchmark using R.
#Example:
library(tidyverse)
library(lubridate)
# Define the date range
date_range <- seq.Date(from = as_date("2025-01-01")...
1
vote
0
answers
47
views
How to make EPSG 4326 into an orthographic map?
I have been using the code below (adapted from this StackOverflow code):
library(sf)
library(ggplot2)
library(rnaturalearth)
antarctica <- ne_countries(continent = 'Antarctica', scale = 'large') |&...
1
vote
0
answers
43
views
Howto uncompress Oracle BLOB in R
I am under R (the statistic tool, rev 4.2.3 under Rstudio on Windows 10, with Rtools 4.2) and I access an Oracle Database with RODBC (I haven't Roracle, but if it could solves my problem, I can ...
0
votes
0
answers
35
views
Issue with JuliaCall function julia_setup
I'm getting an error when running the julia set up command
jl_home<-"C:/Users/[INSERT_USER_HERE]/AppData/Local/Programs/Julia-1.11.4/bin"
julia_setup(jl_home)
returns:
Julia version 1.11....
2
votes
0
answers
105
views
Can't make `future` work in parallel and concurrently on several (logical) cores
Within a Shiny app, a task that is triggered by a button is taking quite a long time to complete (synchronous sequential code).
That's why I want to split this task over several (logical) cores of my ...
0
votes
0
answers
52
views
Roxygen error Block must have an @name for a function in a package
I'm developing a package (PCRA) to which I am trying to add the function cusumActMgr. I create cusumActMgr.R under PCRA > R, and then try and Roxygenize the package by typing devtools::document(). ...
4
votes
0
answers
86
views
R check has 403 errors for stackoverflow URLs
My R package has several references to URLs, especially in its NEWS.md file.
These have never caused problems until now; but a recent R CMD check with my package had messages like this:
Found the ...
0
votes
0
answers
52
views
R - Friedman test: Unreplicated complete block design. How to fix?
I have a big data set.
I'm trying to run Friedman's test since this is an appropriate transformation for my data for a two-way ranked measures ANOVA.
But I get unreplicated complete block design error ...
1
vote
0
answers
50
views
Why mathematical expressions not working in panel.labels argument of tm_layout() in tmap v.4?
I am trying to have mathematical expression in the panel labels. It was working with tmap version 3. I am using the following code:
library(tmap)
library(terra)
library(sf)
r <- rast(system.file(&...
1
vote
0
answers
74
views
How Can I Transfer SQL Query Results from RStudio's SQL Tab into an R Variable?
I'm struggling to transfer SQL query results into R after successfully retrieving data in RStudio's SQL Results tab.
What I've Done So Far
Connected to the database via RStudio's "Connections&...
0
votes
0
answers
48
views
How do I capture an info response from the googledrive API to a text file using sink() in R?
I feel like this might be a really dumb question, but I've spent all day trying and failing to get it to work. I have a an R script that will be run automatically overnight, and in it I copy a file ...
0
votes
0
answers
45
views
Access objects by addresses / pointers in R
Why is it that when I update the pointer in the hash table y=hashtab() which points to z$x=c(1,2,3), I don't update z$x automatically?
> library(pointr)
> ptr("mypointer", "z$x&...
0
votes
0
answers
41
views
TidySDM non-conformable arguments model evaluation error in Ecological Niche Model with subsetted data
I am making ecological niche models in TidySDM in R. I recently made a range-wide model using 5 fold random cross validation, grid set to 100, and algorithms that included GLM, GBM, MAXENT, and MARS. ...
0
votes
0
answers
47
views
Create a new version of the train set for each fold of cross validation
I have a clinical dataset in which there are repeated daily measurements for each patient (eg. 600 patients x 10 daily measurements/patient = 6000 patient days/rows).
I am trying to train ML models to ...
0
votes
0
answers
33
views
Having trouble with weighted cumulative exposure package (WCE) in rstudio
I'm having trouble fitting a WCE model in R using the WCE package with drug exposure interval data. Can't post data here but im testing on a smaller dataset with 40k individuals with a maximum of 23 ...
0
votes
0
answers
48
views
R LineupJS creating a Matrix data type column
On the lineup website, they have an example of a Matrix item type that I am not sure how to recreate in an R dataset that allows you to make a sparkline/heatmap column-
https://lineup.js.org/app/#...
0
votes
0
answers
38
views
How do I knit in Rstudio correctly?
The code below runs smoothly in R but as soon as I try to knit to pdf there is an error.
A file that is clearly in my file library, suddenly can't be read.
(library("seqinr")
read.alignment(&...
0
votes
0
answers
27
views
Can't combine Plotly plot with RMarkdown PDF in Shiny app (LaTeX failed to compile error)
I'm trying to combine a Plotly plot and user text responses into a PDF report generated from an RMarkdown file in a Shiny app.
The downloadHandler part for "Download Plot (PNG)" works and I ...
0
votes
0
answers
38
views
How to access a package loaded with devtools::load_all() when using foreach?
I'm working on an R package 'mypkg' and use devtools::load_all() inside an Rstudio project to simulate what loading it would look like after making changes. This works fine for all my code except for ...
0
votes
0
answers
50
views
Expand rows in gt table
I would like to expand/collapse some rows using gt package. I'm trying to replace the following code. Unfortunately, it doesn't work while having the latest version of the package:
library(gt)
...
0
votes
0
answers
31
views
Using pec with xgboost in R
Is there a way to use the R "pec" package with an R xgboost survival model, i.e., an xgboost model from package xgboost, with objective="survival:cox", eval_metric= "cox-...
1
vote
0
answers
41
views
How to plot a draw stat_function for a shorter domain in ggplot2 and r markdown?
I draw the following plot in R embedded in an Rmd file:
However I need the gray lines demand_firm and demand_firm3 functions to stop in the black dots Eand B, however the domain is defined for the ...
0
votes
0
answers
47
views
How to Resolve Special Character Encoding Problems in R When Using Remote Desktop?
I need help on how to solve a problem encoding special characters in R.
I am working on a data warehouse project stored in slq server. The data is in French and when I do my calculations, I encounter ...
0
votes
0
answers
37
views
Custom Priority with Reneging
I'm trying to implement custom priority in simmeR alongside reneging behaviour.
The latter is explained well in the documentation through the renege_if workaround. The former is easily done by adding ...
0
votes
0
answers
50
views
Changing CRS works, but does not transform data
I have a SP object grid_cells_sf which:
> head(grid_cells_sf)
Simple feature collection with 6 features and 1 field
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: -21850.69 ymin: ...
0
votes
0
answers
46
views
Is there a way to accept user input in R on Replit?
I've developed an R program to help comic collectors organize and sort their collections on Replit. If the user uploads a Google Doc of their collection, the program can print out basic descriptive ...
2
votes
0
answers
50
views
Keep unused levels in plotly barchart
My data features a factor, where not all levels are present in the data. I want to draw a bar chart, but keep all levels in the legend.
In the following plot you can see that the legend features only ...
0
votes
0
answers
11
views
How to modify axis and legend ticks in a beta diversity ternary plot using ggtern in R?
I'm using the ggtern package in R to create a beta diversity ternary plot, but I'm facing a few issues:
I don't know how to modify the axis ticks to display the range from 0 to 1.
I want to adjust the ...
0
votes
0
answers
90
views
Applying font style in ggplot text
I am trying to apply font style to the text in my ggplot. Below is my code
library(ggplot2)
library(ggpp)
set.seed(1)
dat = data.frame(x = rnorm(100), y = rnorm(100))
Text = list('x' = list(letters[1:...
1
vote
0
answers
32
views
Removing small boxes from legend in ggplot2 and ggOceanMaps
I would like to remove the black boxes present in the legend visible in that graph :
The expected result should look like that :
Here is the example of the data used for the plot :
df_map <- ...
0
votes
0
answers
46
views
Print mice imputed glmmTMB conditional and zero-inflated model side-by-side with modelsummary
Consider the following estimate:
library(glmmTMB)
library(mice)
Owls <- Owls
Owls[sample(1:nrow(Owls),10), "ArrivalTime"] <- NA
predictorMatrix <- quickpred(
Owls,
include = ...
2
votes
0
answers
39
views
Adding nested lists using xmlrpc2 package
I'm trying to integrate R with Odoo using the XML-RPC API and the xmlrpc2 package in R. When trying to get the result from the response using result <- from_xmlrpc(content(response, as = "text&...
1
vote
0
answers
32
views
1-D flow model in lsode in r
I want to create a very simple stream model in R for demonstration purposes, and I want to use the deSolve package to keep things fast. What I would like to do is have a vector of each concentration ...
0
votes
0
answers
43
views
ggsurvfit Kaplan Meier risk table customisation
Does anyone known how to customize the risk table below the plot using ggsurvfit such that for one cohort all the values are set to NC (not calculated) instead of the N at risk that is presented ...
0
votes
0
answers
23
views
Extracting WAIC using rjags::jags.samples() from single chain of bayesian model run in parallel with JagsUI
I am using JagsUI to run many single and multi-predictor models, using the autojags() function to run them until convergence. I would like to do model selection using WAIC, rather than DIC. The JagsUI ...
0
votes
0
answers
40
views
problem with glmmTMB with a matern for spatial autocorrelation
I have a dataset of bird counts, on a spatial grid, with environmental and prey data.
I have applied a correction factor for distance from observers, so I have semi-continuous values, with lots of 0's ...
0
votes
0
answers
64
views
Can I use the segmented package with a generalized linear mixed model?
I am working on a grant proposal evaluating the effectiveness of an intervention on several different groups of hospitals and after some statistical consulting have landed on using a generalized ...
5
votes
0
answers
134
views
Is accessing data and mapping from a ggplot object an API?
So I have a few technical questions on the ggplot2 API. Background is, that I'm using ggplot2 and access the $data and $mapping fields in a package I'm writing. I want to use as little undocumented ...
0
votes
0
answers
19
views
RStudio Rmarkdown Visual output abbreviates column values to column name width
Source and Visual are two Rmarkdown views in RStudio, switchable using Ctrl+Shift+F4.
Works fine in the Source Rmarkdown view (and in the console).
Works fine in Visual Rmarkdown view if the column ...
0
votes
0
answers
65
views
Unable to install package (StepReg)
I am unable to install the StepReg package with R (version 4.2.2) and R -Studio on Linux 12 Debian Bookworm, the output from my attempted package install using the install.package("StepReg") ...
Members can contribute articles
Simply submit a proposal, get it approved, and publish it.
See how the process works
Simply submit a proposal, get it approved, and publish it.
See how the process works