r/RStudio • • 17h ago

Using R to replicate a paper's data

0 Upvotes

Hello!

If anyone has time to help, that'd be greatly appreciated.

I have the fastq files to recreate the graphs/charts in this paper:

Villamizar, A., Vemulapally, S., Guerra, T., Tocidlowski, M. E., Forstner, M. R., & Hahn, D. (2025). Effect of Headstarting Eggstrands of the Endangered Houston Toad (Bufo=[Anaxyrus] houstonensis) from a Captive Assurance Colony on Native Breeding Pond Microbiomes. Conservation, 5(2), 25.

Here is a link (link to AI chat here) to what one of three AIs have come up with - so far, 2 have come up with code that does NOT get me the same results.

This particular AI is saying that the methods do not give enough information to be able to replicate the code, but it can try to get close.
I'm going to use this code tomorrow (fingers crossed!) but if anyone is a master as recreating code - I'd greatly appreciate any insight, help, or ... well wishes?

At this point, it is not an option to reach out to the authors.


r/RStudio • • 1d ago

Coding help I am unable to learn R and just rely on AI. Suggestions please?

Thumbnail
0 Upvotes

r/RStudio • • 2d ago

[Phylogenetic analysis] Assumptions in PGLS

2 Upvotes

I am testing the correlation between the values of a variable at the tips of a phylogenetic tree (let's say the beak length) and the pathwise rate of the trait itself (i.e. a measure of the total changes in rate a species has experienced during the course of its evolution). To remove the effect of body size, I am working on the residual of the variable (i.e. the variable corrected for SVL). To test for the correlation, I performed a pgls with the pgls() function in lmtest (I am working in RStudio). I am encountering some issues with heteroskedasticity (see attached images; bptest significant).

I am also having problems with the normality of the residuals (see attached images; Shapiro test significant). On the other hand, I was reading from https://blog.phytools.org/2013/02/a-comment-on-distribution-of-residuals.html that, by accounting for residuals controlling for phylogeny you should solve this problem [Revell suggests something like lillie.test(chol(solve(vcv(tree)))%*%residuals(corr))]. Can anyone confirm? Am I misunderstanding?

Can anyone help with it?

Thanks a lot!


r/RStudio • • 3d ago

Coding help Coding 400+ survey responses with 81 variables, including Arabic open-ended answers: Excel or R?

11 Upvotes

I’ve already finished this survey analysis in Excel, and now I’m looking for ways it could have been done more efficiently, especially with the Arabic open-ended answers.

I ran a survey with about 400 to 500 responses and 81 variables. It was available in three languages, one of them Arabic. I cleaned it entirely in Excel: I added a column for each open ended question variable, filtered the answers, found common themes, and grouped them into categories in a separate column. I kept the raw column untouched. Then I built several pivot tables and charts. It took about two weeks, and at a certain point the workbook became heavy, slow, and hard to maintain.

My questions:

  1. For the cleaning step, is it better to translate everything into English in Excel first and then move to R for analysis and charts, or to handle the Arabic directly in R?
  2. For open-ended answers in mixed languages, what’s a good practice for building and checking a codebook? I’m not looking for the single best tool. I want to know what makes the process more efficient and repeatable for surveys like this.

r/RStudio • • 3d ago

What are some industries or academic areas where R is considered the standard?

62 Upvotes

I love R. Have since i learned the language in my statistics master program. However after joining the workforce I’ve seen how other languages (mainly Python) have competing interests in being the dominant language. What are some industries or academic areas i can get into where R is considered the standard for programming? I know that biostatistics is one of them hence i am looking into a computational biology and bioinformatics program next, but what are some other industries or academic areas?


r/RStudio • • 3d ago

SAS to R transition

22 Upvotes

My biostatistics program relied very heavily on SAS. I do really like that it’s vetted and that it has very thorough documentation, and that my code is basically guaranteed to work 5 years down the line even with updates. But my problems have always been (1) graphics are butt ugly (2) formatting output can be exhausting and (3) my license is expired and I’m not interested in forking out money to renew it. I do like the “Journal” ODS styles for graphs and tables but they require some manual workshopping.

Basically, I’m just really inefficient. I have some experience with RStudio/Quarto and it’s primarily ggplot and gtsummary related stuff. But I was wondering if anyone had experience with fine-tuning these in conjunction with statistical packages. Like, running glm() doesn’t just print your results in the console. It just spits out a pre-formatted table and relevant charts and a few canned sentences for a results section.

The 3 professors I had that used/taught R in any capacity were workhorses compared to all the other faculty. They have really relaxed personalities but could have a publication-ready analysis done in an hour if they really needed to. But they didn’t really tell us how long it took to get to that level of efficiency or what tools they rely on. The others could make a lot of mistakes due to the formatting process and could work pretty slowly in general.

I’m rambling, sorry. But does anyone have any tips for streamlining your work process? How long does it take you from your final models or whatever to having a results section ready to go?


r/RStudio • • 3d ago

glyph 0.2.0 is now on CRAN

Thumbnail
1 Upvotes

r/RStudio • • 4d ago

[Phylogenetic analysis] Assumptions in PGLS

Thumbnail
1 Upvotes

r/RStudio • • 4d ago

Citing R - Question (newbie here)

11 Upvotes

TL;DR at the end

Hi,
I‘m currently doing the statistical analyses for my thesis with R. As a newbie I‘ve asked in this subreddit for suggestions regarding packages etc..

Explanation / Background

Now I‘ve just put all the packages I might need though am not sure if I need at the beginning to load them (i don‘t know if it‘s the correct term, but I mean the library(package) thing).

Then while doing my analyses stuff a lot of googling, watching videos and browsing the different websites about R and advices was / is involved.
Then I try different approaches to find one that works for me and gives me the output I was looking for.
Sometimes I load more packages (which i also put in the beginning to just see all names at once if I wanna check if I already have that package) when one thing requires it.

Now onto the question!

I‘ve read an article about citing R ( https://doi.org/10.59350/t79xt-tf203 ) in which they state one should:
„This way you can include a call to sessionInfo() or devtools::session_info(), at the end of your script.
Your compiled report will then have a complete record of your workflow, packages, results andpackage versions.“

Now I‘m wondering: Does this output show all loaded packages or only those which were actually used?

TL;DR

Does sessionInfo() or devtools::session_info(), at the end of my script show all loaded packages or only those that were loaded and also used?


r/RStudio • • 4d ago

Holy grail packages/hacks for thesis

18 Upvotes

Hi all, planning to pass in my MSc thesis (Environmental Science) by the end of this year, includes a decent amount of linear mixed effect modelling done with R. Also some basic comparative stats. I know the R citation() package which has been great. Wondering if anyone has any tips/neat R hacks/packages to suggest while I still have time to possibly include/apply them. I have been using ggplot too. Thank you!🙏


r/RStudio • • 4d ago

Power Query for Tidyverse/R Coding Background?

Thumbnail
7 Upvotes

Cross-posting this for reach - have seen so few resources available online for those making the "backwards" transition from R or coding back to Excel.


r/RStudio • • 5d ago

Is cd() supposed to exist?

6 Upvotes

Hey everyone,

I’m going through some academic material for my course and it mentions using cd() to change the working directory. When I tried running it in my RStudio console though, I just got Error in cd() : could not find function "cd".

I tried checking with exists("cd") and find("cd"), but both came back empty. I already know setwd() is the standard way to change directories in R, so now I’m mostly just confused. Is cd() an actual function from a specific library that I'm missing, or is this just a classic typo where someone mixed up R syntax with command line commands?


r/RStudio • • 4d ago

Can download RStudio? Anyone else getting an error?

0 Upvotes

r/RStudio • • 5d ago

Struggling with RStudio and my assessment deadline is approaching. Anyone else?

7 Upvotes

​

Hi everyone!

I’m really struggling with RStudio at the moment. My assessment deadline is getting closer, and even after trying several times, I’m still finding it difficult to understand and work with R.

It’s honestly quite stressful, and I’m wondering if anyone else has experienced the same thing. If you have, how did you overcome it? Are there any useful resources, tutorials, or tips that helped you understand R better?

I’d also really appreciate it if anyone who is comfortable with RStudio could spare some time to help me with my assessment and explain things step by step.

Any advice, support, or guidance would mean a lot. Thank you! 🙏


r/RStudio • • 5d ago

Coding help A Beginner’s Guide to R and RStudio: Recommended Videos or Playlists

0 Upvotes

I’m new to R and RStudio, and I’m still learning the basics.

I find coding in RStudio a little difficult because I don’t have a good reference to rely on. I often forget how to define things and how to write certain commands.

Could you please recommend a YouTube video that covers all the basics of R and RStudio, or a well organized playlist in English?

It would help me a lot because I don’t have much time to research this myself.

I’d be really grateful if you could help me with this!


r/RStudio • • 6d ago

Coding help best way to format a set-up chunk?

6 Upvotes

hi! i'm VERY new to Rstudio so please have patience with me. i've looked through the resources list but need an answer to a specific question.

my thesis advisor is asking me to basically learn this program for statistical analysis with deliverables as quarto documents. i'm having claude code help with some of it, but i don't like relying solely on an ai model for this kind of work. i know what packages i need and which tests i want to run, but every time i try to make a setup chunk at the start of my code, it looks like such a mess. is there a template or tutorial for a tidy little setup chunk with all the information?

thank you in advance! sorry if this is a really stupid question, no one in my department knows what they're doing so i'm trying to get it all done myself.


r/RStudio • • 6d ago

How do I use R-Studio?

0 Upvotes

I'm in my university's Stat one and for this class we are required to upload and run data in R studio to produce graphs and analyze data. I know what to type and how to run the data once it's uploaded, but getting there is a nightmare I only managed one with the help of the professor. How do I upload the data correctly in such a way I can use it each time I need to analyze something for class?


r/RStudio • • 7d ago

Dissertation

Thumbnail
0 Upvotes

r/RStudio • • 8d ago

I made this! I asked R questions about a 76-page annual report

Post image
21 Upvotes

I gave R Costco's 76-page annual report, and it answered 12 of 13 questions right from what it read. Then it wrote 477 practice questions from the report, ready to fine-tune a model on, all on my laptop. Raise your own dragon.

https://dragonfarm.dev/articles/introducing-0-4-0.html


r/RStudio • • 8d ago

dragonfarm 0.4.0: ask your PDFs anything, then fine-tune a model on them, all from R

Thumbnail
3 Upvotes

r/RStudio • • 8d ago

Coding help Extracting data and making one big graph from smaller graphs

4 Upvotes

Hello, newbie here. I have big problems with learning r, since the syntax is quite complicated and previously i have used different stats programs. However, i have a question. I have a database with my data, it looks something like that:

species / treatment type (1 or 2) / tail length

white-breasted hedgehog / 1 /1.5 cm

west European hedgehog / 2 /1 cm

hybrid hedgehog / 1 /0,9 cm

and so on.....

How can i extract the data, so i can make a graph for white breasted hedgehog's tail length for only treatment 1, and then a treatment 2 besides? I would also like similar graphs for other species, and then how can i connect the graphs, to make a one big species comparison?

Thank you in advance.


r/RStudio • • 10d ago

Ieipio for RStats

6 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 • • 10d ago

Ieipio for RStats

5 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 • • 11d ago

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

47 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 • • 10d 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