Category "r"

R reticulate specifying python executable to use

First, I'm working on a Windows machine. I would like to specify a specific version of python to use in RStudio. I would like RStudio to use python 3 in the Arc

python does not recognize R functions with ”.“ in the function name

When I call the contrasts.fit function in the R package, limma, I get an error, which I suspect is due to the "." reason, python may not recognize contrasts.fit

fancy pie chart in R using ggplot2

I have a pie chart below, and I would like to leave extra white space between each pie and paste the value of each letter in each pie (A=25). how to get around

Duplicate rows based on common value in other column?

I have a data frame which includes: one column having individual ID's (unique), and a second column showing a common unique variable. That is, everyone in colum

Bin a vector by width

I have a vector of a continuos variable. For example: x <- c(0.9000000, 1.2666667, 4.0000000, 5.7333333, 19.7333333, 35.7666667, 44.0000000, 4.4333333,

huxreg - exponentiated coefficients and updated standard errors

I am running some CRR models from the package cmprsk. I am working towards outputting the results using huxreg. I have used tidy_args to get exponentiated coeff

Match the column value of a dataframe to another, and if no match, the old value stays as it is

I have dataframe A like this: Sample1 Salmon Mouse Rooster Monkey My dataframe B is like below: Sample1 Sample2 Rooster Bird Mous

How to create a new column based on the value of another column while retaining the Date format

The data that I have is as: dt_1 cond1 2009-05-04 1 2009-07-04 0 I want to add a variable that has date from a existing variable, if cond1 is 1

How do I globally load Rmetric Financial calendars into `golem` at the startup?

Question: What are the best practices to go about setting a "global" financial calendar using load_rmetrics_calenders(), ie a singular run of a function in gole

R Shiny server dropbox connection works for sometime and then says "cannot connect to server" - error in drop_upload: Unauthorized (HTTP401)

I have used this code for a long time but I recently changed the dropbox account I wanted the .csv files to be sent to and now the app works, meaning you can op

Discard 200 random healthy instances

Discard 200 random healthy instances. How do I implement this in Rstudio? This is the data frame: https://www.kaggle.com/code/jamaltariqcheema/model-performance

Fill up missing values based on other entries on R

I have dataset input with a couple of missing values. and I have to create dataset output with the following logic: If there is a missing in any of the columns

Aggregate copublications associated with a primary publication

Each primary_citation may have multiple copublications. I would like to aggregate citation_id's associated with each primary citation. The following code works

crr output list- remove df$ from coefficients?

I am using the cmprsk package to create a series of regressions. In the real models I used, I specified my models in the same way that is shown in the example t

R: How can I add titles based on grouping variable in word_associate?

I am using the word_associate package in R Markdown to create word clouds across a grouping variable with multiple categories. I would like the titles of each w

How to avoid error in the output (render) of a reactive object that will still be created in shiny?

I'm not able to solve the following problem with shiny app: a reactive object will be created after some procedures. In the middle of the way there is an action

Tried four different methods to convert long to wide but all result in errors

My data looks like this newdata APPLICATION USER APPLICANT 25428X. P991. A1 25428X. P929. A2 26619L. P929. A1 26619L. P991. A2 This is what I am looking for

How move files based on file names in R?

I know the question was asked many times but still i'm copying empty file. let's assume i have 50000k files and i have around 3000 file names as a vector so i w

Specify the padding between rows in a checkboxGroupInput

This is my shiny application: ui.R # values to show, or not show, these will be the 'choices' and 'selected' values # for the checkboxGroupInput() all_rows <

How to convert the following R code to Python code

The code drops the columns that are not required from the table: inputData <- inputData[,!(colnames(inputData) %in% c('col1','col2',''))] Need help converti