Hi, I was wondering if anyone could provide me with help in entering the attached dataset into R? I've been having a hard time in trying to figure out how to assemble it into both a frequency table and a bar graph within R. I've been trying to present the way I have the data arranged in Excel Spreadsheet into R. I am uncertain what the correct commands and exact techniques are into getting it correctly organized in R. Any help would be greatly appreciated! Thank you! Laura Clasemann
On 02/28/2011 02:37 PM, Laura Clasemann wrote:> > Hi, > > I was wondering if anyone could provide me with help in entering the attached dataset into R? I've been having a hard time in trying to figure out how to assemble it into both a frequency table and a bar graph within R. I've been trying to present the way I have the data arranged in Excel Spreadsheet into R. I am uncertain what the correct commands and exact techniques are into getting it correctly organized in R. Any help would be greatly appreciated! Thank you! >Hi Laura, Your dataset didn't make it to the list. This is a common problem as the moderators take care not to let possibly virus-laden attachments get through. If the dataset isn't too big, you can just add it to the message. If it is already an R object like a dataframe, try "dput" to add it to the body of the email. If all else fails, place the dataset on a public server and send the URL to us. Jim
Hi, I was wondering if anyone could provide me with help in entering the dataset below into R? I've been having a hard time in trying to figure out how to assemble it into both a frequency table and a bar graph within R. I've been trying to present the way I had the data arranged, as below, in Excel Spreadsheet into R. I am uncertain what the correct commands and exact techniques are into getting it correctly organized in R. Any help would be greatly appreciated! Thank you! Diet Binger-Yes Binger-No Total None 24 134 158 Healthy 9 52 61 Unhealthy 23 72 95 Dangerous 12 15 27 Laura [[alternative HTML version deleted]]
Hi, I apologize for sending this again but realized that the data I had originally sent in my first email did not show correctly and wanted to send it again to give a better idea of how I am trying to show my data within R. Thanks! Laura Diet: Binger-yes: Binger-No: Total: None 24 134 158 Healthy 9 52 61 Unhealthy 23 72 95 Dangerous 12 15 27> On Mon, Feb 28, 2011 at 10:02 AM, Laura Clasemann <violagirl470@msn.com> wrote: > > > > Hi, > > > > I was wondering if anyone could provide me with help in entering the dataset below into R? I've been having a hard time in trying to figure out how to assemble it into both a frequency table and a bar graph within R. I've been trying to present the way I had the data arranged, as below, in Excel Spreadsheet into R. I am uncertain what the correct commands and exact techniques are into getting it correctly organized in R. Any help would be greatly appreciated! Thank you! > > > > > > > > > > > > > > > > > > Diet > > Binger-Yes > > Binger-No > > Total > > > > None > > 24 > > 134 > > 158 > > > > Healthy > > 9 > > 52 > > 61 > > > > Unhealthy > > 23 > > 72 > > 95 > > > > Dangerous > > 12 > > 15 > > 27 > > > > Laura > >[[alternative HTML version deleted]]
Hi, Creating the X'y vector has been troublesome. I get the error: requires numeric/complex matrix/vector arguments. Could you please look at my code and tell me what I am doing wrong? I have several dummy variables among my independent variables. #Variable MHL16, or that corresponding to whether the school social worker is required to be licensed or certified by a state agency or board, is coded as dependent variable y1 <- subset(dat, select=c(MHL16)) y <- as.matrix(y1[1:873,]) summary(y) y #Create independent variable vectors x02 <- subset(dat, select=c(sampstra)) x03 <- subset(dat, select=c(size)) x03.dummy <- subset(x03=="2") #where True=large size and False=small size dim(x03.dummy) x04 <- subset(dat, select=c(level)) x05 <- subset(dat, select=c(ENROLL)) x06 <- subset(dat, select=c(URBAN)) x06.dummy <- subset(x06=="1") #where True=urban and False=non-urban or NA x07 <- subset(dat, select=c(REGION)) x08 <- subset(dat, select=c(POVERTY)) x08.dummy <- subset(x08=="2") #where True=high poverty and False=low proverty or NA x08.dummy dim(x08.dummy) x09 <- subset(dat, select=c(MHL12)) #is there a PT/FT school social worker who provides mental health/social services to students x09.dummy <- subset(x09=="1") #where True=yes and False=no dim(x09.dummy) x010 <- subset(dat, select=c(MHL13)) #how many PT/FT school social workers provides services x011 <- subset(dat, select=c(MHL15)) #what is the minimum level of education required for newly hired school social worker x012 <- subset(dat, select=c(MHL27c_03)) #does the school social worker provide services for pregnancy prevention x012.dummy <- subset(x012=="1") #where True=yes, False=no x013 <- subset(dat, select=c(MHL27d_03)) #does the school social worker provide services for HIV prevention x013.dummy <- subset(x013=="1") #where True=yes, False=no x2 <- as.matrix(x02[1:843,]) x3 <- as.matrix(x03.dummy[1:843,]) x4 <- as.matrix(x04[1:843,]) x5 <- as.matrix(x05[1:843,]) x6 <- as.matrix(x06.dummy[1:843,]) x7 <- as.matrix(x07[1:843,]) x8 <- as.matrix(x08.dummy[1:843,]) x9 <- as.matrix(x09.dummy[1:843,]) x10 <- as.matrix(x010[1:843,]) x11 <- as.matrix(x011[1:843,]) x12 <- as.matrix(x012.dummy[1:843,]) x13 <- as.matrix(x013.dummy[1:843,]) #Create X matrix X <- cbind(1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13) dim(X)> Xty <- t(X)%*%yError in t(X) %*% y : requires numeric/complex matrix/vector arguments Thanks!