Quantcast
Channel: Active questions tagged r - Stack Overflow

R Package Development (on Linux) configure sh: 1: ./configure not found

In R package (on Linux) with configure scripts, using shebang as recommended and making the script configure executable via "chmod u+x configure", configure script ("RPackage/configure") leads to error...

View Article


Image may be NSFW.
Clik here to view.

How can I arrange the labels of the x-axis in an alluvial plot using ggrepel?

I am building an alluvial plot to show if categories of species Red Listining are present or not in legislations. Some groups like "Lampreys" and "Dragonflies and damselflies" are short compared to...

View Article


Image may be NSFW.
Clik here to view.

Using patchwork with geofacet, geom_rect's showing up in unused facets

I'm trying to recreate a stunning and often shared graphic "Where are Americans Born." It involves using facet_geo to display the percent of out-of-state and foreign born residents for each US state...

View Article

group_by() is converting dataframe to tibble

I have a problem running st_as_sf() after group_by(). My code isn't working when previously I had no issues.I discovered that group_by() was converting my dataframe to a tibble and st_as_sf() won't...

View Article

Running the Breusch-Pagan test manually in R [migrated]

I am trying to run the Breusch-Pagan test manually in RStudio from a weighted linear model (wi = 1/x2). I need help verifying whether the following rationale is correct:What I did:WLS and residuals#...

View Article


Should I expect better performance from R arrow with partitioned parquet files?

I set up a folder of partitioned parquet files for a project at work, and I'm experiencing severe performance issues. Several hours to do the aggregation.I made this minimal example to show the...

View Article

Incomplete Expression Error in R with ggplot [closed]

I'm trying to load a plot for my marine bio lab class. I loaded in the data just fine using gsheets, I filtered the data using dplyr for the two fish species I'm plotting, then I go to plot using...

View Article

Air suggest gihub action errors with no repo found [closed]

I started using air for formatting code and used their ready github action for suggestions taken from here: https://posit-dev.github.io/air/integration-github-actions.html:# Workflow derived from...

View Article


How to call a numbered sequence of covariates with paste in a for loop

I have a number of columns that are numbered sequentially. e.g. q1, q2, q3, etc. I also have an indicator variable (ind) for control or treatment status for each observation. I want to conduct a series...

View Article


How do I print only n lines of code output in a Quarto document?

This works but I would like something more user friendly. Is there not a chunk option that sets the R code output to be a certain number of lines?---title: "Glimpse Output Example"format:...

View Article

Compute mean in R dependent on specific value in another variable

I have my dataset called IMS, consisting of 11 variables.I would like to compute the mean for the variable std.y for all observations where the variable pi == 1.Anyone who can tell me how to compute this?

View Article

Write multiple tables to Oracle database in a single transaction (via ROracle)

Is it possible to write multiple R dataframes to an Oracle database in a single transaction via ROracle/DBI and dbWriteTable ?dbWriteTable commits the table in full, so transaction management via...

View Article

Can't find how to create a XML ALTO with tesseract on R

I am struggling with tesseract package (5.3.2 version) for R, trying to have a XML ALTO as output of the ocr() function. I read the documentation which states that this has something to do with the...

View Article


Image may be NSFW.
Clik here to view.

tmap MAP_COLORS not coloring adjacent polygons distinctly

I am trying to use tmap with the MAP_COLOR argument which is supposed to plot the given shapefile with unique colors for adjacent polygons. However, it seems to be failing when I use it on two distinct...

View Article

Image may be NSFW.
Clik here to view.

Insert nested tabset in an R Bookdown document

I found this question R Bookdown: Tabbed headings and the awesome answer from @linog which was the basis for my approach.To show you what's the purpose for my bookdown document, I have done this in r...

View Article


Implementing image axis labels with ggplot2 + plotly

My goal is to make a bar plot with images as axis labels, like this (screen 1). I also want plotly's chart annotations, but adding plotly to the program causes the axis labels to be interpreted as raw...

View Article

Nested slurm jobs in R using future.batchtools

I am trying to test future.batchtools for parallelisation in R.I have a small test job (run_futurebatchtools_job.R) as:library(future)library(future.batchtools)# Set up the future plan to use SLURM via...

View Article


Doing PCA with varimax rotation in R

My code has gone south. I'm importing a data 578x17 sheet from csv using the:Data=read.csv("Data.csv", header=TRUE, sep=',', dec='.', row.names= 1 , stringsAsFactors=TRUE)My correlations and covariance...

View Article

How to stream LLM responses in a Shiny app instead of waiting for full output?

I am creating a Shiny app in R. One of its features is to display processed text within the app, and then allow the user to click a button to send that text to an LLM (Large Language Model).The tricky...

View Article

Kruskal-Wallis test with details on pairwise comparisons

The standard stats::kruskal.test module allows to calculate the kruskal-wallis test on a dataset:>>> data(diamonds)>>> kruskal.test(price~carat, data=diamonds)Kruskal-Wallis rank sum...

View Article

Image may be NSFW.
Clik here to view.

How to replicate a distribution plot [closed]

I need to make some small edits on a plot which should look like something as follows I do have the input data with the proper format (showing only the first seven lines for each...

View Article


Read excel file cannot find the path?

library("readxl")my_data <- read_excel("GVA.xlsx")my_datahowever the console says the path does not exist. How can I import excel/csv files and know that the file will always be found.Why does this...

View Article


Transform genotypic matrix to GAPIT-friendly format to conduct GWAS [closed]

I have a genotypic matrix obtained thorugh a 25K analysis with calls in IUPAC format (e.g. locus1 = AA, TT, TT, CG, ... for each genotype). I would like to convert it to numerical format for GWAS...

View Article

How can I get these custom contrasts in modelbased? [closed]

I'd like to use the modelbased package for custom contrasts.How can I contrast (i) time by Site and also (ii) reference vs other sites at specific time points, but include them together in the same...

View Article

Define and use a probabilistic distribution within a shiny flexdashboard app...

I'm trying to use the fitdistrplus package in a shiny flexdashboard app, defining a Pearson-3 distribution function. To do this, I define the function with the ppearsonIII() function from the PearsonDS...

View Article


Combine linetype legend but keep separate color legends and arrange...

I'm trying to graph coefficients (points) and standard errors (error bars) for different metrics and different double machine learning algorithms, across 3 different examples (3 different plots). I've...

View Article

Image may be NSFW.
Clik here to view.

How to change the legend symbol for line types?

I have a plot I'm happy with, but in the legend the lines distinguishing line types appear blue, unlike anything on the plot. I want to change the color of the lines in the legend, preferably just to...

View Article

Making an R module linking OpenBLAS statically

I am trying to build an R module linking statically OpenBLAS:mypkg/├── DESCRIPTION├── NAMESPACE├── R/│├── check_openblas.R│├── my_interface.R│└── openblas_init.R├── inst/│└── libs/│├── linux/││└──...

View Article

Search / replace in R with a capture group

In a Quarto book, I mention R functions as back-quoted strings in text like this, always ending in ()test <- "The functions `lm()` and `car::vif()` are good test cases"I would like to replace each...

View Article



Looking for advice on how to work with json files that sort data in atypical...

I'm working with a json file in R that seems to have a somewhat odd format for a class assignment in both R and Python:{"data":[{"British Columbia":"BC","BC":"4.63"}, {"Alberta":"AB","AB":"4.15"},...

View Article


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