Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Important to notice: this seems to be an issue only with an unordered factor on the X axis. When the variable is numeric or an ordered factor, then it works as described in Help. On Thu, Jul 27, 2017 at 11:58 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: &g

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
nt from my phone. Please excuse my brevity. > > On July 27, 2017 8:18:03 AM PDT, Dimitri Liakhovitski < > dimitri.liakhovit...@gmail.com> wrote: > >Thank you, Bert! > > > >I do NOT have an object named "T" in scope (I checked - and besides, it > >wou

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
Newmiller <jdnew...@dcn.davis.ca.us> wrote: > I suspect this is by design. Questions about "why" should probably cc the > contributed package maintainer(s). > -- > Sent from my phone. Please excuse my brevity. > > On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
; and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: > > To clarify: my question is not about &

Re: [R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
To clarify: my question is not about "who could I exclude NAs from being counted" - I know how to do that. My question is: Why na.rm = T is not working for geom_bar in this case? On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: &

[R] na.rm = T treatment by ggplot2's geom_bar

2017-07-27 Thread Dimitri Liakhovitski
md, mapping = aes(x = a)) + geom_bar(na.rm = T) But I still have NAs in the picture. Why? What am I missing? Thank you! -- Dimitri Liakhovitski [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

Re: [R] Error with installed.packages with R 3.4.0 on Windows

2017-04-28 Thread Dimitri Liakhovitski
ssor, >> Center for Statistics, Copenhagen Business School >> Solbjerg Plads 3, 2000 Frederiksberg, Denmark >> Phone: (+45)38153501 >> Office: A 4.23 >> Email: pd@cbs.dk Priv: pda...@gmail.com >> >> [[alternative HTML version deleted]] >>

Re: [R] update.packages() error R 3.4.0

2017-04-28 Thread Dimitri Liakhovitski
AX > > __ > 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, minima

Re: [R] Why is merge sorting even when sort = F?

2017-03-08 Thread Dimitri Liakhovitski
arch 8, 2017 8:55:06 AM PST, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >>Thank you. I was just curious what sort=FALSE had no impact. >>Wondering what it is there for then... >> >>On Wed, Mar 8, 2017 at 11:43 AM, Jeff Newmiller >><jdn

Re: [R] Why is merge sorting even when sort = F?

2017-03-08 Thread Dimitri Liakhovitski
ore > some semblance of the original ordering afterward, or you can roll your own > possibly-less-efficient merge using match and indexing: > > info[ match( grades2$grade, info$grade ), ] > -- > Sent from my phone. Please excuse my brevity. > > On March 8, 2017 8:07:27 AM PS

[R] Why is merge sorting even when sort = F?

2017-03-08 Thread Dimitri Liakhovitski
o: This solution resorts everything in the order of column 'grade': merge(grades2, info, by = "grade", all.x = T, all.y = F) Could you please explain why this solution also resorts - despite sort = FALSE? merge(grades2, info, by = "grade", all.x = T, all.y =

Re: [R] weird behavior of DoubleMetaphone

2016-12-14 Thread Dimitri Liakhovitski
} return(paste(temp, collapse = "")) } The next 4 lines return the same thing: metaphone("netflix") metaphone("net flex") mymetaphone("netflix") mymetaphone("net flex") Dimitri On Wed, Dec 14, 2016 at 2:35 PM, Dimitri Liakhovitski &l

[R] weird behavior of DoubleMetaphone

2016-12-14 Thread Dimitri Liakhovitski
;NTFL" mymetaphone("net flex") # returns "NTFLKS" Why such a difference between DoubleMetaphone("net flex")$primary and mymetaphone("net flex")? Why isn't DoubleMetaphone("net flex")$primary returning "NTFLKS"? Thank you! -- Dimitri L

Re: [R] creating possible cominations of a vector's elements

2016-12-09 Thread Dimitri Liakhovitski
dx$Var2 <= idx$Var1, c("Var2", "Var1")] > mapply(function(x, y) paste(vec[x:y], collapse=" "), > x=idx[, 1], y=idx[, 2]) > } > > David C > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behal

Re: [R] creating possible cominations of a vector's elements

2016-12-08 Thread Dimitri Liakhovitski
"my""my vector" > [10] "vector" > > This makes a vector of strings but if you want a list use as.list(mapply()) > > David L. Carlson > Department of Anthropology > Texas A University > > > > -Original Message- > From: R-help

[R] creating possible cominations of a vector's elements

2016-12-08 Thread Dimitri Liakhovitski
Hello! I have a vector of strings 'x' that was based on a longer string 'mystring' (the actual length of x is unknown). mystring <- "this is my vector" x <- strsplit(mystr, " ")[[1]] I am looking for an elegant way of creating an object (e.g., a list) that contains the following strings:

Re: [R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
we know. > > As Bert noted in his reply, even the official R distribution comes with no > warranty, and that will be the case with most OSS. > > Regards, > > Marc > > >> On Dec 8, 2016, at 12:08 PM, Dimitri Liakhovitski >> <dimitri.liakhovit...@gmail.com>

Re: [R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
; Dimitri: > > > > > On Thu, Dec 8, 2016 at 10:05 AM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >> I just thought maybe there is something - about the process of >> submitting packages or anything like that - that shows that at least >> some dil

Re: [R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
2016, at 11:47 AM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: > > Guys, > > suddenly, I am being asked for a proof that R packages that are not > '"base" are safe. I've never been asked this question before. > > Is there some documentatio

Re: [R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
"base" are safe. I've never been asked this question before. >> >> Is there some documentation on CRAN that discusses how it's ensured >> that all "official" R packages have been "vetted" and are safe? >> >> Thanks a lot! >> >> -- >

[R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
Guys, suddenly, I am being asked for a proof that R packages that are not '"base" are safe. I've never been asked this question before. Is there some documentation on CRAN that discusses how it's ensured that all "official" R packages have been "vetted" and are saf

[R] double metaphone for non-English languages

2016-12-08 Thread Dimitri Liakhovitski
discovered that DoubleMetaphone can't process non-ASCII characters (like Umlauts in German, accents in French). What would you recommend I use instead? Use 'phonetic' from stringdist? Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To U

[R] stringi behaves differently in 2 similar situations

2016-11-30 Thread Dimitri Liakhovitski
t in the second case? Thanks a lot! -- Dimitri Liakhovitski __ 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 a

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
Thank you, Peter! On Wed, Nov 16, 2016 at 4:21 PM, peter dalgaard <pda...@gmail.com> wrote: > >> On 16 Nov 2016, at 21:58 , Dimitri Liakhovitski >> <dimitri.liakhovit...@gmail.com> wrote: >> >> Hello! >> >> I need to calculate the maximum o

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
15, c=c(111:114,NA)) > >> do.call(pmax, c(x, na.rm=TRUE)) > [1] 111 112 113 114 15 > > On Wed, Nov 16, 2016 at 3:58 PM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >> Hello! >> >> I need to calculate the maximum of each row of a data frame.

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
To clarify: I know I could do: apply(x, 1, max, na.rm = T) But I was wondering if one can modify the pmax one... On Wed, Nov 16, 2016 at 3:58 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Hello! > > I need to calculate the maximum of each row of a data fram

[R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
NAs in each row: x <- data.frame(a = c(1:5), b=11:15, c=c(111:114,NA)) x I'd like it to return: [1] 111 112 113 114 15 Thanks a lot! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.e

Re: [R] multiplying a matrix by a vector

2016-11-04 Thread Dimitri Liakhovitski
the shorter one) and > that the operation is performed column-wise: > > t(y * t(x)) > > Hope this helps, > > Rui Barradas > > > Em 03-11-2016 21:05, Dimitri Liakhovitski escreveu: >> >> Hello! >> >> I have a matrix x and a vector y: >> >> x <- matrix(

Re: [R] multiplying a matrix by a vector

2016-11-04 Thread Dimitri Liakhovitski
arah.gos...@gmail.com> wrote: >> Like this? >> >>> sweep(x, 2, y, "*") >> [,1] [,2] >> [1,]2 12 >> [2,]4 15 >> [3,]6 18 >>> >> >> >> On Thu, Nov 3, 2016 at 5:05 PM, Dimitri Liakhovitski >

[R] multiplying a matrix by a vector

2016-11-03 Thread Dimitri Liakhovitski
could repeat each element of y and multiply two matrices - that's better: rep.row<-function(x,n){ matrix(rep(x,each=n),nrow=n) } y <- rep.row(y, nrow(x)) x * y However, maybe there is a more elegant r-like way of doing it? Thank you! -- Di

Re: [R] removing all non-numeric characters from a string, but not "."

2016-07-26 Thread Dimitri Liakhovitski
Thank you very much, gentlemen! On Tue, Jul 26, 2016 at 5:48 PM, peter dalgaard <pda...@gmail.com> wrote: > >> On 26 Jul 2016, at 23:28 , Dimitri Liakhovitski >> <dimitri.liakhovit...@gmail.com> wrote: >> >> Hello! >> >> I have a string x: &g

[R] removing all non-numeric characters from a string, but not "."

2016-07-26 Thread Dimitri Liakhovitski
Hello! I have a string x: x <- c("x - 84", "y - 293.04", "z = 12.5") I want to remove all the non-numeric stuff from it. The following works: gsub("[^0-9]", "", x) However, it strips my numbers of "." Help - how could I do the same

Re: [R] Shift all values above certain value by 1

2016-01-22 Thread Dimitri Liakhovitski
me? Thanks! On Fri, Jan 22, 2016 at 11:34 AM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Hello! > > # I have a data frame x: > x <- data.frame(a = 1:10, b = 2:11, c = 3:12, other = rnorm(10)) > > # First, I need to change every value 7 in columns a:

[R] Shift all values above certain value by 1

2016-01-22 Thread Dimitri Liakhovitski
Hello! # I have a data frame x: x <- data.frame(a = 1:10, b = 2:11, c = 3:12, other = rnorm(10)) # First, I need to change every value 7 in columns a:c to 4 # Then, I need to decrease by 1 all values in columns a:c that are >7 What would be the fastest way of doing it? Thank you! -- D

Re: [R] (no subject)

2016-01-05 Thread Dimitri Liakhovitski
<- t(x[,grep("char", names(x))]) > newx <- x > newx$char <- row(y)[y==1] > > # merge and define winner > res <- merge(newx, info2) > res$winner <- with(res, ifelse(char==val, 1, 0)) > res > > > On Wed, Dec 23, 2015 at 3:35 PM, Dimitri Liakhovits

Re: [R] Expanding matrix into dummies

2015-12-23 Thread Dimitri Liakhovitski
people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Dec 22, 2015 at 3:03 PM, Marc Schwartz <marc_schwa...@me.com> wrote: >> >>> On Dec 22, 2015, at 4:42 PM

[R] (no subject)

2015-12-23 Thread Dimitri Liakhovitski
ber of games and the number of sets per game. # However, we can assume that the number of sets per game is always the same, # and the number of players per set is always the same. -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCR

Re: [R] Trying to avoid the loop while merging two data frames

2015-12-22 Thread Dimitri Liakhovitski
Actually, the correct merge line should be: my.merge <- merge(myinfo, mydata, by="version", all.x = T, all.y = F) On Tue, Dec 22, 2015 at 3:50 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > You are right, guys, merge is working. Somehow I was under the

Re: [R] Trying to avoid the loop while merging two data frames

2015-12-22 Thread Dimitri Liakhovitski
Taking it back - no need for all.x = T, all.y = F On Tue, Dec 22, 2015 at 3:56 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Actually, the correct merge line should be: > my.merge <- merge(myinfo, mydata, by="version", all.x = T, all.y = F) > >

Re: [R] Trying to avoid the loop while merging two data frames

2015-12-22 Thread Dimitri Liakhovitski
nfo, mydata, by="version") names(my.merge) result2 <- my.merge[,c("myid", "version", "a", "b", "c", "d")] names(result2) result2.order <- arrange(result2, myid, version, a, b, c, d) dim(result2.order) head(result2.order) #

Re: [R] Trying to avoid the loop while merging two data frames

2015-12-22 Thread Dimitri Liakhovitski
m that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > On Tue, Dec 22, 2015 at 12:27 PM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >> >> Hello! >> I have a solution for my task that is based on a loo

[R] Expanding matrix into dummies

2015-12-22 Thread Dimitri Liakhovitski
# I have a matrix x: k <- 20 N <- 5 set.seed(123) x <- matrix(c(sample(1:k, N, replace = F), sample(1:k, N, replace = F), sample(1:k, N, replace = F), sample(1:k, N, replace = F), sample(1:k, N, replace = F), sample(1:k, N,

[R] Trying to avoid the loop while merging two data frames

2015-12-22 Thread Dimitri Liakhovitski
ult[[i]]$myid <- id result[[i]] <- result[[i]][c(5, 1:4)] } result <- do.call(rbind, result) head(result) # This is the desired result -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://st

Re: [R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
nd mean() do not. > > aggregate() calls its FUN with each column of a data.frame as the argument. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Tue, Dec 8, 2015 at 3:08 PM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wrote: >> &g

[R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
ies"], FUN = var) by(data = iris[myvars], INDICES = iris["Species"], FUN = max) by(data = iris[myvars], INDICES = iris["Species"], FUN = min) by(data = iris[myvars], INDICES = iris["Species"], FUN = sd) by(data = iris[myvars], INDI

Re: [R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
ate(iris[,-5], by=iris[,"Species", drop=FALSE], FUN=mean) > > provide the answers I would expect. If you want clearer advice, you > need to provide an actually reproducible example, and tell us more > about what you expect to get. > > Sarah > > > On Tue, Dec 8, 20

Re: [R] "haven" - read_spss: How to avoid extracting value labels instead of long labels?

2015-11-13 Thread Dimitri Liakhovitski
note that the development version of rio > (https://github.com/leeper/rio) has an (non-exported) function for > cleaning up meta data from haven imports. See > https://github.com/leeper/rio/blob/master/R/utils.R#L86 > > Best, > Ista > > On Thu, Nov 12, 2015 at 8:37 PM, Dimi

Re: [R] "haven" - read_spss: How to avoid extracting value labels instead of long labels?

2015-11-12 Thread Dimitri Liakhovitski
suggestions? Thanks! On Thu, Nov 12, 2015 at 11:56 AM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Hello! > > I don't have an example file, but I think my question should be clear > without it. > I have an SPSS file. I read it in using 'haven': > > librar

Re: [R] "haven" - read_spss: How to avoid extracting value labels instead of long labels?

2015-11-12 Thread Dimitri Liakhovitski
2 And I actually need to be able to identify if label is empty. Thank you for looking into it! Dimitri On Thu, Nov 12, 2015 at 5:55 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Looks like a little bug in 'haven': > > When I actually look at the attribute

[R] extraction of parameters for intercept from "lavaan" object

2015-11-12 Thread Dimitri Liakhovitski
e also be an intercept present in this formula? I did not specify any intercepts anywhere in my model? If there should be an intercept, then where can I find it in the object sem1? Thanks a lot! -- Dimitri Liakhovitski __ R-help@r-project.org mailin

[R] "haven" - read_spss: How to avoid extracting value labels instead of long labels?

2015-11-12 Thread Dimitri Liakhovitski
AMILIAR" "NOT AT ALL FAMILIAR" Question: How could I avoid the extraction of the Value Labels for the columns that have no long labels? Thank you very much! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

[R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Dimitri Liakhovitski
could be the reason? I tried to totally delete the folders of those packages, install them from scratch (successfully), still - they keep appearing in Update Pacakges widnow. Any advice? Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailin

Re: [R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Dimitri Liakhovitski
v 5, 2015 at 2:00 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > I am using a windows laptop, R 3.2.2 > > I am using R-gui. > > When I go to Packages -> Update packages and then select a Cran mirror > (in the US) - it tells me to update the fol

Re: [R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Dimitri Liakhovitski
Thank you, Duncan. Indeed those packages were sitting in a temp directory. I had to install them manually from a 'zip file. On Thu, Nov 5, 2015 at 2:40 PM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 05/11/2015 1:00 PM, Dimitri Liakhovitski wrote: >> >> I am usin

[R] F-test of equality of variances - but weighted?

2015-10-07 Thread Dimitri Liakhovitski
n1-1 for group 1 and weighted n2-1 for group 2? Would it be kosher from statistical perspective? Thanks a lot! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] dplyr complete.cases(.) works one way but not another

2015-09-30 Thread Dimitri Liakhovitski
/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. -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNS

[R] na.action in xtabs - how to include NAs?

2015-09-30 Thread Dimitri Liakhovitski
n't figure out how to force xtabs to include NAs. # All my attempts below fail to include NAs: xtabs(~ a + b, x, na.action(na.pass)) xtabs(~ a + b, x, na.action = "na.pass") xtabs(~ a + b, x, na.action(na.pass(x))) xtabs(~ a + b, x, exclude = NULL) Thank y

[R] dplyr complete.cases(.) works one way but not another

2015-09-30 Thread Dimitri Liakhovitski
ses(.)) But this command doesn't work: filter(mydata, complete.cases(.)) Error: object '.' not found Why doesn't it work? Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mail

Re: [R] na.action in xtabs - how to include NAs?

2015-09-30 Thread Dimitri Liakhovitski
m model.frame's output for a call to table. > > xtabs(formula = ~a + b, data = x, na.action = na.pass, exclude = NULL) > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Wed, Sep 30, 2015 at 7:56 AM, Dimitri Liakhovitski > <dimitri.liakhovit...@gmail.com> wr

Re: [R] Hep with regex! - combination of ^, |, \\, _ and $

2015-09-18 Thread Dimitri Liakhovitski
web site: http://harvest.nps.edu > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Berend > Hasselman > Sent: Friday, September 18, 2015 1:30 AM > To: Dimitri Liakhovitski > Cc: r-help > Subject: Re: [R] Hep with regex! - combina

Re: [R] Hep with regex! - combination of ^, |, \\, _ and $

2015-09-17 Thread Dimitri Liakhovitski
For the last one, looks like this one works: x[grep("^(q10|q12).*\\_1$", x)] On Thu, Sep 17, 2015 at 5:46 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Duncan, > Of course my verbal descriptions and my code don't match my regexp - > otherwise I wouldn

[R] Hep with regex! - combination of ^, |, \\, _ and $

2015-09-17 Thread Dimitri Liakhovitski
[grep("1$", x)] # Which strings end with "_1"? - WORKS x[grep("\\_1$", x)] # Which strings start with "q10" AND contain a "1"? - WORKS x[grep("^q10.+1", x)] # Which strings start with "q10" AND end with a "_1"

Re: [R] Hep with regex! - combination of ^, |, \\, _ and $

2015-09-17 Thread Dimitri Liakhovitski
wrote: > On 17/09/2015 5:11 PM, Dimitri Liakhovitski wrote: >> (x <- c("q10_1", "q10_2", "q10_11", "q12_1", "q12_2", "q13_1", "q13_11")) >> >> # Which strings start with "q10" or "q12? - WO

[R] Converting a .wav file into an mp3 file in R

2015-09-08 Thread Dimitri Liakhovitski
Hello, I know how to read in mp3 files, e.g., using tuneR. But is it possible to read in a .wav file - as below and then compress it to mp3 format? library(tuneR) mywav <- readWave("myfile.wav") Thanks a lot for any hints! -- Dimitri

[R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
much! -- Dimitri Liakhovitski __ 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

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Mon, Jul 27, 2015 at 12:38 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I have 5 items in total (1:5), but I show a person only 4

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
With NAs it'd be: rk - c(2,NA,4,3,1, NA) outer(rk, rk, ) + 0 Wow, I still can't believe it - just one line! On Mon, Jul 27, 2015 at 5:31 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Wow! On Mon, Jul 27, 2015 at 5:28 PM, Bert Gunter bgunter.4...@gmail.com wrote: ## I leave

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Mon, Jul 27, 2015 at 2:32 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: With NAs it'd be: rk - c(2,NA,4,3,1, NA) outer(rk, rk, ) + 0 Wow, I still can't believe it - just one line! On Mon, Jul 27

[R] For Hadley Wickham: Need for a small fix in haven::read_spss

2015-07-20 Thread Dimitri Liakhovitski
) I see under those 2 variables NULL - which is true and valid. However, would it be possible to have instead of NULL an NA? This way the length of varnames and mylables would the same and one could put them side by side (e.g., in one data frame)? Thanks a lot! -- Dimitri Liakhovitski

Re: [R] For Hadley Wickham: Need for a small fix in haven::read_spss

2015-07-20 Thread Dimitri Liakhovitski
, but you get the idea) Hadley On Mon, Jul 20, 2015 at 8:56 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hadley, you've added function labelled to haven, which is great. However, when it so happens that in SPSS a variable has no long label, your code considers it to be NULL

[R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
Is there an R package that allows one to calculate skewness and curtosis - but weighted with individual level weights (one weight per observation)? Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
dwinsem...@comcast.net wrote: On Jul 16, 2015, at 8:10 AM, Dimitri Liakhovitski wrote: Is there an R package that allows one to calculate skewness and curtosis - but weighted with individual level weights (one weight per observation)? Integer weights? -- David Winsemius Alameda, CA, USA

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
:37 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Unfortunately not - more like 0.7654, 1.2345. I understand that I could multiply each number by 100, round it to no decimal point and then unroll my data in proportion. I was just hoping someone has done it in C and put

[R] dplyr, summarize_each, mean - dealing with NAs

2015-06-25 Thread Dimitri Liakhovitski
) %% summarise_each(funs(mean), na.rm = TRUE) md %% group_by(device1, device2) %% summarise_each(funs(mean, na.rm = TRUE)) Thank you for your advice! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

Re: [R] dplyr, summarize_each, mean - dealing with NAs

2015-06-25 Thread Dimitri Liakhovitski
Just want to clarify - I know how to do it using base R. I just want to figure out how to do it in dplyr. This i what I want to achieve: myvars - c(x,y,z) aggregate(md[myvars], by = md[c(device1,device2)], mean, na.rm = T) Thank you! On Thu, Jun 25, 2015 at 4:25 PM, Dimitri Liakhovitski

Re: [R] dplyr, summarize_each, mean - dealing with NAs

2015-06-25 Thread Dimitri Liakhovitski
I found the answer: md %% group_by(device1, device2) %% summarise_each(funs(mean(., na.rm = TRUE))) On Thu, Jun 25, 2015 at 4:35 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Just want to clarify - I know how to do it using base R. I just want to figure out how to do

[R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Dimitri Liakhovitski
- dozens of times. Does dplyr allow to run the count of 5s on all 'myvars' columns at once? -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Dimitri Liakhovitski
98503-1274 On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote: Hello! I have a data frame: md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c = c(1,3,4,3,5,5), device = c(1,1,2,2,3,3)) myvars = c(a, b, c) md[2,3] - NA md[4,1] - NA md I want to count number of 5s in each

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Dimitri Liakhovitski
is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Tue, Jun 16, 2015 at 10:24 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have a data frame: md - data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c = c(1,3,4,3,5,5

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Dimitri Liakhovitski
) sum(x==5,na.rm=TRUE),1L) But the result should be by device. On Tue, Jun 16, 2015 at 1:56 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thank you, Bert. I'll be honest - I am just learning dplyr and was wondering if one could do it in dplyr. But of course your solution

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Dimitri Liakhovitski
Thank you guys - it's a great learning: 'summarise_each' and 'funs' On Tue, Jun 16, 2015 at 3:47 PM, Hadley Wickham h.wick...@gmail.com wrote: On Tue, Jun 16, 2015 at 12:24 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I have a data frame: md - data.frame(a = c

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread Dimitri Liakhovitski
: (360) 407-6815 PO Box 47600FAX:(360) 407-7534 Olympia, WA 98504-7600 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels:300 Desmond Drive, Lacey, WA 98503-1274 On Tue, 16 Jun 2015, Dimitri Liakhovitski wrote: Except

Re: [R] reshape data frame when one column has unequal number of entries

2015-04-23 Thread Dimitri Liakhovitski
Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Liakhovitski Sent: Thursday, 23 April 2015 23:15 To: r-help

[R] reshape data frame when one column has unequal number of entries

2015-04-23 Thread Dimitri Liakhovitski
Is it possible without looping? Thank you! -- Dimitri Liakhovitski __ 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

Re: [R] regexpr - ignore all special characters and punctuation in a string

2015-04-20 Thread Dimitri Liakhovitski
I think I found a partial answer: str_replace_all(x, [[:punct:]], ) On Mon, Apr 20, 2015 at 9:59 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! Please point me in the right direction. I need to match 2 strings, but focusing ONLY on characters, ignoring all special

[R] regexpr - ignore all special characters and punctuation in a string

2015-04-20 Thread Dimitri Liakhovitski
. == What a nice day today: Story of happiness (Part 2) -- Thank you! Dimitri Liakhovitski __ 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

Re: [R] regexpr - ignore all special characters and punctuation in a string

2015-04-20 Thread Dimitri Liakhovitski
of the extra space in a after the '-', so also replace spaces... Best, Sven. On 20 April 2015 at 16:05, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I think I found a partial answer: str_replace_all(x, [[:punct:]], ) On Mon, Apr 20, 2015 at 9:59 AM, Dimitri Liakhovitski

[R] Reading .LIST files into R

2015-04-14 Thread Dimitri Liakhovitski
Is it possible to read a LIST file into R? Any package? I've done some googling, but there are just too many hits for a regular 'list'. Appreciate any pointers! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more

Re: [R] Reading .LIST files into R

2015-04-14 Thread Dimitri Liakhovitski
IMDB. I guess I'll just have to open it as any text file. On Tue, Apr 14, 2015 at 4:48 PM, Sarah Goslee sarah.gos...@gmail.com wrote: What produced this file? On Tue, Apr 14, 2015 at 4:40 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Is it possible to read a LIST file into R

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
, 2015 at 12:03 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: I have a data frame 'mydata.final' (see below) that contains US counties and a continuous numeric variable 'Mean.Wait' that ranges from zero to 10 or so. I also created variable 'wait' that is based

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
('county', fill=TRUE, col=newcol, resolution=0, lty=0, bg=transparent) map('state', lwd=1, add=TRUE) One understanding question: what exactly does this rgb line do and why do we have to say maxColorValue=255? Thank you! On Thu, Apr 2, 2015 at 5:02 PM, Dimitri Liakhovitski dimitri.liakhovit

Re: [R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
,red),na.color=white) Jim On Fri, Apr 3, 2015 at 8:08 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Jean, I think I fixed it: newpal - colorRamp(c(yellow, red)) missing - is.na(mydata.final$Mean.Wait) newcol - ifelse(missing, white, rgb(newpal(mydata.final$Mean.Wait

[R] Color US counties on US map using a numeric variable for color intensity

2015-04-02 Thread Dimitri Liakhovitski
is: instead of splitting 'Mean.Wait' into 5 ordered categories ('wait'), I'd like to color the counties on the map based on the intensity of my (continuous) 'Mean.Wait'. What would be the way to do it and maybe even to add a legend? Thanks a lot! -- Dimitri Liakhovitski

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
all the values in this row with NAs? On Fri, Feb 27, 2015 at 9:13 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 27/02/2015 9:04 AM, Dimitri Liakhovitski wrote: I know how to get the output I need, but I would benefit from an explanation why R behaves the way it does. # I have a data

[R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
,] # Leaves rows with c=NA, but makes the whole row an NA. Why??? x[(x$c6) | is.na(x$c),] # output I need - I have to be super-explicit Thank you very much! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
Thank you very much, Duncan. All this being said: What would you say is the most elegant and most safe way to solve such a seemingly simple task? Thank you! On Fri, Feb 27, 2015 at 10:02 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 27/02/2015 9:49 AM, Dimitri Liakhovitski wrote: So

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Dimitri Liakhovitski
,NA,5,NA,7,NA,NA,10)) x[is.true(x$c = 6), ] a b c 7 7 8 7 10 10 11 10 Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Feb 27, 2015 at 7:27 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thank you very much, Duncan. All this being said: What

[R] get_map in ggplot doesn't allow the exact specification of my box's corners?

2015-02-26 Thread Dimitri Liakhovitski
/zoom specification. (experimental) Does it mean that there is no way for me to create a map with these exact corners? Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman

Re: [R] More elegant way of stacking the data

2014-11-25 Thread Dimitri Liakhovitski
c3 4 2 3.c3 3 c c3 5 3 4.c3 4 d c3 6 4 5.c3 5 e c3 7 5 1.c4 1 a c4 4 1 2.c4 2 b c4 5 2 3.c4 3 c c4 6 3 4.c4 4 d c4 7 4 5.c4 5 e c4 8 5 I hope this helps. Chel Hee Lee On 11/24/2014 5:12 PM, Dimitri Liakhovitski wrote: I have the data frame 'df

[R] More elegant way of stacking the data

2014-11-24 Thread Dimitri Liakhovitski
(a,b,c) } out-do.call(rbind,mylist) out Thank you! -- Dimitri Liakhovitski __ 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

  1   2   3   4   5   6   7   >