Re: [R] How to use multi paragraph comment like /* and */ in cpp?

2014-09-08 Thread PO SU
I don't understand what's your meaning, do you mean that i should do some file processing,(like writing a script) ,so that i could add # in any line  i wanted. I think it is not convenient. And, it does seems that there is no way to multi line comment in R. But when i turn to using Rstudio, a

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Karl Ropkins
FYI: I get the same for Windows 7 and 8, no RStudio: edit(vignette("grobs",package = "grid")) works for me edit(file=vignette("grobs",package = "grid")) does not > edit(file=vignette("grobs",package = "grid")) Error in tempfile(name$topic, fileext = ".R") : argument "name" is missing, with no de

Re: [R] How to use multi paragraph comment like /* and */ in cpp?

2014-09-08 Thread Pascal Oettli
A workaround is to escape the evaluation of the lines. For example: tt <- 0 while(tt > 0){ cat('rr\n') } Regards, Pascal On Tue, Sep 9, 2014 at 11:49 AM, PO SU wrote: > > Dear expeRts, >I find it's terrible when i want to comment multi paragraph (e.g. a 30 > lines function) , i have t

Re: [R] How to use multi paragraph comment like /* and */ in cpp?

2014-09-08 Thread Jeff Newmiller
There are no multi line comment markers in R. However, since you are always referring to RStudio you might want to look into roxygen, since their editor supports that tool. I would also suggest making more functions that are smaller. --

[R] How to use multi paragraph comment like /* and */ in cpp?

2014-09-08 Thread PO SU
Dear expeRts,    I find it's terrible  when  i want to comment multi paragraph (e.g.  a 30 lines function) , i have to comment each line with #,  is there any good way to do that ?    I investgate it, but found no easy way, may you help me ? -- PO SU mail: desolato...@163.com Majored in S

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread PO SU
OK, i get it, i should set the editor argument , i don't know how to report a bug to Rstudio, may you do that  ?   -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-09 00:41:33, "William Dunlap" wrote: >Complain to the RStudio people - RStudio defines its own

[R] KDE routines for data that is aggregated

2014-09-08 Thread Saptarshi Guha
Hello, Couldn't think of a better subject line. Rather than a matrix like x,y ..,.. .,.. I have a matrix like x,y,n, ..,..,.., ..,..,.. and so on. Also, sum(n) is roughly few hundred million. The number of rows is <1MM Are they routines to fit a 2d kde estimate to data provided in this form? I

[R] Problems with bstats::white.test()

2014-09-08 Thread Iuri Gavronski
Hi, I am trying to test for heteroskedascity in an OLS model, but I am not able to run the white.test() if the model has dummy variables built from factors. Any suggestions? Please find a reproducible code below: myswiss <- swiss myswiss$fert <- ifelse( myswiss$Fertility>70, "High","Low") mysw

Re: [R] splitting data

2014-09-08 Thread David Winsemius
On Sep 8, 2014, at 2:01 PM, David Winsemius wrote: > > On Sep 8, 2014, at 12:08 PM, eliza botto wrote: > >> >> > > This is typical use for base function aggregate: > >> with( dfrm, aggregate(dfrm[4:7], dfrm[1:2], FUN=sum)) > year month A B C D > 1 1961 1 78 102 138 258 > >>

Re: [R] splitting data

2014-09-08 Thread David Winsemius
On Sep 8, 2014, at 12:08 PM, eliza botto wrote: > Dear R members, > > I have this data frame of 100 years in the following format > > yearmonth day A B C D > > where A,B,C and D are item number sold each day. I am trying > > 1-split the

Re: [R] splitting data

2014-09-08 Thread John McKown
On Mon, Sep 8, 2014 at 2:08 PM, eliza botto wrote: > Dear R members, > > I have this data frame of 100 years in the following format > > yearmonth day A B C D > > where A,B,C and D are item number sold each day. I am trying > > 1-split the dat

Re: [R] splitting data

2014-09-08 Thread Bert Gunter
?tapply e.g. with(yourdata, tapply(A,list(year,month),sum,simplify=FALSE)) This assumes "sum them up" means summing each column separately. You were unclear as to exactly what you meant by this. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. I

[R] Using R to get updated access token on FB Graph API?

2014-09-08 Thread Chichi Shu
Hi, R users, Is it possible to use R to obtain access token to Facebook API automatically? The access token generated in Facebook Graph API expires very soon so I'd like to use R to generate new access token and grab it and save it to a variable automatically every 60 days. Is it possible? If

[R] splitting data

2014-09-08 Thread eliza botto
Dear R members, I have this data frame of 100 years in the following format yearmonth day A B C D where A,B,C and D are item number sold each day. I am trying 1-split the data w.r.t the monthly values for each year 2-then, sum them up I

[R] Parliament Seats Graph

2014-09-08 Thread Stefan Petersson
Hi, Is there any package (or homegrown function) that can produce "Parliament Seats Graph"? I'm referring to the nice looking concentric half circles of colored "seats" as seen on Wikipedia (for example). I can pretty easily plot the points and color them. But I can't group the colored points in

Re: [R] ggplot - boxplot and points split by two factors

2014-09-08 Thread Federico Lasa
Use geom_jitter() instead of geom_point On Mon, Sep 8, 2014 at 12:37 PM, Tom Wright wrote: > ggplot(data,aes(x = z1, y = x, fill=x2)) + > geom_boxplot() + > geom_point(alpha=0.5, > position=position_jitterdodge(jitter.width=0.1), > aes(group=x2)) > > On Mon, 2014-09-08 at 13:1

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Duncan Murdoch
On 08/09/2014 12:48 PM, Duncan Murdoch wrote: On 08/09/2014 12:35 PM, Duncan Murdoch wrote: > On 08/09/2014 12:21 PM, PO SU wrote: > > Tks for correcting me not using the file argument, but the codes you supply seem still not work. > > > > edit(vignette("grobs",package = "grid")) can't work. >

Re: [R] ggplot - boxplot and points split by two factors

2014-09-08 Thread Tom Wright
ggplot(data,aes(x = z1, y = x, fill=x2)) + geom_boxplot() + geom_point(alpha=0.5, position=position_jitterdodge(jitter.width=0.1), aes(group=x2)) On Mon, 2014-09-08 at 13:10 -0400, Tom Wright wrote: > Hi, > I'm trying to create a boxplot overlayed with points where the data is

[R] ggplot - boxplot and points split by two factors

2014-09-08 Thread Tom Wright
Hi, I'm trying to create a boxplot overlayed with points where the data is split by two factor groups. So far: x1<-factor(rep(LETTERS[1:4],5)) x2<-factor(rep(letters[1:2],10)) z<-runif(20,0,10) data<-data.frame(x1=x1,x2=x2,z=z) ggplot(data,aes(x=x1,y=z,fill=x2)) + geom_boxplot() +

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Duncan Murdoch
On 08/09/2014 12:35 PM, Duncan Murdoch wrote: On 08/09/2014 12:21 PM, PO SU wrote: > Tks for correcting me not using the file argument, but the codes you supply seem still not work. > > edit(vignette("grobs",package = "grid")) can't work. > I am using win7, the latest version of Rstudio which u

Re: [R] Testing general hypotheses on regression coefficients

2014-09-08 Thread Greg Snow
Others have discussed some of the theoretical approaches (delta method), but as has also been pointed out, this is a mailing list about R, not theory, so here are some approaches to your question from the approach of those of us who like programming R more than remembering theory. I assume that on

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread William Dunlap
Complain to the RStudio people - RStudio defines its own options("editor") which is not completely compatible with R's option(editor="internal"). If you set options(editor="internal") in RStudio then you can look at the code in the vignette. (I tried with last year's RStudio 0.98.501 and this may

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Duncan Murdoch
On 08/09/2014 12:21 PM, PO SU wrote: Tks for correcting me not using the file argument, but the codes you supply seem still not work. edit(vignette("grobs",package = "grid")) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = fil

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread John McKown
On Mon, Sep 8, 2014 at 11:21 AM, PO SU wrote: > > Tks for correcting me not using the file argument, but the codes you supply > seem still not work. > > edit(vignette("grobs",package = "grid")) can't work. > I am using win7, the latest version of Rstudio which using R.3.1.1.The error > is: > Er

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread PO SU
Tks for correcting me not using the file argument, but the codes you supply   seem still not work. edit(vignette("grobs",package = "grid")) can't work. I am using win7, the latest version of Rstudio which using R.3.1.1.The error is: Error in editor(file = file, title = title) : argument "name"

Re: [R] sequential input script dataframe process functionality

2014-09-08 Thread William Dunlap
d <- data.frame(Choices=c("One","Two","One","Three"), X=1:4) i <- 1 # possible output of menu(unique(d$Choices)) d[ d$Choices[i] == d$Choices, ] # Choices X #1 One 1 #3 One 3 I believe this sort of thing is covered in the Introduction to R pdf that comes with R. It is worth reading. Bil

Re: [R] sequential input script dataframe process functionality

2014-09-08 Thread rl
On Mon, 8 Sep 2014 07:55:23 -0700 William Dunlap wrote: Again, feed the output of menu() directly into "[". Do not use switch(). Bill Dunlap The function was changed to: testdataextract1<-function (testdata) { selectionresult<-menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Selec

Re: [R] sequential input script dataframe process functionality

2014-09-08 Thread William Dunlap
Again, feed the output of menu() directly into "[". Do not use switch(). Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Sep 8, 2014 at 2:12 AM, wrote: > On Sat, 6 Sep 2014 08:21:19 -0700 > William Dunlap wrote: > >> > >> > testdataextract1<-switch(menu(c(unique(levels(testdata[,1]))),gr

[R] using edit to extract codes from vignette failed

2014-09-08 Thread Karl Ropkins
Try: edit(vignette("grobs",package = "grid")) (edit is a method. It looks at the class of the first entry, name, to identify which method to use. See ?edit. You want it to use edit.vignette, so you need to drop 'file=' so you pass the vignette to edit as the first argument or name=. Then edit

Re: [R] sequential input script dataframe process functionality

2014-09-08 Thread rl
On Sat, 6 Sep 2014 08:21:19 -0700 William Dunlap wrote: > testdataextract1<-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select > something')) The switch function does not work the way you are expecting it to. Read help("switch") and read the introduction to R that comes