Category "r"

R Shiny: Slider anchors overlap at the end

On the UI, there are two sliders where the range of the second slider is dependent on the first slider's input. However, certain values on Slider 1 can lead to

Show a message instead of/within plot while data is loading in R Shiny

Is there a possibility in R Shiny to replace a plot with a "loading" message while additional data is loading? I am using a big dataset in my app and since not

R: Plotly: Treemap: Color only lowest labels

By plotting a treemap, I added a color code (colorway) in order to have all main parents having the same color scheme. I would now recolor only the minor childs

Remove borders in plotly treemap

I'm currently plotting some data using the plotly R library for the plot type treemap. When plotting the data, I get a big top border (and smaller ones on right

LDA Returning numbers instead of words from Term Document Matrix

I am trying to use the LDA function to evaluate a corpus of text in R. However, when I do so, it seems to use the row names of the observations rather than the

How to split a vcf.gz file based on the first column, keeping the header in each subset and save back to vcf.gz files

I have a large vcf.gz file (40GB) that I have to split to be able to load into R and run a script on each of the subset. I want to split it by the first column

Installing gfortran on MacBook with Apple M1 chip for use in R

I'm on a MacBook Air with an Apple M1 chip, using macOS 11.6 Big Sur. I'm on R 4.1.1. I have Xtools and gfortran for the Apple M1 installed: markwhite@marks-air

ks.test without reference sample

I'm trying to check that 2 samples follow the same unknown distribution using the ks.test function. I have two datasets: the dataset A tells me the percentage o

Setting colnames in R's cpp11

Provided that cpp11 does not provide any "sugar", we need to use attributes. I am trying to set colnames in a C++ function, as in the next MWE #include "cpp11.h

How to set axis range R

I'm having trouble setting my axis range in r. My data only has values from 2 to 9 on the x axis but I want it to go from 1 to 10. Any quick tips please? head(

R-CMD-check GitHub Actions workflow failing on warnings/notes

In the repository of my R package, I set a GitHub Actions workflow for the R CMD check command, following the examples shown in the usethis package documentatio

Extend x-axis with dates

I wish to use ggrepel to add labels to the ends of the lines of a ggplot. To do that, I need to make space for the labels. To do that, I use scale_x_continuous

ggplot2 legend items in a single horizontal row

It seems that the code I wrote and tested last week has now suddenly decided to change the output even though nothing in the code or the version of R or Rstudio

Add footer to section's start/title page

I am creating a RMarkdown template of Beamer slides and use the metropolis theme as a basis. This already includes: Numbered TOC Hiding of footer on title page

How to adjust facet size manually

I have a faceted plot with very diverse data. So some facets have only 1 x value, but some others have 13 x values. I know there is the parameter space='free' w

How to create an origin-destination matrix from two vectors (in R or Stata)

I have a dataset of commuting by individuals, like this: id Origin Destination 1 1 3 2 1 4 3 2

RPY2 error in Python script! (Conversion 'py2rpy' not defined for objects of type '<class 'pandas.core.frame.DataFrame'>')

This is my current Python code: import pandas as pd import numpy as np import rpy2.robjects.packages as rp from rpy2 import robjects as ro utils = rp.importr('

tab_stat_cpct not giving the required result

I am trying to create a table as shown in picture for multi response data with list of banner . i have tried the below way but didn't worked. library(expss) mtc

How to identify groups of interindividual revisitation?

I have an output data frame from the "recurse" package calculating the revisitation rate of several individuals based on GPS points. In the data frame I have 18

R- import CSV file, all data fall into one (the first) column

I'm new, and I have a problem: I got a dataset (csv file) with the 15 columns and 33,000 rows. When I view the data in Excel it looks good, but when I try t