[R] Puzzled by the "call" component of object returned by xyplot() from lattice.

2020-03-27 Thread Rolf Turner
I have written a function that calls xyplot() from the lattice package. In this function (which is actually a method for plot(), I assign a value plotObj <- xyplot(fmla,groups=...) and then either either do print(plotObj) --- to display a plot as well as returning plotObj, to be kept f

Re: [R] About the multiprecision computing package in R

2020-03-27 Thread 林伟璐
Thanks! I installed Rmpfr now. But it does NOT support eigen function ? x <- array(1:16, dim=c(4,4)) ev <- eigen(x) mat <- mpfrArray(1:25, 64, dim = c(5,5)) ev <- eigen(mat) Error in `dimnames<-`(`*tmp*`, value = NULL) : non-list RHS ***

Re: [R] Tidyverse Question

2020-03-27 Thread William Michels via R-help
Dear Ista (and Phillip), Ista, that's the exact same advice I gave Phillip over a week ago: https://stat.ethz.ch/pipermail/r-help/2020-March/465994.html Phillip, it doesn't make sense to post the same question under different subject headings. While I'm convinced you're making a sincere effort t

Re: [R] dplyr filter function returns all the levels

2020-03-27 Thread Rui Barradas
Hello, Here are two ways. The first keeps word4 as factor, the second coerces to character first, like Jeff said. df %>% filter(word1 == 'for' & word2 == 'the' & word3 == 'first') %>% pull(word4) %>% droplevels() df %>% mutate_if(is.factor, as.character) %>% filter(word1 == 'for' &

Re: [R] dplyr filter function returns all the levels

2020-03-27 Thread Jeff Newmiller
Don't use factors in the first place? Use character data. On March 27, 2020 4:17:57 AM PDT, Elahe chalabi via R-help wrote: >Hello everyone, > >I have the following dataframe  > >         >    library(dplyr) >    dput(df) >    structure(list(Freq = c(19L, 19L, 18L, 15L, 14L, 13L, 13L, 12L,  >   

[R] dplyr filter function returns all the levels

2020-03-27 Thread Elahe chalabi via R-help
Hello everyone, I have the following dataframe               library(dplyr)     dput(df)     structure(list(Freq = c(19L, 19L, 18L, 15L, 14L, 13L, 13L, 12L,     11L, 11L, 11L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 9L), word1 = structure(c(3L,     11L, 5L, 6L, 11L, 3L, 7L, 10L, 8L, 11L, 13L, 1L, 1L,