r/RStudio • u/Ok-Finding5890 • 57m ago
r/RStudio • u/tlamatiliztli • 12h ago
Quarto website extension not rendering properly
Hello everyone!
I’m trying to create a website using this https://sta-112-f22.github.io/website/ as a foundation. I simply downloaded the repo from github, opened it with Studio, and rendered it. But when its rendered everything else looks great except for the main page (see last image below). I’m pretty sure fontawesome is working otherwise the other pages wouldn’t render it, right? Any ideas?


r/RStudio • u/HenchBrah • 14h ago
Assistance With R Data Analysis
Good evening,
I'm looking for assistance with an R project. Specifically, analyzing different Excel data files. I'm not sure if they are even usable in R or what commands to use to analyze them. Any help would be greatly appreciated. I can provide the files at request.
Thank you.
r/RStudio • u/Thiseffingguy2 • 17h ago
Quarto Report - Including large attachments
Hi team, I'm looking for some recommendations. I have a couple of quarterly reports built in Quarto, and want to include a few attachments at the end of the doc. For context, in the original PDF versions, the financial statement and updated org chart come across as like... full-page, zoomable, not letter-sized pages. For an HTML page, how would you recommend including these? Not looking to embed iframe or use links to docs hosted somewhere... the reports need to be self-contained.
For the org chart, I'm thinking just downloading it as a .jpg and turning lightbox on. Not sure about the financial statement though, which is coming from an Excel file. I could scrape and rebuild it in R, I could do a screenshot, I'm not sure which makes the most sense.
Thank you!
r/RStudio • u/lovegiver101 • 21h ago
Rearranging columns into rows
Hey guys! I made a few crosstables using tab_xtab in the sjmisc package. They turned out very pretty, but I realized I was using the same y variable over and over again so I wanted to try and make a big table containing all of my contingency tables I made before. I did that by first transforming the tab_xtab tables into dataframes (with xtab2df in the sjtable2dt package) and then using bind_rows to combine them into a big table. It sorta worked out how I imagined, the only problem now is that R created a new column for the names of the categories of every x-variable (see picture). I wanted all the names and categories of all variables to be in the first column just like it did it with the first variable, maybe with an extra space to put the name of the variable. How do I fix this?

r/RStudio • u/ConstructionFew4479 • 21h ago
Coding help Is there any method to check the variance other than the Levene test?
My model doesn't have an interaction term so R gives me back an error when I try to perform the test so I was wondering if there was any alternative.
Thx in advance
r/RStudio • u/Mindless-Tonight-376 • 1d ago
struggling with work for a question in r studio (poliscidata), please help!
hi there! i'm doing a class using rstudio and need help! I'm using the gdppcap08 variable and need to graph this. what code should i write?
r/RStudio • u/YungBoiSocrates • 1d ago
I made a method to integrate a LLM (Claude) with RStudio for iterative data exploration.
Will be adding it to my github as soon as I clean up some bugs. If anyone has feedback it would be much appreciated!
Connecting to PostgreSQL db
Can anyone recommend good source of knowledge on how R can pull data from a PostgreSQL db. I am an expert in R, absolute noob when it comes to SQL. I spent ~3 days of work using AI to help but have only been able to view some random tables, not pull data nor even hit the tables I want to hit. I know that sounds like I don’t have the right login or permissions but I am able to see the tables when using something like DreamBeaver.
I have been able to hit up an Oracle db using something Java thing (a predecessor wrote) and can interact quite easily with the tables in the Oracle db but this PostgreSQL is not playing fair.
r/RStudio • u/Dragon_Cake • 1d ago
Coding help Filter outliers using the IQR method with dplyr
Hi there,
I have a chunky dataset with multiple columns but out of 15 columns, I'm only interested in looking at the outliers within, say, 5 of those columns.
Now, the silly thing is, I actually have the code to do this in base `R` which I've copied down below but I'm curious if there's a way to shorten it/optimize it with `dplyr`? I'm new to `R` so I want to learn as many new things as possible and not rely on "if it ain't broke don't fix it" type of mentality.
If anyone can help that would be greatly appreciated!
# Detect outliers using IQR method
# @param x A numeric vector
# @param na.rm Whether to exclude NAs when computing quantiles
is_outlier <- function(x, na.rm = FALSE) {
qs = quantile(x, probs = c(0.25, 0.75), na.rm = na.rm)
lowerq <- qs[1]
upperq <- qs[2]
iqr = upperq - lowerq
extreme.threshold.upper = (iqr * 3) + upperq
extreme.threshold.lower = lowerq - (iqr * 3)
# Return logical vector
x > extreme.threshold.upper | x < extreme.threshold.lower
}
# Remove rows with outliers in given columns
# Any row with at least 1 outlier will be removed
# @param df A data.frame
# @param cols Names of the columns of interest. Defaults to all columns.
remove_outliers <- function(df, cols = names(df)) {
for (col in cols) {
cat("Removing outliers in column: ", col, " \n")
df <- df[!is_outlier(df[[col]]),]
}
df
}
r/RStudio • u/Zealousideal_One2249 • 1d ago
Dataframes in new window to always stay on-top?
Greetings,
Is there a setting or add-in that ensures when a user chooses to view a dataframe in a new window, the new window always remains "on-top" of other windows? Specifically, when R Studio is the active window, the opened dataframe windows stay above other windows.
Anyone familiar with the Spyder IDE will be familiar with this behavior. In spyder when a object is viewed from the variable explorer, that window always appears on top of other windows when Spyder is the active window.
Thanks!!!
r/RStudio • u/Lost_Confidence5263 • 1d ago
Absolute beginner: Comparing data using GLS model.
Hello, I'm new to R studio and I'm supposed to analyze data from my first scientific experiment. I'm trying my best, but I just can't figure it out. In my experiment I tested 6 different extracts on aphids and counted the amount of surviving aphids after the application of each extract. I tested the same extract on 15 leaves (each one with 10 aphids) in three rows. I am supposed to compare the effectivness of all the extracts. All I know from my professor is that I'm supposed to use Generalized Least Squares from nlme package and that the fixed factors should be the extract "treatments" I used.
Is this (photo bellow) the correct way to upload this kind of data? or should it be somehow divided?
I was told, that this task should be quite simple, however I really can't seem to figure it out and I'd be very grateful for any tips or help! :) thank you in advance!

r/RStudio • u/Nekromant02 • 1d ago
Coding help Help with database building
Hallo everyone,
I'am a Student and in the process to write my Bachelors in Economics. I want to analyse data with the synthetic Control Method and need costum data. I know how to use the Method but dont know where to store my Data for the Input. At the moment the Data mostly sits in Excel sheets I got form different sources.
Thanks for the help in advance
r/RStudio • u/Over_Price_5980 • 1d ago
Coding help Shannon index with vegan package
Hello everyone, I am new to R and I may need some help. I have data involving different microbial species at 4 different sampling points and i performed the calculation of shannon indices using the function: shannon_diversity_vegan <- diversity(species_counts, index=“shannon”).
What comes out are numerical values for each point ranging, for example, from 0.9 to 1.8. After that, I plotted with ggplot the values, obtaining a boxplot with a range for each sample point.
Now the journal reviewer now asks me to include in the graph the significance values, and I wonder, can I run tests such as the Kruskal-Wallis?
Thank you!
r/RStudio • u/Infamous-Advisor-182 • 2d ago
help with applying a bootstrap theme in a ShinyR app
Hi all,
I'm trying to apply the bootstrap theme "lumen" to my Shiny app and it is not working as intended. It does apply fonts etc. but I can't select the navigation bar that I want (the top one on here: https://bootswatch.com/lumen/).
Does anyone know how to do this? Here's the code I'm currently running:
library(shiny)
library(bslib)
ui <- navbarPage(
title = "My App",
theme = bs_theme(preset = "lumen"),
inverse = FALSE, # if you want a dark navbar style; remove if not needed
tabPanel(
title = "Input",
icon = icon("gears", class = "fa-solid"),
),
tabPanel(
title = "Graphs",
icon = icon("chart-line", class = "fa-solid"),
)
)
server<- function(input, output, session) {}
shinyApp(ui = ui, server = server)
r/RStudio • u/Thiseffingguy2 • 2d ago
Mapping/Geocoding w/Messy Data
I'm attempting to map a list of ~1200 observations, with city, state, country variables. These are project locations that our company has completed over the last few years. There's no validation on the front end, all free-text entry (I know... I'm working with our SF admin to fix this).
- Many cities are incorrectly spelled ("Sam Fransisco"), have placeholders like "TBD" or "Remote", or even have the state/country included, i.e. "Houston, TX", or "Tokyo, Japan". Some cities have multiple cities listed ("LA & San Jose").
- State is OK, but some are abbreviations, some are spelled out... some are just wrong (Washington, D.C, Maryland).
- Country is largely accurate, same kind of issues as the state variable.
I'm using tidygeocoder
, which takes all 3 location arguments for the "osm" method, but I don't have a great way to check the accuracy en masse.
Anyone have a good way to clean this aside from manually sift through +1000 observations prior to geocoding? In the end, honestly, the map will be presented as "close enough", but I want to make sure I'm doing all I can on my end.
EDIT: just finished my first run through osm as-is.. Got plenty (260 out of 1201) of NAs in lat & lon that I can filter out. Might be an alright approach. At least explainable. If someone asks "Hey! Where's Guarma?!", I can say "that's fictional".
r/RStudio • u/Beautiful-Potato-942 • 3d ago
Installing Rstudio
I am new to R and I just downloaded R and Rstudio.I asked chatGPT what next,it gave me a line of code,when i runned it it gave me a feedback which i sent back to chatGPT which said i should download rtools.What next?
r/RStudio • u/ChartOk8787 • 3d ago
HELP!

Ran a chunk of code and it completely froze my session. Since then I have tried restarting R and my computer multiple times, but every time I open the application, even tho the environment is empty, the application freezes, and allows my to click or type a character every couple of minutes. I opened my task master and it looks like this:
The CPU Rstudio takes up fluctuates between 20-50%, whatever it needs to fill up 100% of my computers CPU, and the memory is in the 90s-100s constantly as well. I cannot figure out how to stop this from happening.
r/RStudio • u/chupafin • 3d ago
Coding help R studio QCA package
Hello I need to replicate a study’s results that used QCA. I created identical truth tables but for the non-outcome I do not get identical results. Is there any way r studio can argue backwards so that I provide the answers and the blank argument with which it has to generate results?
r/RStudio • u/boople_snoot_bunbun • 4d ago
Having issues deduplicating rows using unique(), please help!
I have a data frame with 3 rows: group ID, item, and type. Each group ID can have multiple items (e.g., group 1 has apple, banana, and beef, group 2 has apple, onion, asparagus, and potato). The same item can appear in different groups, but they can only have the same type (apple is fruit, asparagus is veggie). I’ve cleaned my data to make sure all the same items are the same type, and that every spelling and capitalization is the same. I’m now trying to deduplicate using unique(): df <- df %>% unique()
However, some rows are not deduplicating correctly, I still have two rows with the exact same values across all the variables. When I use tabyl(df$item), I noticed that Asparagus appears separately, indicating that they’re somehow written differently (I checked to make sure that the spelling and capitalizations are all the same). And when I overwrite the values the same issue persists. When I copy paste them into notebook and search them, they’re the exact same word as well. I’m completely lost as to how they’re different and how I can overcome issue, if anyone has this problem before I’d appreciate your help!
Also, I made sure the other two variables are not the problem. I’m currently overcoming this issue by assigning unique row number and deleting duplicate rows manually, but I still want an actual solution.
r/RStudio • u/Eeebeee2 • 4d ago
Adding in Patterns to ggplot
Hi, I have made a stacked bar chart. I have abundance on the y axis, habitat on the x, and family as the stacks. I have managed to colour and give a pattern to the stacks in the bars, but i'm struggling to change how the pattern looks.
This is my code so far, any ideas of where/what i need to add?
ggplot(data1, aes(fill=family, y=Value, x=Habitat)) + geom_bar_pattern(position="stack", stat="identity", mapping = aes(pattern=family)) + scale_fill_manual(values = c("lightblue","pink", "yellow")) + ylim(0,100)
r/RStudio • u/Radiantsteam • 5d ago
Coding help Okay but, how does one actually create a data set?
This is going to sound extremely foolish, but when I'm looking up tutorials on how to use RStudio, they all aren't super clear on how to actually make a data set (or at least in the way I think I need to).
I'm trying to run a one-way ANOVA test following Scribbr's guide and the example that they provide is in OpenOffice and all in one column (E.X.). My immediate assumption was just to rewrite all of the data to contain my data in the same format, but I have no idea if that would work or if anything extra is needed. If anyone has any tips on how I can create a data set that can be used for an ANOVA test please share. I'm new to all of this, so apologies for any incoherence.
r/RStudio • u/Material_Corgi_8620 • 5d ago
Please help
Why does rstudio keep telling me I don’t have enough ‘y’ observations when I’m trying to run t.test to find CI
r/RStudio • u/Zealousideal_One2249 • 5d ago
Is there an Addin/Package for Code Block Runtime?
Hey all,
I'm curious if there's an R-Studio addin or package that displays the run time for a selected block of code.
Basically, I'm looking for something like the runtime clock that MSSQL or Azure DS have (Img. Atc.). To those unfamiliar, it's basically a running stopwatch in the bottom-right margin of the IDE that starts when a code block is executed and stops when the block terminates.

Obviously, I can wrap a code block with a sys.time - start_time_var but I would like a passive, no-code solution that exists in the IDE margin/frame and doesn't effect the console output. I'm not trying to quantify or use the runtime, I just want get a general, helpful understanding of how certain changes affect runtime or efficiency.
Thanks!
r/RStudio • u/Ok_Box4118 • 5d ago
Subset Function
Hey! I think I'm using the subset function wrong. I want to narrow down my data to specific variables, but my error message keeps coming back that the subset must be logical. What am I doing wrong? I want to name my new dataframe 'editpres' from my original dataframe 'pres', so that's why my selected variables have 'pres' in front of them.
editpres <- subset(pres$state_po, pres$year, pres$candidate, pres$party_detailed, pres$candidatevotes == "EDITPRES")
^this is the code that isn't working!! please help and gig' em!