[R] UpSetR
Hello, Does anyone use UpSetR for set visualization? I am wanting to re-order the sets in the diagram. Thanks, Evan [[alternative HTML version deleted]] __ 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-contained, reproducible code.
Re: [R] Interquartile Range
I already found a solution, you suggested I try to find a non hacky solution, which was not really my priority. I should have declined politely, which I will do now. Or, ifyou just want me to post reproducible code because you are bored or because you like solving problems then let me know and I will accommodate. You have been helpful and I wouldnt mind in that case. Also, IQR was not a help from the beginning. If it supplies one value, then its not even a candidate to be helpful for my problem. I already talked about the format i was looking for. I dont think I violated any posting guideline, I asked for help, and people pointed me in a direction and it helped me. Thanks again, I appreciate it. On Apr 19, 2016 10:53 PM, "Bert Gunter"wrote: > ??? > > IQR returns a single number. > > > IQR(rnorm(10)) > [1] 1.090168 > > To your 2nd response: > "I could have used average, min, max, they all would have returned the > same thing., " > > I can only respond: huh?? Are all your values identical? > > You really need to provide a small reproducible example as requested > by the posting guide -- I certainly don't get it, and I'm done > guessing. Maybe others will see what I am missing and say something > useful. I clearly can't. > > 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 Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 5:29 PM, Michael Artz > wrote: > > Again, IQR returns two both a .25 and a .75 value and it failed, which is > > why I didn't use it before. Also, the first function just returns tha > same > > value repeating. Since they are the same, before the second call, using > the > > mode function is just a way to grab one value. I could have used average, > > min, max, they all would have returned the same thing. > > > > Mike > > > > On Tue, Apr 19, 2016 at 7:24 PM, Marc Schwartz > wrote: > >> > >> Hi, > >> > >> Jumping into this thread mainly on the point of the mode of the > >> distribution, while also supporting Bert's comments below on theory. > >> > >> If the vector 'x' that is being passed to this function is an integer > >> vector, then a tabulation of the integers can yield a 'mode', presuming > of > >> course that there is only one unique mode. You may have to decide how > you > >> want to handle a multi-modal discrete distribution. > >> > >> If the vector 'x' is continuous (e.g. contains floating point values), > >> then a tabulation is going to be problematic for a variety of reasons. > >> > >> In that case, prior discussions on this point, have yielded the > following > >> estimation of the mode of a continuous distribution by using: > >> > >> Mode <- function(x) { > >> D <- density(x) > >> D$x[which.max(D$y)] > >> } > >> > >> where the second line of the function gets you the value of 'x' at the > >> maximum of the density estimate. Of course, there is still the > possibility > >> of a multi-modal distribution and the nuances of which kernel is used, > etc., > >> etc. > >> > >> Food for thought. > >> > >> Regards, > >> > >> Marc Schwartz > >> > >> > >> > On Apr 19, 2016, at 7:07 PM, Bert Gunter > wrote: > >> > > >> > Well, instead of your functions try: > >> > > >> > Mode <- function(x) { > >> > tabx <- table(x) > >> > tabx[which.max(tabx)] > >> > } > >> > > >> > and use R's IQR function instead of yours. > >> > > >> > ... so I still don't get why you want to return a character string > >> > instead of a value for the IQR; > >> > and the mode of a sample defined as above is generally a bad estimator > >> > of the mode of the distribution. To say more than that would take me > >> > too far afield. Post on stats.stackexchange.com if you want to know > >> > why (if it's even relevant). > >> > > >> > 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 Breathed in his "Bloom County" comic strip ) > >> > > >> > > >> > On Tue, Apr 19, 2016 at 4:25 PM, Michael Artz > > >> > wrote: > >> >> Hi, > >> >> Here is what I am doing > >> >> > >> >> notGroupedAll <- ddply(data > >> >> ,~groupColumn > >> >> ,summarise > >> >> ,col1_mean=mean(col1) > >> >> ,col2_mode=Mode(col2) #Function I wrote for getting > the > >> >> mode shown below > >> >> ,col3_Range=myIqr(col3) > >> >> ) > >> >> > >> >> groupedAll <- ddply(data > >> >> ,~groupColumn > >> >> ,summarise > >> >> ,col1_mean=mean(col1) > >> >> ,col2_mode=Mode(col2) #Function I wrote for getting > the > >> >> mode shown below > >> >> ,col3_Range=Mode(col3) > >>
Re: [R] Creating two new variables conditional on retaining values from previous rows
Hi pele, There are probably more elegant ways to do this using some function, but this might help: psdat<-read.table(text="ID DATE ITEM 1 1/1/2014P1 1 1/15/2014 P2 1 1/20/2014 P3 1 1/22/2014 P4 1 3/10/2015 P5 2 1/13/2015 P1 2 1/20/2015 P2 2 1/28/2015 P3 2 2/28/2015 P4 2 3/20/2015 P5", header=TRUE) psdat$DATE<-as.Date(as.character(psdat$DATE),"%m/%d/%Y") psdat$GROUP<-1 psdat$GROUPDATE<-psdat$DATE[1] for(case in 2:dim(psdat)[1]) { # start a new ID if(lastID != psdat$ID[case-1]) { lastID<-psdat$ID[case] psdat$GROUP[case]<-1 psdat$GROUPDATE[case]<-psdat$DATE[case] } else { if((psdat$DATE[case] - psdat$DATE[case-1]) > 10 || (psdat$DATE[case] - psdat$GROUPDATE[case-1]) > 10) { psdat$GROUP[case]<-psdat$GROUP[case-1]+1 psdat$GROUPDATE[case]<-psdat$DATE[case] } else { psdat$GROUP[case]<-psdat$GROUP[case-1] psdat$GROUPDATE[case]<-psdat$GROUPDATE[case-1] } } } psdat Jim On Wed, Apr 20, 2016 at 8:59 AM, pele.s--- via R-helpwrote: > Hello, > > Iam looking for an R solution that can efficiently produce the output shown > below. I can produce this easily in SAS with retain statement and a few lines > of if-then-else logic, etc.. but I am not find anything similar on the Rforum > archives. Below is the logic I am trying to apply to produce the output table > below. Thanks in any help! > > if the ID is the first ID encountered then group=1 and groupdate=date or else > if not first ID and date - previous date > 10 or date - previous group date > >10 then group=previous group # + 1 and groupdate = date or else if not first > ID and date - previous date <= 10 or date - previous group date<=10 then > group=previous group # and groupdate = previous date. > > Input: > > ID DATEITEM > 1 1/1/2014P1 > 1 1/15/2014 P2 > 1 1/20/2014 P3 > 1 1/22/2014 P4 > 1 3/10/2015 P5 > 2 1/13/2015 P1 > 2 1/20/2015 P2 > 2 1/28/2015 P3 > 2 2/28/2015 P4 > 2 3/20/2015 P5 > Desired Output > > ID DATEITEMGROUP GROUPDATE > 1 1/1/2014P1 1 1/1/2014 > 1 1/15/2014 P2 2 1/15/2014 > 1 1/20/2014 P3 2 1/15/2014 > 1 1/22/2014 P4 2 1/15/2014 > 1 3/10/2015 P5 3 3/10/2015 > 2 1/13/2015 P1 1 1/13/2015 > 2 1/20/2015 P2 1 1/13/2015 > 2 1/28/2015 P3 2 1/28/2015 > 2 2/28/2015 P4 3 2/28/2015 > 2 3/20/2015 P5 4 3/20/2015 > > Thanks for any help! > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
Re: [R] Interquartile Range
??? IQR returns a single number. > IQR(rnorm(10)) [1] 1.090168 To your 2nd response: "I could have used average, min, max, they all would have returned the same thing., " I can only respond: huh?? Are all your values identical? You really need to provide a small reproducible example as requested by the posting guide -- I certainly don't get it, and I'm done guessing. Maybe others will see what I am missing and say something useful. I clearly can't. 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 Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 5:29 PM, Michael Artzwrote: > Again, IQR returns two both a .25 and a .75 value and it failed, which is > why I didn't use it before. Also, the first function just returns tha same > value repeating. Since they are the same, before the second call, using the > mode function is just a way to grab one value. I could have used average, > min, max, they all would have returned the same thing. > > Mike > > On Tue, Apr 19, 2016 at 7:24 PM, Marc Schwartz wrote: >> >> Hi, >> >> Jumping into this thread mainly on the point of the mode of the >> distribution, while also supporting Bert's comments below on theory. >> >> If the vector 'x' that is being passed to this function is an integer >> vector, then a tabulation of the integers can yield a 'mode', presuming of >> course that there is only one unique mode. You may have to decide how you >> want to handle a multi-modal discrete distribution. >> >> If the vector 'x' is continuous (e.g. contains floating point values), >> then a tabulation is going to be problematic for a variety of reasons. >> >> In that case, prior discussions on this point, have yielded the following >> estimation of the mode of a continuous distribution by using: >> >> Mode <- function(x) { >> D <- density(x) >> D$x[which.max(D$y)] >> } >> >> where the second line of the function gets you the value of 'x' at the >> maximum of the density estimate. Of course, there is still the possibility >> of a multi-modal distribution and the nuances of which kernel is used, etc., >> etc. >> >> Food for thought. >> >> Regards, >> >> Marc Schwartz >> >> >> > On Apr 19, 2016, at 7:07 PM, Bert Gunter wrote: >> > >> > Well, instead of your functions try: >> > >> > Mode <- function(x) { >> > tabx <- table(x) >> > tabx[which.max(tabx)] >> > } >> > >> > and use R's IQR function instead of yours. >> > >> > ... so I still don't get why you want to return a character string >> > instead of a value for the IQR; >> > and the mode of a sample defined as above is generally a bad estimator >> > of the mode of the distribution. To say more than that would take me >> > too far afield. Post on stats.stackexchange.com if you want to know >> > why (if it's even relevant). >> > >> > 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 Breathed in his "Bloom County" comic strip ) >> > >> > >> > On Tue, Apr 19, 2016 at 4:25 PM, Michael Artz >> > wrote: >> >> Hi, >> >> Here is what I am doing >> >> >> >> notGroupedAll <- ddply(data >> >> ,~groupColumn >> >> ,summarise >> >> ,col1_mean=mean(col1) >> >> ,col2_mode=Mode(col2) #Function I wrote for getting the >> >> mode shown below >> >> ,col3_Range=myIqr(col3) >> >> ) >> >> >> >> groupedAll <- ddply(data >> >> ,~groupColumn >> >> ,summarise >> >> ,col1_mean=mean(col1) >> >> ,col2_mode=Mode(col2) #Function I wrote for getting the >> >> mode shown below >> >> ,col3_Range=Mode(col3) >> >> ) >> >> >> >> #custom Mode function >> >> Mode <- function(x) { >> >> ux <- unique(x) >> >> ux[which.max(tabulate(match(x, ux)))] >> >> >> >> #the range function >> >> myIqr <- function(x) { >> >> paste(round(quantile(x,0.375),0),round(quantile(x,0.625),0),sep="-") >> >> } >> >> >> >> >> >> } >> >> >> >> >> >> Here is what I am doing!! :) >> >> >> >> >> >> >> >> On Tue, Apr 19, 2016 at 2:57 PM, William Dunlap >> >> wrote: >> >>> >> >>> If you show us, not just tell us about, a self-contained example >> >>> someone might show you a non-hacky way of getting the job done. >> >>> (I don't see an argument to plyr::ddply called 'transform'.) >> >>> >> >>> Bill Dunlap >> >>> TIBCO Software >> >>> wdunlap tibco.com >> >>> >> >>> On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz >> >>> >> >>> wrote: >> >> Oh thanks for that clarification Bert! Hope you enjoyed your coffee! >> I >> ended up just using the transform argument in the ddply function. It >>
[R] XLConnect Package
Folks, I am using the XLConnect package. I can download all the named ranges except a couple that are defined by the Excel function “Offset”. For example I have this named range: =OFFSET(APA!$A$1,0,0,APA!$K$11,3) I am pretty sure that this won’t work but I thought I would give it a shot here. Thanks for your time, Best, KW __ 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-contained, reproducible code.
Re: [R] Interquartile Range
Again, IQR returns two both a .25 and a .75 value and it failed, which is why I didn't use it before. Also, the first function just returns tha same value repeating. Since they are the same, before the second call, using the mode function is just a way to grab one value. I could have used average, min, max, they all would have returned the same thing. Mike On Tue, Apr 19, 2016 at 7:24 PM, Marc Schwartzwrote: > Hi, > > Jumping into this thread mainly on the point of the mode of the > distribution, while also supporting Bert's comments below on theory. > > If the vector 'x' that is being passed to this function is an integer > vector, then a tabulation of the integers can yield a 'mode', presuming of > course that there is only one unique mode. You may have to decide how you > want to handle a multi-modal discrete distribution. > > If the vector 'x' is continuous (e.g. contains floating point values), > then a tabulation is going to be problematic for a variety of reasons. > > In that case, prior discussions on this point, have yielded the following > estimation of the mode of a continuous distribution by using: > > Mode <- function(x) { > D <- density(x) > D$x[which.max(D$y)] > } > > where the second line of the function gets you the value of 'x' at the > maximum of the density estimate. Of course, there is still the possibility > of a multi-modal distribution and the nuances of which kernel is used, > etc., etc. > > Food for thought. > > Regards, > > Marc Schwartz > > > > On Apr 19, 2016, at 7:07 PM, Bert Gunter wrote: > > > > Well, instead of your functions try: > > > > Mode <- function(x) { > > tabx <- table(x) > > tabx[which.max(tabx)] > > } > > > > and use R's IQR function instead of yours. > > > > ... so I still don't get why you want to return a character string > > instead of a value for the IQR; > > and the mode of a sample defined as above is generally a bad estimator > > of the mode of the distribution. To say more than that would take me > > too far afield. Post on stats.stackexchange.com if you want to know > > why (if it's even relevant). > > > > 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 Breathed in his "Bloom County" comic strip ) > > > > > > On Tue, Apr 19, 2016 at 4:25 PM, Michael Artz > wrote: > >> Hi, > >> Here is what I am doing > >> > >> notGroupedAll <- ddply(data > >> ,~groupColumn > >> ,summarise > >> ,col1_mean=mean(col1) > >> ,col2_mode=Mode(col2) #Function I wrote for getting the > >> mode shown below > >> ,col3_Range=myIqr(col3) > >> ) > >> > >> groupedAll <- ddply(data > >> ,~groupColumn > >> ,summarise > >> ,col1_mean=mean(col1) > >> ,col2_mode=Mode(col2) #Function I wrote for getting the > >> mode shown below > >> ,col3_Range=Mode(col3) > >> ) > >> > >> #custom Mode function > >> Mode <- function(x) { > >> ux <- unique(x) > >> ux[which.max(tabulate(match(x, ux)))] > >> > >> #the range function > >> myIqr <- function(x) { > >> paste(round(quantile(x,0.375),0),round(quantile(x,0.625),0),sep="-") > >> } > >> > >> > >> } > >> > >> > >> Here is what I am doing!! :) > >> > >> > >> > >> On Tue, Apr 19, 2016 at 2:57 PM, William Dunlap > wrote: > >>> > >>> If you show us, not just tell us about, a self-contained example > >>> someone might show you a non-hacky way of getting the job done. > >>> (I don't see an argument to plyr::ddply called 'transform'.) > >>> > >>> Bill Dunlap > >>> TIBCO Software > >>> wdunlap tibco.com > >>> > >>> On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz > > >>> wrote: > > Oh thanks for that clarification Bert! Hope you enjoyed your > coffee! I > ended up just using the transform argument in the ddply function. It > worked > and it repeated, then I called a mode function in another call to > ddply that > summarised. Kinda hacky but oh well! > > On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunter > > wrote: > > > > ... and I'm getting another cup of coffee... > > > > -- Bert > > Bert Gunter > > > > "The trouble with having an open mind is that people keep coming > along > > and sticking things into it." > > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > > > > On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter < > bgunter.4...@gmail.com> > > wrote: > >> NO NO -- I am wrong! The paste() expression is of course evaluated. > >> It's just that a character string is returned of the form > "something - > >> something". > >> > >> I apologize for the confusion.
Re: [R] Interquartile Range
Hi, Jumping into this thread mainly on the point of the mode of the distribution, while also supporting Bert's comments below on theory. If the vector 'x' that is being passed to this function is an integer vector, then a tabulation of the integers can yield a 'mode', presuming of course that there is only one unique mode. You may have to decide how you want to handle a multi-modal discrete distribution. If the vector 'x' is continuous (e.g. contains floating point values), then a tabulation is going to be problematic for a variety of reasons. In that case, prior discussions on this point, have yielded the following estimation of the mode of a continuous distribution by using: Mode <- function(x) { D <- density(x) D$x[which.max(D$y)] } where the second line of the function gets you the value of 'x' at the maximum of the density estimate. Of course, there is still the possibility of a multi-modal distribution and the nuances of which kernel is used, etc., etc. Food for thought. Regards, Marc Schwartz > On Apr 19, 2016, at 7:07 PM, Bert Gunterwrote: > > Well, instead of your functions try: > > Mode <- function(x) { > tabx <- table(x) > tabx[which.max(tabx)] > } > > and use R's IQR function instead of yours. > > ... so I still don't get why you want to return a character string > instead of a value for the IQR; > and the mode of a sample defined as above is generally a bad estimator > of the mode of the distribution. To say more than that would take me > too far afield. Post on stats.stackexchange.com if you want to know > why (if it's even relevant). > > 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 Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 4:25 PM, Michael Artz wrote: >> Hi, >> Here is what I am doing >> >> notGroupedAll <- ddply(data >> ,~groupColumn >> ,summarise >> ,col1_mean=mean(col1) >> ,col2_mode=Mode(col2) #Function I wrote for getting the >> mode shown below >> ,col3_Range=myIqr(col3) >> ) >> >> groupedAll <- ddply(data >> ,~groupColumn >> ,summarise >> ,col1_mean=mean(col1) >> ,col2_mode=Mode(col2) #Function I wrote for getting the >> mode shown below >> ,col3_Range=Mode(col3) >> ) >> >> #custom Mode function >> Mode <- function(x) { >> ux <- unique(x) >> ux[which.max(tabulate(match(x, ux)))] >> >> #the range function >> myIqr <- function(x) { >> paste(round(quantile(x,0.375),0),round(quantile(x,0.625),0),sep="-") >> } >> >> >> } >> >> >> Here is what I am doing!! :) >> >> >> >> On Tue, Apr 19, 2016 at 2:57 PM, William Dunlap wrote: >>> >>> If you show us, not just tell us about, a self-contained example >>> someone might show you a non-hacky way of getting the job done. >>> (I don't see an argument to plyr::ddply called 'transform'.) >>> >>> Bill Dunlap >>> TIBCO Software >>> wdunlap tibco.com >>> >>> On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz >>> wrote: Oh thanks for that clarification Bert! Hope you enjoyed your coffee! I ended up just using the transform argument in the ddply function. It worked and it repeated, then I called a mode function in another call to ddply that summarised. Kinda hacky but oh well! On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunter wrote: > > ... and I'm getting another cup of coffee... > > -- Bert > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter > wrote: >> NO NO -- I am wrong! The paste() expression is of course evaluated. >> It's just that a character string is returned of the form "something - >> something". >> >> I apologize for the confusion. >> >> -- Bert >> >> >> >> >> Bert Gunter >> >> "The trouble with having an open mind is that people keep coming along >> and sticking things into it." >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> >> >> On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter >> wrote: >>> To be precise: >>> >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> >>> is an expression that evaluates to a character string: >>> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >>> >>> no matter what the argument of your
Re: [R] Creating two new variables conditional on retaining values from previous rows
I do not have the tenacity to decipher your logic, but I would suggest that you go through an R tutorial or two instead of limiting yourself to R-Help (not R forum?) archives. You probably are going about it wrongly in R (I suspect you need indexing). In fact, I would guess that you probably don't want to go about things this way at all in R, but of course that would require my knowing the underlying problem you are trying to solve, which I do not. My point is that you need to change your programming paradigm and learn R instead of trying to overlay SAS paradigms. And yup, it requires time and effort to do this. Note that there are various "R for SAS programmers" tutorials out there, which might be helpful, either for your specific query or more generally. 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 Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 3:59 PM, pele.s--- via R-helpwrote: > Hello, > > Iam looking for an R solution that can efficiently produce the output shown > below. I can produce this easily in SAS with retain statement and a few lines > of if-then-else logic, etc.. but I am not find anything similar on the Rforum > archives. Below is the logic I am trying to apply to produce the output table > below. Thanks in any help! > > if the ID is the first ID encountered then group=1 and groupdate=date or else > if not first ID and date - previous date > 10 or date - previous group date > >10 then group=previous group # + 1 and groupdate = date or else if not first > ID and date - previous date <= 10 or date - previous group date<=10 then > group=previous group # and groupdate = previous date. > > Input: > > ID DATEITEM > 1 1/1/2014P1 > 1 1/15/2014 P2 > 1 1/20/2014 P3 > 1 1/22/2014 P4 > 1 3/10/2015 P5 > 2 1/13/2015 P1 > 2 1/20/2015 P2 > 2 1/28/2015 P3 > 2 2/28/2015 P4 > 2 3/20/2015 P5 > Desired Output > > ID DATEITEMGROUP GROUPDATE > 1 1/1/2014P1 1 1/1/2014 > 1 1/15/2014 P2 2 1/15/2014 > 1 1/20/2014 P3 2 1/15/2014 > 1 1/22/2014 P4 2 1/15/2014 > 1 3/10/2015 P5 3 3/10/2015 > 2 1/13/2015 P1 1 1/13/2015 > 2 1/20/2015 P2 1 1/13/2015 > 2 1/28/2015 P3 2 1/28/2015 > 2 2/28/2015 P4 3 2/28/2015 > 2 3/20/2015 P5 4 3/20/2015 > > Thanks for any help! > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
[R-es] Script sin resultados
Carlos: Te agradezco mucho tu respuesta tan rápida. Se trata de obtener las incidencias en cada uno de los 39 grupos, aquellos que lo hacen con mayor frecuencia. Es decir del grupo 'n' cuántas veces sucede 1, 2, ... hasta 10. Con este resumen que va ir cambiando, aplicarle loess. Por lo que se refiere a los valores que indico, los obtuve contando físicamente de los datos de TAB. Nuevamente te repito las gracias más cumplidas. *MANOLO MÁRQUEZ P.* [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R] Interquartile Range
Well, instead of your functions try: Mode <- function(x) { tabx <- table(x) tabx[which.max(tabx)] } and use R's IQR function instead of yours. ... so I still don't get why you want to return a character string instead of a value for the IQR; and the mode of a sample defined as above is generally a bad estimator of the mode of the distribution. To say more than that would take me too far afield. Post on stats.stackexchange.com if you want to know why (if it's even relevant). 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 Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 4:25 PM, Michael Artzwrote: > Hi, > Here is what I am doing > > notGroupedAll <- ddply(data > ,~groupColumn > ,summarise > ,col1_mean=mean(col1) > ,col2_mode=Mode(col2) #Function I wrote for getting the > mode shown below > ,col3_Range=myIqr(col3) > ) > > groupedAll <- ddply(data > ,~groupColumn > ,summarise > ,col1_mean=mean(col1) > ,col2_mode=Mode(col2) #Function I wrote for getting the > mode shown below > ,col3_Range=Mode(col3) > ) > > #custom Mode function > Mode <- function(x) { > ux <- unique(x) > ux[which.max(tabulate(match(x, ux)))] > > #the range function > myIqr <- function(x) { > paste(round(quantile(x,0.375),0),round(quantile(x,0.625),0),sep="-") > } > > > } > > > Here is what I am doing!! :) > > > > On Tue, Apr 19, 2016 at 2:57 PM, William Dunlap wrote: >> >> If you show us, not just tell us about, a self-contained example >> someone might show you a non-hacky way of getting the job done. >> (I don't see an argument to plyr::ddply called 'transform'.) >> >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com >> >> On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz >> wrote: >>> >>> Oh thanks for that clarification Bert! Hope you enjoyed your coffee! I >>> ended up just using the transform argument in the ddply function. It worked >>> and it repeated, then I called a mode function in another call to ddply that >>> summarised. Kinda hacky but oh well! >>> >>> On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunter >>> wrote: ... and I'm getting another cup of coffee... -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter wrote: > NO NO -- I am wrong! The paste() expression is of course evaluated. > It's just that a character string is returned of the form "something - > something". > > I apologize for the confusion. > > -- Bert > > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter > wrote: >> To be precise: >> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >> is an expression that evaluates to a character string: >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >> >> no matter what the argument of your function, x. Hence >> >> return(paste(...)) will return this exact character string and never >> evaluates x. >> >> >> 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 Breathed in his "Bloom County" comic strip ) >> >> >> On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-help >> wrote: That didn't work Jim! >>> >>> It always helps to say how the suggestion did not work. Jim's >>> function had a typo in it - was that the problem? Or did you not >>> change the call to ddply to use that function. Here is something >>> that might "work" for you: >>> >>> library(plyr) >>> >>> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) >>> myIqr <- function(x) { >>> >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> } >>> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), >>> col1_IQR=stats::IQR(col1)) >>> # groupColumn col1_myIqr
[R] Creating two new variables conditional on retaining values from previous rows
Hello, Iam looking for an R solution that can efficiently produce the output shown below. I can produce this easily in SAS with retain statement and a few lines of if-then-else logic, etc.. but I am not find anything similar on the Rforum archives. Below is the logic I am trying to apply to produce the output table below. Thanks in any help! if the ID is the first ID encountered then group=1 and groupdate=date or else if not first ID and date - previous date > 10 or date - previous group date >10 then group=previous group # + 1 and groupdate = date or else if not first ID and date - previous date <= 10 or date - previous group date<=10 then group=previous group # and groupdate = previous date. Input: ID DATEITEM 1 1/1/2014P1 1 1/15/2014 P2 1 1/20/2014 P3 1 1/22/2014 P4 1 3/10/2015 P5 2 1/13/2015 P1 2 1/20/2015 P2 2 1/28/2015 P3 2 2/28/2015 P4 2 3/20/2015 P5 Desired Output ID DATEITEMGROUP GROUPDATE 1 1/1/2014P1 1 1/1/2014 1 1/15/2014 P2 2 1/15/2014 1 1/20/2014 P3 2 1/15/2014 1 1/22/2014 P4 2 1/15/2014 1 3/10/2015 P5 3 3/10/2015 2 1/13/2015 P1 1 1/13/2015 2 1/20/2015 P2 1 1/13/2015 2 1/28/2015 P3 2 1/28/2015 2 2/28/2015 P4 3 2/28/2015 2 3/20/2015 P5 4 3/20/2015 Thanks for any help! __ 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-contained, reproducible code.
Re: [R] Interquartile Range
Hi, Here is what I am doing notGroupedAll <- ddply(data ,~groupColumn ,summarise ,col1_mean=mean(col1) ,col2_mode=Mode(col2) #Function I wrote for getting the mode shown below ,col3_Range=myIqr(col3) ) groupedAll <- ddply(data ,~groupColumn ,summarise ,col1_mean=mean(col1) ,col2_mode=Mode(col2) #Function I wrote for getting the mode shown below ,col3_Range=Mode(col3) ) #custom Mode function Mode <- function(x) { ux <- unique(x) ux[which.max(tabulate(match(x, ux)))] #the range function myIqr <- function(x) { paste(round(quantile(x,0.375),0),round(quantile(x,0.625),0),sep="-") } } Here is what I am doing!! :) On Tue, Apr 19, 2016 at 2:57 PM, William Dunlapwrote: > If you show us, not just tell us about, a self-contained example > someone might show you a non-hacky way of getting the job done. > (I don't see an argument to plyr::ddply called 'transform'.) > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Tue, Apr 19, 2016 at 12:18 PM, Michael Artz > wrote: > >> Oh thanks for that clarification Bert! Hope you enjoyed your coffee! I >> ended up just using the transform argument in the ddply function. It >> worked and it repeated, then I called a mode function in another call to >> ddply that summarised. Kinda hacky but oh well! >> >> On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunter >> wrote: >> >>> ... and I'm getting another cup of coffee... >>> >>> -- Bert >>> Bert Gunter >>> >>> "The trouble with having an open mind is that people keep coming along >>> and sticking things into it." >>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >>> >>> >>> On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter >>> wrote: >>> > NO NO -- I am wrong! The paste() expression is of course evaluated. >>> > It's just that a character string is returned of the form "something - >>> > something". >>> > >>> > I apologize for the confusion. >>> > >>> > -- Bert >>> > >>> > >>> > >>> > >>> > Bert Gunter >>> > >>> > "The trouble with having an open mind is that people keep coming along >>> > and sticking things into it." >>> > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >>> > >>> > >>> > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter >>> wrote: >>> >> To be precise: >>> >> >>> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> >> >>> >> is an expression that evaluates to a character string: >>> >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >>> >> >>> >> no matter what the argument of your function, x. Hence >>> >> >>> >> return(paste(...)) will return this exact character string and never >>> >> evaluates x. >>> >> >>> >> >>> >> 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 Breathed in his "Bloom County" comic strip ) >>> >> >>> >> >>> >> On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-help >>> >> wrote: >>> That didn't work Jim! >>> >>> >>> >>> It always helps to say how the suggestion did not work. Jim's >>> >>> function had a typo in it - was that the problem? Or did you not >>> >>> change the call to ddply to use that function. Here is something >>> >>> that might "work" for you: >>> >>> >>> >>> library(plyr) >>> >>> >>> >>> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) >>> >>> myIqr <- function(x) { >>> >>> >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> >>> } >>> >>> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), >>> >>> col1_IQR=stats::IQR(col1)) >>> >>> # groupColumn col1_myIqr col1_IQR >>> >>> #1 11-10 >>> >>> #2 22-41 >>> >>> #3 3 12-24 12 >>> >>> #4 4112-320 208 >>> >>> #5 5 2048-8192 6144 >>> >>> >>> >>> The important point is that >>> >>> >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> >>> is not a function, it is an expression. ddplyr wants functions. >>> >>> >>> >>> >>> >>> Bill Dunlap >>> >>> TIBCO Software >>> >>> wdunlap tibco.com >>> >>> >>> >>> On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz < >>> michaelea...@gmail.com> >>> >>> wrote: >>> >>> >>> That didn't work Jim! >>> >>> Thanks anyway >>> >>> On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon >>> wrote: >>> >>> > Hi Michael, >>> > At a guess, try this: >>> > >>> > iqr<-function(x) { >>> > >>> >>>
Re: [R-es] Script sin resultados completos
Hola, Te comento varias cosas: - No obtengo ningún tipo de error, ni warning al ejecutar el script. - Los resultados que obtengo de smas[,2] y smas[,3] son diferentes a los que obtienes en los dos casos (el bueno y el malo). > smas[,2] [1] 17 NA 5 7 NA NA NA NA NA NA 17 NA 5 7 NA NA NA NA NA NA 17 NA 5 7 NA NA NA NA NA NA 17 NA 5 7 [35] NA NA NA NA NA > smas[,3] [1] 16 19 10 14 NA 5 NA NA 4 NA 16 19 10 14 NA 5 NA NA 4 NA 16 19 10 14 NA 5 NA NA 4 NA 16 19 10 14 [35] NA 5 NA NA 4 Y bueno, si hay tanta diferencia con respecto a lo que dices que debiera de salir, no he mirado mucho más. Pero de todas formas, para seguir el bucle, lo mejor es ir incluyendo variables intermedias e ir mostrándolas en consola. Aunque una estrategia mucho mejor es saber qué quieres hacer con tu fichero y ver si este triple bucle es la mejora forma de atacar el problema o hay alguna alternativa más eficiente y clara. Saludos, Carlos Ortega www.qualityexcellence.es El 19 de abril de 2016, 19:38, Manuel Máquezescribió: > Hola Colegas: > Tengo el siguiente script donde no se en donde esta el error, ojalá que > alguno de ustedes me pueda ayudar. > Anticipo las gracias más cumplidas por anticipado. > bas <- read.csv('TAB.csv', header = F) > sv <- 0 > sm <- 0 > lg <- 0 > smas <- matrix (1:390) > for (i in 1:39) { > # if (i == 8) {break} >for (j in 1:10) { > # sm[i] <- 0 > sm[j] <- 0 > for (k in 1:127) { > if(bas[i,k] == 0) next(j) > if(bas[i, k] == j) > sm[j] <- sm[j] + 1 > # smas <- matrix (sm, 10, i) > sv[j*i] <- sm[j] > smas <- matrix (sv, 39, i, byrow = T) > lg <- lg + sm[j] # sm es el ultimo valor de sm > # sm[j + 1] <- 0 > } # de k >} # de j > } # de i > # ME DA warnings PERO DA RESULTADOS INCORRECTOS > # AL PONER smas [,2] da 17 10 8 3 7 4 3 9 6 10 debiendo ser 17 19 16 9 5 > 11 5 2 5 3 > # AL PONER smas [,3] da 10 17 10 8 3 7 4 3 9 6 debiendo ser 16 15 9 11 8 9 > 7 5 3 2 > > sv tampoco me proporciona resultados completos; parece que al cambiar de i > <- 1 a 2 se le perdiera la pista de en dónde se encuentra y la verdad no > encuentro de donde toma los resultados que saca; lo que sí me parece es que > recicla algún otro vector. > Adjunto el archivo Tab.csv. > Reitero las gracias por la atención que se sirvan darme. > Atentamente, > > *MANOLO MÁRQUEZ P.* > > ___ > R-help-es mailing list > R-help-es@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-help-es > -- Saludos, Carlos Ortega www.qualityexcellence.es [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R] Merge sort
On 19/04/2016 3:39 PM, Gaston wrote: Hello everyone, I am learning R since recently, and as a small exercise I wanted to write a recursive mergesort. I was extremely surprised to discover that my sorting, although operational, is deeply inefficient in time. Here is my code : merge <- function(x,y){ if (is.na(x[1])) return(y) else if (is.na(y[1])) return(x) else if (x[1]0 && length(x2) > 0) { # compare the first values if (x1[1] < x2[1]) { result[i + 1] <- x1[1] x1 <- x1[-1] } else { result[i + 1] <- x2[1] x2 <- x2[-1] } i <- i + 1 } # put the smaller one into the result # delete it from whichever vector it came from # repeat until one of x1 or x2 is empty # copy both vectors (one is empty!) onto the end of the results result <- c(result, x1, x2) result } If I were going for speed, I wouldn't modify the x1 and x2 vectors, and I'd pre-allocate result to the appropriate length, rather than growing it in the while loop. But that was a different class! Duncan Murdoch __ 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-contained, reproducible code.
[R] Merge sort
Hello everyone, I am learning R since recently, and as a small exercise I wanted to write a recursive mergesort. I was extremely surprised to discover that my sorting, although operational, is deeply inefficient in time. Here is my code : > merge <- function(x,y){ > if (is.na(x[1])) return(y) > else if (is.na(y[1])) return(x) > else if (x[1]else return(c(y[1],merge(x,y[-1]))) > } > > division <- function(x){ > if (is.na(x[3])) return(cbind(x[1],x[2])) > else > return(cbind(c(x[1],division(x[-c(1,2)])[,1]),c(x[2],division(x[-c(1,2)])[,2]))) > } > > mergesort <- function(x){ > if (is.na(x[2])) return(x) > else{ > print(x) > t=division(x) > return(merge(mergesort(t[,1]),mergesort(t[,2]))) > } > } I tried my best to write it "the R-way", but apparently I failed. I suppose some of the functions I used are quite heavy. I would be grateful if you could give a hint on how to change that! I hope I made myself clear and wish you a nice day, Cheers, Gaston [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R] Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
Using the Matrix package, how can I create a row-oriented sparse Matrix from scratch populated with some data? By default a column-oriented one is created and I'm aware of the note that the package is optimized for column-oriented ones, but I'm only interested in using it for holding my sparse row-oriented data and doing basic subsetting by rows (even using drop=FALSE). Here is what I get when I set up a column-oriented sparse Matrix: > Cc <- Matrix(0, nrow=5, ncol=5, sparse=TRUE) > Cc[1:3,1] <- 1 > Cc 5 x 5 sparse Matrix of class "dgCMatrix" [1,] 1 . . . . [2,] 1 . . . . [3,] 1 . . . . [4,] . . . . . [5,] . . . . . > str(Cc) Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:3] 0 1 2 ..@ p : int [1:6] 0 3 3 3 3 3 ..@ Dim : int [1:2] 5 5 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num [1:3] 1 1 1 ..@ factors : list() When I try to do the analogue for a row-oriented matrix, I get a "dgTMatrix", whereas I would expect a "dgRMatrix": > Cr <- Matrix(0, nrow=5, ncol=5, sparse=TRUE) > Cr <- as(Cr, "dsRMatrix") > Cr[1,1:3] <- 1 > Cr 5 x 5 sparse Matrix of class "dgTMatrix" [1,] 1 1 1 . . [2,] . . . . . [3,] . . . . . [4,] . . . . . [5,] . . . . . > str(Cr) Formal class 'dgTMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:3] 0 0 0 ..@ j : int [1:3] 0 1 2 ..@ Dim : int [1:2] 5 5 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num [1:3] 1 1 1 ..@ factors : list() Trying with explicit coercion does not work: > as(Cc, "dgRMatrix") Error in as(Cc, "dgRMatrix") : no method or default for coercing "dgCMatrix" to "dgRMatrix" > as(Cr, "dgRMatrix") Error in as(Cr, "dgRMatrix") : no method or default for coercing "dgTMatrix" to "dgRMatrix" Am I doing some wrong here? Or is this what means that the package is optimized for the column-oriented representation and I shouldn't really work with row-oriented ones? I'm really only interested in access to efficient Cr[row,,drop=FALSE] subsetting (and a small memory footprint). Thanks, Henrik __ 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-contained, reproducible code.
Re: [R] installation of dplyr
Hi, OK - that can be fixed by our IT whizzes. Thanks, Ben P.S. Thanks for dplyr! > On Apr 19, 2016, at 4:10 PM, Hadley Wickhamwrote: > > You normally see these errors when compiling on a vm that has very > little memory. > Hadley > > On Tue, Apr 19, 2016 at 2:47 PM, Ben Tupper wrote: >> Hello, >> >> I am getting a fresh CentOS 6.7 machine set up with all of the goodies for R >> 3.2.3, including dplyr package. I am unable to successfully install it. >> Below I show the failed installation using utils::install.packages() and >> then again using devtools::install_github(). Each yields an error similar >> to the other but not quite exactly the same - the error messages sail right >> over my head. >> >> I can contact the package author if that would be better, but thought it >> best to start here. >> >> Thanks! >> Ben >> >> Ben Tupper >> Bigelow Laboratory for Ocean Sciences >> 60 Bigelow Drive, P.O. Box 380 >> East Boothbay, Maine 04544 >> http://www.bigelow.org >> >>> sessionInfo() >> R version 3.2.3 (2015-12-10) >> Platform: x86_64-redhat-linux-gnu (64-bit) >> Running under: CentOS release 6.7 (Final) >> >> locale: >> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >> [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 >> [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 >> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C >> [9] LC_ADDRESS=C LC_TELEPHONE=C >> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> >> >> >> # utils::install.packages() >> >> >>> install.packages("dplyr", repo = "http://cran.r-project.org;) >> Installing package into ‘/usr/lib64/R/library’ >> (as ‘lib’ is unspecified) >> trying URL 'http://cran.r-project.org/src/contrib/dplyr_0.4.3.tar.gz' >> Content type 'application/x-gzip' length 655997 bytes (640 KB) >> == >> downloaded 640 KB >> >> * installing *source* package ‘dplyr’ ... >> ** package ‘dplyr’ successfully unpacked and MD5 sums checked >> ** libs >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o >> RcppExports.o >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c address.cpp -o address.o >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c api.cpp -o api.o >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c arrange.cpp -o arrange.o >> In file included from ../inst/include/dplyr.h:131, >> from arrange.cpp:1: >> ../inst/include/dplyr/DataFrameSubsetVisitors.h: In constructor >> ‘dplyr::DataFrameSubsetVisitors::DataFrameSubsetVisitors(const >> Rcpp::DataFrame&, const Rcpp::CharacterVector&)’: >> ../inst/include/dplyr/DataFrameSubsetVisitors.h:40: warning: ‘column’ may be >> used uninitialized in this function >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c between.cpp -o between.o >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c bind.cpp -o bind.o >> g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR >> -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" >> -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector >> --param=ssp-buffer-size=4 -m64 -mtune=generic -c combine_variables.cpp -o >> combine_variables.o >> g++
Re: [R] installation of dplyr
You normally see these errors when compiling on a vm that has very little memory. Hadley On Tue, Apr 19, 2016 at 2:47 PM, Ben Tupperwrote: > Hello, > > I am getting a fresh CentOS 6.7 machine set up with all of the goodies for R > 3.2.3, including dplyr package. I am unable to successfully install it. > Below I show the failed installation using utils::install.packages() and then > again using devtools::install_github(). Each yields an error similar to the > other but not quite exactly the same - the error messages sail right over my > head. > > I can contact the package author if that would be better, but thought it best > to start here. > > Thanks! > Ben > > Ben Tupper > Bigelow Laboratory for Ocean Sciences > 60 Bigelow Drive, P.O. Box 380 > East Boothbay, Maine 04544 > http://www.bigelow.org > >> sessionInfo() > R version 3.2.3 (2015-12-10) > Platform: x86_64-redhat-linux-gnu (64-bit) > Running under: CentOS release 6.7 (Final) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > > > > # utils::install.packages() > > >> install.packages("dplyr", repo = "http://cran.r-project.org;) > Installing package into ‘/usr/lib64/R/library’ > (as ‘lib’ is unspecified) > trying URL 'http://cran.r-project.org/src/contrib/dplyr_0.4.3.tar.gz' > Content type 'application/x-gzip' length 655997 bytes (640 KB) > == > downloaded 640 KB > > * installing *source* package ‘dplyr’ ... > ** package ‘dplyr’ successfully unpacked and MD5 sums checked > ** libs > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o > RcppExports.o > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c address.cpp -o address.o > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c api.cpp -o api.o > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c arrange.cpp -o arrange.o > In file included from ../inst/include/dplyr.h:131, > from arrange.cpp:1: > ../inst/include/dplyr/DataFrameSubsetVisitors.h: In constructor > ‘dplyr::DataFrameSubsetVisitors::DataFrameSubsetVisitors(const > Rcpp::DataFrame&, const Rcpp::CharacterVector&)’: > ../inst/include/dplyr/DataFrameSubsetVisitors.h:40: warning: ‘column’ may be > used uninitialized in this function > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c between.cpp -o between.o > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c bind.cpp -o bind.o > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4 -m64 -mtune=generic -c combine_variables.cpp -o > combine_variables.o > g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR > -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" > -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > --param=ssp-buffer-size=4
Re: [R] Interquartile Range
If you show us, not just tell us about, a self-contained example someone might show you a non-hacky way of getting the job done. (I don't see an argument to plyr::ddply called 'transform'.) Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 19, 2016 at 12:18 PM, Michael Artzwrote: > Oh thanks for that clarification Bert! Hope you enjoyed your coffee! I > ended up just using the transform argument in the ddply function. It > worked and it repeated, then I called a mode function in another call to > ddply that summarised. Kinda hacky but oh well! > > On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunter > wrote: > >> ... and I'm getting another cup of coffee... >> >> -- Bert >> Bert Gunter >> >> "The trouble with having an open mind is that people keep coming along >> and sticking things into it." >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> >> >> On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter >> wrote: >> > NO NO -- I am wrong! The paste() expression is of course evaluated. >> > It's just that a character string is returned of the form "something - >> > something". >> > >> > I apologize for the confusion. >> > >> > -- Bert >> > >> > >> > >> > >> > Bert Gunter >> > >> > "The trouble with having an open mind is that people keep coming along >> > and sticking things into it." >> > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> > >> > >> > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter >> wrote: >> >> To be precise: >> >> >> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >> >> >> is an expression that evaluates to a character string: >> >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >> >> >> >> no matter what the argument of your function, x. Hence >> >> >> >> return(paste(...)) will return this exact character string and never >> >> evaluates x. >> >> >> >> >> >> 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 Breathed in his "Bloom County" comic strip ) >> >> >> >> >> >> On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-help >> >> wrote: >> That didn't work Jim! >> >>> >> >>> It always helps to say how the suggestion did not work. Jim's >> >>> function had a typo in it - was that the problem? Or did you not >> >>> change the call to ddply to use that function. Here is something >> >>> that might "work" for you: >> >>> >> >>> library(plyr) >> >>> >> >>> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) >> >>> myIqr <- function(x) { >> >>> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >>> } >> >>> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), >> >>> col1_IQR=stats::IQR(col1)) >> >>> # groupColumn col1_myIqr col1_IQR >> >>> #1 11-10 >> >>> #2 22-41 >> >>> #3 3 12-24 12 >> >>> #4 4112-320 208 >> >>> #5 5 2048-8192 6144 >> >>> >> >>> The important point is that >> >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >>> is not a function, it is an expression. ddplyr wants functions. >> >>> >> >>> >> >>> Bill Dunlap >> >>> TIBCO Software >> >>> wdunlap tibco.com >> >>> >> >>> On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz > > >> >>> wrote: >> >>> >> That didn't work Jim! >> >> Thanks anyway >> >> On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon >> wrote: >> >> > Hi Michael, >> > At a guess, try this: >> > >> > iqr<-function(x) { >> > >> >> return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> > } >> > >> > .col3_Range=iqr(datat$tenure) >> > >> > Jim >> > >> > >> > >> > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz < >> michaelea...@gmail.com> >> > wrote: >> > > Hi, >> > > I am trying to show an interquartile range while grouping >> values >> using >> > > the function ddply(). So my function call now is like >> > > >> > > groupedAll <- ddply(data >> > > ,~groupColumn >> > > ,summarise >> > > ,col1_mean=mean(col1) >> > > ,col2_mode=Mode(col2) #Function I wrote for >> getting >> the >> > > mode shown below >> > > >> > > >> ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, >> > > as.character(round(quantile(data$tenure,c(.75, sep = "-") >> > > ) >> > > >> > > #custom Mode function >> > > Mode <- function(x) { >> > > ux <- unique(x) >>
[R] installation of dplyr
Hello, I am getting a fresh CentOS 6.7 machine set up with all of the goodies for R 3.2.3, including dplyr package. I am unable to successfully install it. Below I show the failed installation using utils::install.packages() and then again using devtools::install_github(). Each yields an error similar to the other but not quite exactly the same - the error messages sail right over my head. I can contact the package author if that would be better, but thought it best to start here. Thanks! Ben Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org > sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: CentOS release 6.7 (Final) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base # utils::install.packages() > install.packages("dplyr", repo = "http://cran.r-project.org;) Installing package into ‘/usr/lib64/R/library’ (as ‘lib’ is unspecified) trying URL 'http://cran.r-project.org/src/contrib/dplyr_0.4.3.tar.gz' Content type 'application/x-gzip' length 655997 bytes (640 KB) == downloaded 640 KB * installing *source* package ‘dplyr’ ... ** package ‘dplyr’ successfully unpacked and MD5 sums checked ** libs g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c address.cpp -o address.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c api.cpp -o api.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c arrange.cpp -o arrange.o In file included from ../inst/include/dplyr.h:131, from arrange.cpp:1: ../inst/include/dplyr/DataFrameSubsetVisitors.h: In constructor ‘dplyr::DataFrameSubsetVisitors::DataFrameSubsetVisitors(const Rcpp::DataFrame&, const Rcpp::CharacterVector&)’: ../inst/include/dplyr/DataFrameSubsetVisitors.h:40: warning: ‘column’ may be used uninitialized in this function g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c between.cpp -o between.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c bind.cpp -o bind.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c combine_variables.cpp -o combine_variables.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c distinct.cpp -o distinct.o g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
Re: [R] Interquartile Range
Oh thanks for that clarification Bert! Hope you enjoyed your coffee! I ended up just using the transform argument in the ddply function. It worked and it repeated, then I called a mode function in another call to ddply that summarised. Kinda hacky but oh well! On Tue, Apr 19, 2016 at 12:31 PM, Bert Gunterwrote: > ... and I'm getting another cup of coffee... > > -- Bert > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter > wrote: > > NO NO -- I am wrong! The paste() expression is of course evaluated. > > It's just that a character string is returned of the form "something - > > something". > > > > I apologize for the confusion. > > > > -- Bert > > > > > > > > > > Bert Gunter > > > > "The trouble with having an open mind is that people keep coming along > > and sticking things into it." > > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > > > > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter > wrote: > >> To be precise: > >> > >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > >> > >> is an expression that evaluates to a character string: > >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" > >> > >> no matter what the argument of your function, x. Hence > >> > >> return(paste(...)) will return this exact character string and never > >> evaluates x. > >> > >> > >> 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 Breathed in his "Bloom County" comic strip ) > >> > >> > >> On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-help > >> wrote: > That didn't work Jim! > >>> > >>> It always helps to say how the suggestion did not work. Jim's > >>> function had a typo in it - was that the problem? Or did you not > >>> change the call to ddply to use that function. Here is something > >>> that might "work" for you: > >>> > >>> library(plyr) > >>> > >>> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) > >>> myIqr <- function(x) { > >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > >>> } > >>> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), > >>> col1_IQR=stats::IQR(col1)) > >>> # groupColumn col1_myIqr col1_IQR > >>> #1 11-10 > >>> #2 22-41 > >>> #3 3 12-24 12 > >>> #4 4112-320 208 > >>> #5 5 2048-8192 6144 > >>> > >>> The important point is that > >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > >>> is not a function, it is an expression. ddplyr wants functions. > >>> > >>> > >>> Bill Dunlap > >>> TIBCO Software > >>> wdunlap tibco.com > >>> > >>> On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz > >>> wrote: > >>> > That didn't work Jim! > > Thanks anyway > > On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon > wrote: > > > Hi Michael, > > At a guess, try this: > > > > iqr<-function(x) { > > > > return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > > } > > > > .col3_Range=iqr(datat$tenure) > > > > Jim > > > > > > > > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz < > michaelea...@gmail.com> > > wrote: > > > Hi, > > > I am trying to show an interquartile range while grouping values > using > > > the function ddply(). So my function call now is like > > > > > > groupedAll <- ddply(data > > > ,~groupColumn > > > ,summarise > > > ,col1_mean=mean(col1) > > > ,col2_mode=Mode(col2) #Function I wrote for > getting > the > > > mode shown below > > > > > > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, > > > as.character(round(quantile(data$tenure,c(.75, sep = "-") > > > ) > > > > > > #custom Mode function > > > Mode <- function(x) { > > > ux <- unique(x) > > > ux[which.max(tabulate(match(x, ux)))] > > > } > > > > > > I am not sre what is going wrong on my interquartile range > function, it > > > works on its own outside of ddply() > > > > > > [[alternative HTML version deleted]] > > > > > > __ > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > https://stat.ethz.ch/mailman/listinfo/r-help > > >
Re: [R] Problem with X11
Dear Lorenzo, Dear R list,[a] to all recipients: sorry, this email is html-against my own believes and because of inevitable constraints so far.[b] to Lorenzo: "...and I have recently update my R environment" sounds as that would be a gift of heaven! How did you manage to update and how exactly went the process of updating the whole R environment, as you put it? I turn to you since I have not received an understandable answer to that question yet (see [d] below for sessionInfo() details).[c] to all R users: I use as OS a debian derivative (Kubuntu) long-term service version; this spring/ early summer as I was told, a new LTS would be released. Has a new/ revised R version in release in 2016 any Achille's heel that is already known? I perceive that some of the (package) update issues I experience might be due to OS compatibility (see [d] below for sessionInfo() details).[d]> sessionInfo()R version 3.0.2 (2013-09-25)Platform: x86_64-pc-linux-gnu (64-bit)locale: [1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C [3] LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8 [5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8 [7] LC_PAPER=de_DE.UTF-8 LC_NAME=de_DE.UTF-8 [9] LC_ADDRESS=de_DE.UTF-8 LC_TELEPHONE=de_DE.UTF-8 [11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=de_DE.UTF-8attached base packages:[1] stats graphics grDevices utils datasets methods base other attached packages:[1] rkward_0.6.1loaded via a namespace (and not attached):[1] tools_3.0.2Best regards,Markus HofstetterLorenzo Isellaschrieb (19.04.2016 17:23):Dear All, I have never had this problem before. I run debian testing on my box and I have recently update my R environment. Now, see what happens when I try the most trivial of all plots > plot(seq(22)) Error in (function (display = "", width, height, pointsize, gamma, bg, : X11 module cannot be loaded In addition: Warning message: In (function (display = "", width, height, pointsize, gamma, bg, : unable to load shared object '/usr/lib/R/modules//R_X11.so': /usr/lib/x86_64-linux-gnu/libpng12.so.0: version `PNG12_0' not found (required by /usr/lib/R/modules//R_X11.so) and this is my sessionInfo() > sessionInfo() R version 3.2.4 Revised (2016-03-16 r70336) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux stretch/sid locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base Anybody understands what is going on here? Regards Lorenzo __ 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-contained, reproducible code. [[alternative HTML version deleted]] __ 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-contained, reproducible code.
Re: [R] Problem with X11
I don't have my debian box available so can't confirm. But I would try $apt-get install libpng On Tue, Apr 19, 2016 at 11:23 AM, Lorenzo Isellawrote: > Dear All, > I have never had this problem before. I run debian testing on my box > and I have recently update my R environment. > Now, see what happens when I try the most trivial of all plots > > plot(seq(22)) >> > Error in (function (display = "", width, height, pointsize, gamma, bg, > : > X11 module cannot be loaded > In addition: Warning message: > In (function (display = "", width, height, pointsize, gamma, bg, : >unable to load shared object '/usr/lib/R/modules//R_X11.so': > /usr/lib/x86_64-linux-gnu/libpng12.so.0: version `PNG12_0' not > found (required by /usr/lib/R/modules//R_X11.so) > > and this is my sessionInfo() > > sessionInfo() >> > R version 3.2.4 Revised (2016-03-16 r70336) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Debian GNU/Linux stretch/sid > > locale: > [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C > [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8 > [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8 >[7] LC_PAPER=en_GB.utf8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > > Anybody understands what is going on here? > Regards > > Lorenzo > > __ > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R-es] Script sin resultados completos
Hola Colegas: Tengo el siguiente script donde no se en donde esta el error, ojalá que alguno de ustedes me pueda ayudar. Anticipo las gracias más cumplidas por anticipado. bas <- read.csv('TAB.csv', header = F) sv <- 0 sm <- 0 lg <- 0 smas <- matrix (1:390) for (i in 1:39) { # if (i == 8) {break} for (j in 1:10) { # sm[i] <- 0 sm[j] <- 0 for (k in 1:127) { if(bas[i,k] == 0) next(j) if(bas[i, k] == j) sm[j] <- sm[j] + 1 # smas <- matrix (sm, 10, i) sv[j*i] <- sm[j] smas <- matrix (sv, 39, i, byrow = T) lg <- lg + sm[j] # sm es el ultimo valor de sm # sm[j + 1] <- 0 } # de k } # de j } # de i # ME DA warnings PERO DA RESULTADOS INCORRECTOS # AL PONER smas [,2] da 17 10 8 3 7 4 3 9 6 10 debiendo ser 17 19 16 9 5 11 5 2 5 3 # AL PONER smas [,3] da 10 17 10 8 3 7 4 3 9 6 debiendo ser 16 15 9 11 8 9 7 5 3 2 sv tampoco me proporciona resultados completos; parece que al cambiar de i <- 1 a 2 se le perdiera la pista de en dónde se encuentra y la verdad no encuentro de donde toma los resultados que saca; lo que sí me parece es que recicla algún otro vector. Adjunto el archivo Tab.csv. Reitero las gracias por la atención que se sirvan darme. Atentamente, *MANOLO MÁRQUEZ P.* 5,3,5,7,1,1,4,2,4,10,10,2,1,11,1,2,5,9,5,14,13,9,2,4,2,3,1,2,16,4,1,5,8,2,1,2,2,1,6,5,11,13,8,2,3,3,20,17,4,11,1,3,2,7,8,8,2,5,3,1,1,5,9,3,4,9,1,1,1,3,9,4,9,9,3,8,8,4,10,1,1,3,10,2,5,9,8,3,5,9,1,5,4,1,3,2,2,13,31,5,3,4,1,2,4,4,2,9,7,7,16,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,1,1,3,2,2,1,6,7,2,3,1,14,10,2,11,4,2,25,3,3,2,2,1,8,1,6,2,6,2,6,4,15,4,1,3,1,4,6,9,12,6,8,7,9,5,2,3,10,2,3,6,3,1,9,2,4,1,5,3,3,1,5,3,1,12,11,3,2,6,4,11,1,16,1,2,7,10,19,19,1,2,6,2,20,1,7,3,4,5,2,7,11,16,2,21,4,9,11,2,6,3,3,9,5,3,1,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,1,18,5,6,3,1,13,1,7,6,7,15,3,2,7,2,2,13,2,6,1,17,4,14,1,5,1,2,2,5,8,3,8,2,2,6,4,5,2,2,2,14,5,3,1,9,4,1,17,1,4,4,1,4,5,7,3,6,6,12,9,9,2,2,13,15,6,3,1,4,8,7,2,11,5,10,14,15,5,4,16,10,1,6,3,7,7,8,2,15,6,1,3,8,4,22,1,4,1,3,12,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 4,9,9,5,1,1,1,7,10,8,17,3,1,5,7,1,6,6,11,7,14,9,2,6,4,1,10,1,3,1,5,4,1,1,13,10,7,5,3,2,1,2,6,1,3,11,2,1,1,1,3,1,8,4,3,7,11,15,4,1,10,3,2,10,1,6,3,2,2,10,16,4,3,1,1,24,5,2,2,1,5,4,3,3,2,2,8,1,6,7,4,7,1,1,2,15,3,3,3,9,3,1,5,7,2,3,13,2,1,1,2,2,12,6,6,5,1,2,16,3,1,12,3,0,0,0,0,0,0,0 2,5,1,8,11,13,10,2,4,1,3,3,20,1,1,4,8,1,5,3,11,7,5,17,5,3,2,16,4,13,1,4,4,4,15,20,11,8,4,2,3,5,1,1,1,25,3,8,2,9,5,14,3,6,11,2,20,9,2,2,21,2,3,22,3,6,5,6,9,21,2,4,2,4,1,2,2,2,5,1,1,15,2,5,4,19,6,6,5,5,10,3,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,1,6,3,1,17,1,3,10,5,7,1,2,6,1,1,4,8,10,1,3,4,1,2,2,11,1,1,8,13,3,5,13,3,2,2,7,8,11,9,5,1,8,2,1,2,8,3,7,2,1,11,1,2,2,6,3,2,1,10,4,6,2,7,13,5,13,8,3,9,3,6,3,4,1,17,7,18,10,1,1,10,9,2,1,13,1,1,15,1,1,4,2,8,3,21,3,6,5,1,21,15,6,4,1,2,1,8,1,2,1,5,1,2,1,8,1,0,0,0,0,0,0,0,0,0,0,0,0,0 5,10,5,17,1,3,10,1,6,2,2,5,9,5,17,3,1,1,3,3,3,16,8,3,3,7,2,18,12,5,1,9,5,1,2,3,4,1,6,1,2,4,1,6,16,8,3,5,3,4,12,2,1,1,3,11,6,3,7,2,4,3,1,3,6,17,25,1,6,3,1,6,3,1,2,2,9,6,2,10,5,16,11,1,7,24,1,2,8,10,6,1,3,1,11,8,6,7,8,1,5,10,4,1,5,6,1,4,7,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,8,3,3,5,3,10,2,3,8,10,4,13,8,5,16,1,5,3,1,3,14,3,1,9,4,1,23,14,1,8,2,7,2,4,1,11,1,1,9,2,6,3,12,2,6,6,2,6,5,4,6,10,7,19,1,4,2,14,6,4,2,1,2,5,14,10,6,5,3,2,4,8,1,7,7,5,2,11,2,1,9,4,2,5,6,6,2,4,2,9,7,13,5,2,3,10,7,3,1,7,1,4,14,1,13,4,7,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,3,5,10,3,6,1,1,19,9,19,5,4,1,12,4,2,11,1,5,10,1,1,9,1,4,15,5,8,1,2,5,9,2,3,2,9,1,5,4,8,4,2,9,6,5,5,4,13,8,32,1,9,1,2,1,8,1,15,30,3,3,4,21,9,3,1,5,6,4,9,2,4,5,11,4,6,1,2,1,1,2,15,4,1,5,2,9,1,6,5,10,2,7,1,18,19,3,4,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 8,7,26,8,6,1,3,4,2,6,4,4,1,3,15,2,8,5,3,27,3,6,6,2,20,3,1,1,3,1,3,6,25,3,1,10,3,6,14,8,5,1,12,5,14,1,4,4,10,5,13,5,9,7,5,2,8,9,1,5,2,5,1,1,5,25,4,5,3,3,1,9,2,2,4,5,3,1,5,4,1,3,2,11,2,2,8,10,5,2,1,3,4,6,3,2,1,1,1,1,8,7,2,6,8,1,3,2,1,12,3,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 6,2,1,10,6,5,1,7,3,13,1,3,8,13,6,11,6,6,1,6,1,6,1,5,3,8,12,11,1,5,6,14,5,1,2,13,9,13,7,11,9,1,18,1,17,6,1,2,1,3,2,15,6,1,3,3,12,1,5,7,8,5,6,9,1,5,3,23,15,7,1,3,6,2,7,5,4,2,1,3,4,12,7,4,1,2,5,6,16,15,10,7,1,2,1,7,2,1,3,3,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 11,2,4,7,2,7,23,12,1,4,4,2,16,12,10,2,4,4,1,7,6,3,3,5,7,14,8,4,3,2,1,13,4,3,12,1,14,5,11,5,5,6,1,21,1,1,10,7,12,13,1,4,3,6,3,4,12,4,1,1,3,5,13,2,2,11,1,3,2,1,6,1,10,12,2,1,2,2,1,8,5,1,3,5,4,5,22,1,9,2,4,11,4,2,1,5,1,4,1,8,2,2,4,1,4,15,5,3,5,3,3,2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,1,2,1,5,19,8,4,4,5,1,2,7,13,2,8,2,5,3,1,8,25,4,1,16,1,4,5,5,15,5,11,19,4,4,5,3,3,10,2,12,1,8,1,6,12,8,2,3,8,5,3,1,1,6,1,2,7,7,3,5,4,1,3,4,1,5,4,7,6,1,2,11,8,1,1,17,5,2,1,1,5,9,3,6,6,6,9,1,2,2,1,5,2,8,6,10,18,20,1,11,23,2,1,10,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Re: [R] Interquartile Range
... and I'm getting another cup of coffee... -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunterwrote: > NO NO -- I am wrong! The paste() expression is of course evaluated. > It's just that a character string is returned of the form "something - > something". > > I apologize for the confusion. > > -- Bert > > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunter wrote: >> To be precise: >> >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> >> is an expression that evaluates to a character string: >> "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" >> >> no matter what the argument of your function, x. Hence >> >> return(paste(...)) will return this exact character string and never >> evaluates x. >> >> >> 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 Breathed in his "Bloom County" comic strip ) >> >> >> On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-help >> wrote: That didn't work Jim! >>> >>> It always helps to say how the suggestion did not work. Jim's >>> function had a typo in it - was that the problem? Or did you not >>> change the call to ddply to use that function. Here is something >>> that might "work" for you: >>> >>> library(plyr) >>> >>> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) >>> myIqr <- function(x) { >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> } >>> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), >>> col1_IQR=stats::IQR(col1)) >>> # groupColumn col1_myIqr col1_IQR >>> #1 11-10 >>> #2 22-41 >>> #3 3 12-24 12 >>> #4 4112-320 208 >>> #5 5 2048-8192 6144 >>> >>> The important point is that >>> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> is not a function, it is an expression. ddplyr wants functions. >>> >>> >>> Bill Dunlap >>> TIBCO Software >>> wdunlap tibco.com >>> >>> On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz >>> wrote: >>> That didn't work Jim! Thanks anyway On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: > Hi Michael, > At a guess, try this: > > iqr<-function(x) { > return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > } > > .col3_Range=iqr(datat$tenure) > > Jim > > > > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz > wrote: > > Hi, > > I am trying to show an interquartile range while grouping values using > > the function ddply(). So my function call now is like > > > > groupedAll <- ddply(data > > ,~groupColumn > > ,summarise > > ,col1_mean=mean(col1) > > ,col2_mode=Mode(col2) #Function I wrote for getting the > > mode shown below > > > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, > > as.character(round(quantile(data$tenure,c(.75, sep = "-") > > ) > > > > #custom Mode function > > Mode <- function(x) { > > ux <- unique(x) > > ux[which.max(tabulate(match(x, ux)))] > > } > > > > I am not sre what is going wrong on my interquartile range function, it > > works on its own outside of ddply() > > > > [[alternative HTML version deleted]] > > > > __ > > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code. >>> >>> [[alternative HTML version deleted]] >>> >>>
Re: [R] Interquartile Range
NO NO -- I am wrong! The paste() expression is of course evaluated. It's just that a character string is returned of the form "something - something". I apologize for the confusion. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 10:25 AM, Bert Gunterwrote: > To be precise: > > paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > > is an expression that evaluates to a character string: > "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" > > no matter what the argument of your function, x. Hence > > return(paste(...)) will return this exact character string and never > evaluates x. > > > 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 Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-help > wrote: >>> That didn't work Jim! >> >> It always helps to say how the suggestion did not work. Jim's >> function had a typo in it - was that the problem? Or did you not >> change the call to ddply to use that function. Here is something >> that might "work" for you: >> >> library(plyr) >> >> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) >> myIqr <- function(x) { >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> } >> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), >> col1_IQR=stats::IQR(col1)) >> # groupColumn col1_myIqr col1_IQR >> #1 11-10 >> #2 22-41 >> #3 3 12-24 12 >> #4 4112-320 208 >> #5 5 2048-8192 6144 >> >> The important point is that >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> is not a function, it is an expression. ddplyr wants functions. >> >> >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com >> >> On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz >> wrote: >> >>> That didn't work Jim! >>> >>> Thanks anyway >>> >>> On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: >>> >>> > Hi Michael, >>> > At a guess, try this: >>> > >>> > iqr<-function(x) { >>> > >>> return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> > } >>> > >>> > .col3_Range=iqr(datat$tenure) >>> > >>> > Jim >>> > >>> > >>> > >>> > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz >>> > wrote: >>> > > Hi, >>> > > I am trying to show an interquartile range while grouping values >>> using >>> > > the function ddply(). So my function call now is like >>> > > >>> > > groupedAll <- ddply(data >>> > > ,~groupColumn >>> > > ,summarise >>> > > ,col1_mean=mean(col1) >>> > > ,col2_mode=Mode(col2) #Function I wrote for getting >>> the >>> > > mode shown below >>> > > >>> > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, >>> > > as.character(round(quantile(data$tenure,c(.75, sep = "-") >>> > > ) >>> > > >>> > > #custom Mode function >>> > > Mode <- function(x) { >>> > > ux <- unique(x) >>> > > ux[which.max(tabulate(match(x, ux)))] >>> > > } >>> > > >>> > > I am not sre what is going wrong on my interquartile range function, it >>> > > works on its own outside of ddply() >>> > > >>> > > [[alternative HTML version deleted]] >>> > > >>> > > __ >>> > > 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-contained, reproducible code. >>> > >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> 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-contained, reproducible code. >>> >> >> [[alternative HTML version deleted]] >> >> __ >> 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-contained, reproducible code. __ 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
Re: [R] Interquartile Range
To be precise: paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") is an expression that evaluates to a character string: "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" no matter what the argument of your function, x. Hence return(paste(...)) will return this exact character string and never evaluates x. 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 Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 8:34 AM, William Dunlap via R-helpwrote: >> That didn't work Jim! > > It always helps to say how the suggestion did not work. Jim's > function had a typo in it - was that the problem? Or did you not > change the call to ddply to use that function. Here is something > that might "work" for you: > > library(plyr) > > data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) > myIqr <- function(x) { > paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > } > ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), > col1_IQR=stats::IQR(col1)) > # groupColumn col1_myIqr col1_IQR > #1 11-10 > #2 22-41 > #3 3 12-24 12 > #4 4112-320 208 > #5 5 2048-8192 6144 > > The important point is that > paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > is not a function, it is an expression. ddplyr wants functions. > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz > wrote: > >> That didn't work Jim! >> >> Thanks anyway >> >> On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: >> >> > Hi Michael, >> > At a guess, try this: >> > >> > iqr<-function(x) { >> > >> return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> > } >> > >> > .col3_Range=iqr(datat$tenure) >> > >> > Jim >> > >> > >> > >> > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz >> > wrote: >> > > Hi, >> > > I am trying to show an interquartile range while grouping values >> using >> > > the function ddply(). So my function call now is like >> > > >> > > groupedAll <- ddply(data >> > > ,~groupColumn >> > > ,summarise >> > > ,col1_mean=mean(col1) >> > > ,col2_mode=Mode(col2) #Function I wrote for getting >> the >> > > mode shown below >> > > >> > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, >> > > as.character(round(quantile(data$tenure,c(.75, sep = "-") >> > > ) >> > > >> > > #custom Mode function >> > > Mode <- function(x) { >> > > ux <- unique(x) >> > > ux[which.max(tabulate(match(x, ux)))] >> > > } >> > > >> > > I am not sre what is going wrong on my interquartile range function, it >> > > works on its own outside of ddply() >> > > >> > > [[alternative HTML version deleted]] >> > > >> > > __ >> > > 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-contained, reproducible code. >> > >> >> [[alternative HTML version deleted]] >> >> __ >> 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-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
Re: [R] Interquartile Range
Can you show us a self-contained example, along with the output of running conflicts()? Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 19, 2016 at 8:57 AM, Michael Artzwrote: > HI that did not work for me either. The value I got returned from that > function was " - " :(. thanks for the reply > through > > On Tue, Apr 19, 2016 at 10:34 AM, William Dunlap > wrote: > >> > That didn't work Jim! >> >> It always helps to say how the suggestion did not work. Jim's >> function had a typo in it - was that the problem? Or did you not >> change the call to ddply to use that function. Here is something >> that might "work" for you: >> >> library(plyr) >> >> data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) >> myIqr <- function(x) { >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> } >> ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), >> col1_IQR=stats::IQR(col1)) >> # groupColumn col1_myIqr col1_IQR >> #1 11-10 >> #2 22-41 >> #3 3 12-24 12 >> #4 4112-320 208 >> #5 5 2048-8192 6144 >> >> The important point is that >> paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> is not a function, it is an expression. ddplyr wants functions. >> >> >> Bill Dunlap >> TIBCO Software >> wdunlap tibco.com >> >> On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz >> wrote: >> >>> That didn't work Jim! >>> >>> Thanks anyway >>> >>> On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: >>> >>> > Hi Michael, >>> > At a guess, try this: >>> > >>> > iqr<-function(x) { >>> > >>> return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >>> > } >>> > >>> > .col3_Range=iqr(datat$tenure) >>> > >>> > Jim >>> > >>> > >>> > >>> > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz >> > >>> > wrote: >>> > > Hi, >>> > > I am trying to show an interquartile range while grouping values >>> using >>> > > the function ddply(). So my function call now is like >>> > > >>> > > groupedAll <- ddply(data >>> > > ,~groupColumn >>> > > ,summarise >>> > > ,col1_mean=mean(col1) >>> > > ,col2_mode=Mode(col2) #Function I wrote for getting >>> the >>> > > mode shown below >>> > > >>> > > >>> ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, >>> > > as.character(round(quantile(data$tenure,c(.75, sep = "-") >>> > > ) >>> > > >>> > > #custom Mode function >>> > > Mode <- function(x) { >>> > > ux <- unique(x) >>> > > ux[which.max(tabulate(match(x, ux)))] >>> > > } >>> > > >>> > > I am not sre what is going wrong on my interquartile range function, >>> it >>> > > works on its own outside of ddply() >>> > > >>> > > [[alternative HTML version deleted]] >>> > > >>> > > __ >>> > > 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-contained, reproducible code. >>> > >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> 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-contained, reproducible code. >>> >> >> > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
Re: [R] Interquartile Range
HI that did not work for me either. The value I got returned from that function was " - " :(. thanks for the reply through On Tue, Apr 19, 2016 at 10:34 AM, William Dunlapwrote: > > That didn't work Jim! > > It always helps to say how the suggestion did not work. Jim's > function had a typo in it - was that the problem? Or did you not > change the call to ddply to use that function. Here is something > that might "work" for you: > > library(plyr) > > data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) > myIqr <- function(x) { > paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > } > ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), > col1_IQR=stats::IQR(col1)) > # groupColumn col1_myIqr col1_IQR > #1 11-10 > #2 22-41 > #3 3 12-24 12 > #4 4112-320 208 > #5 5 2048-8192 6144 > > The important point is that > paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > is not a function, it is an expression. ddplyr wants functions. > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz > wrote: > >> That didn't work Jim! >> >> Thanks anyway >> >> On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: >> >> > Hi Michael, >> > At a guess, try this: >> > >> > iqr<-function(x) { >> > >> return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> > } >> > >> > .col3_Range=iqr(datat$tenure) >> > >> > Jim >> > >> > >> > >> > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz >> > wrote: >> > > Hi, >> > > I am trying to show an interquartile range while grouping values >> using >> > > the function ddply(). So my function call now is like >> > > >> > > groupedAll <- ddply(data >> > > ,~groupColumn >> > > ,summarise >> > > ,col1_mean=mean(col1) >> > > ,col2_mode=Mode(col2) #Function I wrote for getting >> the >> > > mode shown below >> > > >> > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, >> > > as.character(round(quantile(data$tenure,c(.75, sep = "-") >> > > ) >> > > >> > > #custom Mode function >> > > Mode <- function(x) { >> > > ux <- unique(x) >> > > ux[which.max(tabulate(match(x, ux)))] >> > > } >> > > >> > > I am not sre what is going wrong on my interquartile range function, >> it >> > > works on its own outside of ddply() >> > > >> > > [[alternative HTML version deleted]] >> > > >> > > __ >> > > 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-contained, reproducible code. >> > >> >> [[alternative HTML version deleted]] >> >> __ >> 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-contained, reproducible code. >> > > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
Re: [R] Problem with X11
Probably wrong list, but anyway: Same problem here, after a apt-get dist-upgrade On Tuesday, April 19, 2016 05:23:37 PM Lorenzo Isella wrote: > Dear All, > I have never had this problem before. I run debian testing on my box > and I have recently update my R environment. > Now, see what happens when I try the most trivial of all plots > > > plot(seq(22)) > Error in (function (display = "", width, height, pointsize, gamma, bg, > : > X11 module cannot be loaded > In addition: Warning message: > In (function (display = "", width, height, pointsize, gamma, bg, : > unable to load shared object '/usr/lib/R/modules//R_X11.so': > /usr/lib/x86_64-linux-gnu/libpng12.so.0: version `PNG12_0' not > found (required by /usr/lib/R/modules//R_X11.so) > > and this is my sessionInfo() > > > sessionInfo() > R version 3.2.4 Revised (2016-03-16 r70336) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Debian GNU/Linux stretch/sid > > locale: > [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C > [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8 >[5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8 > [7] LC_PAPER=en_GB.utf8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > > Anybody understands what is going on here? > Regards > > Lorenzo > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
Re: [R] Interquartile Range
> That didn't work Jim! It always helps to say how the suggestion did not work. Jim's function had a typo in it - was that the problem? Or did you not change the call to ddply to use that function. Here is something that might "work" for you: library(plyr) data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) myIqr <- function(x) { paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") } ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1), col1_IQR=stats::IQR(col1)) # groupColumn col1_myIqr col1_IQR #1 11-10 #2 22-41 #3 3 12-24 12 #4 4112-320 208 #5 5 2048-8192 6144 The important point is that paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") is not a function, it is an expression. ddplyr wants functions. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 19, 2016 at 7:56 AM, Michael Artzwrote: > That didn't work Jim! > > Thanks anyway > > On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: > > > Hi Michael, > > At a guess, try this: > > > > iqr<-function(x) { > > > return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > > } > > > > .col3_Range=iqr(datat$tenure) > > > > Jim > > > > > > > > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz > > wrote: > > > Hi, > > > I am trying to show an interquartile range while grouping values > using > > > the function ddply(). So my function call now is like > > > > > > groupedAll <- ddply(data > > > ,~groupColumn > > > ,summarise > > > ,col1_mean=mean(col1) > > > ,col2_mode=Mode(col2) #Function I wrote for getting > the > > > mode shown below > > > > > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, > > > as.character(round(quantile(data$tenure,c(.75, sep = "-") > > > ) > > > > > > #custom Mode function > > > Mode <- function(x) { > > > ux <- unique(x) > > > ux[which.max(tabulate(match(x, ux)))] > > > } > > > > > > I am not sre what is going wrong on my interquartile range function, it > > > works on its own outside of ddply() > > > > > > [[alternative HTML version deleted]] > > > > > > __ > > > 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-contained, reproducible code. > > > > [[alternative HTML version deleted]] > > __ > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
Re: [R] Interquartile Range
Hi bert, I understand the difference between a character string and a number. I need to return a character string, that is a requirement. It needs to be in that format. Getting the range with IQR is trivial I already tried it. The grouping function accepts only one return value, and IQR returns two. Thanks for the reply though sir. On Apr 19, 2016 10:20 AM, "Bert Gunter"wrote: > Are you aware that there *already is* a function that does this? > > ?IQR > > (also your "function" iqr" is just a character string and would have > to be parsed and evaluated to become a function. But this is a > TERRIBLE way to do things in R as it completely circumvents R's > central functional programming paradigm). > > 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 Breathed in his "Bloom County" comic strip ) > > > On Tue, Apr 19, 2016 at 7:56 AM, Michael Artz > wrote: > > That didn't work Jim! > > > > Thanks anyway > > > > On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: > > > >> Hi Michael, > >> At a guess, try this: > >> > >> iqr<-function(x) { > >> > return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > >> } > >> > >> .col3_Range=iqr(datat$tenure) > >> > >> Jim > >> > >> > >> > >> On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz > >> wrote: > >> > Hi, > >> > I am trying to show an interquartile range while grouping values > using > >> > the function ddply(). So my function call now is like > >> > > >> > groupedAll <- ddply(data > >> > ,~groupColumn > >> > ,summarise > >> > ,col1_mean=mean(col1) > >> > ,col2_mode=Mode(col2) #Function I wrote for getting > the > >> > mode shown below > >> > > >> > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, > >> > as.character(round(quantile(data$tenure,c(.75, sep = "-") > >> > ) > >> > > >> > #custom Mode function > >> > Mode <- function(x) { > >> > ux <- unique(x) > >> > ux[which.max(tabulate(match(x, ux)))] > >> > } > >> > > >> > I am not sre what is going wrong on my interquartile range function, > it > >> > works on its own outside of ddply() > >> > > >> > [[alternative HTML version deleted]] > >> > > >> > __ > >> > 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-contained, reproducible code. > >> > > > > [[alternative HTML version deleted]] > > > > __ > > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R] Problem with X11
Dear All, I have never had this problem before. I run debian testing on my box and I have recently update my R environment. Now, see what happens when I try the most trivial of all plots plot(seq(22)) Error in (function (display = "", width, height, pointsize, gamma, bg, : X11 module cannot be loaded In addition: Warning message: In (function (display = "", width, height, pointsize, gamma, bg, : unable to load shared object '/usr/lib/R/modules//R_X11.so': /usr/lib/x86_64-linux-gnu/libpng12.so.0: version `PNG12_0' not found (required by /usr/lib/R/modules//R_X11.so) and this is my sessionInfo() sessionInfo() R version 3.2.4 Revised (2016-03-16 r70336) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux stretch/sid locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base Anybody understands what is going on here? Regards Lorenzo __ 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-contained, reproducible code.
Re: [R] Interquartile Range
Are you aware that there *already is* a function that does this? ?IQR (also your "function" iqr" is just a character string and would have to be parsed and evaluated to become a function. But this is a TERRIBLE way to do things in R as it completely circumvents R's central functional programming paradigm). 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 Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 7:56 AM, Michael Artzwrote: > That didn't work Jim! > > Thanks anyway > > On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemon wrote: > >> Hi Michael, >> At a guess, try this: >> >> iqr<-function(x) { >> return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") >> } >> >> .col3_Range=iqr(datat$tenure) >> >> Jim >> >> >> >> On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz >> wrote: >> > Hi, >> > I am trying to show an interquartile range while grouping values using >> > the function ddply(). So my function call now is like >> > >> > groupedAll <- ddply(data >> > ,~groupColumn >> > ,summarise >> > ,col1_mean=mean(col1) >> > ,col2_mode=Mode(col2) #Function I wrote for getting the >> > mode shown below >> > >> > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, >> > as.character(round(quantile(data$tenure,c(.75, sep = "-") >> > ) >> > >> > #custom Mode function >> > Mode <- function(x) { >> > ux <- unique(x) >> > ux[which.max(tabulate(match(x, ux)))] >> > } >> > >> > I am not sre what is going wrong on my interquartile range function, it >> > works on its own outside of ddply() >> > >> > [[alternative HTML version deleted]] >> > >> > __ >> > 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-contained, reproducible code. >> > > [[alternative HTML version deleted]] > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
Re: [R] Interquartile Range
That didn't work Jim! Thanks anyway On Mon, Apr 18, 2016 at 9:02 PM, Jim Lemonwrote: > Hi Michael, > At a guess, try this: > > iqr<-function(x) { > return(paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") > } > > .col3_Range=iqr(datat$tenure) > > Jim > > > > On Tue, Apr 19, 2016 at 11:15 AM, Michael Artz > wrote: > > Hi, > > I am trying to show an interquartile range while grouping values using > > the function ddply(). So my function call now is like > > > > groupedAll <- ddply(data > > ,~groupColumn > > ,summarise > > ,col1_mean=mean(col1) > > ,col2_mode=Mode(col2) #Function I wrote for getting the > > mode shown below > > > > ,col3_Range=paste(as.character(round(quantile(datat$tenure,c(.25, > > as.character(round(quantile(data$tenure,c(.75, sep = "-") > > ) > > > > #custom Mode function > > Mode <- function(x) { > > ux <- unique(x) > > ux[which.max(tabulate(match(x, ux)))] > > } > > > > I am not sre what is going wrong on my interquartile range function, it > > works on its own outside of ddply() > > > > [[alternative HTML version deleted]] > > > > __ > > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
Re: [R] Indicator Species analysis; trouble with multipatt
Hi Ansley It looks good to me but I did not run the analysis as I am too lazy to install "indicspecies". The inclusion of the raw data is a great help. John Kane Kingston ON Canada -Original Message- From: daily.p...@gmail.com Sent: Tue, 19 Apr 2016 08:16:54 -0400 To: jrkrid...@inbox.com Subject: Re: [R] Indicator Species analysis; trouble with multipatt Thanks for the replies. I have fixed the problem. I only need to reorganized my data. Now my question is about asking questions correctly. I hope I've got it. Please find the script attached here. R Version 3.2.2 I am looking for indicator species with Indicspecies package. After running the function multipatt, I get the following error: Error in is.factor(x) : object 'groups1' not found **Is this reproducibility satisfactory? I fixed the problem by reorganizing my csv file. I was trying to be efficient when making my groups and that was causing the trouble. Thanks. On Tue, Apr 19, 2016 at 6:47 AM, John Kanewrote: Hi Ansely, As Jim points out we really need some sample data to go with the code. Have a look at ?dput which is the best way to supply sample data here or have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example [http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example] and/or http://adv-r.had.co.nz/Reproducibility.html [http://adv-r.had.co.nz/Reproducibility.html] for some general suggestions on asking questions here---including discussions of using dput() John Kane Kingston ON Canada > -Original Message- > From: daily.p...@gmail.com > Sent: Mon, 18 Apr 2016 16:33:54 -0400 > To: r-help@r-project.org > Subject: [R] Indicator Species analysis; trouble with multipatt > > Hello, > > *Error in tx %*% comb : non-conformable arguments* > > Suggestions greatly appreciated. I am a beginner and this is my first > time > posting. > > I would like to get the summary for indicator species analysis, using > package indicspecies with multipatt. I am getting errors, I believe, do > to > my data organization. After reorganizing and reorganizing, nothing has > helped. > >> data<- read.csv(file="Data1.csv", header=TRUE, row.names=1, sep=",") >> ap<-data[c(1:24, 1:81)] >> groups<-c(rep(1:4,6)) >> indval<- multipatt(ap, groups, control = how(nperm=999)) > *Error in tx %*% comb : non-conformable arguments* > > > > -- > Ansley Silva > > > *"The clearest way into the Universe is through a forest wilderness." > John > Muir* > > > *Graduate Research Assistant* > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > [https://stat.ethz.ch/mailman/listinfo/r-help] > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > [http://www.R-project.org/posting-guide.html] > and provide commented, minimal, self-contained, reproducible code. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! Check it out at http://www.inbox.com/earth [http://www.inbox.com/earth] -- Ansley Silva _ _ _"The clearest way into the Universe is through a forest wilderness." John Muir_ _ _ _Graduate Research Assistant_ __ _University of Georgia_ __ _D.B. Warnell School of Forestry and Natural Resources_ __ _180 East Green Street_ __ _Athens, GA 30602_ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. __ 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-contained, reproducible code.
Re: [R] Indicator Species analysis; trouble with multipatt
Thanks for the replies. I have fixed the problem. I only need to reorganized my data. Now my question is about asking questions correctly. I hope I've got it. Please find the script attached here. R Version 3.2.2 I am looking for indicator species with Indicspecies package. After running the function multipatt, I get the following error: Error in is.factor(x) : object 'groups1' not found **Is this reproducibility satisfactory? I fixed the problem by reorganizing my csv file. I was trying to be efficient when making my groups and that was causing the trouble. Thanks. On Tue, Apr 19, 2016 at 6:47 AM, John Kanewrote: > Hi Ansely, > As Jim points out we really need some sample data to go with the code. > > Have a look at ?dput which is the best way to supply sample data here or > have a look at > http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example > and/or http://adv-r.had.co.nz/Reproducibility.html for some general > suggestions on asking questions here---including discussions of using dput() > > John Kane > Kingston ON Canada > > > > -Original Message- > > From: daily.p...@gmail.com > > Sent: Mon, 18 Apr 2016 16:33:54 -0400 > > To: r-help@r-project.org > > Subject: [R] Indicator Species analysis; trouble with multipatt > > > > Hello, > > > > *Error in tx %*% comb : non-conformable arguments* > > > > Suggestions greatly appreciated. I am a beginner and this is my first > > time > > posting. > > > > I would like to get the summary for indicator species analysis, using > > package indicspecies with multipatt. I am getting errors, I believe, do > > to > > my data organization. After reorganizing and reorganizing, nothing has > > helped. > > > >> data<- read.csv(file="Data1.csv", header=TRUE, row.names=1, sep=",") > >> ap<-data[c(1:24, 1:81)] > >> groups<-c(rep(1:4,6)) > >> indval<- multipatt(ap, groups, control = how(nperm=999)) > > *Error in tx %*% comb : non-conformable arguments* > > > > > > > > -- > > Ansley Silva > > > > > > *"The clearest way into the Universe is through a forest wilderness." > > John > > Muir* > > > > > > *Graduate Research Assistant* > > __ > > 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-contained, reproducible code. > > > FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! > Check it out at http://www.inbox.com/earth > > > -- Ansley Silva *"The clearest way into the Universe is through a forest wilderness." John Muir* *Graduate Research Assistant* *University of Georgia* *D.B. Warnell School of Forestry and Natural Resources* *180 East Green Street* *Athens, GA 30602* install.packages("indicspecies") library(indicspecies) mydata<- structure(list(necsur = structure(c(6L, 1L, 1L, 4L, 4L, 2L), .Label = c("0", "1", "11", "2", "24", "3", "4", "42", "5", "8", "9", "PA"), class = "factor"), necame = structure(c(11L, 2L, 5L, 5L, 17L, 9L), .Label = c("0", "1", "10", "11", "12", "13", "15", "2", "20", "22", "3", "4", "5", "6", "7", "8", "9", "PA"), class = "factor"), niccar = structure(c(1L, 1L, 1L, 2L, 1L, 1L), .Label = c("0", "1", "19", "2", "3", "4", "5", "6", "PA"), class = "factor"), nicorb = structure(c(1L, 18L, 19L, 17L, 1L, 27L), .Label = c("0", "1", "10", "11", "12", "13", "15", "16", "18", "19", "2", "20", "21", "23", "25", "29", "3", "30", "31", "32", "33", "36", "4", "40", "42", "44", "48", "5", "50", "6", "61", "7", "8", "9", "PA" ), class = "factor"), nicpus = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("0", "1", "2", "PA"), class = "factor"), nictor = structure(c(1L, 1L, 2L, 1L, 1L, 1L), .Label = c("0", "1", "10", "11", "16", "18", "2", "22", "3", "4", "5", "6", "7", "8", "9", "PA"), class = "factor"), oicina = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("0", "1", "15", "2", "3", "PA"), class = "factor"), delgib = structure(c(37L, 5L, 7L, 11L, 11L, 43L), .Label = c("0", "1", "10", "104", "11", "12", "126", "13", "14", "15", "16", "18", "19", "2", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "3", "30", "31", "32", "33", "34", "35", "37", "39", "4", "40", "43", "5", "50", "6", "61", "63", "65", "68", "7", "72", "8", "81", "82", "97", "PA"), class = "factor"), cancha = structure(c(1L, 1L, 2L, 7L, 7L, 10L), .Label = c("0", "1", "11", "12", "16", "17", "2", "27", "3", "4", "5", "6", "7", "8", "9", "PA"), class = "factor"), melbis = structure(c(2L, 1L, 1L, 1L, 1L, 1L), .Label = c("0", "1", "11", "17", "18", "2", "3", "4", "5", "6", "8", "9", "PA"), class = "factor"), atelec = structure(c(1L, 1L, 1L, 22L, 7L, 2L),
Re: [R] heatmap2 error key
Hi Catalina, The error message is pretty clear. min(diff(breaks)/100) evaluates to a negative number. Perhaps the sort order for the values in "breaks" has changed. Jim On Tue, Apr 19, 2016 at 9:35 AM, Catalina Aguilar Hurtadowrote: > Hi I am trying to understand what happen with the heatmap.2 code that it > used to work (last used in October 2015). I am able to get a heatmap but my > colour key doesn't come up and instead I get an error in all my files the > used to work. Does anyone has any idea of what could have changed? or how > to fix this. > > Thanks. > > # > > Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : > wrong sign in 'by' argument > In addition: Warning message: > In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : > unsorted 'breaks' will be sorted before use > > ## > > library("RColorBrewer") > library("gplots") > > library ("gtools") > > GO_Fil=read.table("1h-6h-up-down-v4.csv", sep=",", header=T) > > data =data.matrix (GO_Fil[,3:4]) # define which columns to use for the > heatmap > > rownames(data) <- GO_Fil$Description > > summary (data) > > pairs.breaks <- c(seq(-6, -0.01, length.out=50), seq(-0.02, > 0.01,length.out=150), seq(0.02, 3.9,length.out=80)) > > hmcols<- colorRampPalette(c("blue","white", "red"))(length(pairs.breaks)-1) > > pdf("Heat_1hv6h-updown-key.pdf", > width = 15, > height = 20, > pointsize = 5) > > hm<- heatmap.2(data, breaks=pairs.breaks, col=hmcols, na.color="white", >trace="none",Colv=FALSE, >dendrogram = "none", >density.info="none", >key="TRUE", >keysize = 2, >key.xlab = "Log2FC", >key.title = "key", >cexCol=3.0, >cexRow=2, >lwid= c(0.4,1), >lhei = c(0.1, 4), >margins= c(50,80), >symm=F,symkey=F,symbreaks=T, scale="none") > > dev.off() > >> R.version >_ > platform x86_64-apple-darwin13.4.0 > arch x86_64 > os darwin13.4.0 > system x86_64, darwin13.4.0 > status > major 3 > minor 2.2 > year 2015 > month 08 > day14 > svn rev69053 > language R > version.string R version 3.2.2 (2015-08-14) > > [[alternative HTML version deleted]] > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
Re: [R] heatmap2 error key
Data? Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html John Kane Kingston ON Canada > -Original Message- > From: cata...@gmail.com > Sent: Tue, 19 Apr 2016 09:35:14 +1000 > To: r-help@r-project.org > Subject: [R] heatmap2 error key > > Hi I am trying to understand what happen with the heatmap.2 code that it > used to work (last used in October 2015). I am able to get a heatmap but > my > colour key doesn't come up and instead I get an error in all my files the > used to work. Does anyone has any idea of what could have changed? or how > to fix this. > > Thanks. > > # > > Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : > wrong sign in 'by' argument > In addition: Warning message: > In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : > unsorted 'breaks' will be sorted before use > > ## > > library("RColorBrewer") > library("gplots") > > library ("gtools") > > GO_Fil=read.table("1h-6h-up-down-v4.csv", sep=",", header=T) > > data =data.matrix (GO_Fil[,3:4]) # define which columns to use for the > heatmap > > rownames(data) <- GO_Fil$Description > > summary (data) > > pairs.breaks <- c(seq(-6, -0.01, length.out=50), seq(-0.02, > 0.01,length.out=150), seq(0.02, 3.9,length.out=80)) > > hmcols<- colorRampPalette(c("blue","white", > "red"))(length(pairs.breaks)-1) > > pdf("Heat_1hv6h-updown-key.pdf", > width = 15, > height = 20, > pointsize = 5) > > hm<- heatmap.2(data, breaks=pairs.breaks, col=hmcols, na.color="white", >trace="none",Colv=FALSE, >dendrogram = "none", >density.info="none", >key="TRUE", >keysize = 2, >key.xlab = "Log2FC", >key.title = "key", >cexCol=3.0, >cexRow=2, >lwid= c(0.4,1), >lhei = c(0.1, 4), >margins= c(50,80), >symm=F,symkey=F,symbreaks=T, scale="none") > > dev.off() > >> R.version >_ > platform x86_64-apple-darwin13.4.0 > arch x86_64 > os darwin13.4.0 > system x86_64, darwin13.4.0 > status > major 3 > minor 2.2 > year 2015 > month 08 > day14 > svn rev69053 > language R > version.string R version 3.2.2 (2015-08-14) > > [[alternative HTML version deleted]] > > __ > 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-contained, reproducible code. Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. __ 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-contained, reproducible code.
Re: [R] Indicator Species analysis; trouble with multipatt
Hi Ansely, As Jim points out we really need some sample data to go with the code. Have a look at ?dput which is the best way to supply sample data here or have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html for some general suggestions on asking questions here---including discussions of using dput() John Kane Kingston ON Canada > -Original Message- > From: daily.p...@gmail.com > Sent: Mon, 18 Apr 2016 16:33:54 -0400 > To: r-help@r-project.org > Subject: [R] Indicator Species analysis; trouble with multipatt > > Hello, > > *Error in tx %*% comb : non-conformable arguments* > > Suggestions greatly appreciated. I am a beginner and this is my first > time > posting. > > I would like to get the summary for indicator species analysis, using > package indicspecies with multipatt. I am getting errors, I believe, do > to > my data organization. After reorganizing and reorganizing, nothing has > helped. > >> data<- read.csv(file="Data1.csv", header=TRUE, row.names=1, sep=",") >> ap<-data[c(1:24, 1:81)] >> groups<-c(rep(1:4,6)) >> indval<- multipatt(ap, groups, control = how(nperm=999)) > *Error in tx %*% comb : non-conformable arguments* > > > > -- > Ansley Silva > > > *"The clearest way into the Universe is through a forest wilderness." > John > Muir* > > > *Graduate Research Assistant* > __ > 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-contained, reproducible code. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! __ 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-contained, reproducible code.
Re: [R] A Neural Network question
Hi Phil, I don't think this is the correct list for this. You question has nothing to do with R specifically which is the purpose here. I suggest you pursue other help lists related to neural networks to try and find someone to assist you. Regards, Charles On Sat, Apr 16, 2016 at 2:08 AM, Philip Rhoadeswrote: > People, > > I thought I needed to have some familiarity with NNs for some of my > current (non-profit, brain-related) projects so I started looking at > various programming environments including R and I got this working: > > http://gekkoquant.com/2012/05/26/neural-networks-with-r-simple-example > > however I needed pictures to help understand what was going on and then I > found this: > > > https://jamesmccaffrey.files.wordpress.com/2012/11/backpropagationcalculations.jpg > > which I thought was almost intelligible so I had an idea which I thought > would help the learning process: > > - Create a very simple NN implemented as a spreadsheet where each sheet > would correspond to an iteration > > I started doing this on LibreOffice: > > - I think am already starting to get a better idea of how NNs work just > from the stuff I have done on the spreadsheet already > > - I have now transferred my LibreOffice SpreadSheet (SS) to a shared > Google Docs Calc file and can share it for editing with others > > > https://docs.google.com/spreadsheets/d/1eSCgGU5qeI3_PmQhwZn4RH0NznUekVP5BP7w4MpKSUc/pub?output=pdf > > - I think I have the SS calculations correct so far except for the stuff > in the dashed purple box in the diagram > > - I am not sure how to implement the purple box . . so I thought I would > ask for help on this mailing list > > If someone can help me with the last bit of the SS, from there I think I > can then repeat the FR and BP sheets and see how the Diffs evolve . . > > Is anyone interested in helping to get this last bit of the spreadsheet > working so I can move on to doing actual work with the R packages with > better understanding? > > Thanks, > > Phil. > -- > Philip Rhoades > > PO Box 896 > Cowra NSW 2794 > Australia > E-mail: p...@pricom.com.au > > __ > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R] heatmap2 error key
Hi I am trying to understand what happen with the heatmap.2 code that it used to work (last used in October 2015). I am able to get a heatmap but my colour key doesn't come up and instead I get an error in all my files the used to work. Does anyone has any idea of what could have changed? or how to fix this. Thanks. # Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : wrong sign in 'by' argument In addition: Warning message: In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 + : unsorted 'breaks' will be sorted before use ## library("RColorBrewer") library("gplots") library ("gtools") GO_Fil=read.table("1h-6h-up-down-v4.csv", sep=",", header=T) data =data.matrix (GO_Fil[,3:4]) # define which columns to use for the heatmap rownames(data) <- GO_Fil$Description summary (data) pairs.breaks <- c(seq(-6, -0.01, length.out=50), seq(-0.02, 0.01,length.out=150), seq(0.02, 3.9,length.out=80)) hmcols<- colorRampPalette(c("blue","white", "red"))(length(pairs.breaks)-1) pdf("Heat_1hv6h-updown-key.pdf", width = 15, height = 20, pointsize = 5) hm<- heatmap.2(data, breaks=pairs.breaks, col=hmcols, na.color="white", trace="none",Colv=FALSE, dendrogram = "none", density.info="none", key="TRUE", keysize = 2, key.xlab = "Log2FC", key.title = "key", cexCol=3.0, cexRow=2, lwid= c(0.4,1), lhei = c(0.1, 4), margins= c(50,80), symm=F,symkey=F,symbreaks=T, scale="none") dev.off() > R.version _ platform x86_64-apple-darwin13.4.0 arch x86_64 os darwin13.4.0 system x86_64, darwin13.4.0 status major 3 minor 2.2 year 2015 month 08 day14 svn rev69053 language R version.string R version 3.2.2 (2015-08-14) [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R] (Small) programming job related to network analysis
Dear all, I am looking for help in programming three functions. Those functions should simulate (social) networks according to the process described in : (1) A.H. Dekker - "Realistic Social Networks for Simulation using Network Rewiring" ( http://www.mssanz.org.au/MODSIM07/papers/13_s20/RealisticSocial_s20_Dekker_.pdf ) (2) Konstantin Klemm and Vıctor M. Eguıluz - "Growing scale-free networks with small-world behavior" (http://ifisc.uib-csic.es/victor/Nets/sw.pdf) (3) Petter Holme and Beom Jun Kim - "Growing Scale-Free Networks with Tunable Clustering" (http://arxiv.org/pdf/cond-mat/0110452.pdf) I am looking for three functions (e.g., sample_dekker, sample_klemm, sample_holme) that generate an output similar to the functions sample_pa and sample_smallworld in the R package igraph. The input should be the number of nodes in the network (e.g., 1000) and any other parameters those models require. In case this is of relevance please get in touch with me by email to discuss further details. Thanks, Michael Michael Haenlein Professor of Marketing ESCP Europe [[alternative HTML version deleted]] __ 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-contained, reproducible code.