The R Studio Interface - looks fancy! But not really.
Once you install R and R studio and open it, it will look something like this (I'm on a mac, so PC users may find a slightly different view):
Yours will also not have anything in the right column or the lower column (I'm currently running some analyses). Your view will also be a white background instead of the black background. You can change all of the look and whatnot in the R Studio preferences (on a mac it is the R studio dropdown at the top - then preferences). I think my view is twilight or something like that. Wait. It can be twilight. I wouldn't allow anything with that word after the terrible books and movies. Ok I had to look. The "appearance" setting in the preferences is "Tomorrow Night Bright". It works the best for my constant staring at the computer screen. White backgrounds are just too harsh.
The bottom black panel here is the R console. It works exactly like it does in the regular R or R64 app that you installed before R studio (remember that R studio actually just uses the R app - it is just a front end to run the R application -- R studio is just much prettier). You can type any commands into the console and hit enter (or return) to run them. I dont like the console much - I just use it to view the output of any functions I run (so in this respect, it serves kind of like the output window in SAS and SPSS, but you can also type commands in the console window).
The top black window is the one I use. This is the R script viewer. You can open a new one (I do this every time I start a new project) by clicking file and new R script. Actually, when you first open R studio you will only see the console window, it will just be larger. When you open a new R script, the console will get smaller and the R script window will show. You can resize stuff as you would any table or something in MS Word (the cursor changes when you hover over the gray line separating the two windows). This is where I type all of my commands. I like this because it is easier to save an R script than to save the whole workspace (this term will come back later -- it is essentially the entire environment you are working with). Regardless, type stuff here - you can hit enter as much as you want... to run the commands you type, you can do one of two things: 1) if the command is only on 1 line, you can click somewhere on that line (you dont have to highlight the line or anything) and click command+enter (on a mac). Im not sure what the equivalent is on a PC, but I think it is probably control+enter and 2) if the commands are on multiple lines, just highlight the entire section and hit command+enter. This window functions just like the SAS editor window and the SPSS syntax editor window. You type your commands and run them. The output shows in the lower console window. As you can see on my screenshot above, I have a lot of these 'editor' windows (yup, I still speak in SAS language) open - again, this works just like the SAS editor window.
The white box at the top right shows any dataframes (the terminology R users use often synonymously with data set), vectors (we will come back to this later, but a vector can be thought of as a variable - the variable may or may not be attached to a dataframe), functions, lists, etc. The lower window can be modified to show whatever you want. I use it pretty much solely for viewing graphics. This is a major benefit of R - the graphics are awesome.
I forgot about one thing the other day - if you are a mac user, you will need to install Xquartz to view graphics (download here: http://xquartz.macosforge.org/landing/ ).
So that is the overview of how R studio looks. Next up, help files and some useful websites to get started. Then we will focus on getting data into R and move on to recoding variables. The bane of my existence.
Peace.

No comments:
Post a Comment