Category "r"

Comparing two Excel files in R and returning different titles

I am working on a project at work where I am required to compare two Excel spreadsheets to see if a title has been added or removed from the second excel sheet

Split numbers and dates into separate columns

My data contains text strings with three important features, an id number separated by":" and a starting date and an end date. I need to get these tree numbers

How to filter out rows that do not fit specified condition in R [duplicate]

I have this data frame: df <- data.frame (ID = c(1:20), Ethnicity = c(rep(c("White", "Asian", "Black", "Hispanic", "Othe

Terra equivalent for raster::stack()?

Basically the title. I know you can read in a folder of rasters with rast() but I just want to stack two rasters that are read in separately. Thanks

Automatically find the best figure dimensions in r?

I am producing many different plots in rmakrdown using ggplot2 and don't want to manually edit their fig.width() ; fig.height() or fig.asp() one by one. Some pl

How to create a mosaic from different shapefile in R?

I have 37 shapefiles with different names.Individually each of them represent a different part of a country. I would like to create a mosaic of my 37 shp to jus

How to apply code to dataframe by condition?

I have the following dataframe: library(dplyr) library(tidyverse) library(concordance) Year <- c(2016,2016,2017,2019,2020,2020,2020,2013,2010,2010) Pf <-

How to sum values in multiple rows to a new column in R?

My dataframe: structure(list(Observation = c("Apple", "Blueberry", "Cirtus", "Dates", "Eggplant"), Topic = 1:5, Gamma = c(0.1, 0.1, 0.2, 0.2, 0.1)), class = "

Looping through environment objects with a special pattern

I have a multiple lists in my environment(all start with "CDS_"). Each list is conducted of multiple sub lists.I want to call the lists one by one to apply a fu

stargazer: odds ratio for hazards model with wrong significance stars

I have been using the following function to output logistic regression tables with stargazer as odds ratio with the right significance stars and standard errors

testing for proportional hazards: cox.zph()

I am confused on what the cox.zph is showing. I came across this test in documentation for the finalfit package, and there was this bit under the heading "Testi

R matrix - how to convert data from data frame columns into 1/0 matrix

I'm preparing a master's degree project and stuck with basic data manipulation. I'm importing several data from the Prestashop database to R, one of those is a

Preparing data for Gephi with Python or R

I am currently trying to prepare my data for network analysis in Gephi. I have data in the following format: Raw Data SHIPMENTCOUNT US Port Foreign Initial Po

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() --------------------------------------------------------------