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,373 questions
No answer
0
votes
0
answers
18
views
Making data.frames of different lengths the same length based on same values in one column across data.frames (or: how to manage subsetting)
I am working with 14 data.frames, each is a year's worth of crime data from NIBRS. The files are titled NIBRS2010, NIBRS2011 . . . NIBRS2023. Each of them has a different number of observations, but ...
1
vote
0
answers
32
views
Control the size of the output plot in R notebook in Positron
I want to control the size of the output plot in Positron in R ipynb notebooks.
In RStudio in markdown, I would start the chunk with {r fig.width=9,fig.height=5} and I could resize the plot to fit my ...
2
votes
0
answers
34
views
R expressions for branch labels in `rpart` object
Given an rpart object representing a classification tree, I want to represent each split in the tree as an expression in R syntax.
This is almost possible using the labels generated by plotting or ...
1
vote
0
answers
31
views
Run reticulate::py_require() once on package installation
We have an internal python library that we want to build an R wrapper for. The python package only needs to be installed once and not every time. The documentation says to use py_require() over ...
1
vote
0
answers
29
views
shinybusy does not work in bslib::page_navbar
I would like to use the shinybusy package to display a custom GIF as busy indicator at start up. While it works well in a fluidPage, using bslib::page_navbar throws an error :
Here the code I used, ...
1
vote
0
answers
69
views
Is there a way to offset the phase of the pattern in geom_abline()?
I have 2 parallel, sometimes overlapping lines of different colors that I create with geom_abline(). Here's a basic example:
ggplot(data.frame(x=1:5,y=1:5)) +
geom_point(aes(x=x,y=y)) +
geom_abline(...
4
votes
0
answers
44
views
Using @inheritParams for arguments from another package gets CRAN warning about missing package anchors
I have a package that has existed quietly and happily on CRAN for some years but in the last few months have received this NOTE accompanied by email warnings that the package will be withdrawn if I ...
2
votes
0
answers
33
views
RODBC for MacOS M4 Sequoia with Windows Authentication to MS SQL Server
I recently got a Macbook Pro with M4 processor and Sequoia OS. I have been using Windows machine for a while and now trying to figure out my settings.
In my PC, I was able to use Windows ODBC ...
2
votes
0
answers
49
views
Trying to add a graphs series to high carter in R
I am trying to add a MACD graph section to the highcharter graph similar to volume section.
I have the code for creating same.
Not sure as how they will be added as seperate section similar to volume.
...
1
vote
0
answers
19
views
How to write a group attribute using ncdf4?
It appears from the ncdf4 documentation (and my trials) that in R, I can define a global attribute by:
ncatt_put(mync,0,'att_name','attribute_text')
I can define a variable attribute in a group by:
...
1
vote
0
answers
24
views
ExportFiles() from REDCapAPI not finding files
I'm working on transferring a legacy project with many file attachments to a new REDCap build and using the exportFiles() function to export the files. I’m running into an issue where I receive the ...
1
vote
0
answers
42
views
how to use a shiny app to edit onedrive files?
I currently have a shiny app at "mycompany.shinyapps.io/myapp" that has access to read/change/create files inside a folder on google drive. All I needed to do is create a service account for ...
1
vote
0
answers
66
views
R with Reticulate crashes on MacMini and not on Windows
I want to use the Python versions of TabPFN and AutoGluon via the reticulate package in R. When I run the code on my laptop (Windows), everything works fine. However, as soon as I run the same code on ...
0
votes
0
answers
14
views
adonis2() and pairwise.adonis2() how to include structure from the permutation package?
I am fairly confident (maybe I should not be) that I have structured my data correctly for PERMANOVA analysis in the vegan package using the adonis2() function.
For my study design, I placed paired ...
0
votes
0
answers
37
views
Shiny components not laying out like expected
I am trying to make a modular navbar (and eventually sidebar) with some branding to be used across multiple different Shiny applications. Please note: I mean navbar in a general sense, not in the ...
0
votes
0
answers
59
views
Load multiple xlsx files from folder tree into R as list
I have a folder structure along a path like this: ":/Users/XXX/Individual reports/". Within this Individual Reports folder, there is a folder for every state and within each state folder ...
0
votes
0
answers
20
views
Error in solve.QP(Dmat = H, dvec = -c, Amat = t(Aneq), bvec = bneq) : constraints are inconsistent, no solution
Can someone help me with this R code. It's a quadratic optimization problem and something is wrong, as I get an error:
Error in solve.QP(Dmat = H, dvec = -c, Amat = t(Aneq), bvec = bneq) : constraints ...
0
votes
0
answers
59
views
Unable to get 95% CI from nls.lm: singular Hessian issue
I fitted a nonlinear model to the data using the minpack.lm::nls.lm function. Below is the output:
Parameters:
Estimate Std. Error t value Pr(>|t|)
a 1.379e+02 3.242e+00 42.527 <2e-16 ...
0
votes
0
answers
39
views
read.tree() works in RStudio but not in University Computing Cluster
I am trying to do some Bayesian phylogenetic analysis on a university computing cluster, to do which I am first downloading 1000 phylogenetic trees to include in my analysis. To import the trees, I ...
0
votes
0
answers
48
views
R package tmap: unable to overlay points on county, ZCTA or any other type of border shape file
I have successfully plotted points overlaid on area-level borders in the past using similar code via tmap. I have not had this problem in the past.
Points and county polygons have the same Coordinate ...
0
votes
0
answers
33
views
identifying PCA score based on column value in R using factoextra
I've done a PCA on some behavior data and now I'm trying to extract the scores to use in further analysis, but I want to make sure I am connecting the correct score to the correct row/data point. I'm ...
0
votes
0
answers
61
views
Trouble in repeated measurments: lme model fails with "NA/NaN/Inf" error
I'm trying to fit a linear mixed-effects model with lme() from the nlme package to analyze repeated measures. The model runs fine on the full dataset, but after filtering by sex, I get the following ...
1
vote
0
answers
49
views
How to display code chunk output in Quarto presentation only after being prompted?
I am creating a quarto presentation using revealjs in RStudio, which will include a simple code chunks. I need the presentation to only display the code itself and to show the output of the code only ...
-4
votes
0
answers
66
views
What does `st_extract` of the stars R package do when you have an extra dimension?
I have read in to R as a stars object some gridded temperature data (from Copernicus) that has the following form, including 4 depth layers:
> thetao
stars object with 4 dimensions and 1 attribute
...
0
votes
0
answers
16
views
Rstudio DBSCAN KNNdistplot for pokemon dataset
I wanted to find proper EPS value using 800pokemon dataset from Kaggle (https://www.kaggle.com/datasets/rounakbanik/pokemon/code).
First of all, I created a numeric dataset by pivoting 'pokemon names' ...
0
votes
0
answers
54
views
Turn "Large ggplot_built" into regular ggplot so I can insert it in a word document using the officer package
I created ggplots in a massive function but when I call the function they only display in my plots window and not my global environment. I need them in my global environment so I can add them to a ...
1
vote
0
answers
53
views
how to group based on category in ggtree
I have a ggtree plot where I'm working with three different varieties for a plant, and since I'm planning to add additional info in the circos around it, I was wondering whether there is a simple way ...
0
votes
0
answers
39
views
Panel GMM won't run unless there is a lagged variable on the right side of the equation
I'm using plm:pgmm in order to run a panel GMM model. But I can only run it if there is a lagged independent variable. If I try to run a Panel GMM model without a lagged variable (it can any of them), ...
0
votes
0
answers
32
views
How to use R and EBI Image to read a ranged bar chart in .tif file format?
I have a .tif file of a ranged bar chart, with the bars arranged vertically, representing the temperature ranges of nine different countries. I need to analyse the image to extract the min and min ...
0
votes
0
answers
66
views
Download and unzip file in a dataset using dataverse package
I would like to download the file Canada, Provinces, Territories and Federal Electoral Districts (2013 Representation Order)/98-401-X2021010_English_CSV_data.csv at this dataverse using the dataverse ...
0
votes
0
answers
56
views
rendering divs from inline text / pasted code
I would like to be able to generate a series of tables in r-quarto. They are small tables, nothing fancy and generally will have the structure below in (1). A title that is a separate line of text and ...
1
vote
0
answers
87
views
Why are these 2 different blocks of JavaScript code deployed in a Shiny App UI section conflicting with each other?
In running the below R Shiny code, the 2 sections of JavaScript appear to be conflicting with each other. One section of JS is in the tooltipFun() function and the other is in the module UI section; ...
2
votes
0
answers
196
views
did_multiplegt_dyn estimate effects for non-absorbing treatment (R)
I am trying to use the did_multiplegt_dyn package to estimate 2 different DiD models, one in which treatment is absorbing and one in which it is non-absorbing. That is, subjects may switch in and out ...
2
votes
0
answers
70
views
Why does survival::survreg produce an extreme estimation?
In the context of a simulation study, I simulate many survival datasets including the following variables:
trt: whether the patient received treatment or placebo (0/1)
Evt: whether the patient died ...
0
votes
0
answers
44
views
Adding blank Lines to docx rendering
I am an infrequent r-markdown user. This is the first problem. The second problem is that I am trying to knit to a word document using an existing word document as the style reassigns after the first ...
0
votes
0
answers
57
views
Git clone: Permission denied. Can't create temporary folder
my simple try to clone a repository fails with the error:
fatal: could not open '/home/myusername/reponame/.git/objects/pack/tmp_pack_uSnA9n' for reading: Permission denied
fatal: fetch-pack: invalid ...
0
votes
0
answers
22
views
R.NET failing to use any R libraries in .NET 8
First: From RStudio everything is working fine, no problems.But when I try to run:
engine.Evaluate("library(dplyr)");
or try to use with any other library which is installed and work from ...
1
vote
0
answers
13
views
Rstudio - remove ctrl+click as a shortcut to View?
I've noticed if you hold ctrl as you click on a data frame name (e.g frm) in R-studio it acts as a shortcut to View(frm). Does anyone know how to turn off this behaviour?
Example:
frm <- data....
0
votes
0
answers
28
views
How to change fill color for NAs in tmap::tmap_options()
I want to develop a tmap::tmap_style() that includes several options, such as "yellow" for the fill color for missing values. I want to produce the following graphics:
World <- tmap::...
1
vote
0
answers
37
views
Meta-analysis: InfluenceAnalysis()
I am currently learning how to conduct a meta-analysis using this guide: https://bookdown.org/MathiasHarrer/Doing_Meta_Analysis_in_R/
However, I have encountered an issue in Chapter 5 when using ...
0
votes
0
answers
51
views
Undefined reference to BLAS
I'm trying to install the HurdleNormal R package as a dependency for another package (COZINE), and I'm getting the following error:
C:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe:
...
0
votes
0
answers
22
views
Why isn't RServe reading its configuration file in Linux?
First of all RServe is running and I can connect remotely to it using Java.
For some reason, however Rserve is not reading the configuration file referenced in the /etc/systemd/system/rserve.service ...
3
votes
0
answers
73
views
Limits in ggplot2::geom_violin, ggdist::stat_slab/stat_eye
In practice, many distributions are far from normal and highly skewed. A couple years ago I started a discussion on plotting such "difficult" distributions in ggplot2. Often the tail is not ...
0
votes
0
answers
40
views
Unable to save gt file to word document (word docx)
I'm getting a consistent error trying to save the following to Word doc.
It's reading the final file as a string, but I can't see the coding error.
#sample of my data
head(dat)
Year ...
1
vote
0
answers
58
views
R Plotly choropleth not plotting geojson data
I am trying to follow this tutorial to create a choropleth map in R using plotly. The geojson file I am using is available here. The problem I am having is that plotly won't plot the shapes of the ...
0
votes
0
answers
36
views
Fitting the Birbaum-Saunders distribution to right-censored data
I've tried many packages and functions as fitdistcens, flexsurvreg,... And I haven't be able to achieve my purpose. I want to fit a Birnbaum Saunders distribution to a right censored data based on ...
0
votes
0
answers
85
views
Is there a way to read parquet files from Planetary computer in R?
I found the ms-building collection and there is an example to load the data with python. Is there a way to load the data with R?
https://planetarycomputer.microsoft.com/dataset/ms-buildings#Example-...
0
votes
0
answers
68
views
How can I add left aligned subheaders for parameter documentation in roxygen2?
Assume I have a function that I would like to document with roxygen2 and I have sets of related parameters that I would like to group with a shared header in the help file.
I've been spending some ...
1
vote
0
answers
44
views
Pull in all the tables in Snowflake at once into R
I am pulling data from Snowflake via R, and have been pulling tables via ODBC connection with the dbGetQuery function from the DBI package in R. Is there a way that I can read in all of the tables ...
0
votes
0
answers
32
views
writing a genepop file from genind object
I had to remove some loci from a genepop file and now have a genind object. However, a lot of my downstream analyses require a file path to a .gen file and won't accept an object loaded from my ...
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