Category "r"

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

kableExtra: Vertical alignment not working in PDF output with many columns

I would like to align all columns in a kableExtra table to the top. The valign = "top" option does not seem to solve the issue here. Also, the third column is

Reference Cell value assign in particular cell

Is it possible to get this output in R? =INDIRECT((CONCATENATE(V4, AH4)),TRUE)

R Shiny: downloadHandler - problem in content argument

I have a Shiny App and want to download a plot as png using a downloadButton and the command "downloadHandler". As you can see in the code below it should use i

How can I use magrittr pipe (%>%) in my package?

I am trying to create a package ("packagename") to host some custom R functions and R markdown templates. I am trying to use magrittr pipe in one of the functio