Re: [R] rle with data.table - is it possible?

2015-01-02 Thread Beejai
What are you having trouble with exactly? Do you need a bigger example. The code works perfectly well with your code so I'm sure how you are finding trouble with it (minus the fact that I had put in a few errors in myself at the beginning with I apologize). On Fri, Jan 2, 2015 at 9:05 PM, Jeff N

Re: [R] rle with data.table - is it possible?

2015-01-02 Thread Jeff Newmiller
Here is what I get when I try to use your algorithm: myf <- function( s ) { seg <- rep( 0, length( s ) ) rs <- rle( s ) span <- rs$lengths[ rs$values ] seg[ s ] <- rep( seq_along( span ), times = span ) seg } DT <- data.table( x ) DT[ , dadseg := myf( Dad %in% c( "AA", "RR" ) ), by=Gro

Re: [R] rle with data.table - is it possible?

2015-01-02 Thread Jeff Newmiller
The problem is that I cannot see how your use of rle and/or seq_along could possibly lead to the sample result you are giving us. That is why I asked for a new example. --- Jeff NewmillerThe .

Re: [R] rle with data.table - is it possible?

2015-01-02 Thread Beejai
Obviously this is why I need help... This is a larger data frame. I'm only posting something small here to make it simple. There are many Groups which are larger, and I want to assign a sequence value to consecutive rows where sumchild in not equal to 0. As the data frame I'm working with is mu

Re: [R] Fitting a Tweedie distribution

2015-01-02 Thread David Winsemius
On Jan 2, 2015, at 12:04 PM, Ben Bolker wrote: > Ben Bolker gmail.com> writes: > >> >> Paul Hudson gmail.com> writes: >> > > [snip] > >> library("tweedie") >> set.seed(1001) >> r <- rtweedie(1000,1.5,mu=2,phi=2) >> library("bbmle") >> dtweedie2 <- function(x,power,mu,phi,log=FALSE,debug=FA

Re: [R] Fitting a Tweedie distribution

2015-01-02 Thread Ben Bolker
Ben Bolker gmail.com> writes: > > Paul Hudson gmail.com> writes: > [snip] > library("tweedie") > set.seed(1001) > r <- rtweedie(1000,1.5,mu=2,phi=2) > library("bbmle") > dtweedie2 <- function(x,power,mu,phi,log=FALSE,debug=FALSE) { > if (debug) cat(power,mu,phi,"\n") > res <- dtweed

Re: [R] Fitting a Tweedie distribution

2015-01-02 Thread Ben Bolker
Paul Hudson gmail.com> writes: > > Hello all, > > I want to fit a tweedie distribution to the data I have. > > The R packages I have been able to find assume that I want to use it as > part as of a generalized linear model. > > This is not the case, I want to directly fit the distribution to

Re: [R] Fitting a Tweedie distribution

2015-01-02 Thread David Winsemius
On Jan 2, 2015, at 10:33 AM, Paul Hudson wrote: > Hello all, > > I want to fit a tweedie distribution to the data I have. > > The R packages I have been able to find assume that I want to use it as > part as of a generalized linear model. > > This is not the case, I want to directly fit the di

Re: [R] Fitting a Tweedie distribution

2015-01-02 Thread Hasan Diwan
The tweedle package[1] claims to have "functions for computing and fitting the Tweedie family of distributions". Hope that helped. -- H 1. http://cran.r-project.org/web/packages/tweedie On 2 January 2015 at 10:33, Paul Hudson wrote: > Hello all, > > I want to fit a tweedie distribution to the da

[R] Fitting a Tweedie distribution

2015-01-02 Thread Paul Hudson
Hello all, I want to fit a tweedie distribution to the data I have. The R packages I have been able to find assume that I want to use it as part as of a generalized linear model. This is not the case, I want to directly fit the distribution to the data. Is there a package that allows this?

Re: [R] Help in building R with minGW

2015-01-02 Thread Jeff Newmiller
Please read the posting guide. This subject is off topic (should be on R-devel) and both this list and the R-devel list are plain-text-only mailing lists so your HTML is mangled. --- Jeff NewmillerThe

Re: [R] Scientific Numbers in Boxplot Label

2015-01-02 Thread William Dunlap
You can use options(scipen=n) to control when numbers are printed using scientific notation (the default value is 0). Compare options(scipen=0); plot( 1e-17*(1:10), 1e5*(1:10)) options(scipen=10); plot( 1e-17*(1:10), 1e5*(1:10)) options(scipen=20); plot( 1e-17*(1:10), 1e5*(1:10)) Bill Dunlap

Re: [R] Help in building R with minGW

2015-01-02 Thread Duncan Murdoch
On 02/01/2015 12:05 PM, Edoardo Baldoni wrote: > Dear R users, > I would need some help in building R using minGW in windows 8.1. After > using the command *configure *(./configure --enable-R-shlib > --with-readline=no --with-x=no), I use the command *make. *This results in > the following error:

Re: [R] rle with data.table - is it possible?

2015-01-02 Thread David Winsemius
On Jan 2, 2015, at 12:07 AM, Kate Ignatius wrote: > Ah, crap. Yep you're right. This is not going too well. Okay - let > me try that again: > > x$childseg<-0 > x<-x$sumchild !=0 That previous line would appear to overwrite the entire dataframe with the value of one vector > span<-rle(x)$len

Re: [R] Gains package installation error

2015-01-02 Thread Jeff Newmiller
Please don't cross post. You have your answer on crossvalidated. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] remove outlier

2015-01-02 Thread David Winsemius
On Jan 2, 2015, at 4:58 AM, Methekar, Pushpa (GE Transportation, Non-GE) wrote: > Hi , > I am working on a function . > > rm.outliers = function(dataset,model){ > dataset$predicted = predict(model) >dataset$stdres = rstudent(model) > m = 1 > for(i in 1:length(dataset$stdres)){ >

[R] Help in building R with minGW

2015-01-02 Thread Edoardo Baldoni
Dear R users, I would need some help in building R using minGW in windows 8.1. After using the command *configure *(./configure --enable-R-shlib --with-readline=no --with-x=no), I use the command *make. *This results in the following error: [...] make[2]: Leaving directory `/home/Edoardo/r-3.1.2/s

Re: [R] Gains package installation error

2015-01-02 Thread Uwe Ligges
Do you have a working internet connection? install.packages("gains") should install it from the mirror you have chosen. Best, Uwe Ligges On 02.01.2015 11:51, Rodica Coderie via R-help wrote: I am trying to install the Gains package in R Studio Version 3.1.2 like this: install.packages("ga

Re: [R] remove outlier

2015-01-02 Thread David Barron
Your problem is that you are subsetting the dataset on line 13 of the function, but then on the following line you attempt to add predicted values from the complete data used to fit the model. You'll have to subset that as well (and the same would be true for the following line where you attempt to

[R] Scientific Numbers in Boxplot Label

2015-01-02 Thread rganguly
I am using Rstudio and running this simple code hist(atap$Price) The x-axis label displayed is in this format, 0e+00,1e+05 etc... How do I get rid of the scientific values and display numbers? Seems it is doing for all commands (barplot, boxplot, hist ) I am running. I have few outliers in th

[R] Gains package installation error

2015-01-02 Thread Rodica Coderie via R-help
I am trying to install the Gains package in R Studio Version 3.1.2 like this:  install.packages("gains")The following warnings appear: InternetOpenUrl failed: 'The server name or address could not be resolved'Warning in install.packages :  unable to access index for repository http://www.stats.o

[R] remove outlier

2015-01-02 Thread Methekar, Pushpa (GE Transportation, Non-GE)
Hi , I am working on a function . rm.outliers = function(dataset,model){ dataset$predicted = predict(model) dataset$stdres = rstudent(model) m = 1 for(i in 1:length(dataset$stdres)){ dataset$outlier_counter[i] = if(dataset$stdres[i] >= 3 |

Re: [R] rounding down with as.integer

2015-01-02 Thread Mike Miller
On Fri, 2 Jan 2015, Duncan Murdoch wrote: On 01/01/2015 10:05 PM, Mike Miller wrote: This is how big those errors are: 512*.Machine$double.eps [1] 1.136868e-13 Under other conditions you also were seeing errors of twice that, or 1024*.Machine$double.eps. It might not be a coincidence th

Re: [R] Select subtree with vector of leaves using zoom function of the ape package

2015-01-02 Thread Ben Bolker
Luigi Marongiu gmail.com> writes: > I am drawing a phylogenetic tree using the zoom() function of the > ape package. Since I have 476 sequences in my alignment, this allows > me to have the outlook of the main tree and then highlight a portion > of it, and this works fine. At the moment I am us

Re: [R] Saving an edited R function - RStudio and R

2015-01-02 Thread Uwe Ligges
On 31.12.2014 17:24, John Sorkin wrote: Windows 7 Colleagues, I used the fix() function to edit an existing function when using RStudio. After editing the function, I am given the option to SAVE the modified function. I would like to know (1) where the modified function is stored (the save

Re: [R] rounding down with as.integer

2015-01-02 Thread peter dalgaard
On 02 Jan 2015, at 04:05 , Mike Miller wrote: > > ...but why are we seeing errors so much bigger than the machine precision? > Why does it change at 2? Because relative errors in the one-thousands part are roughly a thousand times bigger than errors in the number itself? Put differently: th

Re: [R] rounding down with as.integer

2015-01-02 Thread Duncan Murdoch
On 01/01/2015 10:05 PM, Mike Miller wrote: > On Thu, 1 Jan 2015, Duncan Murdoch wrote: > >> On 01/01/2015 1:21 PM, Mike Miller wrote: >> >>> I understand that it's all about the problem of representing digital >>> numbers in binary, but I still find some of the results a little >>> surprising, l

Re: [R] rle with data.table - is it possible?

2015-01-02 Thread Kate Ignatius
Ah, crap. Yep you're right. This is not going too well. Okay - let me try that again: x$childseg<-0 x<-x$sumchild !=0 span<-rle(x)$lengths[rle(x)$values==TRUE] x$childseg[x]<-rep(seq_along(span), times = span) Does this one have any errors? On Fri, Jan 2, 2015 at 2:32 AM, David Winsemius wro

Re: [R] Can not save files

2015-01-02 Thread jwd
On Wed, 31 Dec 2014 18:29:05 -0500 "John Sorkin" wrote: > When I try to save a file, I get "Permission denied". > Can someone let me know why this happens? > > > I am running under Windows 7, Rstudio > > > > save(TheResults,file="c:\\data") You are explicitly attempting to place a file name