Category "r"

Extract data frame column after pipe, in base R [duplicate]

I'd like to use the [[ base R function to extract a column from a dataframe at the end of a sequence of piped operations. But I get an error m

Source RMarkdown chunks

Please consider the following. For me, the beauty of writing nearly all analyses in a RMarkdown file instead of in R scripts it that RMarkdown offers the possib

cat_plot showing same confidence intervals for all data points (interactions package in r)

I am using the cat_plot function from the [interactions]https://interactions.jacob-long.com/reference/cat_plot.html package to plot a 2-way interaction between

Plot three way interaction with 3d graph

I have fitted a binominal logistic glm with a three-way interaction between sex (male & female), tree cover including a quadratic term (1-100%), and the mea

R plotting code behaves differently for CSVs containing different data formatted the same way

I have two CSVs for experimental data measuring the effects of a two values of a single variable. Basically the code is the same except for the name of the data

%>% .$column_name equivalent for R base pipe |>

I frequently use the dplyr piping to get a column from a tibble into a vector as below iris %>% .$Sepal.Length iris %>% .$Sepal.Length %>% cut(5) How

R: Manually divide a specific row and column by a number in a dataframe

Unfortunately, I could only come across questions on how to divide columns by a specific number. However, I would like to divide the value only in a specific ro

I am getting a Torch error when using the textEmbed() function in the Text Package in R

I am trying to run the textEmbed() function in R using the text package in text analysis. However, I keep on getting errors telling me I haven't installed torch

how can I run r function from package in postgresql

I am trying to use the R function from a R package (https://cran.microsoft.com/snapshot/2017-04-03/web/packages/genasis/index.html) directly in Postgres without

`openxlsx` `dataValidation`: providing text input in list insteaf of cell reference

The documentation for openxlsx::dataValidation demonstrates how to get a dropdown menu by referencing cell(s). However, I'm interested in adding text input ("Ye

Calculating snow accumulation and snow melt using SnowMelt {EcoHydRology} package in R

I found an R package that calculates snow accumulation and snow melt. However, I'm getting an error which I have no idea about. My confusion is that snowdepth d

How to safely shutdown mlflow ui?

After running mlflow ui on a remote server, I'm unable to reopen the mlflow ui again. A workaround is to kill all my processes in the server using pkill -u MyUs

Reshape wide data to panel format with multiple paired columns using tidyr

In a large survey, the data are encoded as (Respondent, question, year binary, question, year binary). As in: R Question1 | 2008 Bin. | Question2 | 2009

Is there a faster way to find synonyms for a large list of taxa in R?

I have a list of about ~96,000 species names I need to collect all synonyms for. I have tried the 'taxize' package with the synonyms() function, which outputs t

Stacked histograms with ggridges package in R

The following code produces histograms that overlap. How can I modify this code to make the histograms stack on top of each other? library(tidyverse) library(gg

Set the width of regulartable() when exported in word document

Im trying to export a dataframe to word using knitr and regulartable() but my table does not fit in the word page. --- title: "Correlation table" author: "mk" d

Using R to Calculate the time since binary output=1

I have binary data in a dataframe with a time feature and I'm looking to produce a dataframe like below with a new column "duration since =1". I was able to fi

Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid value 0 for 'digits' argument

When I submit priceR to R-hub, I see the following logs: ### ** Examples > > > format_currency("2423562534234", "$") Error in prettyNum(.Internal(for

How to sum email opt-in per customer per month

For my master thesis I try to sum the total opt-ins a customer has for all possible newsletters over-time (monthly). I fail in doing so. Dput() data to Replicat

RStudio hangs, won't start on Ubuntu 22.04LTS (R compiled from source)

Just another post about RStudio does not start. I'm using Ubuntu Linux 22.04LTS "jammy". Since the new R version (currently 4.2.0) wasn't available in the repos