Category "r"

Understanding the get_prior output in brms package

I'm relatively new to Bayesian modeling in R and am trying to understand how to interpret the get_prior output and how to use the information in the set_prior f

Predicted values for conditional logistic regression greater than 1

I have a multivariate conditional logistic regression model. Case and controls are matched on a 1 to many basis. I want to make predictions using the model. How

Group estimate in different direction than individual components

I have a binary outcome and five classes of grouped exposures in a BHM model. One group's summary estimate does not make sense to me given the estimates of the

I keep getting object ‘country_long’ not found

power %>% count(country_long, sort=T) %>% head(10) capacity <- power %>% group_by(country_long, primary_fuel) %>% summarize(capacity_mw) pl

Rendering quietly not working if the chunk has message = FALSE

I want to render an R Markdown file quietly, i.e nothing should be displayed in the console. Let foo.Rmd be the following file: --- title: "Foo" output: ht

Parallel processing cluster not used when running dredge on a MCMCglmm model with the parallel package

I am using MCMCglmm to run a PGLMM model. Since the aim is not to make predictions, I'm using dredge (from MuMIn) to calculate model-weighted parameter values a

Plotly screenshot for big graph screenshots

actual output which is cluttered But When I click on the camera icon of plotly , I get the whole screenshot which I wanted . I have attached the screenshot of i

Clustering within a single time series (detecting process changes)

I have a single time series where you can clearly see a process change (denoted by the manually drawn lines). I am trying to detect and cluster these changes so

Creating a summary statistics table in python

I am trying to recreate the 'SummarySE()' function from R in python but I am having trouble getting it to work. The function creates a summary stats table from

Quarto file not producing data table

I am very new to Quarto and I am trying to create an markdown document using it. Everything works well except I am not able to render tables on the output HMTL

Code for cross lagged model with moderators

I want to find out which relation exists between Attractiveness (X) and self-worth (Y) and use R for it. This relation should be moderated by age (A), gender (G

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