

On the lower right, you will see the provided information, “ Generic X-Y Plotting“. (The “stats” library is automatically loaded onto R.) You can then click on “ stats::var” to obtain information on this particular command.Īs an example of using the help command for a specific command (plot), consider typing in the lower left console quadrant: (You may need to click on several of the possibilities in order to find the command you need.) The “ stats” corresponds to the library in which the “ var” command can be found. In this case “ stats::var” is the command you want. (Note the two question marks here.) On the right bottom you will see a list of possible commands that match the “general statistical area”. If you do not know the name of a specific command but know the “general statistical area” in which you are interested (say “variance”), type ?variance in the lower left console quadrant and then return. (Or, type ?mean in the lower left console, then the Enter carriage twice.) The help information will appear on the right bottom. If you know the name of a particular command (say “mean”), type ?mean in the upper left quadrant, highlight, and then hit Run. The “Help” is, perhaps, most easily accessed by entering commands directly in the console. Using the menu, choose “File > Open File > … and then navigate to rtest.R Suppose you come back at some later date and wish to access the file “rtest.R” again.To edit your graphs, you will need to modify RStudio commands in the upper left quadrant, highlight them, and hit Run.

Note that the file is essentially a picture, so edits cannot be made on it. From here, you can paste into your document. For copying plots, go to the menu immediately above the plot. Copy and paste the material from the console directly into the document (we strongly suggest that you save R output using “courier” or “new courier” font to maintain alignment). One way to do so is the following: Open a new document-perhaps in WORD or a PowerPoint slideshow. Suppose you wish to take output-including plots-from R and place it in a document.Except for an occasional quick test-or accessing the help-it is strongly suggested that you enter all your commands in the upper left. However, in this case they will not be saved. – You could actually just type in your commands into the console and run them line-by-line. Temperature Save (It is good practice to regularly save a file on which you are working during your R-session). (Make sure that you follow each line with a carriage return.) Then use the “mean” function to find the mean of the 8 temperature values. Enter the temperature data as a vector with the 8 values (2, 4, 6, 8, 10, 12, 14, 16) as the components of the vector.
#BASIC R STUDIO COMMANDS CODE#

You can think of the top left portion as an editor. You will be entering all of your commands on the two parts on the left. You will notice that the screen is roughly divided into 4 parts. Start R-Studio by clicking on it (Do not start R directly).This is where you will place your R files, data files, and also files with computer output, including plots.
#BASIC R STUDIO COMMANDS INSTALL#
