Skip to content

Instantly share code, notes, and snippets.

@joaovissoci
Created January 10, 2013 22:50
Show Gist options
  • Save joaovissoci/4506501 to your computer and use it in GitHub Desktop.
Save joaovissoci/4506501 to your computer and use it in GitHub Desktop.
#Instal packages needes for the analysis
lapply(c("sem","ggplot2", "psych", "RCurl", "irr", "nortest", "moments","GPArotation","nFactors",
"boot","psy","ResearchMethods"), library, character.only=T)
#Loading dataset from Gdocs
webdata <- getURL("https://docs.google.com/spreadsheet/pub?key=0ArVW3PoO2euydHFkeHVMd3FyeVlkZE1ySlc2bWEwZFE&single=true&gid=1&output=csv"
,ssl.verifypeer = FALSE)
data<-read.csv(textConnection(webdata))
#Create a subset in the data to contain students from the 2nd year
pg2 <- subset(data,Gyear == 2)
View(pg2)
#Creating a subset in the data to contain students from the 3rd year
pg3 <- subset(data,Gyear == 3)
View(pg3)
#Problem is, when I analyze the dataset separetly I have:
str(pg2) # Display datasets configuration
#You can se that there are 10 obs.
'data.frame': 10 obs. of 5 variables:
$ Case : Factor w/ 5 levels "Case1","Case2",..: 1 1 2 2 3 3 4 4 5 5
$ R1 : Factor w/ 8 levels "33A1","33A2",..: 1 5 6 7 5 5 3 3 2 2
$ R2 : Factor w/ 8 levels "33A1","33A2",..: 5 5 6 7 7 5 3 3 2 2
$ R3 : Factor w/ 7 levels "33A1","33A2",..: 5 4 7 3 4 4 2 2 6 6
$ Gyear: int 2 2 2 2 2 2 2 2 2 2
str(pg3)
#Here there are 20 observations
'data.frame': 20 obs. of 5 variables:
$ Case : Factor w/ 5 levels "Case1","Case2",..: 1 1 1 1 2 2 2 2 3 3 ...
$ R1 : Factor w/ 8 levels "33A1","33A2",..: 8 8 1 6 1 1 5 4 2 2 ...
$ R2 : Factor w/ 8 levels "33A1","33A2",..: 8 8 3 1 6 5 3 4 2 2 ...
$ R3 : Factor w/ 7 levels "33A1","33A2",..: 4 4 4 1 7 7 3 7 4 4 ...
$ Gyear: int 3 3 3 3 3 3 3 3 3 3 ...
#When I create the dataset, it evens the vectors for 20 obs.
#Creating data frames for agreement between 2nd and 3rd years
InterR12x3<-data.frame(pg2$R1,pg3$R1) #Create dataframe fro Agreement between Before and After AO Training
'data.frame': 20 obs. of 2 variables:
$ pg2.R1: Factor w/ 8 levels "33A1","33A2",..: 1 5 6 7 5 5 3 3 2 2 ...
$ pg3.R1: Factor w/ 8 levels "33A1","33A2",..: 8 8 1 6 1 1 5 4 2 2 ...
And to perform the agreement analysis, every package I found runs the analysis based on a dataframe or a matrix.
My question is, can I get this data set I've crated as a trustworthy data set, to run the analysis? I beliece R double's the observations from the dataset wth 10 obs. to match the on with 20. Is it correct? How to run with this?
kappam.fleiss(Inter2nd1) #Agreement analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment