R — Fall 21

Lesson 2 — Basic Commands and Scripts

By


Goals of this Lesson:

  • Use the basic commands:

c( ) ls( ) rm( ) mean( ) median( ) sd( ) summary( )

  • Create a R script
      1. Use # to write comments.
      2. Execute commands via an R script (a file with file extension .R).

 

Instructions

  1.  Watch the following video and do your R2 assignment. While the video demonstration below uses a Mac, both PC and Mac users will see a very similar screen layout in the R Console.

R2 — Basic commands & scripts

           (Note: You only need to upload the .R script to Canvas, not the .txt file.)

 

2)  If you notice that your screen layout looks very different than that shown in the video, that probably means that you are using the RStudio instead of the R Console.

For PC users, in case you cannot find the menu option to save your script, please watch the following video at the timestamp 6:29 —

https://www.youtube.com/watch?v=Q3NxsSRxKek

 

 3) If the file extension .R is not shown when you are saving the file in the R Console, it’s probably because your desktop is not set to show file extensions.

Here is how to set your desktop to show file extension:

For Mac:

https://support.apple.com/guide/mac-help/show-or-hide-filename-extensions-on-mac-mchlp2304/mac

For Window 10 on PC:

https://vtcri.kayako.com/article/296-view-file-extensions-windows-10

-END-



Content is copyright the author. Layout is copyright Mark Ciotola. See Corsbook.com for further notices.