Re: [R] svyglm

2017-12-09 Thread Anthony Damico
hi, could you create a reproducible example starting from http://asdfree.com/pesquisa-nacional-de-saude-pns.html ? thanks On Mon, Dec 4, 2017 at 9:56 AM, Luciane Maria Pilotto via R-help < r-help@r-project.org> wrote: > Hi, > I am trying to run analyzes incorporating sample weight, strata and >

Re: [R] exporting data to stata

2018-03-22 Thread Anthony Damico
hi, you can export the dataset from an R survey design to stata with install.packages('survey') library(survey) library(foreign) write.dta( data1$variables , "c:/path/to/file.dta" ) then type "data1" into the R console to look at the weight, id/cluster, strata, and fpc variables to use for the "

[R] more floating point sensitivity in 3.5.0?

2018-05-18 Thread Anthony Damico
hi all, in the past two days, i've found two places in unrelated code where i needed to substitute something like `x == y` with `isTRUE(all.equal(x,y))` to fix problems that started occurring in 3.5.0 on windows. the release news[1] makes one mention of floating points, but i'm not sur

Re: [R] Multinomial Logistic Regression with Complex Survey using 'Survey' Package in R

2018-06-19 Thread Anthony Damico
hi, check out the news page.. https://cran.r-project.org/web/packages/survey/NEWS On Tue, Jun 19, 2018 at 5:54 PM, Mackenzie Jones wrote: > Dear R Users, > > I want to use a multinomial logistic regression model with survey data in > the “survey” package. The original package did not have a func

Re: [R] cannot load .sav-files in R 3.4.0

2017-05-01 Thread Anthony Damico
hi, i don't think foreign::read.spss or haven::read_spss have ever worked with a handful of the ess files, but library(memisc) does. you are better off loading ess with library(lodown) because the drudge work has already been done-- library(devtools) devtools::install_github("ajdamico/lo

Re: [R] cannot load .sav-files in R 3.4.0

2017-05-01 Thread Anthony Damico
did my code work? thanks On Mon, May 1, 2017 at 11:35 AM, wrote: > hi, thanks for the reply! > it always worked until 3.4.0. i got warning but they did not stop R > loading the file ... > > Am 01.05.2017 16:10 schrieb Anthony Damico: > >> hi, i don't thin

Re: [R] cannot load .sav-files in R 3.4.0

2017-05-02 Thread Anthony Damico
sführung angehalten > ERROR: loading failed for 'i386', 'x64' > * removing '\\unetna01/mandersk$/Daten/R/win-library/3.3/lodown' > Error: Command failed (1) > > Am 01.05.2017 18:15 schrieb Anthony Damico: > >> did my code work? thanks >> &

Re: [R] Svyglm Error

2017-07-05 Thread Anthony Damico
hi, i am not hitting an error when i copy and paste your code into a fresh console. maybe compare your sessionInfo() to mine? > sessionInfo() R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack

Re: [R] Help with ftable.svyby

2017-07-09 Thread Anthony Damico
try resetting your factor levels and re-run? q50 <- update( q50 , INCOME = factor( INCOME ) , AGECL = factor( AGECL ) , RACECL = factor( RACECL ) ) On Sun, Jul 9, 2017 at 2:59 PM, Orsola Costantini via R-help < r-help@r-project.org> wrote: > Hi all, > > When I try the following with pkg Surve

[R] readLines without skipNul=TRUE causes crash

2017-07-15 Thread Anthony Damico
hello, the last line of the code below causes a segfault for me on 3.4.1. i think i should submit to https://bugs.r-project.org/ unless others have advice? thanks install.packages( "devtools" ) devtools::install_github("ajdamico/lodown") devtools::install_github("jimhester/archive") file_f

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-15 Thread Anthony Damico
the embedded nuls have something to do with it-- # WARNING do not run with less than 64GB RAM tf <- tempfile() a <- rep( "a" , 10 ) b <- paste( a , collapse = '' ) writeLines( b , tf ) ; rm( b ) ; gc() d <- readLines( tf ) On Sat, J

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-15 Thread Anthony Damico
15, 2017 at 10:32 AM, Anthony Damico wrote: > hi, thanks Dr. Murdoch > > > i'd appreciate if anyone on r-help could help me narrow this down? i > believe the segfault occurs because there's a single line with 4GB and also > embedded nuls, but i am not sure how to

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-16 Thread Anthony Damico
the bother On Sat, Jul 15, 2017 at 4:14 PM, Duncan Murdoch wrote: > On 15/07/2017 11:33 AM, Anthony Damico wrote: > >> hi, i realized that the segfault happens on the text file in a new R >> session. so, creating the segfault-generating text file requires a >> contri

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-16 Thread Anthony Damico
d): >> ## [1] compiler_3.4.1 >> tools::md5sum( fn1 ) >> ## /home/jdnewmil/Downloads/Microdados ENEM 2009/Dados Enem >> 2009/DADOS_ENEM_2009.txt >> ## >> "83e61c96092285b60d7bf6b0dbc7072e" >> dat <- readLines( fn1 ) >> length( dat ) >>

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-16 Thread Anthony Damico
sorry, typo, 80937 not 809367 On Sun, Jul 16, 2017 at 6:21 AM, Anthony Damico wrote: > hi, thank you for attempting this. it looks like your unix machine > unzipped the txt file without corruption -- if you copied over the same txt > file to windows 7, i don't think that would

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-16 Thread Anthony Damico
7-15 17:19:47 no On Sun, Jul 16, 2017 at 6:34 AM, Duncan Murdoch wrote: > On 16/07/2017 6:17 AM, Anthony Damico wrote: > >> thank you for taking the time to write this. i set it running last >> night and it's still going -- if it doesn't finish by tomorrow, i will

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-16 Thread Anthony Damico
that segfaults when presented > with that corrupt file? Can you please confirm the file name and run md5sum > on it and share the result so we can tell when the file problem has been > reproduced? > -- > Sent from my phone. Please excuse my brevity. > > On July 16, 2017 3:21:21 A

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-17 Thread Anthony Damico
ine. > > I would discourage you from harassing the Brazilian government about their > RAR file because the RAR file seems fine (no NUL characters appear in the > text file) when extracted using the file-roller archive tool on Ubuntu. > -- > Sent from my phone. Please excuse my brevity

Re: [R] readLines without skipNul=TRUE causes crash

2017-07-17 Thread Anthony Damico
## BLAS: /usr/lib/libblas/libblas.so.3.0 >>>> ## LAPACK: /usr/lib/lapack/liblapack.so.3.0 >>>> ## >>>> ## locale: >>>> ## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >>>> ## [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 >>>&

Re: [R] Import selected columns from sas7bdat file

2017-08-10 Thread Anthony Damico
hi, the sas universal viewer might be a free, non-R way to convert a sas7bdat file to non-proprietary formats, not sure if it's windows-only. those other formats should be easier to import only a subset of columns into R.. https://support.sas.com/downloads/browse.htm?fil=&cat=74 On Thu, Aug 10, 2

[R] code to provoke a crash running rterm.exe on windows

2016-05-28 Thread Anthony Damico
hi, here's a minimal reproducible example that crashes my R 3.3.0 console on a powerful windows server. below the example, i've put the error (not crash) that occurs on R 3.2.3. should this be reported to http://bugs.r-project.org/ or am i doing something silly? thanx # C:\Users\AnthonyD>"c

Re: [R] asking for large memory - crash running rterm.exe on windows

2016-05-28 Thread Anthony Damico
Maechler wrote: > >>>>> Ben Bolker > >>>>> on Sat, 28 May 2016 15:42:45 + writes: > > > Anthony Damico gmail.com> writes: > >> > >> hi, here's a minimal reproducible example that crashes my > >> R 3

Re: [R] svykappa using the survey package

2016-06-20 Thread Anthony Damico
hi pradip, this should give you what you want library(foreign) library(survey) tf <- tempfile() download.file( " https://meps.ahrq.gov/mepsweb/data_files/pufs/h163ssp.zip"; , tf , mode = 'wb' ) z <- unzip( tf , exdir = tempdir() ) x <- read.xport( z ) names( x ) <

Re: [R] svymean using the survey package - strata containing no subpopulation members

2016-06-22 Thread Anthony Damico
t; this case - Asians with diabetes diagnosed in MEPS 2013). Is there a way to > get this count or ask R to provide this information? Any hints will be > appreciated. > > Acknowledgements: The current R script is a tweaked-version of the code > originally sent (on this forum) by A

Re: [R] r code for multilevel latent class analysis

2016-07-07 Thread Anthony Damico
start at https://github.com/ajdamico/asdfree/blob/master/European%20Social%20Survey/structural%20equation%20modeling%20examples.R maybe? On Thu, Jul 7, 2016 at 6:26 AM, Cristina Cametti wrote: > Dear all, > > I am not able to find a reliable r code to run a multilevel latent class > model. Indee

Re: [R] svytable: How do i create a table informing a third variable?

2016-09-02 Thread Anthony Damico
# mean svymean( ~ income_variable , NN ) svyby( ~ income_variable , ~ age + sex , NN , svymean ) # median svyquantile( ~ income_variable , NN ) svyby( ~ income_variable , ~ age + sex , NN , svyquantile , 0.5 ) On Fri, Sep 2, 2016 at 3:04 PM, Juan Ceccarelli Arias wrote: > Hello > Im analyzin

Re: [R] Svyglm Error in Survey Package

2016-09-23 Thread Anthony Damico
hi could you make this a minimal reproducible example? On Sep 24, 2016 12:03 PM, "Courtney Benjamin" wrote: > In attempting to use the svyglm call in the R Survey Package, I am > receiving the error: Error in pwt[i] : invalid subscript type 'list' > > I have not been able to find a lot of inform

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-05 Thread Anthony Damico
hi, after running each individual line of code above, check that the object still has the expected number of records and unique county fips codes. it looks like length( shapes$GEOID ) == 3233 but nrow( merged_data ) == 3109. the way for you to debug this is for you to go through line by line after

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-05 Thread Anthony Damico
com/reubano/1281134. > > Thanks again! > > Sincerely, > > Shouro > > On Tue, May 5, 2015 at 5:21 PM, Anthony Damico wrote: > >> hi, after running each individual line of code above, check that the >> object still has the expected number of records and unique

Re: [R] confidence intervals for differences in proportions from complex survey design?

2015-05-10 Thread Anthony Damico
i don't know the answer to your larger question, but for confidence intervals around proportions you might look at ?svyciprop. one of the method= options might yield the same result as your approximation, not sure On Mon, May 11, 2015 at 12:40 AM, Brown, Tony Nicholas < tony.n.br...@vanderbilt.ed

Re: [R] Households per Census block

2015-08-03 Thread Anthony Damico
hi, ccing the package maintainer. one alternative is to pull the HU100 variable directly from the census bureau's summary files: that variable starts at position 328 and ends at 336. just modify this loop and you'll get a table with one-record-per-census-block in every state. https://github.com/

[R] minimal reproducible read.fwf() example that crashes the console on windows 8 with 32-bit R

2015-08-15 Thread Anthony Damico
hi, if i copy and paste this (pretty straightforward) code into R 3.2.2's 32-bit console, the program dies. if i use 64-bit R, the console doesn't die, but the process ends with a weird line-ending warning. i'm under the impression that if the console crashes, it's a bug? but i wanted to check w

Re: [R] Missing Data Imputation for Complex Survey Data

2014-12-12 Thread Anthony Damico
the mitools package is compatible with the survey package.. asdfree.com has complete step-by-step R code examples to work with govt microdata. here are the ones with multiply imputed survey data. :) national health interview survey national survey of children's health consumer expenditure survey

Re: [R] R example codes for direct standardization of rates (Reference: Thoma's Lumley's survey package)

2014-12-30 Thread Anthony Damico
hi pradip hope you're doing well! these two scripts have age adjustment calculations, but neither are specific to nhis. the nhanes example is probably closer to what you're trying to do :) https://github.com/ajdamico/usgsd/blob/master/National%20Health%20and%20Nutrition%20Examination%20Survey/2

Re: [R] multiple imputed files

2015-01-26 Thread Anthony Damico
hi nate and annelies, the survey of consumer finances and consumer expenditure survey folders both have examples of how to run a glm on multiply-imputed survey data.. but these examples are specifically for complex sample survey data, which might not be what you're working with. :) https://github

Re: [R] multiple imputed files

2015-01-26 Thread Anthony Damico
On Mon, Jan 26, 2015 at 2:13 PM, hnlki wrote: > Thank you for your answers. In fact I am using the HFCS dataset, cool, so survey data. asdfree.com is a good place for examples. also, if you can match any officially-published statistics, i would love to collaborate on a post with you :) >

Re: [R] Subsetting data with svyglm

2015-02-11 Thread Anthony Damico
hi brennan, survey design objects can be subsetted with the same subset() syntax as data.frame objects, so following jeff's advice maybe you want svyglm( formula , design = subset( surveydesign , variable %in% c( 'value a' , 'value b' ) ) ) for some examples of how to construct a survey design wi

Re: [R] Error in svychisq and svyttest with svrepdesign

2015-03-10 Thread Anthony Damico
hi anabela, please provide a complete reproducible example. you need to use ?dput -- we are not able to import "dadosSPSS.sav" so we cannot recreate your problem in order to help you. thanks! http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example On Tue, Mar 10

[R] iconv() replaces invalid characters with " " instead of " " (two spaces instead of one) on unix?

2015-03-14 Thread Anthony Damico
hello, i am trying to replace non-ASCII characters in a character string with a single space. the iconv() function works as i expect it to on windows, but on unix, non-ASCII characters are getting replaced with two spaces instead of one. i suppose i could write a workaround for my code, but i'm w

Re: [R] not a Stata version 5-12 .dta file

2015-03-19 Thread Anthony Damico
hi nicole, i have published easy to reproduce, well-documented code to download and then analyze every file from every wave of the world values survey here. the download automation script should solve your problem, or at least work around it :) http://www.asdfree.com/search/label/world%20values%

Re: [R] not a Stata version 5-12 .dta file

2015-03-19 Thread Anthony Damico
their > stata files, it seems, as .dta. Further, the .rdata files are not loading > correctly, either, giving me .Traceback or crashes R when I try to source > it. I will poke around your link to see if it can provide any insight. > > ~n > > > > > > > > On Ma

Re: [R] Having trouble with gdata read in

2015-03-25 Thread Anthony Damico
maybe library(xlsx) tf <- tempfile() ami <- " http://www.ferc.gov/industries/electric/indus-act/demand-response/2008/survey/ami_survey_responses.xls " download.file( ami , tf , mode = 'wb' ) ami.data2008 <- read.xlsx( tf , sheetIndex = 1 ) On Wed, Mar 25, 2015 at 5:01 PM, Benjamin Baker wrot

Re: [R] Pseudo R squared for quantile regression with replicates

2014-09-18 Thread Anthony Damico
here is a reproducible example, mostly from ?withReplicates. i think something would have to be done using return.replicates=TRUE to manually compute survey-adjusted residuals, but i'm not really sure what nor whether the pseudo r^2 would be meaningful :/ library(survey) library(quantreg) data

Re: [R] Using "survey" package with ACS PUMS

2014-09-30 Thread Anthony Damico
hi michael, you probably need options( "survey.replicates.mse" = TRUE ) i also think you don't want type = "Fay" and you do want scale = 4/80 and rscales = rep( 1 , 80 ) as well, but what you have might be equivalent (not sure) regardless, this blog post details how to precisely replicate the

Re: [R] vcov function and cross terms

2014-10-15 Thread Anthony Damico
it might be slightly different, but i think the result is very close to a tsl result (which hasn't been implemented).. could you use this? mns<-svyby(~api00+api99, ~stype, rclus1, svytotal,covmat=TRUE) vcov(mns) On Wed, Oct 15, 2014 at 9:27 AM, Daniela Droguett < daniela.droguett.l...@gmail.c

Re: [R] "survey" package -- doesn't appear to match svy

2014-10-28 Thread Anthony Damico
could you provide a minimal reproducible example? perhaps use ?dput. in general the survey package matches all other languages http://journal.r-project.org/archive/2009-2/RJournal_2009-2_Damico.pdf here's an example of a minimal reproducible example that does match http://www.ats.ucla.edu/stat

Re: [R] tapply error svyby function "survey" package

2014-11-12 Thread Anthony Damico
try resetting your levels? if that doesn't work, please dput() an example data set that we can test with :) thanks! sii.design <- update( sii.design , d6 = factor( d6 ) ) On Wed, Nov 12, 2014 at 7:59 AM, Martin Canon wrote: > Hi. > > > I'm trying to calculate the weighted mean score of a

Re: [R] tapply error svyby function "survey" package

2014-11-12 Thread Anthony Damico
L, 1L, 2L, NA, 1L, 1L, 6L, 1L, > 6L, 6L), .Label = c("Soltero", "Casado", "Separado", "Divorciado", > "Viudo", "Union libre"), class = "factor"), ovt = c(NA, 93.3823547363281, > NA, NA, NA, NA, 83.8235321044922, NA, NA, NA

Re: [R] SVYPLOT

2014-11-20 Thread Anthony Damico
survey:::svyplot.default with style="grayhex" calls hexbin:::gplot.hexbin an internet search turns up lots of people asking the question "how do i set xlim and ylim on hexbin plots?" but i don't see any easy solutions. :/ On Thu, Nov 20, 2014 at 10:31 AM, Raphael Fraser wrote: > Does not w

[R] r function idea: minimize() to turn reproducible_example.R into minimal_reproducible_example.R

2015-09-10 Thread Anthony Damico
just going to throw this idea out there in case it's something that anyone wants to pursue: if i have an R script and i'm hitting some unexpected behavior, there should be some way to remove extraneous objects and manipulations that never touch the line that i'm trying to reproduce. automatically s

Re: [R] help with svychisq

2015-09-10 Thread Anthony Damico
could you try this, and then not use factor(age) elsewhere? sv1 <- update( sv1 , age = factor( age ) ) if that doesn't work, is it possible for you to share a reproducible example? thanks On Thu, Sep 10, 2015 at 4:51 PM, Emanuele Mazzola wrote: > Hello, > > I’m having a weird issue with the f

[R] 32 bit windows version of r 3.2.2 crashes a lot at first internet connection attempts

2015-11-06 Thread Anthony Damico
hi, just throwing this out there. it's not clear to me how to reproduce the crashes, because they are sporadic (but common) guessing it's related to the switched default of setInternet2(TRUE) but not sure here's a semi-absurd screenshot http://s17.postimg.org/70omgtmi7/early_crashes.png i had

[R] .Internal(La_rs(x, FALSE)) crashes R after long (reproducible) script on windows only

2016-02-23 Thread Anthony Damico
hi, does anybody have a clue why .Internal(La_rs(x,FALSE)) is getting corrupted (actual detonation occurs within La_solve_cmplx within Lapack.c) on windows but not mac/unix? i have provided two (long) scripts that reproduce the problem and a third script modified to trigger the crash that unfortun

Re: [R] .Internal(La_rs(x, FALSE)) crashes R after long (reproducible) script on windows only

2016-02-23 Thread Anthony Damico
e On Tue, Feb 23, 2016 at 8:22 AM, Duncan Murdoch wrote: > On 23/02/2016 7:49 AM, Anthony Damico wrote: > >> hi, does anybody have a clue why .Internal(La_rs(x,FALSE)) is getting >> corrupted (actual detonation occurs within La_solve_cmplx within Lapack.c) >> on windows b

Re: [R] Loading large .pxt and .asc datasets causes issues.

2016-02-23 Thread Anthony Damico
hi eiko, LaF is incompatible with survey data, that road is a dead-end. this code below will painlessly load brfss into R, review the link douglas sent for analysis examples and change `years.to.download <- ` to 2006 only if you just want a single year of microdata. glhf # install.packages( c("M

[R] is this an R bug or a DBI bug?

2016-02-27 Thread Anthony Damico
this happens with both SQLite and MonetDBLite, so i assume it is not an RSQLite bug. notice the gc() in the no-crash version.. thanks # initiate R with "C:\Program Files\R\R-3.2.3\bin\x64\Rterm.exe" --max-mem-size=35M library(RSQLite) db <- dbConnect( SQLite() ) for( i in 1:1000

Re: [R] is this an R bug or a DBI bug?

2016-02-28 Thread Anthony Damico
tested this out on 3.2.0, 3.2.1, and 3.2.2 -- only happens on 3.2.3, so i assume it was an R bug not a DBI bug. submitted here: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16734 On Sat, Feb 27, 2016 at 6:20 PM, Anthony Damico wrote: > this happens with both SQLite and MonetDBL

Re: [R] Using final sample weight in survey package

2016-04-04 Thread Anthony Damico
hi, probably not.. if your survey dataset has a complex design (like clusters/strata), you need to include them in the `svydesign` call. coercing an incorrect survey design into a replicate-weighted design will not fix the problem of failing to account for the sampling strategy On Mon, Apr 4, 201

Re: [R] Quantiles on multiply imputed survey data - mitools

2016-05-10 Thread Anthony Damico
is the `with` not passing make.formula( get( 'var_name' ) ) through to svyquantile for some reason? does this work? MIcombine( with(des, svyquantile(~LBXTCD, .5))) if that's not it, could you make a minimal reproducible example that includes the data download? code to download and import nhane

Re: [R] Quantiles on multiply imputed survey data - mitools

2016-05-11 Thread Anthony Damico
ta=imputationList(Imputed_list), nest=TRUE) > M_mean <- with(des_mult, svymean(make.formula(get('var_name' > summary(M_mean) > M_quantile <- with(des_mult, svyquantile(make.formula(get('var_name')), > quantiles = c(.5))) > summary(M_quantile) > > > Than

Re: [R] Significance of Svyrepdesign Object Warning

2016-10-23 Thread Anthony Damico
hi, great example. i am ccing survey package author/maintainer dr. lumley. why do you have `na.action=na.exclude`? if you remove it, things work as expected-- library(RCurl) library(survey) data <- getURL(" https://raw.githubusercontent.com/cbenjamin1821/careertech-ed/master/elsq1a

Re: [R] Resetting Baseline Level of Predictor in svyglm Function

2016-11-01 Thread Anthony Damico
hi, i think you want elsq1ch_brr <- update( elsq1ch_brr , F1HIMATH = relevel(F1HIMATH,"PreAlg or Less") ) On Mon, Oct 31, 2016 at 9:05 PM, Courtney Benjamin wrote: > Hello R Users: > > I am using the survey package in R for modeling with complex survey data. > I am trying to reset the basel

Re: [R] Archer-Lemeshow Goodness of Fit Test for Survey Data with Log. Regression

2016-11-17 Thread Anthony Damico
great minimal reproducible example, thanks. does something like this work? #Log. Reg. model-all curric. concentrations including F1RTRCC as a predictor allCC <- svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1

Re: [R] Archer-Lemeshow Goodness of Fit Test for Survey Data with Log. Regression

2016-11-18 Thread Anthony Damico
> > Located at Gault Toyota > > Doctoral Candidate-Educational Theory & Practice > > State University of New York at Binghamton > > cbenj...@btboces.org > > 607-763-8633 > -- > *From:* Anthony Damico > *Sent:* Thursday, No

Re: [R] Can you get the DEFT from svyratio?

2016-12-07 Thread Anthony Damico
hi, your code isn't runnable at fpc= ~M + Nbar) On Wed, Dec 7, 2016 at 5:03 PM, Chris Webb wrote: > To Dr. Lumley or anyone who may know the answer, > > I am trying to obtain ratio estimates from Levy and Lemeshow's Sampling of > Populations 4th ed. page 281. The results in the book

Re: [R] Problem in calculation of subpopulation mean in Survey package (Specify survey design with replicate weights)

2016-12-24 Thread Anthony Damico
hi, please revise your minimal reproducible example. the objects `W` and `bootstrap.results` do not exist. thanks On Fri, Dec 23, 2016 at 4:56 PM, Kristi Glover wrote: > Hi R users, > > I got a problem when I was trying to calculate the population mean for > different groups (classes) in using

Re: [R] how to extract weighted data in "survey" package

2017-01-01 Thread Anthony Damico
# load the survey library library(survey) # load the apistrat data.frame data(api) # look at the first six records head(apistrat) # look at the weight column only apistrat$pw On Sun, Jan 1, 2017 at 9:49 AM, Kristi Glover wrote: > Hi R Users, > > Happy New Year > > > I wanted to see the da

Re: [R] how to extract weighted data in "survey" package

2017-01-01 Thread Anthony Damico
ey) > > > # load the apistrat data.frame > > data(api) > > > # look at the first six records > > head(apistrat) > > > # look at the weight column only > > apistrat$pw > > # calcualet mean using raw data and afetr adjusted > > > svymea

[R] if i paste this into my windows 3.3.2 R console, it crashes

2017-01-07 Thread Anthony Damico
hi, should i file this on https://bugs.r-project.org/ ? thanks # crash R with this command dir.create( "C:/My Directory/PEW/Hispanic Trends/2015/2013 Recontact Survey of Asian Ame ricans Field dates: 10/16/13 - 10/31/13 Respondents: Nationally-rep resentative sample of 802 Asian A

Re: [R] if i paste this into my windows 3.3.2 R console, it crashes

2017-01-07 Thread Anthony Damico
and while I am too lazy to count the characters, you may > have exceeded the 259 character limit as well. Are there really > embedded EOLs as well? This is truly a masterpiece of computer > disobedience. > > Jim > > > On Sat, Jan 7, 2017 at 8:31 PM, Anthony Damico wrote: &g

Re: [R] if i paste this into my windows 3.3.2 R console, it crashes

2017-01-07 Thread Anthony Damico
e of associated email address). > > Duncan Murdoch > > > >> Jim >> >> >> On Sat, Jan 7, 2017 at 8:31 PM, Anthony Damico >> wrote: >> >>> hi, should i file this on https://bugs.r-project.org/ ? thanks >>> >>> >>> &g

Re: [R] Does "coeftest" correctly use weights from "svydesign" in "svyglm" object?

2017-02-08 Thread Anthony Damico
hi, that setup is not correct. see examples in https://github.com/ajdamico/asdfree/tree/master/European%20Social%20Survey On Feb 8, 2017 11:54 PM, "André Grow" wrote: > Dear all, > > > > I am using data from the European Social Survey (ESS) and I would like to > calculate country-level cluster

[R] > quit('no')\nError: cannot allocate vector of size 512 Kb

2017-03-04 Thread Anthony Damico
this one is cute [damico@rocks010 ~]$ ulimit -v 15 [damico@rocks010 ~]$ R R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-redhat-linux-gnu (64-bit) R is free software and comes with

[R] first readline() instance getting skipped on windows with R 3.3.3

2017-03-10 Thread Anthony Damico
hi, i'm curious if anyone else has noticed a change in behavior of readline()? i have a function in an R package that calls readline() here: https://github.com/ajdamico/lodown/blob/master/R/mics.R#L126 after upgrading to 3.3.3, the function appeared to start ignoring that readline() call. my fu

[R] Re-assigning variables stored as character strings in another variable

2010-02-22 Thread Anthony Damico
Is there any way to get the last line of this code to double the contents of a and b without naming them directly? #create variables a and b a<-5 b<-10 #store variable names a and b in variables c and d c<-"a" d<-"b" e<-c(c,d) #loop through both variables for (i in e){ #print the numbers five

[R] Memory Problems with CSV and Survey Objects

2009-10-23 Thread Anthony Damico
n able to get a database connection working after creating a svydesign object and not a svrepdesign object - and also because neither the DB SO website nor the svrepdesign help page make any mention of those parameters. The DB SOs are described in detail here: http://faculty.washington.edu/tluml

[R] Problem Removing Border Lines in Maps Package

2009-10-24 Thread Anthony Damico
I'm working with the nationwide county maps data, and trying to remove the internal county boundary lines. The only map() function parameter that I've found that gets me anywhere close to my desired result leaves small white segments on parts of the map. I believe this is due to the low resolutio

Re: [R] issue running svyglm after subsetting: NA/NaN/Inf in foreign function call (arg 1)

2022-09-30 Thread Anthony Damico
hi, that error happens before svyglm because the second parameter isn't a logical test? run `subset(rclus1, as.factor(stype=="E"))` and you'll see the same error.. if you remove the "as.factor" `subset(rclus1, (stype=="E"))` then the svyglm simply fails to converge but i think that's just too ma

Re: [R] Is there any design based two proportions z test?

2024-01-17 Thread Anthony Damico
hi, this guide to analyzing changes in prevalence rates over time with complex survey data might also help? thanks http://asdfree.com/trend-analysis-of-complex-survey-data.html On Wed, Jan 17, 2024, 9:15 AM John Fox wrote: > Dear Md Kamruzzaman, > > To answer your second question first, you

Re: [R] Creating a map in R using ACS PUMS data

2013-09-12 Thread Anthony Damico
the smallest boundary in the 1-year acs files is public use microdata area (puma), but the 3- and 5-year public use microdata samples (pums) go down to some counties, i believe.. http://www.census.gov/acs/www/guidance_for_data_users/estimates/ i think you just need to download the census bureau

Re: [R] accumulate() function in R?

2013-09-14 Thread Anthony Damico
maybe ?cumsum z <- 1:10 cumsum( z ) z <- sort( z ) cumsum( z )[ cumsum( z ) < 30 ] On Sat, Sep 14, 2013 at 10:36 PM, wrote: > I came from Python, newly learning R. is there something like accumulate() > in R? > > Example: > accumulate([1,2,3,4,5]) --> 1 3 6 10 15 > > Or perhaps I should sh

Re: [R] how to get a value from a list (using paste function)?

2012-12-18 Thread Anthony Damico
# use the mtcars data frame as your starting list. save it to x x <- as.list( mtcars ) # just print one column, by hand. x$wt # ..dynamically choose the column you want colname <- 'wt' # this breaks get( paste( 'x$' , colname , sep = "" ) ) # this works, but doesn't do what you want, since it'

Re: [R] Order variables automatically

2013-01-01 Thread Anthony Damico
# create an example data frame yourdata <- data.frame( cat1 = c( 1 , 0 , 1 ) , cont1 = c( 0 , 1 , 0 ) , cat2 = c( 0 , 0 , 1 ) ) # if this doesn't work for you, # please ?dput some example data in the future :) # figure out which variables contain the word 'cat' vars

Re: [R] Sas by function in R

2013-01-03 Thread Anthony Damico
https://www.google.com/search?q=multiple+histograms+R turns up a lot of possible answers.. what's your desired output and how does what you're trying to do differ from what's already been described on the web? :) On Thu, Jan 3, 2013 at 2:50 AM, catalin roibu wrote: > Hello, > It's an alternat

Re: [R] Version Controlled CRAN Packages

2013-01-03 Thread Anthony Damico
are you looking for the 'old sources' link shown on every package homepage on CRAN? http://cran.r-project.org/web/packages/ggplot2/ > 'old sources' > http://cran.r-project.org/src/contrib/Archive/ggplot2/ On Thu, Jan 3, 2013 at 9:33 AM, Mario Bourgoin wrote: > Dear Sir or Madam, > > The grou

Re: [R] Inserting percentile values in a data frame

2013-01-03 Thread Anthony Damico
it doesn't work because you're trying to save something of the wrong length into your data frame I used agr1$quantile <- quantile(agr1$cnt, probs=c(.50, .75, .90, .95, .99)) > # these two numbers should be the same nrow( agr1 ) length( agr1$quantile ) # these two numbers should be the same lengt

Re: [R] SRS, Stratified, and Cluster sampling

2013-01-10 Thread Anthony Damico
there isn't much, but Dr. Lumley's book is probably your best bet.. up till now, i think most people have learned survey methodology in the abstract and then applied that theory to their language of choice :) http://www.amazon.com/Complex-Surveys-Analysis-Survey-Methodology/dp/0470284307 On Wed

Re: [R] SQLDF column errors

2013-01-15 Thread Anthony Damico
i think this is what you want.. :) http://stackoverflow.com/questions/4765936/using-joined-tables-to-exclude-certain-records library(sqldf) # use the mtcars example table mtcars # keep the first eight records in a second, separate data set x <- mtcars[ 1:8 , ] # keep all the records from mtca

Re: [R] importing a SAS syntax-files (value labels)

2013-01-17 Thread Anthony Damico
it is easy to parse through yourself. if you don't care about the labels and just want to import fixed-width file data, you can use the SAScii package. if you do, run this code to get 'em :) # load the stringr package to trim strings quickly library(stringr) # example proc format block-- # s

Re: [R] top 10 (n values) for each classes

2013-02-10 Thread Anthony Damico
hi catalin, i thought this was a great question and could not find a good answer on stackoverflow.com, so i have started this thread which asks the question formally. i have also provided one answer that should be sufficient for you, but others may weigh in as well http://stackoverflow.com/questi

Re: [R] remove rows in data frame by average

2013-02-21 Thread Anthony Damico
another option that i think is easy & intuitive :) library(sqldf) mydata <- sqldf( "select Subject , Block , avg( Feature1 ) as Feature1 , avg( Feature2 ) as Feature2 , [..keep going..] , avg( Feature10 ) as Feature10 from yourdata group by Subject , Block" ) On Thu, Feb 21, 2013 at 4:45 PM,

Re: [R] frequency table-visualization for complex categorical variables

2013-02-25 Thread Anthony Damico
in the future, please provide R code to re-create some example data :) read http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-examplefor more detail.. # create a data table with three unique columns' values.. # treat these values just like letters x <- cbind(

Re: [R] replace zeros for NA in a column based on values of another column

2013-03-02 Thread Anthony Damico
you want to replace all rows where the 4th column is zero.. (data[ , 4 ] == 0) and you want to perform that replacement in the first column.. so try data[ data[ , 4 ] == 0 , 1 ] <- NA On Sat, Mar 2, 2013 at 5:26 AM, Camilo Mora wrote: > Hi everyone, > > Imagine that I have a data frame with

Re: [R] About basic logical operators

2013-03-05 Thread Anthony Damico
not sure if you meant to use both 0.2 and 0.02, but i believe your unexpected results are a floating point issue.. start here http://r.789695.n4.nabble.com/That-dreaded-floating-point-trap-td3418142.html and here http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-ar

Re: [R] New Stack

2013-03-11 Thread Anthony Damico
you can create an empty data frame with yourdata <- data.frame() and then add new records to it with another data table called `newdata` like this.. yourdata <- rbind( yourdata , newdata ) On Mon, Mar 11, 2013 at 9:13 AM, Anup khanal wrote: > > Hi Experts, I am newbie in R. Could you pleas

Re: [R] How to delete Identical columns

2013-03-28 Thread Anthony Damico
this might screw up the column classes of some of your columns, but it could be enough for what you're doing :) # start with a data frame with duplicate columns v <- data.frame(id = c(1:6), x = c(15, 21, 14, 21, 14, 38), y = c(36, 38, 55, 11, 5, 18), x.1 = c(15, 21, 14, 21, 14, 38), z = c("D", "B

Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-02 Thread Anthony Damico
try adding colTypes = 'numeric' to your readWorkSheetFromFile() call if that doesn't work, try a few other steps # view what data types your file is being read in as sapply( temp , class ) # convert all fields to character if they're factor variables.. but i don't think you need this, readWo

Re: [R] Problems with reading data by readWorksheetFromFile of XLConnect Package

2013-05-03 Thread Anthony Damico
40919 5505 20 10211 1007 32988 30554 > - 81 27897 20411985 54 4494 > NA 81 27897 20411985 54 4494 > 1953 12779 9184686415 > 1953 12779 9184686415 > > temp[ is.na( temp ) ] <- 0 > > temp > 6478

Re: [R] Official way to set/retrieve options in packages?

2013-06-01 Thread Anthony Damico
hope this helps.. :) # define an object `x` x <- list( "any value here" , 10 ) # set `myoption` to that object options( "myoption" = x ) # retrieve it later (perhaps within a function elsewhere in the package) ( y <- getOption( myoption ) ) it's nice to name your optio

Re: [R] Problem i9ncreasing memory to jvm for XLConnect

2013-06-11 Thread Anthony Damico
the > rm(list = ls()) at the top of your snippet makes me wonder if you had loaded any packages (like XLConnect) that use Java in a previous part of the session? i believe you must designate the ram allocation for java prior to loading any java-related packages, and clearing out your objects wil

  1   2   >