Category "r"

R Plotly Bar Chart - Add horizontal line markers

I want to draw a bar chart with two bars side by side for each category (LETTERS) and add a horizontal line to each bar (y_ref as red lines & z_ref as green

How to set size of rpivotTable in rmarkdown document

I would like to include several rpivotTables in an rmarkdown HTML output (document, flexdashboard, other options that result in a standalone HTML file are ok; I

dplyr mutate only works once

I'd like to add a new variable to a dataframe for plotting labels, as seen in the top voted answer here Here's the data: small <- structure(list(Site = stru

Tibetan characters in data.frames cannot be displayed in R console even after locale is set (Chinese is fine, Tibetan in matrices is fine)

In R, Tibetan characters do not display properly when they are located in data.frames: > Sys.setlocale("LC_CTYPE", "Tibetan") [1] "Tibetan_China.950" > da

Error while running WTC (Wavelet Coherence) Codes in R

I am doing Wavelet Analysis in R using Biwavelet. However, I receive the error message: Error in check.datum(y) : The step size must be constant (see approx fun

How can I plot a sphere with plotly in R?

I would like to plot a sphere in the following plot: And that is the code for it: library(plotly) fig <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec,

Creating custom rendered footer values i a reactable

I am having a hard time to render my footer column in a reactable. I want to use JS here to access the client-side filtered state, and since iam not too familia

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