![]() ![]() # A long vector will be displayed over several lines. # Sequences of integers are so common there is a shortcut for making them. # Of course using the arrow instead of equal sign works here. # You create vectors by using the c() function. Often a list of numbers, but it can be a list of other types such as characters. # R has another notation for assignment: the arrow: x x You can see the value of x by just using x as a command. # When you assign a value to a variable it does not echo the answer to the screen. Using Variables # You can store results in variables and use them in calculations. It is there for when R is printing numbers in a list. R as a Calculator # The basic operations are *,+,-,/,^. The command window is the one with the >. ![]() If you've installed R and RStudio then simply start the RStudio application. Even so, you will be able to run statistical simulations and make beautiful plots of your data. This is not a programming class so we will only ask you to issue simple commands and no serious programming. R is a very full featured statistics package as well as a full programming language. The worst that will happen is R will print out an error message. If you wonder about the effect of some command, try it. Then make up a few of your own variants and try them. When the tutorial shows you a command try it in RStudio. In order to (begin to) learn the commands have RStudio open and go through the tutorial line-by-line. ![]() Trick: you can use the up arrow to find previous commands. R's response will be in the line or lines below the command. You should enter everything after the '>' and hit return. # We've inserted comment lines, which begin with a '#',Ĭommand lines begin with a '>'. Time for a bit of playing around with the commands.Ĭonventions # This is an edited transcript of a R session. We estimate this tutorial (1A and 1B) will take 20-30 minutes. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |