[R] Remove all factor levels from an R dataframe

2020-11-09 Thread John
Hi, I would like to sort the following simple dataframe by "year" (characters), but the factor structure prevents me from doing so. How can I remove the factor structure? Thanks! > df1 year country 4 2007 Asia; survey 5 2010 8 countries in E/SE Asia 6 2015

Re: [R] paste() turns list element character vector into deparsed expression. Why?

2020-11-09 Thread Ege Rubak
I agree that it is weird, but I don't see that it is easy to coerce a list to character of the same structure. In my example (missing the trailing parenthesis, sorry...) the input is a length two list and the output is a length two character vector, so in the general case the rationale seems to be

Re: [R] analyzing results from Tuesday's US elections

2020-11-09 Thread Bert Gunter
For those who are interested: Very nice examples of (static) statistical graphics on election results can be found here: https://www.nytimes.com/interactive/2020/11/09/us/arizona-election-battleground-state-counties.html?action=click&module=Spotlight&pgtype=Homepage Takes multidisciplinary teams

Re: [R] analyzing results from Tuesday's US elections

2020-11-09 Thread Abby Spurdle
RESENT INITIAL EMAIL, TOO BIG ATTACHMENTS REPLACED WITH LINKS I created a dataset, linked. Had to manually copy and paste from the NY Times website. > head (data, 3) STATE EQCOUNTY RMARGIN_2016 RMARGIN_2020 NVOTERS_2020 SUB_STATEVAL_2016 1 Alabama Mobile 13.3 12

Re: [R] [effects] Wrong xlevels in effects plot for mixed effects model when multiline = TRUE

2020-11-09 Thread Gerrit Eichner
Dear John, thank you for prompt reply and your hints. The problem is that our lmer model is much more complicated and has several interaction terms: Mass ~ Sex + I(YoE - 1996) + I(PAI/0.1 - 16) + I(gProt/10 - 6.2) + I(Age/10 - 7.2) + I((Age/10 - 7.2)^2) + Diuretics + Sex:I(PAI/0.1 - 16)

Re: [R] [effects] Wrong xlevels in effects plot for mixed effects model when multiline = TRUE

2020-11-09 Thread John Fox
Dear Gerrit, This looks like a bug in plot.eff(), which I haven't yet tracked down, but the following should give you what you want: eff <- Effect(c("gProt", "Age"), m, xlevels = list(gProt = 1:6 * 30, Age=60:100)) plot(eff, lines=list(multiline=TRUE)) or eff <- predictorEffect("Age", m, x

Re: [R] analyzing results from Tuesday's US elections

2020-11-09 Thread Marc Roos
Publish the results/graphs please, like to see what your are doing. -Original Message- From: Matthew McCormack [mailto:mccorm...@molbio.mgh.harvard.edu] Sent: Monday, November 09, 2020 6:14 PM To: r-help@r-project.org Subject: Re: [R] analyzing results from Tuesday's US elections

Re: [R] analyzing results from Tuesday's US elections

2020-11-09 Thread Matthew McCormack
Benford Analysis for Data Validation and Forensic Analytics Provides tools that make it easier to validate data using Benford's Law. https://www.rdocumentation.org/packages/benford.analysis/versions/0.1.5 Matthew On 11/9/20 9:23 AM, Alexandra Thorn wrote: > External Email - Use

Re: [R] analyzing results from Tuesday's US elections

2020-11-09 Thread Alexandra Thorn
This thread strikes me as pretty far off-topic for a forum dedicated to software support on R. https://www.r-project.org/mail.html#instructions "The ‘main’ R mailing list, for discussion about problems and solutions using R, announcements (not covered by ‘R-announce’ or ‘R-packages’, see above), a

[R] [R-pkgs] sbo: N-gram Stupid Back-Off models in R

2020-11-09 Thread Valerio Gherardi
Dear all, I would like to introduce sbo: Utilities for building and evaluating text prediction functions based on Stupid Back-off N-gram models. v0.3.0 is now on CRAN: https://cran.r-project.org/web/packages/sbo/index.html website: https://vgherard.github.io/sbo/ For bugs/issues: https://git

[R] [effects] Wrong xlevels in effects plot for mixed effects model when multiline = TRUE

2020-11-09 Thread Gerrit Eichner
Dear list members, I observe a strange/wrong graphical output when I set the xlevels in (e. g.) allEffects for an lmer model and plot the effects with multiline = TRUE. I have compiled a reprex for which you need the lmer model and the environment in which the model was fitted. They are contained

Re: [R] paste() turns list element character vector into deparsed expression. Why?

2020-11-09 Thread Boris Steipe
Thanks Ege - That narrows it down, ... but it's still weird. My issue is that I don't consider "c(\"xyz\", \"uvw\")" to be a valid character representation of a list. c() is a function, so "c(\"xyz\", \"uvw\")" is a string representation of a function call that could be eval(parse(...))'ed in

Re: [R] paste() turns list element character vector into deparsed expression. Why?

2020-11-09 Thread Ege Rubak
I think `paste()` just calls `as.character()` on each input argument and then collapses things afterwards. Calling `as.character()` on the first input argument generates exactly the output you show (and didn't expect) and there is nothing to collapse. So changing `collapse = ""` to anything else do

[R] paste() turns list element character vector into deparsed expression. Why?

2020-11-09 Thread Boris Steipe
I was just surprised by very un-intuitive behaviour of paste(), which appears to collapse a one-column data frame or one-element list into a deparsed expression, rather than producing the expected string. Can someone kindly explain what's going on here? reprex: === list(s = c("xyz", "uvw"