[R] GREA - installation problems
i came across the GREA add-in for RStudio on R-bloggers: http://feedproxy.google.com/~r/RBloggers/~3/dU-3B7fQJ2c/?utm_source=feedburner&utm_medium=email https://github.com/Stan125/GREA and wanted to try it straight away - yet I failed already with the installation. after typing in > devtools::install_github("Stan125/GREA") I get the following: Downloading GitHub repo Stan125/GREA@master from URL https://api.github.com/repos/Stan125/GREA/zipball/master Installing GREA "C:/PROGRA~1/R/R-33~1.1/bin/x64/R" --no-site-file --no-environ --no-save \ --no-restore --quiet CMD INSTALL \ "C:/Users/mandersk/AppData/Local/Temp/RtmpSEKk1L/devtools18e0379148ae/Stan125-GREA-e80db34" \ --library="\\unetna01/mandersk$/Daten/R/win-library/3.3" --install-tests * installing *source* package 'GREA' ... ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded *** arch - i386 Warnung in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) there is no package called 'GREA' Fehler: Laden fehlgeschlagen Ausf�hrung angehalten *** arch - x64 Warnung in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) there is no package called 'GREA' Fehler: Laden fehlgeschlagen Ausf�hrung angehalten ERROR: loading failed for 'i386', 'x64' * removing '\\unetna01/mandersk$/Daten/R/win-library/3.3/GREA' Error: Command failed (1) any suggestions?? thanks, k@ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors
hi all, after fitting a multiple linear regression model <- lm(y ~ a + b+ c+d) i wanted to plot diagnostics plot(model) but get the error message Error in object$coefficients : $ operator is invalid for atomic vectors. which does not make a lot of sense, since there is no "$" - i am working with an attached dataset. can anyone help, please?? thanks a lot, kat -- dr. katharina manderscheid soziologisches seminar universität luzern kasernenplatz 3 6000 luzern 7 tel. ++41 41 228 4657 web: http://www.unilu.ch/deu/dr.-katharina-manderscheid_346380.aspx [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors
this problem seems to only exist in R 2.12.0 but not in R 2.11.1. any ideas? a bug? -- dr. katharina manderscheid soziologisches seminar universität luzern kasernenplatz 3 6000 luzern 7 tel. ++41 41 228 4657 web: http://www.unilu.ch/deu/dr.-katharina-manderscheid_346380.aspx -Ursprüngliche Nachricht- Von: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Gesendet: Mittwoch, 17. November 2010 16:33 An: Manderscheid Katharina Cc: 'r-help@r-project.org' Betreff: Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors On 17/11/2010 10:28 AM, Manderscheid Katharina wrote: > hi all, > after fitting a multiple linear regression > model<- lm(y ~ a + b+ c+d) > i wanted to plot diagnostics > plot(model) > but get the error message > Error in object$coefficients : $ operator is invalid for atomic vectors. > which does not make a lot of sense, since there is no "$" - i am working with > an attached dataset. > can anyone help, please?? > thanks a lot, > kat I just tried those lines (with fake data for a,b,c,d and y) and got no error message. I was using R 2.12.0. I think you need to show us a reproducible example, and the sessionInfo() to go with it, to help with this. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors
hi peter, thanks for your reply. i was kind of hoping/thinking that others have encountered the same problem too. i try to provide a reproducable example. my variables are the following (just the cases 1:50). the whole dataset has about 2800 cases. > satlife[1:50] [1] 9 10 11 8 11 10 11 6 7 8 3 8 10 9 8 9 7 7 9 8 8 7 10 8 9 [26] 5 7 9 9 11 11 5 3 9 8 9 3 9 6 8 5 6 6 6 9 11 6 5 9 9 > income[1:50] [1] 1841-2250 -1460 1841-2250 1841-2250 2251-2710 2711-3190 1461-1840 [8] 3771-4550 4551-5870 3191-3770 1841-2250 1461-1840 3771-4550 2251-2710 [15] 2251-2710 2711-3190 0-11001841-2250 1841-2250 -1460 [22] 3771-4550 1461-1840 2711-3190 1461-1840 [29] 0-11001461-1840 1841-2250 3191-3770 [36] 2251-2710 2711-3190 [43] 2711-3190 2251-2710 3771-4550 3771-4550 4551-5870 [50] 10 Levels: 0-1100 -1460 1461-1840 1841-2250 2251-2710 ... 5870 und mehr > satwirt[1:50] [1] 3 5 6 1 5 5 4 1 4 6 4 1 4 8 1 4 6 5 10 7 8 1 2 4 4 [26] 5 4 4 8 NA 3 4 5 8 6 NA 6 8 6 4 4 3 6 8 6 3 4 1 9 8 > freunde[1:50] [1] 4 5 7 4 6 7 7 3 3 4 2 4 4 5 3 6 7 4 5 2 4 4 5 4 4 6 5 4 4 6 6 6 4 4 5 4 5 6 [39] 3 7 4 5 6 5 5 5 4 2 3 5 > gesund[1:50] [1] gesund gesund gesund gesund nicht gesund [6] gesund gesund nicht gesund nicht gesund gesund [11] gesund nicht gesund gesund gesund nicht gesund [16] gesund gesund nicht gesund gesund gesund [21] gesund gesund gesund gesund nicht gesund [26] gesund gesund gesund nicht gesund gesund [31] gesund gesund nicht gesund gesund gesund [36] nicht gesund nicht gesund nicht gesund nicht gesund gesund [41] nicht gesund gesund nicht gesund gesund nicht gesund [46] gesund gesund gesund gesund gesund Levels: gesund nicht gesund and this is the regression model: > reg.satlife <- lm(satlife ~ as.numeric(income)+ freunde + gesund+ satwirt) the problem appears when calling > par(mfrow=c(2,2)) > plot(reg.satlife) the problem persists also when running the model without the factors income and gesund. do you need more information? thanks, katharina Von: Peter Ehlers [ehl...@ucalgary.ca] Gesendet: Donnerstag, 25. November 2010 21:54 An: Manderscheid Katharina Cc: 'r-help@r-project.org'; 'Duncan Murdoch' Betreff: Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors On 2010-11-25 02:25, Manderscheid Katharina wrote: > this problem seems to only exist in R 2.12.0 but not in R 2.11.1. > any ideas? a bug? > Duncan *did* say that he was using R 2.12.0. So that's not likely to be the problem. Most of the time, when users claim that a problem exists in a new version that did not exist in an older version, it's due to a change in the user's setup or to not updating packages or to not checking the NEWS file. Since you still have not provided a *reproducible* example, it's not likely that anyone can help. Can't you make up a small example that shows exactly how you are using lm() and that will generate the error? Peter Ehlers > > -- > dr. katharina manderscheid > > soziologisches seminar > universität luzern > > kasernenplatz 3 > 6000 luzern 7 > > tel. ++41 41 228 4657 > > web: http://www.unilu.ch/deu/dr.-katharina-manderscheid_346380.aspx > > -Ursprüngliche Nachricht- > Von: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] > Gesendet: Mittwoch, 17. November 2010 16:33 > An: Manderscheid Katharina > Cc: 'r-help@r-project.org' > Betreff: Re: [R] Problem with plotting diagnostics - Error in > object$coefficients : $ operator is invalid for atomic vectors > > On 17/11/2010 10:28 AM, Manderscheid Katharina wrote: >> hi all, >> after fitting a multiple linear regression >> model<- lm(y ~ a + b+ c+d) >> i wanted to plot diagnostics >> plot(model) >> but get the error message >> Error in object$coefficients : $ operator is invalid for atomic vectors. >> which does not make a lot of sense, since there is no "$" - i am working >> with an attached dataset. >> can anyone help, please?? >> thanks a lot, >> kat > > > I just tried those lines (with fake data for a,b,c,d and y) and got no error > message. I was using R 2.12.0. > > I think you need to show us a reproducible example, and the > sessionInfo() to go with it, to help with this. > > Duncan Murdoch > > __ &g
Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors
thanks for your suggestions. i think i am getting some sort of idea where the problem lies. i am working with a dataset which i attached. the objects of my regression model are derived from this dataset but, as far as i understand, only exist in the r environment. i have detached the main dataset and created a new data frame containing just the four objects, and then i attached this new data frame, ran the model, did the plotting and: fine. still, what i don't understand why it worked without this extra loop in R 2.11.1 and not anymore in R 2.12.0. in order to reproduce the problem: i am working with the ESS data (http://www.europeansocialsurvey.org/) round 4, DE, and produced the four objects as follows: satwirt <- as.numeric(stfeco) satwirt[satwirt>11]<-NA freunde <- as.numeric(sclmeet) freunde[freunde>8]<-NA gesund <- factor(c("gesund", "nicht gesund")) gesund[as.numeric(health)<3]<-"gesund" satlife <- as.numeric(stflife) satlife[satlife>11] <-NA income <- factor(c("0-1100", "-1460", "1461-1840", "1841-2250", "2251-2710", "2711-3190", "3191-3770", "3771-4550", "4551-5870", "5870 und mehr")) income[hinctnta=="J"] <- "0-1100" income[hinctnta=="R"] <- "-1460" income[hinctnta=="C"] <- "1461-1840" income[hinctnta=="M"] <- "1841-2250" income[hinctnta=="F"] <- "2251-2710" income[hinctnta=="S"] <- "2711-3190" income[hinctnta=="K"] <- "3191-3770" income[hinctnta=="P"] <- "3771-4550" income[hinctnta=="D"] <- "4551-5870" income[hinctnta=="H"] <- "5870 und mehr" the problem appears when calling par(mfrow=c(2,2)) plot(reg.satlife) i get the first two, but not the second two graphs. which kind of does not make sense to me yet. thanks again for your support, katharina -Ursprüngliche Nachricht- Von: Peter Ehlers [mailto:ehl...@ucalgary.ca] Gesendet: Freitag, 26. November 2010 12:49 An: Manderscheid Katharina Cc: 'r-help@r-project.org' Betreff: Re: AW: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors On 2010-11-25 23:59, Manderscheid Katharina wrote: > hi peter, > > thanks for your reply. i was kind of hoping/thinking that others have > encountered the same problem too. > > i try to provide a reproducable example. > > my variables are the following (just the cases 1:50). the whole dataset has > about 2800 cases. >> satlife[1:50] > [1] 9 10 11 8 11 10 11 6 7 8 3 8 10 9 8 9 7 7 9 8 8 > 7 10 8 9 [26] 5 7 9 9 11 11 5 3 9 8 9 3 9 6 8 5 6 6 > 6 9 11 6 5 9 9 >> income[1:50] > [1] 1841-2250 -1460 1841-2250 1841-2250 2251-2710 2711-3190 1461-1840 > [8] 3771-4550 4551-5870 3191-3770 1841-2250 1461-1840 3771-4550 2251-2710 > [15] 2251-2710 2711-3190 0-11001841-2250 1841-2250 -1460 > [22] 3771-4550 1461-1840 2711-3190 1461-1840 > [29] 0-11001461-1840 1841-2250 3191-3770 > [36] 2251-2710 2711-3190 > [43] 2711-3190 2251-2710 3771-4550 3771-4550 4551-5870 > [50] > 10 Levels: 0-1100 -1460 1461-1840 1841-2250 2251-2710 ... 5870 und > mehr >> satwirt[1:50] > [1] 3 5 6 1 5 5 4 1 4 6 4 1 4 8 1 4 6 5 10 7 8 > 1 2 4 4 [26] 5 4 4 8 NA 3 4 5 8 6 NA 6 8 6 4 4 3 6 > 8 6 3 4 1 9 8 >> freunde[1:50] > [1] 4 5 7 4 6 7 7 3 3 4 2 4 4 5 3 6 7 4 5 2 4 4 5 4 4 6 5 4 4 6 6 6 > 4 4 5 4 5 6 [39] 3 7 4 5 6 5 5 5 4 2 3 5 >> gesund[1:50] > [1] gesund gesund gesund gesund nicht gesund > [6] gesund gesund nicht gesund nicht gesund gesund > [11] gesund nicht gesund gesund gesund nicht gesund > [16] gesund gesund nicht gesund gesund gesund > [21] gesund gesund gesund gesund nicht gesund > [26] gesund gesund gesund nicht gesund gesund > [31] gesund gesund nicht gesund gesund gesund > [36] nicht gesund nicht gesund nicht gesund nicht gesund gesund > [41] nicht gesund gesund nicht gesund gesund nicht gesund > [46] gesund gesund gesund gesund gesund > Levels: gesund nicht gesund > > and this is the regression model: >> reg.satlife<- lm(satlife ~ as.numeric(income)+ freunde + gesund+ >> satwirt) > > the problem appears when calling >> par(mfrow=c(2,2)) >> plot(reg.satlife) > > the problem persists also when
[R] package ca/rgl for ubuntu?
hi, for some unknown reason i cannot install the package ca in R running in a ubuntu mint system. i keep getting the following error message: configure: error: missing required header GL/gl.h ERROR: configuration failed for package ‘rgl’ * removing ‘/home/kat/R/i486-pc-linux-gnu-library/2.12/rgl’ ERROR: dependency ‘rgl’ is not available for package ‘ca’ * removing ‘/home/kat/R/i486-pc-linux-gnu-library/2.12/ca’ Die heruntergeladenen Pakete sind in ‘/tmp/Rtmp7r6s3h/downloaded_packages’ Warnmeldungen: 1: In install.packages("ca") : Installation des Pakets 'rgl' hatte Exit-Status ungleich 0 2: In install.packages("ca") : Installation des Pakets 'ca' hatte Exit-Status ungleich 0 thanks a lot for your help! katharina __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] package ca/rgl for ubuntu?
thanks a lot, duncan for that super-fast reply and help! i could install rgl via synaptic and afterwards ca in R directly. and it works! :-) have a nice evening, kat Von: Duncan Murdoch [murdoch.dun...@gmail.com] Gesendet: Montag, 6. Dezember 2010 19:55 An: Manderscheid Katharina Cc: r-help@r-project.org Betreff: Re: [R] package ca/rgl for ubuntu? On 06/12/2010 1:45 PM, Manderscheid Katharina wrote: > hi, > for some unknown reason i cannot install the package ca in R running in a > ubuntu mint system. i keep getting the following error message: You need the development package for OpenGL or MesaGL to install rgl. I don't know Ubuntu so I don't know how to ask for it, but that's what you want (unless you choose to install a binary; I believe some are available for Ubuntu). Duncan Murdoch > configure: error: missing required header GL/gl.h > ERROR: configuration failed for package ‘rgl’ > * removing ‘/home/kat/R/i486-pc-linux-gnu-library/2.12/rgl’ > ERROR: dependency ‘rgl’ is not available for package ‘ca’ > * removing ‘/home/kat/R/i486-pc-linux-gnu-library/2.12/ca’ > > Die heruntergeladenen Pakete sind in > ‘/tmp/Rtmp7r6s3h/downloaded_packages’ > Warnmeldungen: > 1: In install.packages("ca") : >Installation des Pakets 'rgl' hatte Exit-Status ungleich 0 > 2: In install.packages("ca") : >Installation des Pakets 'ca' hatte Exit-Status ungleich 0 > > thanks a lot for your help! > katharina > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors
hi lexi indeed, for a week or so i can also plot the diagnostics - same script, no change in data... maybe an update of a package, i don't know. katharina -- dr. katharina manderscheid soziologisches seminar universität luzern kasernenplatz 3 6000 luzern 7 tel. ++41 41 228 4657 web: http://www.unilu.ch/deu/dr.-katharina-manderscheid_346380.aspx -Ursprüngliche Nachricht- Von: Setlhare Lekgatlhamang [mailto:setlha...@bob.bw] Gesendet: Mittwoch, 8. Dezember 2010 10:00 An: Manderscheid Katharina; Duncan Murdoch Betreff: RE: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors Dear Katharina, I would like to confirm what Duncan found - i.e., R 2.12.0 is able to plot the diagnostics without a problem. Lexi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Manderscheid Katharina Sent: Thursday, November 25, 2010 12:26 PM To: 'r-help@r-project.org'; 'Duncan Murdoch' Subject: Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors this problem seems to only exist in R 2.12.0 but not in R 2.11.1. any ideas? a bug? -- dr. katharina manderscheid soziologisches seminar universität luzern kasernenplatz 3 6000 luzern 7 tel. ++41 41 228 4657 web: http://www.unilu.ch/deu/dr.-katharina-manderscheid_346380.aspx -Ursprüngliche Nachricht- Von: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Gesendet: Mittwoch, 17. November 2010 16:33 An: Manderscheid Katharina Cc: 'r-help@r-project.org' Betreff: Re: [R] Problem with plotting diagnostics - Error in object$coefficients : $ operator is invalid for atomic vectors On 17/11/2010 10:28 AM, Manderscheid Katharina wrote: > hi all, > after fitting a multiple linear regression > model<- lm(y ~ a + b+ c+d) > i wanted to plot diagnostics > plot(model) > but get the error message > Error in object$coefficients : $ operator is invalid for atomic vectors. > which does not make a lot of sense, since there is no "$" - i am working with > an attached dataset. > can anyone help, please?? > thanks a lot, > kat I just tried those lines (with fake data for a,b,c,d and y) and got no error message. I was using R 2.12.0. I think you need to show us a reproducible example, and the sessionInfo() to go with it, to help with this. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. DISCLAIMER:\ Sample Disclaimer added in a VBScript.\ ...{{dropped:3}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] .por files
hi, i have a spss portable file which i cannot open in R. i tried library(Hmisc) File.spss <- spss.get("File.por", use.value.labels=T) and received: Fehler in read.spss("File.por", : Datei »File.por« ist nicht in einem unterstützten SPSS-Format (in engl.: error, not supported spss format) then i tried library(memisc) File <- spss.portable.file("File.por") and got: WARNING: slash not found ans = l832112+JGJJs6tiskYVsGfoVisDRTZekfjY462+52+7,+5+41KLD5+8+2+5+8+2+3K+5ZeXReXjUlRkFehler in readStringPorStream(stream) : kann Speicherblock der Größe 3.3 GB nicht zuteilen the file is 1023 kb i can open the file in spss - so it is not damaged or anything. any ideas? > sessionInfo() R version 2.12.0 (2010-10-15) Platform: i486-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=de_CH.UTF-8 LC_NUMERIC=C [3] LC_TIME=de_CH.UTF-8 LC_COLLATE=de_CH.UTF-8 [5] LC_MONETARY=de_CH.UTF-8 LC_MESSAGES=de_CH.UTF-8 [7] LC_PAPER=de_CH.UTF-8 LC_NAME=de_CH.UTF-8 [9] LC_ADDRESS=de_CH.UTF-8LC_TELEPHONE=de_CH.UTF-8 [11] LC_MEASUREMENT=de_CH.UTF-8LC_IDENTIFICATION=de_CH.UTF-8 attached base packages: [1] splines grid stats graphics grDevices utils datasets [8] methods base other attached packages: [1] memisc_0.95-31 Hmisc_3.8-3 Deducer_0.4-2foreign_0.8-41 [5] effects_2.0-10 colorspace_1.0-1 lattice_0.19-13 multcomp_1.2-4 [9] mvtnorm_0.9-95 car_2.0-6survival_2.36-2 nnet_7.3-1 [13] MASS_7.3-5 ggplot2_0.8.8proto_0.3-8 reshape_0.8.3 [17] plyr_1.2.1 JGR_1.7-4iplots_1.1-3 JavaGD_0.5-3 [21] rJava_0.8-8 loaded via a namespace (and not attached): [1] cluster_1.13.2 tools_2.12.0 kat __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] labelling of axis in plot.ca
hi all, how can i get correspondence analysis plots (package ca, plot.ca()) with the inertia on the two dimensions of the map? thanks, kat [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot.ca with labelled axes?
hi all, maybe my last post was to short and cryptic. i conducted a correspondence analysis with ca(my.data) and would like to have the x and y axis labelled with the eigenvalues of the dimensions? the argument xlab/ylab does not work... thanks for suggestions, kat __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] svytable and na's
hi, i am trying to work with the survey package in order to apply survey design weights. the data set i am using - ess - contains missing values. my question: when using svytable(~variable1+variable2, design=my.svydesign.object, na.rm=T) the resulting crosstable contains all missings although i defined the na's as such. any ideas??? thanks a lot, katharina -- dr. katharina manderscheid soziologisches seminar universität luzern kasernenplatz 3 6000 luzern 7 tel. ++41 41 228 4657 web: http://www.unilu.ch/deu/dr.-katharina-manderscheid_346380.aspx [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] svytable and na's
hi thomas thanks for your reply. in the documentation of svytable, the argument na.rm=T is mentioned. however, last night i figured out what went wrong in my tabulation: i had a dataset which i attached and then defined the missing values - of course they were not stored in the data set. attach(data) vote[vote=="Don't know"|vote=="Refusal"]<-NA detach(data) so they disappeared when i created a svydesign-object with weighted data and my table looked like this: > svytable(~gndr+vote, design=data.weight, na.rm=T) vote gndr Yes No Not eligible to vote Refusal Don't know Male 453.8726 226.7600 154.1651 0.10.8572 Female507.6368 302.3634 145.4426 0.17.9157 No answer 0. 0. 0. 0. 0. vote gndrNo answer Male 0. Female 0. No answer0. thus the solution is to define the missings in the original data set by using data$variable before creating the svydesign-object. data$vote[data$vote=="Don't know"|data$vote=="Refusal"]<-NA then the svytable looks correctly: > svytable(~gndr]+vote, design=data.weight, na.rm=T) vote[drop = T] gndr[drop = T] Yes No Not eligible to vote Male 453.8726 226.7600 154.1651 Female 507.6368 302.3634 145.4426 or is there a way to define factor levels as na directly in an svydesign-object? best and thanks katharina dr. katharina manderscheid soziologisches seminar universität luzern kasernenplatz 3 6000 luzern 7 tel. ++41 41 228 4657 Von: Thomas Lumley [tlum...@uw.edu] Gesendet: Donnerstag, 19. Mai 2011 23:48 An: Manderscheid Katharina Cc: r-help@r-project.org Betreff: Re: [R] svytable and na's On Thu, May 19, 2011 at 11:41 PM, Manderscheid Katharina wrote: > hi, > > i am trying to work with the survey package in order to apply survey design > weights. the data set i am using - ess - contains missing values. > my question: when using svytable(~variable1+variable2, > design=my.svydesign.object, na.rm=T) the resulting crosstable contains all > missings although i defined the na's as such. > Could you give more details? There isn't an na.rm= argument to svytable, so it's not surprising it has no effect, but I don't know what you mean when you say the table "contains all missings." Perhaps you could show us the output and say how it differs from what you expected. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.