[R] Help with dplyr

2015-11-05 Thread Axel Urbiz
Hello, Is there a way to avoid the warning below in dplyr. I’m performing an operation within groups, and the warning says that the factors created from each group do not have the same levels, and so it coerces the factor to character. I’m using this inside a package I’m developing. I’d

Re: [R] Help with dplyr

2015-11-05 Thread peter dalgaard
> On 06 Nov 2015, at 00:59 , Axel Urbiz wrote: > > Hello, > > Is there a way to avoid the warning below in dplyr. I’m performing an > operation within groups, and the warning says that the factors created from > each group do not have the same levels, and so it coerces

Re: [R] Help with dplyr

2015-11-05 Thread Jeff Newmiller
Yes, that was my intention, but it appears I may not have read his code carefully enough. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] Help with dplyr

2015-11-05 Thread Jeff Newmiller
Solution is to always use the stringsAsFactors=TRUE option in your data.frame() function calls. --- Jeff NewmillerThe . . Go Live... DCN:Basics:

Re: [R] Help with dplyr

2015-11-05 Thread William Dunlap
Did you mean to add stringsAsFactors=FALSE to the following call to data.frame? bin <- data.frame( pred = pred, bin = cut(pred, breaks = Breaks, include.lowest = TRUE)) Since cut() produces a factor you would also have to convert it to character to make stringAsFactors=FALSE to have

Re: [R] Help with dplyr

2015-11-05 Thread David Winsemius
> On Nov 5, 2015, at 3:59 PM, Axel Urbiz wrote: > > Hello, > > Is there a way to avoid the warning below in dplyr. There is an option that lets you turn off warnings. There also a wrapper function called, not surprisingly, … `suppressWarnings`. This is all descibed

Re: [R] Help with dplyr

2015-11-05 Thread David Winsemius
> On Nov 5, 2015, at 4:58 PM, Jeff Newmiller wrote: > > Solution is to always use the stringsAsFactors=TRUE option in your > data.frame() function calls. Since that is the default, I’m wondering if you meant to say FALSE? — David. >

Re: [R] Help with dplyr

2015-11-05 Thread Axel Urbiz
Thank you all! > On Nov 5, 2015, at 9:07 PM, William Dunlap wrote: > > Did you mean to add stringsAsFactors=FALSE to the following call to > data.frame? > bin <- data.frame( > pred = pred, > bin = cut(pred, breaks = Breaks, include.lowest = TRUE)) > Since cut()