dplyr mutate rowwise max of range of columns
I can use the following to return the maximum of 2 columnsnewiris<-iris %>% rowwise() %>% mutate(mak=max(Sepal.Width,Petal.Length))What I want to do is find that maximum across a range of...
View ArticleWhen developing the same package for R and Python, do you put them in one...
When developing the same package for R and Python, should I put them in one GitHub repo or separate repos?What's making it a tad bit trickier is that the Python package is calledgood_name, and the R...
View ArticleHow can I conduct (and plot) a chisquare test for pairwise combinations of...
I have data from a series of behavioral choice tests where I offered my test subjects (ladybugs) each combination of three substances: A, B, and C (that is, AB, BC, and AC). I want to evaluate if they...
View ArticleUsing .I to return row numbers with data.table package
Would someone please explain to me the correct usage of .I for returning the row numbers of a data.table?I have data like this:require(data.table)DT <- data.table(X=c(5, 15, 20, 25, 30))DT# X# 1: 5#...
View Articlemlr3 selector_cardinality_greater_than() returns target name
Trying to make a learner that makes predictions on the religion of a country from its flag features using mlr3. My learner of choice is lrn("classif.svm") and data of choice is the flags dataset from...
View ArticleHow to write the quantile aggregate function?
I have the following table:CREATE TABLE #TEMP (ColA VARCHAR(MAX), ColB VARCHAR(MAX), Date date, Value int)INSERT INTO #TEMP VALUES('A','B','7/1/2010','11143274')INSERT INTO #TEMP...
View Articlelegendry unable to nest axis guide when there's only one label present
I have the following dataset:uf_vcf_m <- structure(list(sample = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,...
View ArticleHow to join two dataframes based on a matching word in strings?
I have a data frame that contains a short description of the origin of a particular specimen, and another data frame that has an index/list of regions and countries that specimens can be sourced...
View ArticleCreating multilayers donut chart
I tried to create a donut chart with three layers. Based on this post (3 layer donut chart in R), I used the following...
View ArticleCorrect format for input of License into DESCRIPTION document of own R package
So I'm writing an R package. Part of the essential documentation is the DESCRIPTION file. In this DESCRIPTION file there is a line where one must specify the Licensing of the package for...
View Articlebrm model running, no error, no result, when including file = "path/filename"
I am running the current model with brms:# Set modelbf_AltPro1 <- bf(PA ~ (1|roost_ID) + scl_AltPro, family = bernoulli(link = "logit"))# Set priorspriors_AltPro2 <- c( prior(normal(0,2), class =...
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 ArticleHow to color code individual rows of kableextra table in quarto
I have a table that I want to color code each row a custom color.Here's the data in a reproducible format:table_data <- data.frame( visibility =...
View ArticleHow-to color code individual lines of kable table in Quarto
I have a table that I want to color code each row a custom color.Here's the data in a reproducible format:table_data <- data.frame( visibility =...
View Articlelegendry unable to nest axis guide
I have the following dataset:uf_vcf_m <- structure(list(sample = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,...
View ArticleGeoPackage file loaded as SpatVector plotted using geom_spatvector() returns...
I would like to plot a GeoPackage file downloaded from https://www.agvchapp.bfs.admin.ch/de/boundaries?SnapshotDate=01.01.2026&Unit=Communes# loaded as a SpatVector using...
View ArticleHow to know a dimension of matrix or vector in R?
I want to find the function in R which does the same as the function size in Matlab. In Matlab, if A = [ 1 2 3 4 5], then size(A) = 1 5.If A =[ 1 2 3;4 5 6], then size(A) = 3 3.In R, I found that the...
View ArticleHow to correctly parse a nested JSON list using jsonlite::fromJSON in R...
I am parsing a JSON file in R using the jsonlite package. The JSON structure has a top-level key containing a list of objects, where each object represents a province name and its demographic data.When...
View ArticleCARET Package in R - createDataPartition() function not found?
I am learning the CARET Package in R and I am trying to run to code in Max Kuhn's paper "A Short Introduction to the caret Package". When I run the following code, after successfully installing...
View ArticleHow to remove outliers by columns in R
I have this data frame.IQsleepGREhappiness105702001540501501570207010150150806148609007115101200401109015512040601299307015100015306870601270I would like to remove the outliers for each variable. I do...
View Article