Journal Entry: Studying R basics - bcb420-2022/Emiliya_Stolyarova GitHub Wiki
Started: January 12, 2022. Completed: January 25, 2022.
Objective: Refresh knowledge of R and prepare for the upcoming quiz.
Task 1 and Task 2
I have R and RStudio already installed on my computer.
Task 3 and Task 4
I have installed Docker and I have created a notebook in RStudio from a browser window. My progress is described in a previous journal entry.
Task 5
R notebook with code from task: here.
Task 6
I have Git already downloaded on my computer. I opened RStudio through docker in my browser. I have now opened the basic setup and I have saved it in my project directory.
Task 7
Current working directory:
> getwd()
[1] "/home/rstudio/projects/R_Exercise-BasicSetup"
Finding home directory:
> setwd("~")
> getwd()
[1] "/home/rstudio"
Setting directory to project directory containing other course files:
> setwd("/home/rstudio/projects")
> getwd()
[1] "/home/rstudio/projects"
> list.files()
[1] "First Notebook.nb.html"
[2] "First Notebook.Rmd"
[3] "New Notebook Emiliya Stolyarova 2022.nb.html"
[4] "R_Exercise-BasicSetup"
[5] "Task 5, R - basics, Emiliya Stolyarova 2022.Rmd"
Task 8
I have found the .Rprofile file in the file tab in the basic setup project folder.
Notes:
Using ls()
can show what is in the workplace. New variables will be added and shown here.
It is not a good idea to save a workplace
Task 9
I can use help(), ?, or ?? to get more information on a function. I can also use apropos().
Task 10
I need to make sure to make my code clear when asking for help. I need to make sure to revisit these resources when I would like to reach out for help when I encounter and error.
Task 11 - Notes on Operators
> 2 * 3 + 1
[1] 7
> 7 %% 2
[1] 1
> 7 %% 3
[1] 1
> # 1 is the remainder
> 7 %/% 2
[1] 3
> 7 %/% 3
[1] 2
Task 12
> lastNum
[1] 9
> lastNum > 6 | lastNum < 10
[1] TRUE
> 10 < lastNum & lastNum < 19
[1] FALSE
> (((lastNum / 7) * 100) %% 1)^(1/3)
[1] 0.8298265
> (((lastNum / 7) * 100) %% 1)^(1/3) == 2
[1] FALSE
Notes: The case of letters is important when defining variables. In variable names beginning with a dot, a number can not be the second character. Reserved words can’t be used as variable names. Descriptive variables are best. It is better to not ever use “<<-” since it may cause problems in the code. Task 13 Numbers in ranges (for example 1:2) are integers.
Task 14
Vectorized operations are performed on every element of the vector.
References:
Steipe, B. & Isserlin, R. (2020). R - Basics. https://bcb420-2022.github.io/R_basics/