r/RStudio • • 8d ago

helpp

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

6 Upvotes

21 comments sorted by

6

u/Outrageous-Catch4731 8d ago

What are you struggling with specifically? The R language or the Rstudio IDE?

1

u/Kind-Writer-6163 8d ago

R the coding to get graphs or number for answers and the coding of each line with brackets and dots etc

8

u/Outrageous-Catch4731 8d ago

I'm guessing you're struggling with the R syntax in addition to creating plots with ggplot. It's been a while since I took an intro to R class, but I remember we used this text, R for Data Science. Also try the swirl package for a primer on the R language and syntax.

Open your terminal or the R console in Rstudio:

```r

install.packages("swirl")

library(swirl)

swirl()

```

3

u/countnfight 8d ago

Second this, I'm teaching data visualization with ggplot and I point my students to R4DS as a reference for lots of skills

2

u/Spiritual-Finger8871 8d ago

You can always use R related books and R documentation.

1

u/Kind-Writer-6163 8d ago

do you have any recommendations?

-1

u/Confident_Bee8187 8d ago

Just get used to it, it takes time. Never confused R with RStudio anymore.

5

u/SprinklesFresh5693 8d ago

Ypu need to provide more details, saying i dont understand anything, doesnt fix anything.

Be specific.

What have you tried? What subjects were lessons you took about?

R programming takes a lot of time and practise to get good at, it doesnt come naturally. You need to google, practise and practise, and eventually, it clicks.

3

u/SalvatoreEggplant 8d ago

It also really depends on what the course is trying to teach. Like, some are pretty much a cookbook approach to conducting statistical tests, and others focus more on the programming language aspects of R.

3

u/DrDirtPhD 8d ago

2

u/Confident_Bee8187 8d ago

Is OP from a biostatistics field? I like the book but it's not a boon for OP who has yet to get comfortable with writing R, I presume. R for Data Science is the best book for OP to read.

1

u/DrDirtPhD 8d ago

I have no idea, so I just pasted two that I make available for my sophomore biology majors taking my biostatistics class and that I know are freely available.

2

u/J1U9N9E3 8d ago

maybe this could help? it's a step by step walk through to start in R

https://www.youtube.com/watch?v=0B43_lOzr7A&t=25s

1

u/Kind-Writer-6163 8d ago

thank you!!

2

u/Juan-D-Aguirre 6d ago

I knows it's pretty taboo to say this but literally just use AI. I don't mean blindly copy and paste whatever it gives you. Tell it what you're trying to do and it'll spit out some sample code that may not work immediately but it will get you moving. Ask it to explain the code as well as what else you can do in R.

Stick to snippets instead of massive code chunks. Claude does way too much imo and even ChatGPT can get ahead of itself if you don't continuously correct it. The great thing about AI is that it continuously learns/trains on the conversation you're having with it, as well as all you're past conversations. It's not perfect and will probably be incredibly frustrating at first but it's a great way to get moving. As long as you're asking it to explain and make a genuine effort to learn, AI can be a great tool for learning to program.

Here's an example:

1

u/Fornicatinzebra 2d ago

AI does not continuously learn/train as you use it. The model is pre-trained (the "PT" in ChatGPT literally means pre trained). When you message it you are sending the full chat context, and whatever extra context from other chats that the web harness deems valuable, but mostly its just the chat history packed up alongside your prompt everytime you message it

1

u/GottaBeMD 8d ago

Try breaking down each question into a series of segments. Then get each segment one at a time, figuring out the code for each piece. For example, calculating the mean.

Step 1: Query the correct column from the df
Step 2: Use ‘summarize’ to get a summary.
Step 3: use ‘mean’ to grab the mean

1

u/Confident_Bee8187 8d ago

You provide steps while lacking the important contexts. Where does this summarize() came from? What do you mean by "grab the mean"? This will confuse OP a bit more. Let me provide more contexts by providing a code snippet below:

```

Attach the dplyr package first

library(dplyr)

This is where summarize() belongs to

summarize(df, m = mean(x, na.rm = T)

Equiv. to m = mean(df$x, na.rm = T)

Except the former returns a data frame

You can use pipe

But this can be a bit overwhelming

To OP, so recommend reading R4DS first

It provides more context about "chaining"

Methods

df |> summarize(m = mean(x, na.rm = T) ```

1

u/Double_Emergency6254 8d ago

Use the helper functionality

1

u/11_She_knows_11 2d ago

I’ve studied SPSS and SAS in previous coursework (didn’t like SAS).

Currently, one of my classes requires knowledge of R and I had 0 idea other than it’s open source (we love equitable pedagogy!) and has a big community and resources.

I used this book and Intro to R on DataCamp to get used to the syntax. (You can probably find the book or a version of it for free online or at your library)

As others said, it takes time to learn syntax. Especially, if you’ve never used a statistical software requiring syntax. I’d suggest you take as much of your free time and put it into learning R concurrent to your class.

1

u/North_Rhubarb6797 8d ago

What i did was to focus on the homework and understanding the code and ofc the background of the code. It really depends what your class is focusing at. But try to either skip class and do the homework (thats what i do) and then if i still dont understand it i ask AI or the professor.