Before we can do any statistics, you need to be able to load your data into R. There are a variety of ways to do this of course, but I will focus on the read.table command. We will work with the file data.txt. I would encourage you to open this file in a text editor or EXCEL to take a look at it. This is the standard way to lay out data for statistical analysis, a column(s) for the independent variable, here coded as a 1 or 2 and column(s) with data, were negative numbers in column 2 ranging from approximately -2 to -12 and positive numbers ranging from 200 to 500 in column 3.
Open R Studio. Using Session --> Set Working Directory --> Choose Directory set the directory to the one in which you have placed the data.txt file. I strongly encourage you to create a R directory somewhere and place all your files there. Note, you will see the command for changing the working directory in your command window after using the Session drop down menu. To do this from the command prompt you would use setwd("~/R") where whatever is in quotes is your path to your R directory.
At the command prompt, ">" type the following command: mydata = read.table("data.txt").
You should now see your data in R Studio. You can either use the command View(mydata) or click on the Environment tab and look under Data. Then click on mydata to see your data.
We have loaded the data into a structure called a table (hence the command read.table). In R tables are used to hold statistical data. Note that the columns have labels V1, V2, and V3. These are the default column labels in R. To see the first column for instance you would type mydata$V3 at the command prompt (note the $ - this tells R that you want the column V3 in the table mydata). Do this now. You should see the numbers in the third column with numbers in [ ] brackets which provide the index of the first number in the row. For example, the second number in the third column would be identified as mydata$V3[2].
Open R Studio. Using Session --> Set Working Directory --> Choose Directory set the directory to the one in which you have placed the data.txt file. I strongly encourage you to create a R directory somewhere and place all your files there. Note, you will see the command for changing the working directory in your command window after using the Session drop down menu. To do this from the command prompt you would use setwd("~/R") where whatever is in quotes is your path to your R directory.
At the command prompt, ">" type the following command: mydata = read.table("data.txt").
You should now see your data in R Studio. You can either use the command View(mydata) or click on the Environment tab and look under Data. Then click on mydata to see your data.
We have loaded the data into a structure called a table (hence the command read.table). In R tables are used to hold statistical data. Note that the columns have labels V1, V2, and V3. These are the default column labels in R. To see the first column for instance you would type mydata$V3 at the command prompt (note the $ - this tells R that you want the column V3 in the table mydata). Do this now. You should see the numbers in the third column with numbers in [ ] brackets which provide the index of the first number in the row. For example, the second number in the third column would be identified as mydata$V3[2].