Manual change the color of the circles using sf package in R [closed]
I would like to create a Venn Diagram with sf+ggplot2 packages.How to manually change the colors of the circles and the intersection regions of the two inner circles? Changing the scale fill in...
View ArticleHow can I order y-axis (facet plot) by year correctly in ggplot2?
I'm working with a dataset showing the residuals of each studies.My data as follow:data <- data.frame( Study = c("Philpott et al.1989, 1990", "Philpott et al.1989, 1990", "Philpott et al.1989,...
View ArticleConfiguring compilers on Apple silicon (M1, M2, M3, ...) for Rcpp and other...
I'm trying to use packages that require Rcpp in R on my M1 Mac, which I was never able to get up and running after purchasing this computer. I updated it to Monterey in the hope that this would fix...
View ArticleMinibars show up in docx print(preview=docx) but not in final knit_print()...
I'm using Quarto to produce some word doc reports and I'm struggling to get minibars to show up in a table in the final produced docx report. However, I can get the table to produce as expected when...
View ArticleHow to shade a region under a curve using ggplot2
I've been trying to use ggplot2 to produce a plot similar to this R graphic:xv<-seq(0,4,0.01)yv<-dnorm(xv,2,0.5) plot(xv,yv,type="l")...
View Articleggplot2: medians of ordered boxplots plotting differently relative to each...
I am trying to plot the following data such that the x-axis is grouped by B_4digits and is in ascending order by the median of y (IntactPlusOne) the groupsData:data <- tibble( ID =...
View ArticleCreating a utilization distribution of telemetry data using the circular...
I am trying to replicate a procedure performed in Ramsey et al. 2022 to assess the efficiency of radio tracked animals in locating conspecifics for removal. This procedure uses a utilization...
View ArticleWhy does spec() return NULL after subsetting a tibble? (And how do I avoid...
After reading in my data using read_csv() from readr, the command spec() returns "full column specification" for the resulting tibble:> spec(steps)cols( duration = col_double(), version_code =...
View ArticleglmmTMB issue with number of observations and groups
I have a dataset with 125 animals across 3 sites and 100500 observations. Both show up properly when looking at the structure of the data but when I run the model with an updated data frame (I added a...
View ArticlePlot the best fit linear regression with the slope set to a fixed value (m=1)
Currently using R 4.4.3 on Windows 11. I'm plotting the following data set with ggplot2 and performing a linear regression with geom_smooth:df <- data.frame(A= c(1.313, 1.3118, 1.3132, 1.3122,...
View ArticleHow to plot UPGMA phylos with sub selection
First time working on a network in R, and I was looking into some possible packages/libraries to do so. There is this guide using ggraph that seems pretty complete and has some nice features I'm...
View ArticleWhy does R evaluate `NA==T|F` as NA, but `NA==F|T` as True? (and related Qs)...
If you run the following lines of code in R, you may be surprised by the results (printed above each line as a comment)#1: NANA==T#2: NANA==F#3: NANA==T&T#4: FALSENA==F&F#5: NANA==F&T#6:...
View Articlereticulate cannot bind to Python: "was not built with a shared library" even...
I'm using R with the reticulate package to run Python code. When I try to load reticulate, I get the following error:Error: '/usr/bin/python3.10' was not built with a shared library. reticulate can...
View Articlegtsummary::tbl_regression use pool_and_tidy_mice() with tidy_standardize()
I'm currently trying to run tbl_regression with an imputed dataset from mice run through a logistic glm. I'm having trouble trying to combine the custom tidiers pool_and_tidy_mice and tidy_standardize...
View ArticleExit swirl in the middle of a cmd_question
I know I can exit swirl by typing bye() but this doesn't work when I have a cmd question that is waiting for my input. In this case it works as "normal R" and if I type some of the keywords of swirl...
View Articlesuppress NAs in paste()
Regarding the bountyBen Bolker's paste2-solution produces a "" when the strings that are pasted contains NA's in the same position. Like this,> paste2(c("a","b", "c", NA), c("A","B", NA, NA))[1] "a,...
View ArticleFilter data.frame by list
I want to be able to filter a given data.frame by a dynamic list.Lets say I have a list of filters like thisfilter_list = list(filter_1 = list(vs = c(0), carb = c(1,4)), filter_2 = list(cyl =...
View ArticleAdding labels to multiple data points based on a condition [R] [duplicate]
I'm trying to get a plot that shows some important data points highlighted.Dataset:df <- structure(list(its = 1:20, pd = c(-0.521, -1.866, -0.11, 0.296, -0.14, -0.303, 0.141, 0.181, -0.116, 0.475,...
View ArticleDrop a column if all of its values are NA
I've got a database query running from R which can have multiple columns filled with NA, some of these columns I need further down the line but one specific column can be dropped if all values are NA.I...
View ArticleDrop rows with empty string in any of the specified columns
I have a very very large data frame. It has 10 columns and millions of rows.I have two columns that have a lot of empty fields. both columns are in chr format. I need to remove the rows with empty...
View ArticleHow to combine and position title and legend in tmap in R?
I am struggling to place the title inside the frame of the legend, but on top of the legend and not below. Any guidance or working examples would be greatly appreciated! Thank you. The online help...
View ArticleUnexpected String Constant when completing Confirmatory Factor Analysis
I keep getting an error message stating unexpected string constant in R when trying to complete factor analysis. It always seems to be the last two lines of information which are causing the issue....
View ArticleSetting xlim when the x-value is a factor causes the x-axis to extend beyond...
When I plot my data without explicitly setting the x coordinate range (the fourth and lowest plot in the screenshot, "Sonntag"), par("usr") tells me what range R uses by default:> par("usr")[1]...
View ArticleNested elements in body for REST API using R package httr
I would like to use the REST API of the Canvas Learning Management System to make changes to quizzes students make via the system. I use the R package httr for this. This generally works fine using...
View ArticleConvert matrix to list a of submatrices by row index
I have a matrix m, which I would like to convert into a list l of submatrices consisting of x rows of m.m <- matrix(sample(15, 60, TRUE), 12)l <- list(m[1:3,], m[4:6,], m[7:9,], m[10:12,])I'm...
View ArticleChange colour of text that labels a tile in ggplot2
This question follows on from this one (Warning message: Removed 2 rows containing missing values (`geom_tile()`)). Some of the days are weekend days and I would like to communicate this in the chart....
View Articleggsurvfit 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 normally?
View ArticleDrop rows with missing values in all columns
It looks like tidyr's drop_na will drop rows if any of the specified columns contain missing values.Example:> library(tidyverse)> df <- data.frame(a=c(1,NA,2,NA), b=c(3,4,NA,NA))> df a b1 1...
View ArticleRStudio Viewer Pane not working?
I have been trying to learn R to work on some network analysis. I found the networkD3 package and ran their example code (below) to get acquainted. It would switch to the "Viewer" tab on the right side...
View ArticlePlotly choropleth - change width to rectangular
I'm making an R Shiny application that uses a choropleth to display some data. The plotly version works well, but I can't find how to adjust its sizing to make full use of the space.It always looks...
View Article