Category "r"

Extracting rows based on more than two partial strings that must all be part of the string

I want to extract rows that must contain two or more partial strings. For example, suppose I have the following data.table df <- data.table(player = c('A', '

Shiny datatable mode editable - restrict specific columns AND ROWS

I would like to restrict editable mode in datatable for columns and rows. For the moment, in this minimal example, I can edit only specific columns but it doesn

Using grep to match variables in one column to a string of text in another column [duplicate]

I need to match a string in the first variable with a string in the second variable and then return true or false in the third column. Here is

Create a column includes all confidence intervals

I have a code like that : library("survival") library("survminer") data("lung") res.cox <- coxph(Surv(time, status) ~ sex, data = lung) x<-confint(res.

Trying to replicate figures from Bayesian statistics without tears: A sampling-resampling perspective, but failed

I'm trying to replicate the three figures from the paper Bayesian statistics without tears: A sampling-resampling perspective, which can be fo

How to disable all Shiny UI elements, including a downloadButton

This answer explains how can one disable/enable all UI elements in a Shiny app. Among the two solutions given, the one I am interested in uses the shinyjs packa

Summary of descriptive data

i got a panel data set. I am analysing name changes of mutual funds. I created 6m prior & 6m past name-change Mean & Median values for various variables

How do I populate upper.tri of matrix with matched integers from the lower.tri?

Issue I have a dataframe of familial relationships coded with integers, where R01 is the relationship of person N to person 1, R02 their relationship to person

Calculate percent from total observations in r gtsummary::tbl_summary?

Issue: In gtsummary the tbl_summary function calculates column percent out of the total non-missing observations. I would like gtsummary to calculate percent fr

Get data from variable z where variable x = variable y

library(dplyr) df = data.frame(group_id = c(rep("a",5), rep("b",5)), prod_id = 1:10, prod_type = rep(c("a","a", "b", "c","d"),2)

How to aggregate row values with multiple row criteria

I'm trying to aggregate values present in rows in which repeated values present in other columns must be used as a criteria: This is what I have: Candidate, Cit

Divide Legend by multiple groups

In am looking a solution to a different representation of the legend to the example given here: https://rpubs.com/ageek/ggplot-adv-part2 The code below gives th

Connect to googlesheets via shiny in R with googlesheets4

I'm trying to use an updated version of this example to connect to a private googlesheet via shiny, and deploy this app on the shinyapps.io server. The user is

Replication for SVAR

I am using Stata and studying VAR, Orthogonalized VAR, Structural VAR. I successfully replicated VAR and OVAR, but I failed to do that for SVAR. Could anyone su

How to read dirty csv file in R?

I have a very dirty data that I need to read in R. The csv file seperated with comma, but there are also some commas in the first column of my data that puts me

R Shiny, shinjqui get orderInput after modification

I have an orderInput from the shinyjqui library and I would like the server to set which items are in the orderInput. Afterwards I would like the user to modify

R Shiny, shinjqui get orderInput after modification

I have an orderInput from the shinyjqui library and I would like the server to set which items are in the orderInput. Afterwards I would like the user to modify

How to loop over on different files and save the output with filename in R?

I have several files with the names RTDFE, TRYFG, FTYGS, WERTS...like 100 files in txt format. For each file, I'm using the following code and writing the outpu

Converting character to date turning all dates to NA & x-axis of ggplot not in chronological order [duplicate]

I am using an online ONS dataset of inflation and trying to chart it, but when plotting it with ggplot the x-axis is not in chronological orde

How to copy multiple row and column headers in a rendered table when using DT table copy function?

A similar question was posted but never answered: r shiny problem with datatable to copy a table with table head (colspan) When running the below reproducible c