Category "r"

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

Transform a list of dataframes to a nested dataframe

I'm struggling with this problem: I have three lists of dataframes (each list has the same number of rows, each dataframe has 3 columns). I want to combine the

Batch removing the second sheet from many excel sheets in R?

I have many excel sheets that I need to remove the second sheet before importing them. All files are .xlsx type in one folder and have same format. What kind of

I need to verify that a variable exists in a database. Shiny in R

I have a query that gives me a dataframe. When I receive the data frame, I use this code to make some numeric variables: variables_numeric<-c("A","B","C","D"

ggplot line legend disappears with alpha < 1

When trying to plot some data in ggplot2 using geom_line(), I noticed that the legend items become empty if I use alpha < 1. How can I fix this and why is th

Access an element of a list in the same manner how you access an element of a matrix

I have a matrix: mat <- matrix(c(3,9,5,1,-2,8), nrow = 2) [,1] [,2] [,3] [1,] 3 5 -2 [2,] 9 1 8 I have a list: lst <- as.list(dat