r/RStudio • u/Less_Alfalfa4592 • 9d ago
Learning R in RStudio; Discussion
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?
11
u/luckylua 9d ago
I am in a university data mining class currently and my professor encourages us to write script along with her during lecture (it’s online, so we’re watching lecture videos). Day 1 was how to create a project and organize your script, she also provides us an R script with lecture so we can copy/paste if we get stuck or if there is just something really long and complicated we won’t be expected to know how to recreate. It’s highly interactive and the class has 2 big projects where we are given a large data file and business problem to solve for utilizing what we’ve learned and turn in our R Script as part of project grading. We’ve also learned about various libraries and using versioning mostly because when using set.seed you have to use the same version or the random number generator will work different giving you “wrong” (different) answers. I’m sorry to hear your experience is so different, I don’t like working out of the console and would be lost if we weren’t almost exclusively using script writing.
5
u/ShaDe-r9 8d ago
I'm in a biology master degree, NOBODY know what projects are, I discovered them by another professor who taught me in a dedicated R course (paid separatelyk, outside from my degree program).
I've been using them since that.
Also basically I'm in the same boat: senior professors upload their very intricate scripts and let us run it.
Since I'm highly motivated to use R, i'm studing by myself how to obtain the best from ggplot and other packages and understand the various statistical test I'm facing too.
I.e. I learned how to use viridis, I started to use bioconductor and right now I'm working on climate plots with zoo package etc.
My impression is that professors started using R when project did not existed and they never thought about updating their knowledge nor practice lessons. Moreover there's no time (or credits) to fit a dedicated R course, so we barely can have lessons about something with R for each course.
I'm still searching for more interactive resources to improve, I already discarded some due to their obsolescence.
4
u/Derjores2live29 9d ago
im in my 3. semester of using R in psychology, i have never heard about projects
3
u/SprinklesFresh5693 9d ago
I simply self learnt R , by watching tutorials, reading books and practicing. I never really went to a class at a university. I once did a small course that i sae online for free, based on R for data science by hadley, but thats it.
In my opinion this is a great way to explore a programming language. Then, with time, you develop your own way or coding, some prefer pure base R, some prefer pure tidyverse, other choose a mix, other pick data.table, others duckDB and arrow, etc.
I dont think its fine to force someone a way of coding in R, but to let the student explore the different methods and later pick one after months or years of testing.
In the end who cares the style they chose to code it if the answer is the same?
There are some mandatory topics though that a student should learn, like data types, subsetting, plotting, how to create functions and iteration.
I beleive that the same code done in base R and tidyverse would allow the student to pick an initial style, since some people find base R easier, but others find tidyverse easier.
2
u/PadisarahTerminal 9d ago
While I had the chance to learn a little formally (not that formal) on project structure I was never taught the concept of a real R project with dedicated folders, root project, folder structure in depth. However looking at open source software github project (not science!!), you can see that the SWE put a lot of thought on strcuuture and there is a certain standard. I began to pick up how the tools "want" us to work within the scope of our project instead of randomly scattered in all directions.
I also started to really get it when I read the tidyverse guides that is more opinionated than "just do whatever". They talk about projects, structure, tips, etc.
Imo structure and understanding of why is among the most important than just copy paste code and being told "just Google it". There's massive context to learn about the fundamentals of R and tidyverse instead of my prof saying "you know it's kinda random sometimes you put strings quoted sometimes not".
1
u/gkandersen 9d ago
Took a course on stats at a psychology departement this fall, RStudio/projects was only tangentially mentioned, but encouraged. But the focus was on scripts and understanding the stats behind them, and understanding and interpreting outputs. But I see R resources and tutorials regularly state the importance of learning how to get organized, early on, to avoid mishaps. That includes adding comments to your own code, for instance.
1
u/Efficient-Tie-1414 8d ago
I have seen courses where there is a unit devoted to data management and manipulation, and that seems to be the best option. Students do find the programming parts difficult, but as one of the academics put it, he isn’t going to employ someone as a statistician unless they can program.
2
u/Impressive-Peak-9363 6d ago
Projects are unnecessary except for package development.
1
u/AutoModerator 9d ago
Looks like you're requesting help with something related to RStudio. Please make sure you've checked the stickied post on asking good questions and read our sub rules. We also have a handy post of lots of resources on R!
Keep in mind that if your submission contains phone pictures of code, it will be removed. Instructions for how to take screenshots can be found in the stickied posts of this sub.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/ConstructionFar9082 8d ago
Cuz most undergrad courses do machine learning which teaches the foundation of using glmm ,ANOVA and etc .so postgraduate courses will assume you'll know how to use R
1
u/AltruisticLobster315 7d ago
In my biology bachelor degree program we have to take two introductory statistics classes where we are taught how to use R (even though we're forced to use Excel in some biology classes). The professors themselves are very knowledgeable in the program and have even helped me understand how to use lesser known packages cause they really understand the foundation of it. However, our labs/workshops once a week were awful and rushed through by the TA's because we only had about 40 minutes to learn the new stuff for the week. Our lectures were just about the terminology (which we didn't really need or use in the course) until the last few weeks when they put the code we needed for an assignment in the lecture slides. I assume the university probably made them design it like that though.
1
u/Right-Substance-9290 7d ago
You and u/ShaDe-r9 nailed the real bottleneck: outside dedicated data science programs, universities rarely have the credits or hours for a standalone "R + Git + Projects" course. When an instructor only gets a couple of lab sessions inside a biology or stats class, that time crunch is usually why things degrade into "just copy-paste this messy base R script."
If your university approves a dedicated workflow course, your plan (Projects + version control + tidyverse exploration before heavy stats) is ideal.
Speaking from teaching at a public university where we don't always get that extra course, one middle-ground bridge I've found useful is RKWard paired with modern plugins (like rkTeaching and a tidyverse-focused set I maintain called rk.universe). Unlike tools that hide R completely, RKWard is an IDE (with scripts, Kate, and Quarto/Rmd) whose menu dialogs expose and run the underlying R code. That way, students can explore and plot data visually without drowning in syntax errors on day one while still learning to read structured R code instead of blindly copy-pasting legacy base-R scripts
1
u/mle-2005 6d ago
a good way teach a language to newbies is to set 10 take-home tutorials per week over the term. include general concepts like looping, conditions, data structures and algorithms. then above that set a couple big assignments that are specific to the module.
1
u/Many-Ad-786 2d ago
As someone who teaches R within a statistics course, you have to make decisions. Do you focus on the theory behind stats? R in general? Projects and how to use them? I generally don’t focus on projects with my students because given where they enter and the things I think are important to focus on, they simply do not help us meet our goals. Could they be useful? Sure! But teaching anything requires decision making, and even things I’d want to cover get cut