Category "r"

R plot doesn't shows on Mac but the same plot shows on Windows

Yesterday I bought a Mac (M1 processor) and today I installed R and R Studio. I tried to plot the same code in a Windows machine and my Mac, but the plot only s

Insert Attributes in Parent Nodes in JSON with data.tree in R

I am new to tree.data, and have the following data: library(data.tree) library(jsonlite) # data Show <- c("The Flintstones", "The Flintstones", "The Flintst

survfit outputs NA upper bounds but median survival is reached

The following data reach the median survival of 50%, but the upper bounds are NA. I am unable to figure out why the upper bounds are NA if I have valid survival

Count number of rows that fulfill multiple conditions in R

I have a dataframe: df <- data.frame (ID = c(1:20), Ethnicity = c(rep(c("White", "Asian", "Black", "Hispanic", "Other"), times=20/5)),

Purrr::pmap using a named list of columns with '~' function doesn't respect names from .l?

This is my first time posting, so bear with me. I'm using purrr::pmap() to map a function over 3 columns of a tibble(), to create a 4th column library(tidyverse

Delete title section from shinydashboard box

How can someone delete the title section in shiny box? Or reduce its height to 0? No I dont want it NULL or ="" library(shiny) library(plotly) library(shinydash

Having trouble when installing rgee at "2.Creating a Python enviroment(rgee)"

codes are simple: library(rgee) ee_install()` what shows in console are as follow: ee_install() --------------------------------------------------------------

CONDITION WHICH VERIFY THE 2 FIRST CARACTER

I am working in R, this is a look of my table : IAE_2017 IAE_2018 L1PYSH L2PYSH M1CHIMIE M2CHIMIE ..... ........ Now I want to make a conditi

How do I restart R in linux using a line of code?

I need to restart an R session running in linux using a line of code. When the R session restarts I need it to load an existing R script and for the new R sessi

Can't replicate R tidysynth results

This is an odd sort of question, but I'm using the exact data and code from this github here: https://github.com/edunford/tidysynth However, when I get to the c

Error in converting Matlab code to R code using tidyverse and matconv

I am using a piece of R code which was provided as a response to the previous question Using tidyverse and matconv to convert Matlab code to R code. The code su

How to use mutate() +across() only for specific rows

The data: df <- tribble( ~name, ~val.I, ~val.V, ~`val.%`, "Peter", 123, 12.4, 14, "Peter in %", 111, 532, 57, "Harald", 2222, 3333, 444, "Harald in

Mutate variable conditional on first unique occurance of another variable

I want to create a variable which identifies the first occurance of a variable in a column but I cannot seem to get the code to work. The new varibale should on

Remove variable in model_parts() plot

I want to remove certain variables from the plot. # Packages library(tidymodels) library(mlbench) # Data data("PimaIndiansDiabetes") dat <- PimaIndiansDia

Making a table from CI output

I am trying to make a table from my CI output, I do not have experience making tables in R and would really appreciate some help. CI <- data %>% group_by(

R data visualization: Is there a way to plot based on emmeans using ggplot?

I am trying to visualize my data separately as a bar graph and as a dot plot connected by a line. The experimental design includes 2 treatments, 3 levels for ea

R output matrix index with values in dataframe

I am trying to find the "matrix index" from values of dataframe in the Position column. The "matrix" that I would like to reference to is either a 3 x 3 or 4 x

Calculate row means on subset of columns

Given a sample data frame: C1<-c(3,2,4,4,5) C2<-c(3,7,3,4,5) C3<-c(5,4,3,6,3) DF<-data.frame(ID=c("A","B","C","D","E"),C1=C1,C2=C2,C3=C3) DF I

Automatically Create Tabbed skim() results with Proper Output format

I'm trying to create dynamically create tabbed output of skim() results in a R Notebook, but the output format comes out all funky. I'm using the asis results o

How can I check if a block of multiple lines matches certain criteria, without loops?

I have a data set with 2 million lines, so loops are not an option. The problem is about as follows: Each line is a transaction by a person. A person can have m