Understanding `purrr::pmap` with a dataframe inside `mutate` in R
I want to make the sum of the first 3 columns with pmap.library(tidyverse)mtcars %>% mutate(new = pmap(select(., 1:3), ~ sum(.))) # FAILSmtcars %>% mutate(new = pmap(., ~ sum(.[1:3]))) # FAILS...
View ArticleWhy are keyword searches acting like name searches in google places API?
I am working on a public health project where I'm scraping an entire state for tobacco vaping shops. I've been experimenting using the google places API webservice, specifically the Nearby and Text...
View ArticleHow to plot a 3 set proportional Venn/Euler diagram?
I have a set of microarray data, and I would like to represent it according to the attached figure (done with PowerPoint). I have tried the various packages available for R (VennDiagram, venneuler,...
View ArticleIs it possible to create a proportional triple Venn Diagram
I am trying to create a proportional Venn Diagram with three groups. I searched the web and tried with 3 different packages: Venndiagram, venneuler and eulerr. However, with none it seems that it...
View ArticleAvoiding Memory Aliasing Errors in R
How does pointer/reference aliasing work in R? If I assign a vector or data frame to a new variable (y <- x) and modify y, R automatically duplicates the data in memory so x stays unchanged. Are...
View ArticleUse = instead of
I love the package but I was wondering how I could change one rule from the tidyverse style: I'd like to keep "=" instead of "<-" for assignment.I've read that note:...
View ArticleAvoid `zoo:na.fill(x, "extend")` error: need at least two non-NA values to...
When trying to extend and linearly interpolate a time series with zoo::na.fill(x, "extend"), an error is thrown whenever one of the columns or groups only has one value. How can I avoid this...
View ArticleHow to smooth only certain edges of a sf polygon
I'm trying to smooth the edges of polygons created from species occurrence points.When a species has a small number of occurrence records, e.g. five occurrences distributed over a large area, the...
View ArticleHow to mutate multiply imputed data for estimateNetwork() in R? (mice, bootnet)
I am trying to conduct an MGM network analysis using the bootnet package. I have a dataset of categorical vars and items that constitute survey scales (e.g., summing columns 1-8 produces a total score...
View ArticleIssue with bbmle package and optimx in R returning par as all NAs
I am having an issue with using the optimx with the bbmle package. The model will run on my personal computer, but will not return viable results on a linux computer. Both are running the same code, on...
View ArticleError in singlefold(obs, k) : insufficient records:2, with k=5 / unused...
This is the code I use:competition <- ENMevaluate(occ = occ_coord, env = env, bg.coords = bg_coord, method = "randomkfold", RMvalues=seq(0.5, 5, 0.5), fc = c("L", "LQ", "H", "LQH"),...
View ArticleLoosing files because of names encoding in R when using unzip - could be...
While there are other questions on the issue of encoding and unzipping, but I have a case, where I didn't get any error messages (unlike here or here), I wanted to share this peculiarity.While I did...
View ArticleHow to smooth the edges of parts of sf polygons
I'm trying to smooth the edges of convex hull polygons created from species occurrence points.When a species has a small number of occurrence records, e.g. five occurrences distributed over a large...
View ArticleHow to smooth the edges of convex hull sf polygons
I'm trying to smooth the edges of convex hull polygons created from species occurrence points.When a species has a small number of occurrence records, e.g. five occurrences distributed over a large...
View ArticleSend code in background from Sublime Text to RStudio
I would like to use Autohotkey v2 to send the highlighted code or the current line in Sublime Text 4, essentially the content of the clipboard, to the RStudio console. Unfortunately the ST package...
View ArticleIs there a way to publish a R flexdashboard html page in SharePoint?; Remove...
I created a html output from r with rmarkdown::render(“file.rmd”, “output.html”). The output is a multi-page flexdashboard html output with several plotly graphs. There is no shiny involved thus a...
View ArticleHow can I find out which package version is loaded in R?
I am in a process of figuring out how to use my university cluster. It has 2 versions of R installed. System wide R 2.11 (Debian 6.0) and R 2.14.2 in non-standard location.I am trying to use MPI...
View ArticleChanging the class of a column using dplyr tools
I probably think a bit to complicated, but I would like to change the class of a data.frame column, ideally with {dplyr} functions for easy selection of columns.df <- data.frame(id=1:3,...
View ArticleFirst letter to upper case
Is there another version to make the first letter of each string capital and also with FALSE for flag perl?name <- "hallo"gsub("(^[[:alpha:]])", "\\U\\1", name, perl = TRUE)
View ArticleHow to fix "Error: unused argument (verbose = FALSE)"?
I'm conducting an MGM network analysis in R (via the bootnet package) and am trying to compare edge weights across two networks (via the NetworkComparisonTest package). I have missing data, so I'm...
View Article