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

2017-04-28 Thread 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, self-conta

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

2017-04-28 Thread Dimitri Liakhovitski
://www.R-project.org/ >>> >> posting-guide.html >> >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> -- >> Peter Dalgaard, Professor, >> Center for Statistics, Copenhagen Business School >> Solbje

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

2017-07-27 Thread Dimitri Liakhovitski
lot(data = 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

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: &

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

2017-07-27 Thread Dimitri Liakhovitski
it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski > wrote: > > To clarify: my question is not about "who could I exclude NAs from being > > counted" - I know how

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

2017-07-27 Thread Dimitri Liakhovitski
Jeff Newmiller 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 < > dimitri.liakhovit

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

2017-07-27 Thread Dimitri Liakhovitski
y 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 > >would never occur to me to use th

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: > Š¢hank

[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] 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 wrote: > >> On 26 Jul 2016, at 23:28 , Dimitri Liakhovitski >> wrote: >> >> Hello! >> >> I have a string x: >> x <- c("x - 84", "y - 293.04",

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

2015-04-20 Thread Dimitri Liakhovitski
ppiness: Part 2." == "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

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 wrote: > Hello! > > Please point me in the right direction. > I need to match 2 strings, but focusing ONLY on characters, ignor

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

2015-04-20 Thread Dimitri Liakhovitski
f happiness: Part 2." >> b = "What a nice day today: Story of happiness (Part 2)" >> sa = gsub("[^A-Za-z0-9]", "", a) >> sb = gsub("[^A-Za-z0-9]", "", b) >> a==b >> # [1] FALSE >> sa==sb >> # [1] TR

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

2015-04-23 Thread Dimitri Liakhovitski
= as.character(x$b) x str(x) I need to produce this data frame: 1 a 1 b 1 c 2 d 2 e 3 f 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

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

2015-04-23 Thread Dimitri Liakhovitski
"))) > > Duncan > > Duncan 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 Di

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

2015-06-16 Thread Dimitri Liakhovitski
) - so that I can't specify those counts.a, counts.b, etc. manually - 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 UNSUBSCR

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

2015-06-16 Thread Dimitri Liakhovitski
300 Desmond Drive, Lacey, WA 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 =

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

2015-06-16 Thread Dimitri Liakhovitski
t; > Cheers, > Bert > > Bert Gunter > > "Data is not information. Information is not knowledge. And knowledge is > certainly not wisdom." >-- Clifford Stoll > > On Tue, Jun 16, 2015 at 10:24 AM, Dimitri Liakhovitski > wrote: >> >> Hello! >>

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

2015-06-16 Thread Dimitri Liakhovitski
NA md[4,1] <- NA md vapply(md[myvars], function(x) 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 wrote: > Thank you, Bert. > I'll be honest - I am just learning dplyr and was wondering if one > could do it in dplyr. &

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

2015-06-16 Thread Dimitri Liakhovitski
.edu > Department of Ecology VOICE: (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 &g

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 wrote: > On Tue, Jun 16, 2015 at 12:24 PM, Dimitri Liakhovitski > wrote: >> Hello! >> >> I have a data frame: >> >> m

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

2015-06-25 Thread Dimitri Liakhovitski
o be ignored (na.rm = TRUE) - I tried, but the function doesn't want to accept this argument. Both these lines result in error: md %>% group_by(device1, device2) %>% summarise_each(funs(mean), na.rm = TRUE) md %>% group_by(device1, device2) %>% summarise_each(funs(mean, na.rm

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

2015-06-25 Thread Dimitri Liakhovitski
(dplyr) > md %>% group_by(device1, device2) %>% summarise_each(funs(mean)) > > However, I am getting some NAs. I want the NAs to be ignored (na.rm = > TRUE) - I tried, but the function doesn't want to accept this > argument. > Both these lines result in error: > >

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 wrote: > 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 wh

[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
: > > 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? > &

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
knowledge. And knowledge > is certainly not wisdom." >-- Clifford Stoll > > > On Thu, Jul 16, 2015 at 8:37 AM, Dimitri Liakhovitski > wrote: >> Unfortunately not - more like 0.7654, 1.2345. >> I understand that I could multiply each number by 100, round it t

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

2015-07-20 Thread Dimitri Liakhovitski
a labels. When I run lapply(spss1, attr, "label") 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

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

2015-07-20 Thread Dimitri Liakhovitski
s1, attr_default, "label", NA_character_) > > (code untested, but you get the idea) > > Hadley > > On Mon, Jul 20, 2015 at 8:56 AM, Dimitri Liakhovitski > wrote: >> Hadley, >> >> you've added function labelled to haven, which is great. However,

[R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
elegant way? Thank you very 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.htm

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

2015-07-27 Thread Dimitri Liakhovitski
[3,]0100 > [4,]1110 > > > > 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

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 wrote: > Wow! > > On Mon, Jul 27, 2015 at 5:28 PM, Bert Gunter wrote: >> ## I leav

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

2015-07-27 Thread Dimitri Liakhovitski
t;Data is not information. Information is not knowledge. And knowledge > is certainly not wisdom." > -- Clifford Stoll > > > On Mon, Jul 27, 2015 at 2:32 PM, Dimitri Liakhovitski > wrote: >> With NAs it'd be: >> >> rk <- c(2,NA,4,3,1, NA) >>

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

2015-02-26 Thread Dimitri Liakhovitski
unding box to center/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:/

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

2015-02-27 Thread Dimitri Liakhovitski
ith NAs? x[x$c<6,] # Leaves rows with c=NA, but makes the whole row an NA. Why??? x[(x$c<6) | 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 UN

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

2015-02-27 Thread Dimitri Liakhovitski
, but I'll replace all the values in this row with NAs? On Fri, Feb 27, 2015 at 9:13 AM, Duncan Murdoch 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 doe

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 wrote: > On 27/02/2015 9:49 AM, Dimitri Liakhovitski wrote: >> So, Dun

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

2015-02-27 Thread Dimitri Liakhovitski
frame(a=1:10,b=2:11,c=c(1,NA,3,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 > wrote: >&g

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

2015-04-02 Thread Dimitri Liakhovitski
in 'wait': map('county', fill = TRUE, col = allcolors[mydata.final$wait], resolution = 0, lty = 0, bg = "transparent") map('state', lwd=1, add=TRUE) My goal is: instead of splitting 'Mean.Wait' into 5 ordered categories

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

2015-04-02 Thread Dimitri Liakhovitski
ol, > resolution=0, lty=0, bg="transparent") > map('state', lwd=1, add=TRUE) > > Jean > > > On Thu, Apr 2, 2015 at 12:03 PM, Dimitri Liakhovitski > wrote: >> >> I have a data frame 'mydata.final' (see below) that contains U

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

2015-04-02 Thread Dimitri Liakhovitski
nal$Mean.Wait, na.rm=T)), maxColorValue=255)) map('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

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

2015-04-02 Thread Dimitri Liakhovitski
es=c("yellow","red"),na.color="white") > > Jim > > > On Fri, Apr 3, 2015 at 8:08 AM, Dimitri Liakhovitski > wrote: >> >> Jean, I think I fixed it: >> >> newpal <- colorRamp(c("yellow", "red")) >> missin

[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 UNSUB

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 wrote: > What produced this file? > > On Tue, Apr 14, 2015 at 4:40 PM, Dimitri Liakhovitski > wrote: >> Is it possible to read a LIST file into R? Any package? >&g

[R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
Dear Rers, I am trying to run a for-loop in R. During each iteration I read in an mp3 file and do some basic processing. If I do what I need to do for each file one by one - it works fine. But once I start running a loop, it soon runs out of memory and says: can't allocate a vector of size... In e

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
> Sent from my phone. Please excuse my brevity. > > On October 20, 2014 8:30:21 AM PDT, Dimitri Liakhovitski < > dimitri.liakhovit...@gmail.com> wrote: > >Dear Rers, > > > >I am trying to run a for-loop in R. > >During each

Re: [R] How to clear R memory in a for loop

2014-10-20 Thread Dimitri Liakhovitski
on this mailing >>>list, >>>> self-contained examples are needed. And in order to not corrupt the >>>example >>>> you will need to post in plain text. >>>> >>>--- &

Re: [R] How to clear R memory in a for loop

2014-10-21 Thread Dimitri Liakhovitski
I will try with .wav files and report back. So far, I am not sure I understood what could be done (if anything) to fix it... On Tue, Oct 21, 2014 at 2:26 AM, Prof Brian Ripley wrote: > On 20/10/2014 17:53, John McKown wrote: >> >> On Mon, Oct 20, 2014 at 10:30 AM, Dimit

Re: [R] How to clear R memory in a for loop

2014-10-22 Thread Dimitri Liakhovitski
NULL, >> NULL, NULL, NULL); > > > > Thanks, Bill! > I haven't found the time to look at it. > Now in the master sources, bugfix release will follow shortly, > Uwe > > > >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com &

[R] reducing the sampling rate of a .wav file

2014-10-22 Thread Dimitri Liakhovitski
name="silence0.5sec 8000.wav",f=800) But it doesn't work - it saves the file but when I read it in, Samplingrate is still 44100 -- Dimitri Liakhovitski __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PL

Re: [R] reducing the sampling rate of a .wav file

2014-10-22 Thread Dimitri Liakhovitski
Thank you so much, Uwe! seavewav is from another package :) On Wed, Oct 22, 2014 at 4:03 PM, Uwe Ligges wrote: > > > On 22.10.2014 21:57, Dimitri Liakhovitski wrote: >> >> I've read in a wav file using 'tuneR': >> >> silence<-readWave("sile

Re: [R] reducing the sampling rate of a .wav file

2014-10-22 Thread Dimitri Liakhovitski
Thank you so much, Uwe! seavewav is from another package :) On Wed, Oct 22, 2014 at 4:03 PM, Uwe Ligges wrote: > > > On 22.10.2014 21:57, Dimitri Liakhovitski wrote: >> >> I've read in a wav file using 'tuneR': >> >> silence<-readWave("sile

[R] ggplot question error: Error in s(x, bs = "cs") : object 'x' not found

2014-11-20 Thread Dimitri Liakhovitski
Dear R-ers, apologies for not providing the full code. I just need a point in the right direction. I have a data frame ('temp') with 1,200 rows and 2 variables. I am using ggplot2 to create a scatter plot: This is my code and it works fine, it creates a scatter plot: library(ggplot2) sp10<-ggplo

Re: [R] ggplot question error: Error in s(x, bs = "cs") : object 'x' not found

2014-11-20 Thread Dimitri Liakhovitski
Never mind, I found the problem. In my profile s was assigned to summary. This is why it did not work. On Thu, Nov 20, 2014 at 5:14 PM, Dimitri Liakhovitski wrote: > Dear R-ers, > > apologies for not providing the full code. I just need a point in the > right direction. > I ha

[R] More elegant way of stacking the data

2014-11-24 Thread Dimitri Liakhovitski
mylist[[i]]<-df[c("a","b",myname)] names(mylist[[i]])<-c("a","b","c") } out<-do.call(rbind,mylist) out Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list https://stat.ethz.c

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

2014-11-25 Thread Dimitri Liakhovitski
.c2 2 b c2 3 2 > 3.c2 3 c c2 4 3 > 4.c2 4 d c2 5 4 > 5.c2 5 e c2 6 5 > 1.c3 1 a c3 3 1 > 2.c3 2 b 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 >

[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] 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
/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? - WORKS >> x[grep

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 wrote: > Duncan, > Of course my verbal descriptions and my code don't match my regexp - > otherwise I wouldn't be asking the question

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

2015-09-18 Thread Dimitri Liakhovitski
ttp://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! - combination of ^,

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

2015-09-30 Thread Dimitri Liakhovitski
ter(complete.cases(.)) 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

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

2015-09-30 Thread Dimitri Liakhovitski
SE 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 UNSUBSCRIBE and more, see https://s

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

2015-09-30 Thread Dimitri Liakhovitski
x27;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) Th

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

2015-09-30 Thread Dimitri Liakhovitski
#x27;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 > wrote: >> Please help: >> >> #

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

2015-10-07 Thread Dimitri Liakhovitski
ar1/var2 With df's of weighted 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://s

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

2015-11-05 Thread Dimitri Liakhovitski
I didn't just update them. What 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 ___

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 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 following packages: > > GLMMGibbs > RDCO

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 wrote: > On 05/11/2015 1:00 PM, Dimitri Liakhovitski wrote: >> >> I am using a windows laptop, R 3.2.2 &g

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

2015-11-12 Thread Dimitri Liakhovitski
VERY/SOMEWHAT FAMILIAR" "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 --

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

2015-11-12 Thread Dimitri Liakhovitski
ny suggestions? Thanks! On Thu, Nov 12, 2015 at 11:56 AM, Dimitri Liakhovitski 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': > > library(haven) >

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

2015-11-12 Thread Dimitri Liakhovitski
057? Or should there 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

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

2015-11-12 Thread Dimitri Liakhovitski
1 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 wrote: > Looks like a little bug in 'haven': > > When I actually look at the att

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

2015-11-13 Thread Dimitri Liakhovitski
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, Dimitri Liakh

[R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
;Species"], 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],

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

2015-12-08 Thread Dimitri Liakhovitski
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, 2015 at 5:30 PM, Dimi

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

2015-12-08 Thread Dimitri Liakhovitski
t; 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 > wrote: >> >> Sorry, I omitted the first line: >> >> myvars <

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

2015-12-22 Thread Dimitri Liakhovitski
] <- myinfo[myinfo$version == result[[i]]$version, ] result[[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-pr

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

2015-12-22 Thread Dimitri Liakhovitski
> What is the problem 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 > wrote: >> >> Hello! >> I have a solution for my task that is based on a loop. However, it

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

2015-12-22 Thread Dimitri Liakhovitski
erge my.merge <- merge(myinfo, 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.or

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 wrote: > You are right, guys, merge is working. Somehow I was under the > erroneous impression that beca

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 wrote: > 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, Dimi

[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, repl

Re: [R] Expanding matrix into dummies

2015-12-23 Thread Dimitri Liakhovitski
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 wrote: >> >>> On Dec 22, 2015, at 4:42 PM, Dimitri Liakhovitski >>> wrote

[R] (no subject)

2015-12-23 Thread Dimitri Liakhovitski
mber 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 UNS

Re: [R] (no subject)

2016-01-05 Thread Dimitri Liakhovitski
har", 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 Liakhovitski > wrote: >>

[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] Shift all values above certain value by 1

2016-01-22 Thread Dimitri Liakhovitski
a frame? Thanks! On Fri, Jan 22, 2016 at 11:34 AM, Dimitri Liakhovitski 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:c to 4 > # Then, I need t

[R] multiplying a matrix by a vector

2016-11-03 Thread Dimitri Liakhovitski
Or I 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 yo

Re: [R] multiplying a matrix by a vector

2016-11-04 Thread Dimitri Liakhovitski
>> >>> 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 >> wrote: >>> Hello! >>> >>> I h

Re: [R] multiplying a matrix by a vector

2016-11-04 Thread Dimitri Liakhovitski
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(1:6, ncol = 2)

[R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
non-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 http

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 wrote: > Hello! > > I need to calculate the maximum of each row of a data frame. > This works: > > x <-

Re: [R] using pmax in presence of NAs

2016-11-16 Thread Dimitri Liakhovitski
gt; 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 > wrote: >> Hello! >> >> I need to calculate the maximum of each row of a data frame. >> This works: >> >> x <- data.frame(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 wrote: > >> On 16 Nov 2016, at 21:58 , Dimitri Liakhovitski >> wrote: >> >> Hello! >> >> I need to calculate the maximum of each row of a data frame. >> This works: >> >

[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

[R] double metaphone for non-English languages

2016-12-08 Thread Dimitri Liakhovitski
and 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

[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&qu

Re: [R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
with ABSOLUTELY NO WARRANTY." > > Don't think it could be clearer than that! > > Cheers, > Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley

Re: [R] are R packages safe?

2016-12-08 Thread Dimitri Liakhovitski
sured > that all "official" R packages have been "vetted" and are safe? > > Thanks a lot! > > -- > Dimitri Liakhovitski > > > > Dimitri, > > You are going to need to define "safe". > > Also, note that the notion of "official

  1   2   3   4   5   6   7   >