r/RStudio • • 59m ago

Coding help Help with choropleth map colors!!

Post image
3 Upvotes

Hello! I'm trying to create a choropleth map in R using plotly but I'm having a hard time adjusting the color scale setting. My main issue is that there is only one country with a high number of n_studies so the map is quite hard to look at (the numbers range from 0 to 35). Here's my code:

# light grey boundaries
l <- list(color = toRGB("grey"), width = 0.5)

# specify map projection/options
g <- list(
  showframe = FALSE,
  showcoastlines = FALSE,
  projection = list(type = 'Mercator')
)
fig2 <- plot_geo(all_data)
fig2 <- fig2 %>% add_trace(
  z = ~n_studies, color = ~n_studies, colors = "Blues",
  text = ~COUNTRY, locations = ~country_code, marker = list(line = l)
)
fig2 <- fig2 %>% colorbar(title = 'Number of studies', orientation = "h", y = -0.01)
fig2 <- fig2 %>% layout(
  geo = g
)

fig2

Any suggestions on how I can change the color scale setting so each interval is a bit more distinct? I was thinking of maybe using a specific color for each interval (e.g., 0-5, 5-10, etc.), not sure if that makes sense.

Thank you so much!!


r/RStudio • • 18h ago

I suck at this

8 Upvotes

I use R studio for a stats course in uni, but I absolutely suck at it. It makes sense in the moment if i have a step by step guide but once it's removed I seem to forget everything. Ive always been bad at computers, maybe its just me subconsciously not trying because I think im bad and just keeps me bad, but I really want to improve since I know r studio is very useful and probably will make my life easier in the future.

I'm not terrible at stats, im just really bad at computers/coding/anything to do with tech (including printers)

How do i improve? It doesnt feel intuitive at all. Is it just practice and practice and practice? It all makes me feel very stupid :/


r/RStudio • • 1d ago

I failed to install "Git" on my Mac

Post image
2 Upvotes

When I finished installing my Rstudio on my Mac(m2), a window poped up and said I need to install "Git", but I can't install it somehow. Could anyone be nice enough to tell me how to install it?

🥹😊


r/RStudio • • 2d ago

Learning R in RStudio; Discussion

35 Upvotes

Hi all,

I struggled with R for a long time during my university years but managed to work through it and now work with it on a daily basis.
With this background I approached students and asked about their experiences and hear many stories along "in the R course we are asked to copy paste the code that does the PCA/ ANOVA/ GLMM etc." or "We are told not to write scripts but work in the console" and not a single course I heard about is using projects. Also everything is written in unstructured base R.

I believe many universities do it that way and am shocked how poorly even the people leading the course understand the topic. How was your journey and how could R be taught better. I imagine a course where e.g. TT datasets are explored with the tidyverse in a superficial way but setting up projects and enstablish version control for each and get experience in the basics should be key. After exploring data and the workflow are given, restructuring etc. and making good plots to communicate get into focus.
Once they have created a few dozen projects with version control and explored various datasets which have been rudimentary visualized, only then can they start with statistics which is something completely different.

The Project structure would help to share and ask specific questions, also it would allow to understand each others code better. But I want to have the clearest picture and suggestion before I ask my Uni if I could get a course or any say in the matter how R is taught.
So, how do you see the situation?


r/RStudio • • 2d ago

Python in RStudio

Thumbnail reddit.com
3 Upvotes

r/RStudio • • 4d ago

Coding help How to find inverse of a function

7 Upvotes

Hi everyone! I've just began using R for Mathematical Statistics, where I often have to find the quantiles of a probability. For that I need to find the inverse of the cdf, which are often too complicated to solve by hand. I tried using R, but when I searched up the code for the inverse in the help articles, I didn't find any notes on how to specifically find the inverse of a function, whether univariate or multivariate. How do I go about in this instance? And as a seperate question, if it's not too much: how do I plot multiple graphs in one window? Thanks in advance!


r/RStudio • • 6d ago

Internal research group setup for Quarto?

11 Upvotes

Small university research group (2 faculty, 1 doc student), where we're mostly used to passing .Rmd (and output .html) files back and forth. (We don't use Rmarkdown to generate files for external use right now; this is for internal "this is what I'm doing in this process" communications.)

I know that Rmarkdown is no longer being updated, and I'm wondering how painful a transition to Quarto would be. We're currently using a shared Dropbox folder, so yeah, I know you'll advise us to switch to git for versioning control etc. Anything else to keep in mind?


r/RStudio • • 6d ago

Coding help ANOVA Statistics Help

5 Upvotes

Hello RStudio community!

I'm a graduate student trying to conduct an ANOVA on some data I have; it is 5 columns of data all outlining the density of bats in a cave, with the number of samples per opening ranging from 15 to 30 samples. I'd like to conduct a 1 way anova due to the variance in samples and also the relatively low sample size per opening.

I'm trying to use the aov() function, but I'm not sure how to use all 5 columns (might it be easier to shift it around to have the openings as row headers?) at once for my ANOVA.

Thanks in advance!


r/RStudio • • 6d ago

Unable to install packages

7 Upvotes

Hello, my teacher had shown us last year how to install packages with a little code he gave us but this year, it's not working for me on my new pc any help?


r/RStudio • • 6d ago

R version conflict

7 Upvotes

Hey folks,

Did anyone here face the issue that your machine is either forcing a specific version of R, or completely removing the program files for any other version/all versions you have? I have been facing this issue for a while now, where I'm actively using 4.5.3, but then at some point the program files and all the installed packages just disappear. My institution's IT department suggested it was a conflict with the newest version, but even after erasing everything R-related from my laptop, the issue persisted, even erasing the newest version, and re-installing the specific version i need, it happened again and misteriously the newest version was present again.

I got a temporary solution which is currently working (external R installation, basically plugging usb every time i need to use it), but it is very annoying and I would like to finally close this issue.

Technical points if it matters: windows 11 (institutional), built in software center (which does offer some even older version of R), version i need that keeps getting deleted 4.5.3, version being forced 4.6.1. Files are not being removed by protection software, it is deeper.

I am mostly wondering if someone had similar issues, and how did you resolve them.

Thanks in advance!


r/RStudio • • 8d ago

Coding help Help with gglikert_side

Post image
20 Upvotes

Attempting to make a likert graph using the likert package. Have successfully got a graph with the correct data but the side graph is squished to the side. I followed instructions online and no one seems to have this issue and i cant find any variables that would affect this.

If anyone has any suggestion I would greatly appreciate the help.

My code is:

> gglikert_side(Travel,
+               reverse_likert = TRUE,
+               labels_accuracy = .9,
+               add_totals = FALSE,
+               y_label_wrap = 20,
+               side_values = "No Answer",
+               symmetric = TRUE,
+               width = 1)+
+     ggtitle("...Was an important reason for travel")> gglikert_side(Travel,
+               reverse_likert = TRUE,
+               labels_accuracy = .9,
+               add_totals = FALSE,
+               y_label_wrap = 20,
+               side_values = "No Answer",
+               symmetric = TRUE,
+               width = 1)+
+     ggtitle("...Was an important reason for travel")

r/RStudio • • 8d ago

erro fatal no Rstudio quando tento puxar um dataframe

4 Upvotes

Sou bem iniciante no R, comecei a estudar faz uns 2 meses.
Tenho tentado usar o R para Ciência de Dados (2 edição). Porém, logo em uma das primeiras coisas que pedem para fazer meu R esta dando erro fatal.

Em "1.2.1 O data frame pinguins" pede para puxar dados::pinguins. Mas meu R da erro fatal.
Instalei o pacote "dados"

> library(dados)

Mensagen de aviso: pacote ‘dados’ foi compilado no R versão 4.6.2

mas qualquer interação que tento fazer com esse pacote da erro fatal.

Alguém consegue me ajudar com isso?


r/RStudio • • 8d ago

cuplyr: dplyr on an NVIDIA GPU

Thumbnail reddit.com
2 Upvotes

r/RStudio • • 8d ago

I built tawjih (LLM-tawjih-Model-building): A zero-dependency, single-file Python tool to manage LLM knowledge in 3-sided trees and run branching workflows across them

Thumbnail reddit.com
0 Upvotes

r/RStudio • • 9d ago

Coding help Adding new documents to an existing topic model in R

4 Upvotes

I'm quite new to topic modeling and R.

I have made a topic model in R using the topic modeling package, and I was wondering if it is possible to add new documents to an existing model without having to retrain the entire model from scratch.

Is there a way to do this while keeping the original topics intact? If so, which packages or methods would you recommend?

Thanks in advance for your help!


r/RStudio • • 13d ago

Coding help md5sum hashes of file not matching

5 Upvotes

This should be straightforward, but am struggling to get this to work. I've tried the digest and openssl libraries and neither matches what I get on the commandline.

Obviously the first thing to get right was to ensure I wasn't just hashing the filename (d'oh!). With the digest function I used this:

digest(file(system.file("myfile")), "md5")

Which concerningly returns a different result each time it runs.

With the openssl md5() function I ran:

md5(file(system.file("myfile")))

Which at least is consistent, but only returns the serialised output and doesn't match the output I get on the commandline with md5sum (on macOS).

Help. How do I get an md5sum in R that matches what I get on the commandline? NB: I don't want to do a system call as this needs to be cross platform.


r/RStudio • • 14d ago

Coding help Desperate for help understanding Rstudio and and how to do an ANOVA

32 Upvotes

I am a physiology grad student who has never taken a statistics course or anything. I am genuinely desperate for any help at this point and if anyone at all is willing to zoom with me to help, even for just five minutes, I would greatly appreciate it


r/RStudio • • 14d ago

Coding help Making text in my xtable smaller (r sweave document)

4 Upvotes

Hi.

I wanted to have smaller text in my table. I used \tiny but it did not seem to work. What am I doing wrong?, and how would you guys reccomend getting smaller text in a table?

MRE

\documentclass{article}
\begin{document}
<<package, include=FALSE>>=
library(xtable)
library(survival)
@

<<data,include=FALSE>>=
lung <- lung
@
\tiny
<<table, echo=FALSE,results='asis'>>=
xtable(lung)
@
\end{document}

EDIT: I think i figured it out with

table <- xtable(lung)

print(table, size="\\tiny")

r/RStudio • • 14d ago

Remedy for statistically significant interaction term in Schoenfeld residual (programming in R) [thesis]

0 Upvotes

Dear all!

I am conducting a Cox proportional hazards analysis and tested the proportional hazards assumption using Schoenfeld residuals. Two interaction terms between predictors showed statistically significant results, suggesting that these effects may vary over time. I am therefore unsure which approach would be most appropriate in R to address this.

Would tt() be suitable in this case? Would it work for interaction terms?

Initially I was thinking of tmerge(), but that doesn't work because this would only work if it is the treatment, right? (although the interaction is between treatment group and an intake variable).

I initially also thought of using strata(), but I guess that's only for categorical variables?

I would be very grateful for any advice on how to handle this appropriately in R, and what remedy there is. Recommendations for relevant literature would also be very welcome.


r/RStudio • • 14d ago

RgentAI (Cheaper Posit Assistant Alternative in RStudio)

14 Upvotes

I founded RgentAI over a year ago. It was the first AI inside RStudio before the Posit Assistant release. After the release of Posit Assistant and my PhD keeping me extremely busy, I did very little marketing and development for RgentAI. Surprisingly, it kept getting new users anyway, so I took a closer look at the market...

Posit costs twice as much ($20 vs $10) and gives you less usage. No wonder we were getting new customers! That told me Rgent was worth investing in, so I spent the last few weeks adding new features and reworking it.

The short video below shows the new features, look, and experience! If you're looking for a cheaper alternative to Posit Assistant with more usage inside RStudio, this could be worth checking out!


r/RStudio • • 15d ago Bravo

I made this! FigureIDE : New IDE for R with vector graphic editor

20 Upvotes

I've been developing FigureIDE, open-source desktop application for creating and editing scientific figures using R.

FigureIDE is built on the open-source VectorCraft project, with AI tools(Thanks to Codex and Gemini).

The first Windows beta is now available!

GitHub: https://github.com/newkor3185-blip/FigureIDE

Demo Video: https://youtu.be/ay1fmnCTgsg

I'm still improving the software and would really appreciate feedback from you.
Contributions are also welcome!


r/RStudio • • 14d ago

Soundboarding [Discussion]

Thumbnail reddit.com
4 Upvotes

r/RStudio • • 15d ago

Remedy for statistically significant interaction term in Schoenfeld residual (programming in R) [thesis]

3 Upvotes

Dear all!

I am conducting a Cox proportional hazards analysis and tested the proportional hazards assumption using Schoenfeld residuals. Two interaction terms between predictors showed statistically significant results, suggesting that these effects may vary over time. I am therefore unsure which approach would be most appropriate in R to address this.

Would tt() be suitable in this case? Would it work for interaction terms?

Initially I was thinking of tmerge(), but that doesn't work because this would only work if it is the treatment, right? (although the interaction is between treatment group and an intake variable).

I initially also thought of using strata(), but I guess that's only for categorical variables?

I would be very grateful for any advice on how to handle this appropriately in R, and what remedy there is. Recommendations for relevant literature would also be very welcome.


r/RStudio • • 15d ago

Can Existing Local Shiny Apps Be Deployed Through Dataiku Without Using Its Low-Code Features?

7 Upvotes

Our company uses Dataiku, and I'm exploring whether it could serve as a deployment platform for several R Shiny applications I've already developed and currently run locally.

I'm not interested in Dataiku's no-code or low-code development capabilities. My goal is simply to deploy my existing Shiny applications so that other employees can access them through a web browser.

Unfortunately, we don't have access to Shiny Server, Posit Connect, or shinyapps.io.

I've come across several Dataiku articles highlighting its deep integration with R and support for web applications built using frameworks such as Shiny, Dash, and Bokeh.

https://doc.dataiku.com/dss/latest/R/index.html
https://doc.dataiku.com/dss/latest/webapps/shiny.html

I have a few questions:

  1. Deployment feasibility: Can an existing, fully functional R Shiny application be deployed directly through Dataiku without substantially modifying its code?
  2. R package dependencies: My applications depend on numerous R packages. Can these be installed within Dataiku, or would IT administrator privileges be required?
  3. Deployment process: How straightforward is the deployment process? Can I upload my existing app.R file and supporting files, configure dependencies, and publish the application?
  4. Licensing and permissions: Does hosting Shiny applications require additional Dataiku licenses, plugins, or administrative configuration?

When running these applications locally, I've generally been able to install R packages without administrator privileges. I'm particularly interested in whether Dataiku offers similar flexibility.

Has anyone successfully deployed existing R Shiny applications through Dataiku? How does the experience compare with using a dedicated Shiny hosting platform?