Category "r"

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

How to split up a dataframe with one column into a dataframe with different columns?

I have asked a similar question before and tried to use the answers (which were very good) on my project, but I failed. I have the following dataframe: library(

Extract single value from function that returns multiple values for use with dplyr() pipe

I have the following data: date_range <- c('2020-01-31', '2020-02-28', '2020-03-31', '2020-04-30', '2020-05-31',

Multiple comparisons with gtsummary

Since my question is similar to one that's been asked before, I'll steal the reprex (also below), for consistency's sake, from Summary Table (mean + std.error)

How can I reshape a long dataset into a short data set with multiple variables

**UPDATE My data set contains 314090 observations in the following format: UPDATEDID BRIEF_ID gamma LDR_SUM LDR_Topic LDR_7Code 16 04999120040277 2.879744e-03

can you use split_cols_by and also get a total column?

I'm making a table like this: basic_table() %>% split_cols_by("ARM") %>% analyze(vars = c("AGE", "BMRKR1"), afun = function(x) { in_rows( "M

R: How to remove spikes/outliers on ggplot2

Given the following R script: library(glue) library(ggplot2) library(tidyverse) library(magrittr) library(stringi) library(dplyr) ir.data <- read.csv(file="

RASTER TO VECTOR : WriteVector from terra package leads to fatal error

I have this sampled code that I tried on RStudio these last days : library ('terra') binar <- rast("C:/Users/BIC_/Desktop/21_binarisation_SWIR.tif") poly_ra

Convert date of birth to age

I want to convert date of birth to age using the following code df$age <- round(as.numeric(Sys.Date()-as.Date(df$DOB),format="%d/%m/%y")/365) The format of

R Count Frequency of Custom Dictionary in a Dataframe Column but Group them

I have a task, which is too complex for my R-knowledge. I have a dataframe with Tweets-data, including a column that consists of the usernames, data of the Twee

Problem when creating a weights column in the table

Running regression with panel data on different geographical levels in the US and Euro area with weights that essentially look like this: lm(log(POP25) ~ log(EM