Category "r"

app$vspace error in building phylogenetic tree in R

I am working with phylogenetic trees. Import the phylogenetic tree file with ggtree::read.tree and get the information with readxl::read_xlsx. I want to visuali

How to create beepvar or dayvar from time-varying VAR

For my Thesis, I am applying time-varying vector autoregression (TVVAR) on time-series objects. I am using a dataset from an open-source paper. As R-package I a

R code error - Error arguments implying differing number of rows: 35, 13

I am creating an NMDS plot and first I need to create a dataframe with the scores from the individual sites. This is my NMDS code: nmds_results <- metaMDS(co

In a point pattern with marks representing area height and width: how to delete points with "nested" areas?

I have point patterns comprising of several 100k marked points representing cell centres of cells of two types (big and small cells). The point coordinates are

R: Match an odd number of repetitions

I would like to match a string like \code, but not when the backslash is escaped. I think that one way of doing this could be matching an odd number of backslas

Cohen's f2 in R

Does anyone know how to extract the cohen's f2 effect size value from a model computed with the lm() function in R? I would like to report effect sizes for indi

Remove outlier from five-number summary statistics

How can I force fivenum function to not put outliers as my maximum/minimum values? I want to be able to see uppper and lower whisker numbers on my boxplot. My c

InternetOpenUrl failed: 'A connection with the server could not be established'

I have gone down a rabbit hole trying to set up Github actions to check the builds of my packages via usethis::use_github_action_check_standard(). The function

Facet title alignment using facet_wrap() in ggplot2?

I'm making a plot involving facets, and I am trying to fix the alignment of the facet/strip title. Right now it seems to left align to the panel, which places i

Add tags to post summaries of lithium themed hugo blogdown website

Using the guidance linked to at Add template for taxonomies to Blogdown default theme I was able to add tags to show-up at the top of my posts and create a /tag

Change variable chunk of a Netcdf with R

Regularly I face the same problem when using R to work with big netcdf files (bigger than the computer memory). There is not an obvious way to change the chunk

How to apply slope plot R code to another data

I have dataframe which represents sales by model within 2 different years. 'change' column stands for absolute change by models from 2020 to 2021 while 'chng.pe

Error when renaming columns with plyr in a loop in R

I found similar error but it seems the problem is not the same. for (i in colnames(t[,4:ncol(t)])) { for (j in poids_teff$station) { if (i == j) { t

Is there an R function for setting rows on aggregate data?

The data I am working with is from eBird, and I am looking to sort out species occurrence by both name and year. There are over 30k individual observations, eac

R function to start new line every n words?

I want to create an R function that inserts a "\n" after every n words in a string (where n is an argument). e.g. startstring <- "I like to eat fried potat

Error: $ operator not defined for this S4 class while running hoslem.test

I'm working on an optimization of a logistic regression model made with glm, the optimization is a lasso regression using glmnet. I want to compare both models

I'd like to gather the data frame with two key columns in R

I'd like it to gather the dataframe with two key columns, one would be mean and the other variance. Here is the data frame: est1_mean est1_var est2_mean est

Can't build RDCOMClient using rtools40 and R 4.0

A while back, I created a fork of the RDCOMClient package to keep it working with R 3.6 (https://github.com/dkyleward/RDCOMClient). People are now running into

How could I bar_plot this data.frame?

vertejumi_ceturksnos <- data.frame( Vertejumi = c("0", "1", "2", "3"), Pirmais = c(Pirmaiss), Otrais = c(Otraiss), Tresais = c(Tresaiss), Ce

R not changing Plotly colorscales for Contour plots

Okay, so I am using a generic data set to troubleshoot this problem. Here is the code I am entering into R: library(plotly) fig <- plot_ly( type = 'cont