Let's say you've loaded data from a csv file (example of how to do this in the link). FYI
First, load the data nihs<-read.table("C:\\Documents and Settings\\admin\\My Documents\\temp\\NHIS 2007 data.csv",header=T,sep=",") I've called the csv file "nihs". Thus R now had the object nihs. First, just type: nihs This should print out in your script window what your nihs data looks like. str(nihs) str stands structure. It gives you a simple sense of the structure of your new R Object. How many observations you have (observations are basically rows). How many variables (variables are basically columns). We get the following output:
fix(nihs) this loads a spreadsheet where you can see and edit your new R object. (Note that you won't be able to work in the R script window until you've close your 'fix' window.) Mean, Median, Mode, Variance & Standard DeviationSay we're curious about basic summary statistics (mean, median, variance, standard deviation) for our SLEEP variable.
summary(nihs$SLEEP) Min. 1st Qu. Median Mean 3rd Qu. Max. 3.000 6.000 7.000 9.507 8.000 99.000 this gives you a simple taste of what your variable's central tendency and range looks like. If you type summary(nihs), you'll get output for all the variables in your nihs object. Once Getting a visual sense of your data - Using R to get a histogram and plot of your data. |