Category "r"

Shiny Error: replacement has 2 rows, data has 1

I am trying to create a Shiny app, in which users can select an "option" in the drop-down box(created using selectInput) and Shiny will display the data table a

gganimate does not work properly in combination with geom_area

I would like to animate a ggplot with gganimate using geom_area with different values for the years between 2000 and 2050. However, for some reason if I include

R: T-statistics with subsets

I would like to have a table as ouptut where I have the t-statistics between the difference in means of certain variables and based on two specific subsets of m

Constant warning message with reshape::melt in r

I am constantly getting warning message like : as.is should be specified by the caller using true Code is like : difficulty_data <- data_original[,c(-1)] %

Trouble reading HTML table saved with gtsave

I saved a table created by gt in HTML using gtsave. I'm having trouble loading and displaying this small HTML table in Shiny The HTML table is at: https://filed

Error in R using imputed data : Error in `[<-.data.frame`(`*tmp*`, j, value = c() replacement has 165 rows, data has 163

I am trying to add a column in an imputed dataset (I used mice). I managed to transform the imputed dataset in a dataframe, add the column that comes from anoth

When validating cox model: NaN when using rms::validate, Divergence or singularity in [all] samples

I would like to fit a Cox model for prediction of 1-year survival using a specific set of predictors. The data contains 78 events in 620 subjects. I don't think

Simultaneously remove the first and last rows of a data frame until reaching a row that does not have an NA

I have a dataframe that contains NA values, and I want to remove some rows that have an NA (i.e., not complete cases). However, I only want to remove rows at th

could not find function "symbolicInt"

I simply cannot get these functions: symbolicInt and integral. Not sure why. I just re-installed everthing. I thought maybe it was becuase of the libraries but

Replace values in a dataframe based on lookup table

I am having some trouble replacing values in a dataframe. I would like to replace values based on a separate table. Below is an example of what I am trying to d

How to display statistical significance and the mean score using ggstatsplot

I have the following R code: ##Installe the package install.packages("ggstatsplot") library(ggstatsplot) ## Create data df <- data.frame(replicate(2,sample(

How to left join two data frames conditionally - by rows that fall within a date range - and by two variables found in each data frame

I have two simulated data frames: d, created below, which has all the rows of longitudinal data for two different people. Each row has a start and end date. Som

Get dput data assigned to variable

When I try to assign dput to object, it assigns and then prints the values below. It should ne happen.It should just pass to the object get_ls <- dput(head(i

Coerce R matrix to dgTMatrix inside a function

Given a matrix object in R, it's easy to coerce it to a sparse matrix in triplet format: library(Matrix) m <- matrix(rbinom(100,1,0.5),10,10) m <- as(1*m,

how to add density line over real count value (maybe with 2 y-axis)

I would like to plot a density plot over counts histogram using following sample data: However my density line was not readable in my plot. if I use ..ncount..,

Missing list entry in loop causes ggplot2 and patchwork failure

I am trying to write a script that will generate violin plots with seurat for single cell sequencing data. I am looking for cell type clusters. Seurat makes a

What kind of object i get with input$checkboxGroupInput in shiny?

I want to do a TA dashboard in shiny and i wish to plot each indicator checked from the checkboxGroupInput the problem is when using input$my_checkboxGroupInput

Indexing dataframe within a loop

I'ld like to extract specific data from a log-data. In R it looks like that Data Frame I need values from Data$Time of the cases, where Data$Data_Type == "DATA"

Make a list out of frequencies, concatenating categories to that list

I am trying to adapt this solution, by onyambu: New data dat_in_new <- structure(list(rn = c("Type_A", "Type_B" ), `[0,25) east` = c(1269L, 85L), `[0,25)

Why are "--slave" and "--no-restore" being used by commandArgs when I call my R file with Rscript

I am running an R script using Rscript from the command line (linux) like this: Rscript myscript.R inputfile1.csv inputfile.csv integerArg My command args are