Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

Question list filters

Filter by
Sorted by
Tagged with
Filter by Employee ID
Score of 0
1 answer
23 views

I want to combine the plotly autorange capability with a limit to the maximum range. Setting the layout autorangeoptions attributes clipmax and maxallowed appear to be specifically for this purpose. ...
Score of 5
5 answers
179 views

Context I would like to efficientely add rows to a relatively large data frame (30 000+ line et 1.0+ Go). These rows are stored as tibbles in a in a list-column. I need to extract the content of each ...
Score of 1
1 answer
89 views

Is there a way to pass on the default geom_raster() breaks (e.g., 0.03, 0.02, 0.01) to geom_contour()? library(ggplot2) ggplot(faithfuld, aes(waiting, eruptions)) + geom_raster(aes(fill = density)) ...
Score of 0
1 answer
106 views

To reproduce: create a file foo.R with the following content: message("interactive = ", interactive()) and call it foo.R. Then, from Powershell, run the following command: R.exe -e "...
Score of -4
1 answer
179 views

For years I've been using rgeolocate in conjunction with Maxmind's free GeoLite IP geolocation dataset in MMDB format to convert IP addresses of website visitors to countries in R. This is my current ...
Score of 5
2 answers
194 views

Is it possible to use sprintf() to format numbers so they display at least 3 digits before OR after the decimal point, as shown in the example? 68674.271 -> 68674 9863.683 -> 9864 387.961 -&...
Score of 3
1 answer
88 views

I attempted to plot a geom_chicklet barplot with nested axis using legendry. I might have come across a small limitation of either two packages. Essentially, when flipping coordinates it isn't ...
Score of 0
1 answer
124 views

Here is a minimal reproducible example > dummy_data <- data.frame(vec1= 1:10, + vec2= as.factor(1:10), + group= rep(letters[1:2], 5)) > str(...
Score of 2
3 answers
276 views

I am trying to find and remove numbers that are out-of-order in a number sequence in R. For example, in the following set of vectors, one or more elements are to be removed but sometimes it's unclear ...
Score of -3
1 answer
135 views

ggplot(data = dowell_raw, mapping = aes(x = factor(borh), y = bois)) + fill = factor(borh) + geom_boxplot(outlier.shape = NA) + geom_point(position = position_jitter(width = 0.1), color = "...
Score of 5
5 answers
182 views

I want to apply a function, say mean, in the grouping function ave() to only a subset defined by a different column in the data set. Here is some toy data: > x <- data.frame(A=c("a",&...
Score of 1
1 answer
71 views

I try to create a circular bar plot, however the first bar is being removed after applying coord_polar() . The following warning is being displayed: Removed 1 row containing missing values or values ...
Score of 8
2 answers
1005 views

When stepping through the below lines of code via RStudio (ctrl+enter) I'm getting the following error: Error in .rs.exprMutatesPackageLibrary(expr) : argument "part" is missing, with no ...
Score of 3
1 answer
83 views

I have a function that is creating a bunch of plots and saving them in a list. When using patchwork::wrap_plots(), guides = "collect"collects the fill guide but not the size guide. Expected ...
Score of -1
0 answers
78 views

I am trying to evaluate significant differences in the community composition of various biomass samples. My original dataset included a column with sample names, a column with taxa names, and another ...
Score of 0
0 answers
52 views

I am doing some psychometric analysis of a measure. Based on parallel analysis and my own theoretical interpretation, it seems like extracting two factors is the ideal solution for this measure; ...
Score of -3
0 answers
133 views

For many years I've been using RStudio on my Windows machine. There is a complete mess of different versions of the R packages in the result. Because of that, installation of new R packages and their ...
Score of 0
1 answer
58 views

I am trying to find a computationally-efficient way to extract all layers with a specific timestamp in a SpatRaster in R, with the "terra" package. My raster is a data cube downloaded from ...
Score of 1
2 answers
92 views

I need to calculate some calibration metrics for a glm model. I've been recommended to use the Hosmer–Lemeshow test to check that my model is calibrated or not, but it seems like it's very criticized ...
Score of 1
0 answers
130 views

I am currently working on a scale development project. The scale is a measure of objective knowledge and therefore the variables are binary (0=incorrect answer, 1=correct answer). I want to compare a ...
Score of 1
1 answer
109 views

I have a facet grid plot where I wish to add red-shaded rectangles/areas to categories for which I don't have any observations. I remember I achieved something similar with a much simpler 3×2 facet ...
Score of 2
1 answer
179 views

When creating a reproducible example using the {reprex} package, how can I include plain text explanations or markdown prose between my R code blocks without having them interpreted as standard R ...
Score of 2
2 answers
143 views

I have been looking for a solution to automatically drop unused y values when specifying limits in a ggplot2::scale_x_datetime() call, such as: library(ggplot2) ggplot(data=economics, aes(x=date, y=...
Score of 3
2 answers
113 views

I thought it'd be nice visually for a temperature time series to show all of the points at which the temperature was above a specific threshold. geom_ribbon doesn't seem to like to connect all of the ...
Score of 2
3 answers
262 views

I have a large range of dates (a) in a date-class that I need to find the nearest lower date in another, smaller, range (b), also in a date-class: a <- c("2025-04-22", "2025-04-22&...
Score of 0
1 answer
79 views

I have tried to build calibration plots for data frames with varying numbers and names of columns. So, I tried to work with this using lists and for-loops. Outside of the loop it works, but inside the ...
Score of 2
1 answer
103 views

I am using the locuszoom() function from the topr R package. However, the legend, that is created automatically is not correct, as it doesn't show the legend for the dark blue color and the labels are ...
Score of 1
0 answers
127 views

I am extracting values from a raster based on a multipolygon layer. The polygons can overlap various raster cells or be wholly contained in one cell. I am interested in the sum of the value across the ...
Score of 3
2 answers
150 views

If you are programming in dplyr, you can use the selection mechanism and promises as follows: mypull <- function(data, var) { data |> pull({{ var }}) } then you can call for example iris |>...
Advice
1 vote
1 replies
114 views

I think this example speaks for itself: tmp <- data.table::data.table(a = 1) set_ <- function(x) data.table::set(x, j = "b", value = 2) set_(tmp) tmp # Is modified by reference, as ...
Score of 2
1 answer
71 views

I'd like to display a grouped column plot for my dataset, where certain groups have subgroups associated with them. Here is a dummy dataset: main_group <- c("Fruit", "Fruit", &...
Score of 0
1 answer
115 views

I'm making a downloadable report which from a CSV input within a shiny app. The app runs fine locally and generates an html report. However, upon publishing it to shinyapps.io, the report fails to ...
Score of 1
2 answers
198 views

I created a bar chart for the month of January and February but the bar chart shows February and March. Any information in solving this problem would be greatly appreciated. Please find the code ...
Score of 2
2 answers
128 views

Given the following example: library(patchwork) p1 <- ggplot(iris, aes(x=Sepal.Length, y=Petal.Length)) + geom_point() p2 <- ggplot(iris, aes(x=Sepal.Length, y=Petal.Length)) + geom_point() ...
Score of 1
0 answers
51 views

I have a question about avg_comparisons() with linear fixest models and individual/year fixed effects. I ran this model m <- feols( y ~ treatment * sex | participant_id + year, data = dat ) ...
Score of 2
1 answer
137 views

A practice question from https://aditya-dahiya.github.io/RfDS2solutions/Chapter15.html#tbl-q1a-ex5 asks us to: # Convert the following expressions from str_c() to str_glue() str_c("\\section{&...
Score of 2
1 answer
85 views

I'm using facet_wrap2 to plot some data for different chromosomes. The thing is that I have some empty space beneath chr19 and chr20 and wish to move the legend there. So, I was following this post ...
Score of 2
5 answers
152 views

I have a data frame where I want to change entries to make sure that a numerical indicator at the end is two digits long, even if the recorded number is between 1 and 9. To illustrate, this is what we ...
Best practices
0 votes
3 replies
115 views

I recently obtained correlation result for one of my datasets. I seek guidance to observe the computed result and interpret the correlation result to meet the requirement of report writing guideline ...
Score of 1
1 answer
144 views

purrr and furrr have deprecated some of the functions I previously used to build ensemble machine learning models, namely future_invoke_map() which I used as as noted in the snippet below, this mapped ...
Best practices
1 vote
3 replies
88 views

I’m new to RStudio and have successfully created a gt table. However, I would like to export this table to a Word file (ideally in an editable format) while preserving its structure and formatting. ...
Best practices
0 votes
3 replies
129 views

Hi I had a quick question about what to do when you encounter a situation where the optimal cluster center is different when you graph out the gap statistic and the total sum of squares. As I ...
Tooling
2 votes
11 replies
242 views

I want to use R to read a group from a .zarr file, which was originally created using python's xarray. in python when I do: import xarray as xr path_zarr = "path/to/data.zarr" ds = xr....
Score of 4
2 answers
230 views

I am currently trying to do calibrations for chemical data and have tried following the instructions given in this post. I can fully replicate the example and it works fine, but when applying it to my ...
Advice
6 votes
3 replies
389 views

In the R documentation, it says: Open parenthesis, (, and open brace, {, are .Primitive functions in R. ... For {, the result of the last expression evaluated. This has the visibility of the last ...
Score of 0
1 answer
125 views

I am using R 4.4.1 with gtsummary version 2.5.0. When a continuous variable has static values, gtsummary treats this as a categorical variable instead. Example: gtsummary::theme_gtsummary_compact() ...
Advice
0 votes
10 replies
107 views

With the toy dataset below, I'd like to create a bar chart. Each bar should be the description. The length of the bar should be the total length of days. But I'd also like the bar to have a total of ...
Advice
0 votes
6 replies
137 views

I'm using the googlesheets4 package. I'm generating scatter plots and am trying to upload them to google sheets. I'm able to create the image and save it to my disk. The code I've used so far is this: ...
Score of 1
1 answer
136 views

I'm working on a figure which upon suggestions was changed from a “stacked” to a “dodged” barplot. Everything seems to be working fine; however, the geom_text labels I added are now completely out of ...
Score of -3
0 answers
97 views

Question update ; I am trying to summarize a panelAR model using modelsummarymodelsummary, which doesn't support panelAR models. I followed their instructions regarding unsupported models from this ...

1
2 3 4 5
10209