Generating Random Polygons in R
I need help coming up with a spatial workflow in R, or to be pointed in the direction of a package or something, I have no idea where to start with this.I have a raster called "Suit" (epsg:32615), and...
View ArticlePlot won't fit in R window
I am using the meta package in R to do a meta-analysis of proportions. I have about a hundred studies in my analysis. When I type forest(result) to create my forest plot, it works, but the graphic is...
View ArticleUsing sjPlot::plot_model to generate plot of lmer model with log-transformed...
I've got a lmer model that looks similar to the following example:df<-data.frame(var_1=c(1.1,2.2,2.1,4.4,4.4,5.6,4.4,2.6,3.3,3.3,3.9,3.8,1.1,1.3,1.4,1.1,1.8,2.1),...
View ArticleReuse function in a package
I'm trying to reuse a function from one of my packages that installs the latest version of my package in another package. The original package is {pkgA} and the function is update(). The function uses...
View ArticleMemory issue for large raster in R
I am trying to use slope_rast from rtrend R package for a large raster likelibrary(rtrend)library(terra)f = system.file("rast/MOD15A2_LAI_China_G050_2001-2020.tif", package = "rtrend")r = rast(f)#Make...
View ArticleHow to label colnames of a dataframe directly with a vector
I have a dataframe with 300 columns. I would like to label the columns with a vector (consisting of 300 entries).I try to use the labelled package. But I don't want to assign each variable to a label...
View ArticleWhat does "Error in UseMethod("mutate")" mean, returned from...
library(glmmTMB)library(dplyr)library(DHARMa)ml <- glmmTMB(menthlth ~ sex + medcost + ..., ziformula = ~ sex + medcost + X_educag + internet + ..., data = data %>%...
View ArticleR Default lubridate date time printing and parsing fails to read midnight
I'm working with date-time (POSIXct) observations. My workflow involves reading CSVs, manipulating the date-time data, and exporting as CSV for later use.I've found that without tediously specifying...
View ArticleR Shiny - observe two reactive inputs and get the values for the one that...
How do I know which reactive inputs from a list of inputs has changed and use only its values to perform some action?For instance, in this code, I'd like to update the input$test with either the value...
View ArticleWorld map showing day and night regions
I'm trying to add a daytime/nighttime line to a world map using ggplot in order to indicate day and night regions; something like this:The plan is to animate my map over a 24 hour cycle like this:The...
View ArticleControl levels the marginaleffects library uses when stratifying a numeric...
I'm trying to use the marginaleffects library in R to get the estimates of a bunch of interaction effects from a bunch of different models. When I pass it an interaction that has a continuous...
View Articlesample() returning vector of size-1 [duplicate]
In R version 5.4.1, when I set the size parameter of sample() in the form 1000*(1-i), I sometimes get a output that is 1 value too short; this only seems to happen at values of i above 0.7, but the...
View ArticleHow to select data with the column names in a character string
TL;DRIn short, how do I get ok.netroles <- c("netrole1", "netrole2"); mutate(across(ok.netroles)... to work like mutate(across(.cols=netrole1, netrole2, ...))?I am trying to designate the names of...
View ArticleError in start_col:end_col : argument of length 0 - UpSetR
I have a dataset like this:df <- structure(list(id = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,...
View ArticleFind and process @concept tags in .Rd files
In several packages, I've added @concept tags to Roxygen documentation for datasets. I'd like to process these to create a datasets.csv file for the package, that would include these as tags for each...
View ArticleIs it possible to auto-adjust the zoom when rendering large leaflet maps into...
With the following code one can generate a leaflet map:library(leaflet)library(mapview)library(dplyr)library(sf)bbox <- st_bbox(my_polygon)print(bbox) xmin ymin xmax ymax -0.5509286 39.4419540...
View Articleggbarplot mean standard error bars not aligning
I am trying to plot the percentage of three cellTypes (T cells CD4, T cells CD8 & Tregs) that are assigned to A vs B, averaged across the ROI_name column and with mean_se bars, however the plotted...
View ArticleHow to insert reactable table in tooltip/popup in Shiny
Is it possible to insert/show a reactable table in a map tooltip/popup in Shiny/R. I can generate it with a modal and observeEvent{(input$map_click,)...} but wanted to avoid interrupting map view which...
View ArticleProblem scrapping Eschmeyer's Catalog of Fishes with R on Windows
I would like to scrap the results of this website like a normal searching result.The code I have is the following but it saves a local copy of the html file, and I would like to change it to a function...
View ArticleSorting grouped individuals into defined spaces [closed]
Not sure if this is the right place get help with this kind of problem, but I am trying to solve this by coding so I'll try. If anyone knows about some better suited forum/place for this kind of...
View Articletbl_regression not showing p-values when compiler is running on R Markdown
I am trying to run tbl_regression() on lme4 models. In R Markdown, the p-values can be seen in the output there. However, when I try to compile to a pdf or html, the p-values disappear, while the...
View Articleread_html(url) issues cannot open the connection
I doread_html("https://finngen.gitbook.io/documentation")which issuesError in open.connection(x, "rb") : cannot open the connectionHowever, I can open https://finngen.gitbook.io/documentation with...
View ArticlesvyCreateTableOne cannot process factors
I tried to produce a table 1 from a code which worked perfectly well a year ago, but doesn't work now.Here a simple example :library(tableone)library(survey)age<-...
View ArticleError: Package or Namespace Load Failed for janitor in Quarto Only
When I ran each R code chunk in thetitle: "Step 2: Data Import and Schema Sanity Check"author: "Dr. James Daniel"date: todayformat: html: toc: true code-fold: trueexecute: echo: true warning: false...
View ArticleHow to pop up the graphics window from Rscript?
I'm using Rscript to run a plot as follows: x=1:10 y=1:10 plot(x,y) I expect this code to popup a window with a graphic showing the plot when I run the code like this:Rscript plot.RThe program finishes...
View ArticleError with X11 on R
I tried the following command in RStudio version Version 0.99.441 in Linux system: X11(width=800,height=600,pointsize=12)But it gives me the error:No protocol specifiedError in .External2(C_X11,...
View Articleproblem with min function in R getting error: InfWarning: no non-missing...
I have been working with a data frame similar to the one below (though much larger. Every time I run the min function on this data frame when there are NA values I get this warning repeated thousands...
View ArticleIs it possible to manually crop images loaded into RMarkdown documents via...
I'm fairly new to rmarkdown but had a question about images. I'm trying to generate a document that displays images from the Web (i.e., accessible with a URL, not a file path on my computer). The...
View ArticleR dplyr: How to filter murders dataset by region and homicide rate and select...
I need some help in my coding related to Basic Data Wrangling. The instructions for coding in R are as follows:Let's say you want to live in the Northeast or West in US and you want the homicide rate...
View ArticleHow do I uninstall R completely to fix install.packages() function problem?
I am running R on linux mint 22.2 Cinnamon and my install.packages() command is not functionning. So I tried to uninstall R a first time, but apparently all of my R data was not uninstalled. So I tried...
View Article