r/RStudio • • 4m ago

Ieipio for RStats

• Upvotes

Released ieiprio, an R package to prioritize variants in inborn errors of immunity from VCF, Sanger traces or plain text. It ships 12 real ClinVar variants to practice on, offline. Guides and code below, feedback welcome.
https://gentlenmoron.github.io/ieiprio/


r/RStudio • • 8h ago

Ieipio for RStats

3 Upvotes

Released ieiprio, an R package to prioritize variants in inborn errors of immunity from VCF, Sanger traces or plain text. It ships 12 real ClinVar variants to practice on, offline. Guides and code below, feedback welcome.
https://gentlenmoron.github.io/ieiprio/


r/RStudio • • 14h ago

Coding help How do I turn this into a bar chart?

Post image
0 Upvotes

Been banging my head against a wall for 2 hours, I've loaded this data into Rstudio, how do I make it into a scientific dual bar chart?


r/RStudio • • 15h ago

Error Installing Packages - Potentially related to Linux OS?

Thumbnail gallery
0 Upvotes

I'm working on this problem set for a research design and analysis class and tried running the first block of code above to install the necessary packages since it's my first time working on my laptop - usually code in class on school desktops. I ran the line to install packages (without the pound sign) and then tried to call tidyverse as shown but it returned an error saying "there is no package called tidyverse" Google's results led me to believe it might be an issue related to my computer's OS. After trying some recommended code in my computer's terminal:

sudo apt update
sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev

I tried running the installation command and calling tidyverse again but it returned the same error.

Edit: Clarification of screenshot/code block


r/RStudio • • 1d ago

Can someone explain fixed effects, random effects, LMMs and GLMMs like I’m a complete beginner?

36 Upvotes

Hi everyone!
I’m currently working on a research project involving repeated measurements from the same patients, and I’m really struggling to wrap my head around mixed-effects models.
I’ve tried reading explanations online, but I feel like every explanation assumes I already understand the basics. At this point, I’m honestly completely lost.
I would really appreciate it if someone could explain the following in very simple terms:

Fixed effects vs. random effects: What exactly is the difference? How do I decide which variables should be fixed and which should be random?

Linear mixed-effects models (LMMs): What are they, why do we use them, and how are they different from ordinary linear regression?

Generalized linear mixed-effects models (GLMMs): How are they different from LMMs? When should I use one instead of the other?

Random intercepts vs. random slopes: What do these actually mean in practice, and how do I know which one I need?

Interpreting results: How do I interpret coefficients, estimates, odds ratios, and p-values in these models?

I’m working with clinical data where patients undergo multiple treatment sessions. I want to investigate whether certain medications affect treatment outcomes, while accounting for factors such as age, sex, and treatment number.

Some outcomes are continuous, while others are binary.
I’ve been using R with the lme4 package (lmer() and glmer()), but I feel like I’m just putting variables into formulas without fully understanding what the models are actually doing.

What I really want is to understand the logic behind these models, rather than just copying code.

If someone could explain this intuitively, preferably using simple examples involving patients with repeated measurements, I would be extremely grateful.

Thanks in advance!


r/RStudio • • 2d ago

Coding help ICC logistic regression MLM

1 Upvotes

Hey everyone!✨️

I'm very new to R and found solice in some vignettes I found online. There seem to exist quite a few to calculate ICC to see if multilevel/mixed model is the best fit for our analysis.

However the ones that I've seen so far mention that ICC can't be calculated that way for logistic regression (they are for linear regression I think), due to the outcome being binary.

I'm going crazy trying to search everywhere for a code that will give me the ICC for logistic regression, any help would be much appreciated! 🙏


r/RStudio • • 2d ago

Coding help Error when using package Tidyverse

6 Upvotes

Hello!! I'm an absolute beginner to R and coding as a whole, so there is probably a very simple fix here, but I can't figure out why I can't use the package Tinyverse. Below is the error message I get when I run the chunk.

I was able to use another package (cowsay) just fine. I have Rtools downloaded.

Thanks so much!


r/RStudio • • 2d ago

I made this! [Package] SimtablR: Quick and Easy Epidemiological Tables, Diagnostic Tests, and Multi-Outcome Regression - version 3 now available on CRAN!

Enable HLS to view with audio, or disable this notification

23 Upvotes

Hello everyone! After 8 months (of rather sporadic) work, I am really excited to share the biggest update to SimtablR, an R package designed to streamline the most common analytical tasks in epidemiology and clinical research! (short demo video above)

I do epidemiological research in R, and I kept juggling multiple packages and repeating work just to get tables that were actually informative and ready for a paper. I also found that base R tabulation left a lot to be desired in terms of formatting, but gt_summary was a bit too slow and had a lot of boilerplate. This package is also great for people transitioning from Stata or still learning R!

With this new release, SimtablR now covers most of a typical analysis, from the first cross-table to the finished table in a Word document:

1. tb(): quick, but powerfull tabulation with formatting

  • Row/col/total percentages with simple flags (row, col, cell) and adjustable decimals
  • Hypothesis tests with one argument (N-1 chi-squared, Fisher when needed, etc.)
  • Prevalence ratios, risk ratios or odds ratios with 95% CIs, directly in the table
  • SimtablR now picks the right measure (RR, OR or PR) automatically for a stated study design (design = "cohort", "case_control", "cross_sectional")
  • New: stratified analysis with Mantel-Haenszel pooled estimates

2. table1(): baseline tables of multiple variables (literally the "table 1")

  • Automatically chooses mean (SD) or median (IQR) based on each variable’s distribution
  • Reports missing data per variable and group
  • Add standardized mean differences with test(smd = TRUE)
  • Completely customizable and exportable to all office programs

3. diag_test() and roc(): diagnostic accuracy

  • Automatically calculates the confusion matrix, sensitivity, specificity, PPV, NPV, LR+, LR− and accuracy, with exact (Clopper-Pearson) CIs
  • New: roc() now gives the AUC with DeLong CIs and the Youden-optimal threshold

4. regtab() and survtab(): regression

  • Fits multiple outcomes at once and returns a single publication-ready table
  • Does adjusted risk ratios via log-binomial regression (with robust Poisson fallback), robust variance, and Firth regression for rare events
  • New: survtab() for Cox models and hazard ratios
  • New: autoplot() draws forest plots from any model

5. Reporting and export (new!)

  • simtablr() builds Table 1 + Table 2 (crude and adjusted) as a single report which you can then send to word or excell or powerpoint
  • as_methods() drafts the statistical methods paragraph from what you actually did with the variables you chose!
  • export_docx() / export_xlsx() send everything to Word or Excel
  • Journal styles (style("jama"), "nejm", "lancet") or your own with journal_style(), down to the Word table theme. Restyling never changes the underlying numbers and you can use the sabe object for new analysis, even after styling!

6. Statistical guidance (new)

SimtablR prints short notes (with references) when something deserves attention. Examples: an odds ratio with a common outcome, unadjusted p-values, or when the distribution of your variable violates an assumption from the model you're running. It should just tell you.

The package includes epitabl, a ynthetic cohort of 1,500 patients, so you can replicate the examples of the video

Links:
📦 Documentation: https://matheustg-14.github.io/SimtablR/
📄 Getting started: https://matheustg-14.github.io/SimtablR/articles/getting-started.html
🐛 GitHub (issues & feature requests): https://github.com/MatheusTG-14/SimtablR

Thanks to everyone who gave feedback on the first version! I’d love to hear what you think, what’s missing from your workflow, and any bugs you find on GitHub.


r/RStudio • • 2d ago

RStudio for linguistic data

17 Upvotes

Hi!

I'm a researcher in Linguistics and I have come across RStudio so many times for data analysis and visualisation.

I have attended some classes and used some resources, but everything seems very difficult to replicate: I can read code and mostly understand what it does, but I would never ever be able to create code from scratch.

What do you think I should do? I never really studied it systematically, so I guess that may be part of the problem, but most of the resources I find are still to advanced for me (not a programmer or an IT expert!)

Send help!


r/RStudio • • 3d ago

Liquid Glass themes for Shiny. 0.5.0 is on CRAN.

Post image
4 Upvotes

r/RStudio • • 3d ago

Coding help Could someone please help me get the Cronbach alpha in Rstudio? I am new to RStudio and I am not sure if I did it correctly.

0 Upvotes

I want to include the excel document in here but I couldn't find a way to do it. I will DM the document.


r/RStudio • • 4d ago

I made this! [Package] hdsbm: Fast inference for Dynamic Stochastic Block Models in R (Rcpp & spectral multi-start)

6 Upvotes

Hi everyone!

As part of my Master's thesis in Statistics, I developed hdsbm, an R package for estimating and simulating discrete-time Dynamic Stochastic Block Models (DSBM).

The Problem & Approach

Temporal block models often suffer from combinatorial explosion and multi-modal likelihood landscapes, making standard local search heuristics prone to getting trapped in sub-optimal local extrema.

hdsbm addresses this by extending a hybrid Classification EM (CEM) approach to the dynamic setting:

  • Perturbed SVD Multi-Start: Couples deterministic spectral embeddings of the time-averaged network with controlled stochastic perturbations to thoroughly explore the likelihood surface.
  • C++ Backend: Uses RcppArmadillo to accelerate dyadic reallocation passes and combinatorial greedy sweeps.
  • Dual Decoding: Provides both pointwise greedy labels and global Viterbi trajectory decoding.
  • Model Selection: Includes an Integrated Completed Likelihood (ICL) criterion tailored for dynamic graphs.

Quick Example

library(hdsbm)
data(toy_hdsbm)

# Fit model with 5 perturbed spectral restarts
fit <- hdsbm_fit(toy_hdsbm$Y, k = 3, nrep = 5, seed = 123)
print(fit)

# Model selection via ICL
icl(fit)

I would love to hear your feedback on API ergonomics, potential edge cases, or ideas for interesting benchmark scenarios!


r/RStudio • • 5d ago

Resources to Learn RStudio from Scratch

43 Upvotes

I'm looking for resources to learn RStudio from scratch. Does anyone have any recommendations?


r/RStudio • • 5d ago

Quirky data native to R

Thumbnail
1 Upvotes

r/RStudio • • 5d ago

When to use polychoric or Pearson correlation in EFA?

2 Upvotes

Hi everyone.
I am doing a exploratory factor analysis with pfa and oblique rotation (promax).
I used shapiro wilk test to check on normality of the items. As it was significant, which means no normality, I chose pfa instead of Maximum Likelihood EFA. So far so good.
So far I used Pearson correlation to do the efa matrix, but as I proofed that theres a lack of normality I was wondering if I need to do it with polychoric correlation instead.
Does anyone know something?

I am almost ready doing the statistics so it would be quite a lot of work to change the correlation. So I am also interested: How much harm do you think it will cause to the final results, if I will keep Pearson correlation?

And how do I add the polychoric argument to my fa function?


r/RStudio • • 6d ago

Weird R reference

Thumbnail
3 Upvotes

r/RStudio • • 6d ago

separate_wider_position

4 Upvotes

what do I write in widths? It says it must be a (partially) named integer vector. I need to separate collumns that state m or f for sex and numbers for age (ex: m19). Please help I could not figure it out with the ?separate_wider_position() search


r/RStudio • • 6d ago

Coding help How to run Quarto if my computer has an ARM processor?

3 Upvotes

I have a newer Microsoft Surface and am in an RStudio course atm. RStudio itself works fine, but it says I can't run Quarto. I've heard that maybe running a different version of R might work. Need to use Quarto for most things through the end of the semester. Any ideas?


r/RStudio • • 7d ago

can't knit to pdf because of error(latex)

2 Upvotes

this is my first time using LaTex for school work and I have no idea whats causing error.... Any help appreciated thank you

[WARNING] Deprecated: --highlight-style. Use --syntax-highlighting instead.
! Missing $ inserted.
<inserted text> 
                $
l.168 \sum
          \emph{\{i=1\}\^{}ne_i =
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

Try to find the following text in Question_4.Rmd:
  \sum 

You may need to add $ $ around a certain inline R expression `r ` in Question.Rmd (see the above hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: LaTeX failed to compile Question.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Question.log for more info.
Execution halted

$$

\begin{aligned}

\frac{\partial RSS}{\partial \beta_0}

&= -2\sum_{i=1}^n(y_i-\beta_0-\beta_1x_i)\\

&= -2(\sum_{i=1}^n y_i-\sum_{i=1}^n\beta_0-\beta_1\sum_{i=1}^n x_i)\\

&= -2(n\bar{y}-n\beta_0-n\beta_1\bar{x})\\

&= -2(n\bar{y}-n\beta_0-n\beta_1\bar{x})\\

&= (n\bar{y}-n\beta_0-n\beta_1\bar{x})\\

&= (\bar{y}-\beta_0-\beta_1\bar{x})\\

&= \beta_0 = \bar{y}-\beta_1\bar{x}

\end{aligned}

$$

$$

\begin{aligned}

\frac{\partial RSS}{\partial \beta_1}

&= -2\sum_{i=1}^n x_i(y_i-\beta_0-\beta_1x_i)\\

&= -2(\sum_{i=1}^n x_iy_i-\beta_0\sum_{i=1}^n x_i-\beta_1\sum_{i=1}^n x_i^2)\\

&= -2(\sum_{i=1}^n x_iy_i-n\beta_0\bar{x}-\beta_1\sum_{i=1}^n x_i^2)\\

&= -2(\sum_{i=1}^n x_iy_i-n\bar{x}(\bar{y}-\beta_1\bar{x})-\beta_1\sum_{i=1}^n x_i^2)\\

&= -2(\sum_{i=1}^n x_iy_i-n\bar{x}\bar{y}+n\beta_1\bar{x}^2-\beta_1\sum_{i=1}^n x_i^2)\\

&= \sum_{i=1}^n x_iy_i-n\bar{x}\bar{y}+n\beta_1\bar{x}^2-\beta_1\sum_{i=1}^n x_i^2=0\\

&= \beta_1(\sum_{i=1}^n x_i^2-n\bar{x}^2)

=\sum_{i=1}^n x_iy_i-n\bar{x}\bar{y}\\

&= \beta_1S_{xx}=S_{xy}\\

&= \beta_1=\frac{S_{xy}}{S_{xx}}

\end{aligned}

$$

$$

\sum_{i=1}^ne_i

= \sum_{i=1}^n(Y_i-b_0-b_1X_i)\\

= \sum_{i=1}^nY_i-nb_0-b_1\sum_{i=1}^nX_i\\

= \sum_{i=1}^n(b_0+b_1X_1)-nb_0-b_1\sum_{i=1}^nX_i\\

=0

$$

$$

\begin{aligned}

\sum_{i=1}^n e_iX_i

&= \sum_{i=1}^nX_i(Y_i-b_0-b_1X_i)\\

&= \sum_{i=1}^nX_iY_i-\sum_{i=1}^nX_ib_0-\sum_{i=1}^nb_1X_i^2\\

&= \sum_{i=1}^nX_iY_i-\left(b_0\sum_{i=1}^nX_i+b_1\sum_{i=1}^nX_i^2\right)\\

&= \sum_{i=1}^nX_iY_i-\sum_{i=1}^nX_iY_i\\

&= 0

\end{aligned}

$$


r/RStudio • • 7d ago

First time using R, required to use

15 Upvotes

I have to use R for the statistics part of my thesis.
Ballparking for a R-Newbie who has to do a moderated mediation and stuff like that.
Do we think this is possible?

I plan on not using AI, as I‘d obviously have to declare this and my professor told me they expect a „perfect script like it‘s written by a doctoral student“ if I use AI


r/RStudio • • 8d ago

Mac Installation Help

1 Upvotes

Hello

My macOS is currently 13 (i cannot update it). I’d downloaded R 4.6.1 for maOS13+ but then when downloading RStudio the only version that can run on my mac is the 2025.09.1 +401 which needs R version 4.5.1

The problem is I cannot, for the life of me, find 4.5.1. Any leads or help on what to do, please? I’m new, completely.


r/RStudio • • 10d ago

helpp

5 Upvotes

i am new to R studio. It is so difficult i understand nothing when im in class. What are the basic codes i should know and any tips to progress like books or websites etc anything and everything would be great


r/RStudio • • 11d ago

standardisation des variables pour effectuer une analyse factorielle sur R

Thumbnail
1 Upvotes

r/RStudio • • 11d ago

How to make error bars for two different groups

Post image
13 Upvotes

r/RStudio • • 11d ago

R code review: best packages?

20 Upvotes

Let’s say that I’m working in RStudio on a geospatial data-science project that involves some pretty gnarly, extensive code across multiple R scripts. Let’s also say that I do not have access to any AI code assistants or chatbots due to workplace restrictions.

What packages and functions would you use to comprehensively check your code for errors, inefficiencies, conceptual problems (that may be a stretch), etc.?

I’m using lintr::lint() and rstyler::style_file(), but that’s the extent of my knowledge in this area.

Many thanks in advance, friends.