[R] Color scale graphic
Hello Recently, I've been dealing with a seemingly simple problem. I have a table with two columns filled with values from a test I made (say, amount of precipitation and Months measured). Now, instead of plotting a typical linear graphic with precipitation on the y-axis and the months in the x-axys, I would like to convert the values of precipitation in a color gradient, resulting in a vertical gradient throughout the x-axis. In this way, months with higher precipitation would appear reddish while lower precipitation would appear blueish, for example. Despite being a simple problem (basically converting the y-values in a color gradient), I have failed to find a way of doing this. If someone knows how to solve this, either using R or other program, please lend me a hand. Thanks for your attention Diogo -- View this message in context: http://r.789695.n4.nabble.com/Color-scale-graphic-tp2244657p2244657.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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] spatstat sub-selection
Fellow Users, In Spatstat, if you have a ppp object with, say 100 points, how do you create another ppp containing a random selection, N, of the original? You can tell the function 'rthin' to make a sub-selection of points, i.e. every point is removed with probability 0.5 but you CAN'T set N exactly... I'm sure this should be easy... Ta! Tom -- View this message in context: http://r.789695.n4.nabble.com/spatstat-sub-selection-tp2244619p2244619.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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] How to get the closing price from the the GOOGLE FINANCE site for NSEINDIA stocks
Try getSymbols(RCOM.NS, from=1900-01-01) instead. It looks like google has removed the ability to download csv (not much business providing it;)). In any case, Yahoo historical prices go way back than googles. For instance, getSymbols(^DJI, from=1900-01-01) ; head(get(DJI)) shows the first date as 1928! Hope this helps, Ivan Date: Sat, 5 Jun 2010 23:46:37 +0530 From: veepsi...@gmail.com To: r-help@r-project.org Subject: [R] How to get the closing price from the the GOOGLE FINANCE site for NSEINDIA stocks Sir, How to get the closing price from this link http://www.google.com/finance/historical?q=NSE:RCOM I installed quantmod getSymbols('NSE:RCOM',src='google') gives me this error** Error in download.file(paste(google.URL, q=, Symbols.name, startdate=, : cannot open URL 'http://finance.google.com/finance/historical?q=NSE:RCOMstartdate=Jan+01,+2007enddate=Jun+05,+2010output=csv' Calls: getSymbols - do.call - getSymbols.google - download.file In addition: Warning message: In download.file(paste(google.URL, q=, Symbols.name, startdate=, : cannot open: HTTP status was '404 Not Found' Could someone please give me the correct statement. thanks __ R-help@r-project.org mailing list 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 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] Onequestion
Dear Mr. or Ms., I used the R-software to run the zero-inflatoin negative binomial model, but I could not get the results. And the error message is solve.default(as.matrix(fit$gaussian)) . In the model, I introduced 3 dummy variables. I do not know the reasons fully. I will be very appreciate if you can help me. Thank you. Best regards, Sincerely, Xiongqing Zhang [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] tapply help
That was very clever. Worked perfectly, thanks! And thanks to everyone else who provided feedback. On Jun 5, 2010, at 5:46 AM, jim holtman wrote: It this what you are looking for: set.seed(1) # create range for each possible class # 'name' the values so you can use them in the 'sapply' function lows-c(a=1, b=2, c=3, d=4, e=5) highs-c(a=5, b=6, c=7, d=8, e=9) # data values vals-sample(1:10,100,replace=T) #classes classes-sample(letters[1:5],100,replace=T) # split the data so that you retain the 'classes' name x.split - split(vals, classes) percentage - sapply(names(x.split), function(.class){ + # compute the percentage based on 'class' + sum((x.split[[.class]] = lows[.class]) + (x.split[[.class]] = highs[.class])) / length(x.split[[.class]]) * 100 + }) percentage abcde 50.0 45.0 62.5 54.54545 55.6 On Fri, Jun 4, 2010 at 4:02 PM, Mark Ebbert mark.ebb...@hci.utah.edu wrote: Dear R gurus, I am trying perform what I believe will be a pretty simple task, but I'm struggling to figure out how to do it. I have two vectors of the same length, the first is numeric and the second is factor. I understand that tapply is perfect for applying a function to the numeric vector by subsets of the factors in the second vector. My issue is trying to make use of two other vectors within the custom function I've written for tapply. The two other vectors are a high and low value for each subset I am breaking my data into, and I want to calculate the percentage of data points that fall into each respective range. I will attempt to provide a coherent example: # create range for each possible class lows-c(1,2,3,4,5) highs-c(5,6,7,8,9) # data values vals-sample(1:10,100,replace=T) #classes classes-sample(letters[1:5],100,replace=T) # Try to calculate percentage of values that fall # into the respective range for the given class. percentages-tapply(vals,classes, function(i){ length(i[i=lows[index] i=highs[index]])/length(i) # I don't know how to actually keep an index count in tapply, but I'm guessing there's a better way. }) I really appreciate any help. ME __ R-help@r-project.org mailing list 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list 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] log likelihood and deviance
Hi Prof Brain Ripley, If we know the residual of the model, how could we calculate the Log likelihood? Thanks for your help, Yunteng Lao [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Color scale graphic
On 06/06/2010 10:02 AM, Diogo_Silva wrote: Hello Recently, I've been dealing with a seemingly simple problem. I have a table with two columns filled with values from a test I made (say, amount of precipitation and Months measured). Now, instead of plotting a typical linear graphic with precipitation on the y-axis and the months in the x-axys, I would like to convert the values of precipitation in a color gradient, resulting in a vertical gradient throughout the x-axis. In this way, months with higher precipitation would appear reddish while lower precipitation would appear blueish, for example. Despite being a simple problem (basically converting the y-values in a color gradient), I have failed to find a way of doing this. Hi Diogo, The answer is in the subject line. color.scale or smoothColors in the plotrix package will probably be what you want. Jim __ R-help@r-project.org mailing list 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] SciViews-K / Komodo as editor on the Mac [was: StatET plot problem]
Philippe, ad 2) I totally agree that alt+f1 is the better and more comfortable option here. The main reason I tried to test some of the functionality that is typically display outside the R console, such as plotting and ?topic (and honestly, I did not realize from the start that alt+f1 was meant to fully replace traditional ways). I´d really like to use R outside the terminal, but it was the only I way I got it to work from within Komodo. Both R.app and R64.app did not work. All I get when I run R is the open -a mydirectory/R64.app message at the bottom and then after a couple of seconds I get the Ready message. No R pops up, because it obviously does not start. Running R from the terminal worked, but the Command output inside Komodo appeared to have problems, when I run about 100 lines of code or display data.frames with a couple of hundred rows. Is there a way to move the command output around, i.e. relocate the window or even open it in another window? That would be really helpful particularly if you work on two screens. thx for all the help! best Matt On 05.06.2010, at 19:52, Philippe Grosjean wrote: Matt, Yes, I see this problem. Thanks for report. Also ??topic is wrong. Note two points: 1) ?topic works with R.app/R64.app. So, just in case you would consider using R.app instead of R inside a terminal session, 2) I have not noticed this bug because using ?topic inside SciViews-K / Komodo is a little bit silly. There is a much better mechanism: place your cursor on a word (the 'topic' in ?topic) and hit Alt-F1, and you got the corresponding help page displayed. It is much more natural to type the name of your function, then Alt-F1 to see the man page, than to type ?myfun, then move back to eliminate '?', move forward and continue typing your code, isn't it? Also try Alt-Shift-F1 for a better alternative to ??topic from within SciViews-K / Komodo. Best, Philippe ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .. On 05/06/10 18:54, Bunny, lautloscrew.com wrote: Philippe, now I tried to run the SciViews-K / Komodo combo on my Mac. It did work and I like it. Thx for your suggestion. On first sight everything works really well. The only thing that bothers me a little bit, is that I was only able to run it with the directly in terminal option. Everytime I start ?whateverhelp from Komodo R inside the terminal crashes. If I run ?myhelp directly from the terminal, everything works just fine. Probably I could just live with that, but somehow I want to fix it or at least know why this is happening. Besides, I think the code folding, syntax highlighting and auto-complete / command+t stuff is really an advantage over the standard editor on a mac and it´s well worth the hustle. best matt On 04.06.2010, at 11:13, Philippe Grosjean wrote: On 04/06/10 10:37, Bunny, lautloscrew.com wrote: Dear all, after trying several suggestions from the list for a nice R-Editor / IDE for MacOS X and really trying some of those that needed to be configured a little more (such as emacs, aquamacs and StatET / Eclipse), I prefer StatET at the moment. I found more experienced like John suggesting this combination (http://www.mail-archive.com/r-help@r-project.org/msg38883.html) on Mac OS X. So far I am really happy with it except for the plotting. I just can´t get plots to go. everytime I plot(x) nothing happens. What´s striking is that the edit() works and opens up in X11. Is there some configuration option I just missed ? best regards You haven't try SciViews-K/Komodo, don't you? (http://www.sciviews.org/SciViews-K). Best, Philippe matt __ R-help@r-project.org mailing list 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 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 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] SciViews-K / Komodo as editor on the Mac [was: StatET plot problem]
On 06/06/10 10:45, Bunny, lautloscrew.com wrote: Philippe, ad 2) I totally agree that alt+f1 is the better and more comfortable option here. The main reason I tried to test some of the functionality that is typically display outside the R console, such as plotting and ?topic (and honestly, I did not realize from the start that alt+f1 was meant to fully replace traditional ways). I´d really like to use R outside the terminal, but it was the only I way I got it to work from within Komodo. Both R.app and R64.app did not work. All I get when I run R is the open -a mydirectory/R64.app message at the bottom and then after a couple of seconds I get the Ready message. No R pops up, because it obviously does not start. open -a mydirectory/R64.app So, is R64.app located in mydirectory? If not, then, you know why it does not work. Running R from the terminal worked, but the Command output inside Komodo appeared to have problems, when I run about 100 lines of code or display data.frames with a couple of hundred rows. Is there a way to move the command output around, i.e. relocate the window or even open it in another window? That would be really helpful particularly if you work on two screens. Well, what you are asking is having a R console displayed in a separate window that you could place on your second screen... and you have it: it is your terminal window where R is running. Best, Philippe thx for all the help! best Matt On 05.06.2010, at 19:52, Philippe Grosjean wrote: Matt, Yes, I see this problem. Thanks for report. Also ??topic is wrong. Note two points: 1) ?topic works with R.app/R64.app. So, just in case you would consider using R.app instead of R inside a terminal session, 2) I have not noticed this bug because using ?topic inside SciViews-K / Komodo is a little bit silly. There is a much better mechanism: place your cursor on a word (the 'topic' in ?topic) and hit Alt-F1, and you got the corresponding help page displayed. It is much more natural to type the name of your function, then Alt-F1 to see the man page, than to type ?myfun, then move back to eliminate '?', move forward and continue typing your code, isn't it? Also try Alt-Shift-F1 for a better alternative to ??topic from within SciViews-K / Komodo. Best, Philippe ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .. On 05/06/10 18:54, Bunny, lautloscrew.com wrote: Philippe, now I tried to run the SciViews-K / Komodo combo on my Mac. It did work and I like it. Thx for your suggestion. On first sight everything works really well. The only thing that bothers me a little bit, is that I was only able to run it with the directly in terminal option. Everytime I start ?whateverhelp from Komodo R inside the terminal crashes. If I run ?myhelp directly from the terminal, everything works just fine. Probably I could just live with that, but somehow I want to fix it or at least know why this is happening. Besides, I think the code folding, syntax highlighting and auto-complete / command+t stuff is really an advantage over the standard editor on a mac and it´s well worth the hustle. best matt On 04.06.2010, at 11:13, Philippe Grosjean wrote: On 04/06/10 10:37, Bunny, lautloscrew.com wrote: Dear all, after trying several suggestions from the list for a nice R-Editor / IDE for MacOS X and really trying some of those that needed to be configured a little more (such as emacs, aquamacs and StatET / Eclipse), I prefer StatET at the moment. I found more experienced like John suggesting this combination (http://www.mail-archive.com/r-help@r-project.org/msg38883.html) on Mac OS X. So far I am really happy with it except for the plotting. I just can´t get plots to go. everytime I plot(x) nothing happens. What´s striking is that the edit() works and opens up in X11. Is there some configuration option I just missed ? best regards You haven't try SciViews-K/Komodo, don't you? (http://www.sciviews.org/SciViews-K). Best, Philippe matt __ R-help@r-project.org mailing list 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 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 https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
Re: [R] log likelihood and deviance
Hi, If we know the residual of the model, how could we calculate the Log likelihood? It depends on the model (lm? glm? nls?). Why not using directly the logLik function? x - rnorm(100, 10) y - rnorm(100, 10) model1 - lm(y ~ x) logLik(model1) model2 - glm(y ~ x, family=gaussian) logLik(model2) model3 - glm(y ~ x, family=Gamma) logLik(model3) Cheers, Arnaud. __ R-help@r-project.org mailing list 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] Error Bar Issues
On Sun, Jun 6, 2010 at 12:51 AM, beloitstudent schu...@beloit.edu wrote: Thanks for the suggestion...but R still doesn't like it. Now I have 3 error messages. It seems to dislike my *err=y* command. I'm going to continue trying. Thanks for your help! If you happen to spot anything else, please let me know! Off course, same problem: You're referring to an object y in your command. But you have no object named y in your workspace, so R can't continue. Look at the help files: ?plotCI You'll see you have to put quotation marks around y, like William showed you. Next to that, please also define from which package you use a plot. plotCI can be found in the gplots package and in the plotrix package. Cheers Joris Either you define all input for the function before you run it, or you use the double quotes like William showed thanks! beloitstudent On Sat, Jun 5, 2010 at 5:16 PM, Joris FA Meys [via R] ml-node+2244611-1554261936-278...@n4.nabble.comml-node%2b2244611-1554261936-278...@n4.nabble.com wrote: you can't refer to an argument within a function call. Try uiw - Saline[,3] plotCI(x=Saline [,1],y=Saline [,2], uiw=uiw, liw=uiw, err=y, pch=21, pt.bg=par(bg), cex=1.5, lty=1, type=o, gap=0, sfrac=0.005, xlim=c(-21,340),xaxp=c(-20,320,11), xlab=Time (min), ylim=c(0,12), yaxp=c(0,12,11), ylab=Arterial Plasma Acetaminophen (µg/mL), las=1, font.lab=2, add=TRUE) Cheers Joris On Sat, Jun 5, 2010 at 6:09 PM, beloitstudent [hidden email]http://user/SendEmail.jtp?type=nodenode=2244611i=0 wrote: Hello all, I am an undergraduate student who is having syntax issues trying to get error bars on my graph. This is the data, which I assigned the name Saline to. Time Average SEM 1 -20 0.00 0.000 2 3 30 0.00 0.000 4 45 3.227902 0.7462524 5 60 5.04 1.1623944 6 80 6.107491 1.5027762 7 110 6.968231 1.3799637 8 140 7.325713 1.2282053 9 200 7.875194 1.1185175 10 260 6.513927 0.5386359 11 320 4.204342 0.6855906 This is the command that I typed in to get my error bars. plotCI(x=Saline [,1],y=Saline [,2], uiw=Saline [,3], liw=uiw, err=y, pch=21, pt.bg=par(bg), cex=1.5, lty=1, type=o, gap=0, sfrac=0.005, xlim=c(-21,340),xaxp=c(-20,320,11), xlab=Time (min), ylim=c(0,12), yaxp=c(0,12,11), ylab=Arterial Plasma Acetaminophen (µg/mL), las=1, font.lab=2, add=TRUE) And this is the error message I keep getting Error in plotCI(x = Saline[, 1], y = Saline[, 2], uiw = Saline[, 3], liw = uiw, : object 'uiw' not found In addition: Warning message: In if (err == y) z - y else z - x : the condition has length 1 and only the first element will be used Now, to me, the command seems correct. I want the error bars to show up where the points on my graph are...so the x coordinates should be my time (aka Saline [1]) and the y coordinates should be my Averages (aka Saline [2]) and my upper and lower limits to my confidence interval should be the SEM from Saline [3], but something is wrong with this and I cannot figure out what it is. If anyone has suggestions I would be very grateful. Thanks for your help! beloitstudent -- View this message in context: http://r.789695.n4.nabble.com/Error-Bar-Issues-tp2244335p2244335.html Sent from the R help mailing list archive at Nabble.com. __ [hidden email] http://user/SendEmail.jtp?type=nodenode=2244611i=1mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 [hidden email] http://user/SendEmail.jtp?type=nodenode=2244611i=2 --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ [hidden email] http://user/SendEmail.jtp?type=nodenode=2244611i=3mailing list 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. -- View message @ http://r.789695.n4.nabble.com/Error-Bar-Issues-tp2244335p2244611.html To unsubscribe from Error Bar Issues, click here (link removed) ==. -- View this message in context: http://r.789695.n4.nabble.com/Error-Bar-Issues-tp2244335p2244627.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting
Re: [R] spatstat sub-selection
You can't specify it in rthin, which I can understand for the simple reason that this violates the independence of the sampling. If you put a fixed limit on your resampling, the chance of being selected depends on when some point is selected. You could do it by hacking the object : rthin.exact - function(x,n){ l - x$n i - sample(1:l,n,replace=F) x$n - n x$x - x$x[i] x$y - x$y[i] return(x) } data(redwood) plot(redwood, main=thinning) # keep 30 points Y - rthin.exact(redwood, 30) points(Y, col=green, cex=1.4) Cheers Joris On Sun, Jun 6, 2010 at 12:26 AM, Tom_R tom.richard...@bristol.ac.uk wrote: Fellow Users, In Spatstat, if you have a ppp object with, say 100 points, how do you create another ppp containing a random selection, N, of the original? You can tell the function 'rthin' to make a sub-selection of points, i.e. every point is removed with probability 0.5 but you CAN'T set N exactly... I'm sure this should be easy... Ta! Tom -- View this message in context: http://r.789695.n4.nabble.com/spatstat-sub-selection-tp2244619p2244619.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] R CMD in 2.11.1 error
Hi, I have a set of user defined package which I have installed in 2.8.1 for quite some time. I installed 2.11.0 and 2.11.1 a couple of days ago while still having 2.8.1 version in my system. For the package, package.skeleton works fine in R 2.11. However, it comes problem when I run Rcmd check/intall. The intall.out shows below. I further tested that I reran R-2.8.1/bin/R CMD check in 2.8.1. it still works. Then I ran and test the doomed function, gzWrite, in R-2.11.1/binRgui, it also works fine. So, is this the problem in R-2.11.1/bin/Rcmd itself? How do I fix it? I have MinGW, Perl, etc. installed in my system. I also attached my function gzWrite below. Thank you very much. 00check.out: * install options are ' --no-html' * installing *source* package 'quantplus' ... ** R ** preparing package for lazy loading ** help Warning: newline within quoted string at gzWrite.Rd:92 Warning: ./man/gzWrite.Rd:99: unknown macro '\n' Warning: newline within quoted string at gzWrite.Rd:92 Error in parse_Rd(./man/gzWrite.Rd, encoding = unknown, ...) : Unexpected end of input (in quoted string opened at gzWrite.Rd:99:46) ERROR: installing Rd objects failed for package 'quantplus' * removing 'd:/developer/projects/quant+/package_builder/quantplus.Rcheck/quantplus' the problem function: ** gzWrite = # write out a data frame into a gzip file in the format of write.table function(ds, outdir, outpfx, datepfx, sep='\t', quote=TRUE, row.names=FALSE, col.names=TRUE, na='NA', append=FALSE) { if (F) { ds = ds.price; outdir = pathPrice; outpfx = paste(pfx.price,'_',sep=''); datepfx = fdate; sep = '\t'; quote = TRUE; row.names = FALSE; col.names = TRUE; na = 'NULL'; append = FALSE; } file.out = paste(outdir, '\\', outpfx, datepfx, '.gz', sep=''); file.tmp = paste(outdir, '\\', outpfx, datepfx, '.txt',sep=''); write.table(ds, file=file.tmp, sep=sep, quote=quote, row.names=row.names, col.names=col.names, na=na, append=append); zz = gzfile(file.out, 'w'); raw = file(file.tmp, 'r'); cat(readLines(raw), file=zz, append=F, sep='\n'); close(zz); close(raw); unlink(file.tmp); invisible(NA); } [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] I need help in analyzing
I'm sory for my weak english. I need to analyze this subject : x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 y 0 0 1 0 0 1 0 0 1 0 czarne 1 1 0 0 0 0 1 0 0 0 rude 0 0 1 0 0 1 1 0 0 0 braz 0 0 1 0 1 0 1 0 0 0 blond 1 0 0 0 0 1 0 0 0 1 rude 1 1 0 0 0 0 0 0 0 1 blond 0 0 1 1 0 0 0 0 1 0 czarne 1 0 0 1 0 0 1 0 0 0 blond 0 0 1 0 0 1 1 0 0 0 blond 1 0 0 0 0 1 1 0 0 0 czarne 0 0 1 0 0 1 0 0 0 1 czarne 1 0 1 0 0 0 1 0 0 0 czarne 0 0 1 1 0 0 0 0 0 1 braz 0 1 0 1 0 0 0 0 0 1 braz 1 0 1 0 0 0 0 0 1 0 braz 0 0 0 1 1 0 0 0 0 1 blond 1 0 1 0 0 0 0 0 1 0 czarne 0 1 0 0 0 1 0 0 0 1 braz 1 0 0 1 0 0 0 0 0 1 braz 0 0 1 0 0 1 0 0 0 1 braz 0 0 0 1 0 1 0 0 0 1 blond 0 0 1 1 0 0 0 0 0 1 czarne 0 0 1 0 0 1 0 0 0 1 rude 0 0 1 0 0 1 0 0 0 1 braz 0 0 1 0 0 1 1 0 0 0 braz 0 0 1 0 0 1 1 0 0 0 rude 0 0 1 1 0 0 1 0 0 0 braz 1 0 1 0 0 0 0 0 1 0 rude 0 0 0 1 0 1 1 0 0 0 czarne 0 0 1 0 0 1 0 0 1 0 blond 1 0 0 1 0 0 0 0 1 0 blond 0 0 1 0 0 1 1 0 0 0 rude 1 0 0 0 0 1 0 0 0 1 braz 0 0 0 0 1 1 1 0 0 0 blond 0 0 1 1 0 0 0 0 0 1 blond 0 0 1 0 0 1 1 0 0 0 blond 1 0 0 1 0 0 0 0 0 1 blond 1 0 1 0 0 0 1 0 0 0 rude 0 1 0 0 0 1 0 0 1 0 braz 0 1 1 0 0 0 0 0 0 1 czarne 0 0 1 0 0 1 0 1 0 0 blond 0 1 1 0 0 1 0 1 0 0 rude 1 0 0 0 0 1 0 0 0 1 czarne 0 1 1 0 0 0 0 0 1 0 blond 0 0 1 0 0 1 1 0 0 0 rude 0 0 1 0 0 1 0 1 0 0 blond 0 0 1 0 1 0 1 0 0 0 blond 0 1 1 0 0 0 0 1 0 0 braz 0 0 1 1 0 0 0 0 1 0 braz 1 0 0 1 0 0 0 0 0 1 blond 1 1 0 0 0 0 0 0 0 1 czarne 0 1 1 0 0 0 1 0 0 0 rude 1 0 1 0 0 0 0 0 0 1 braz 1 1 0 0 0 0 1 0 0 0 braz 0 0 1 1 0 0 0 0 0 1 czarne 1 1 0 0 0 0 0 0 0 1
Re: [R] textbox in lattice
Hi, I've just added width/heightDetails methods following Paul's suggestion. I kept a duplicate of all on-the-fly grob size calculations; it is necessary to ensure that the table cells adjust to the content which can be subsequently edited (e.g changing the colnames to plotmath expressions). Drawing the full iris dataset (150 x 5) takes 12 seconds when it was 8 seconds before. It is still reasonable; I don't think anyone would want to use it for huge tables anyway. Out of curiosity, could drawDetails and height/widthDetails be altered to share some information (thereby avoiding such duplication of calculations at drawing time), or do they have to be completely independent in the implementation? Best, baptiste On 3 June 2010 07:58, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, On 3 June 2010 05:26, Paul Murrell p.murr...@auckland.ac.nz wrote: Or the same drawing calculations have to be repeated within width/heightDetails - those methods should get run within the same graphical context as the drawDetails method. Yes, the idea crossed my mind, but I did not find it very appealing (already the function is slower than it could/should be). Something to consider though, in a future version. Thanks, baptiste Paul Best, baptiste __ R-help@r-project.org mailing list 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. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ __ R-help@r-project.org mailing list 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] I need help in analyzing
This help list is not intended for solving your assignments. But you're honest about it, so I'll describe for you shortly what the output is. How to interprete that output is up to you. see inline comments. On Sun, Jun 6, 2010 at 12:38 PM, wojak121 rotworm...@op.pl wrote: I'm sory for my weak english. I need to analyze this subject : last column is my Y. When i entered this to R i've get model.lda=lda(y~.,dane) Warning message: In lda.default(x, grouping, ...) : variables are collinear Obvious warning message, and the indication that there are other methods maybe more suited for your data. model.lda Call: lda(y ~ ., data = dane) what you put in Prior probabilities of groups: blond braz czarne rude 0.317 0.283 0.233 0.167 The proportions of each hair type in the original dataset Group means: x1 x2 x3 x4 x5 x6 x7 blond 0.3684211 0.1578947 0.4736842 0.4210526 0.2105263 0.3684211 0.3684211 braz 0.2941176 0.2941176 0.6470588 0.3529412 0.000 0.4117647 0.2352941 czarne 0.3571429 0.1428571 0.7142857 0.4285714 0.000 0.3571429 0.3571429 rude 0.400 0.300 0.800 0.000 0.000 0.600 0.600 x8 x9 x10 blond 0.10526316 0.1578947 0.3684211 braz 0.05882353 0.1764706 0.5294118 czarne 0. 0.2142857 0.4285714 rude 0.1000 0.100 0.200 Proportion of yes answers for every hair type, and this for each x variable. Coefficients of linear discriminants: LD1 LD2 LD3 x1 5.1043768 4.0739211 -2.3626627 x2 5.1972181 2.9748157 -0.3920615 x3 5.9721912 3.0080526 -2.1908394 x4 3.9526576 2.7992826 -2.4115814 x5 2.0778084 5.5095145 -1.6788562 x6 4.9891371 3.5497498 -1.4580874 x7 0.6484504 0.5349203 -0.4412781 x8 -2.2934686 0.8713075 1.4076988 x9 -0.3536417 -0.2746371 -0.4208209 x10 0.2013050 -0.5773421 0.3025799 How the x variables combine into the linear discriminant functions. Proportion of trace: LD1 LD2 LD3 0.6918 0.2574 0.0508 Can be interpreted as the relative importance of every discriminant function (sum up to 1) w=sample(1:60,20) test=dane[w,] ucz=dane[-w,] m=lda(y~.,ucz) test.x=test[,-11] klasyfikacja=predict(m,test.x) table(klasyfikacja$class,test$y) blond braz czarne rude blond 2 1 1 0 braz 2 3 2 1 czarne 0 2 2 0 rude 1 1 1 1 misclassification table model=rpart(y~.,dane,method=class,control=rpart.control(xval=3,cp=0)) plot(model) text(model) model$cptable CP nsplit rel error xerror xstd 1 0.05691057 0 1.000 1.097561 0.08180737 2 0.02439024 3 0.8292683 1.219512 0.07040857 3 0. 4 0.8048780 1.195122 0.07310295 the table of optimal prunings npt=which.min(model$table[,4]) npt integer(0) nothing. there's no table in the model object. try npt = which.min(model$cptable[,4]) This gives you the rownumber of the pruning with minimal standard deviation. I need to describe this subject, but i don't know what R is saying to me. This subject is about what women hairs mens like. x1 to x10 are answers to questions 1 is yes,0 is no, but there was 2 groups of questions; from x1 to x6 it must be choisen 2 answers on yes and from x7 to x 10 only 1 on yes. Help me please, i need this to pass this subject. -- View this message in context: http://r.789695.n4.nabble.com/I-need-help-in-analyzing-tp2244886p2244886.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] Loading an image/picture (png/jpeg/...) to screen...
Hello, how can I load an external picture/image file to screen? I want to use locator() then to get coordinates of that picture... ...in other words I want to use R to do some measurements on a picture. Therefore I need to load the image into R display, and that displaying needs to work together with locator(). How to do it best? At the moment I need to be able to read in *.png files, but if *.jpeg or other formats also will be supporttzed, this would be fine. __ R-help@r-project.org mailing list 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] Loading an image/picture (png/jpeg/...) to screen...
Hi, Try this, library(png) example(readPNG) HTH, baptiste On 6 June 2010 13:46, oliver oli...@first.in-berlin.de wrote: Hello, how can I load an external picture/image file to screen? I want to use locator() then to get coordinates of that picture... ...in other words I want to use R to do some measurements on a picture. Therefore I need to load the image into R display, and that displaying needs to work together with locator(). How to do it best? At the moment I need to be able to read in *.png files, but if *.jpeg or other formats also will be supporttzed, this would be fine. __ R-help@r-project.org mailing list 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 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] Nested ANOVA with covariate using Type III sums of squares
Dear Anita and Joris, Please see https://stat.ethz.ch/pipermail/r-help/2010-March/230280.html, posted to r-help in March. Regards, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Anita Narwani Sent: June-03-10 8:49 PM To: Joris Meys Cc: r-help@r-project.org Subject: Re: [R] Nested ANOVA with covariate using Type III sums of squares Yes I understood the strangeness of removing a main effect without interactions that contain it because I did this during my efforts using model simplification. I had checked out the link you sent a couple of days ago. It was useful. So does Type II SS remove both the factor and any interactions containing it when comparing models? i.e. to test for the main effect of B you compare A + B + A:B against A? On Thu, Jun 3, 2010 at 4:59 PM, Joris Meys jorism...@gmail.com wrote: Hi Anita, I have to correct myself too, I've been rambling a bit. Off course you don't delete the variable out of the interaction term when you test the main effect. What I said earlier didn't really make any sense. That testing a main effect without removing the interaction term is has a tricky interpretation. By removing a main effect you test full model A + B + A:B against the model A + A:B. If you remove the main effect Zoop for example, you basically nest Zoop within Diversity and test whether that's not worse than the full model. This explains it very well: https://stat.ethz.ch/pipermail/r-help/2010-March/230280.html I'd go for type II, but you're free to test any hypothesis you want. Cheers Joris On Thu, Jun 3, 2010 at 9:59 PM, Anita Narwani anitanarw...@gmail.comwrote: Thanks for your response Joris. I was aware of the potential for aliasing, although I thought that this was only a problem when you have missing cell means. It was interesting to read the vehement argument regarding the Type III sums of squares, and although I knew that there were different positions on the topic, I had no idea how divisive it was. Nevertheless, Type III SS are generally recommended by statistical texts in ecology for my type of experimental design. Interestingly, despite the aliasing, SPSS has no problems calculating Type III SS for this data set. This is simply because I am entering a co-variate, which causes non-orthogonality. I would be happier using R and the default Type I SS, which are the same as the Type III SS anyway when I omit the co-variate of Mean.richness, except that these results are very sensitive to the order in which I add the variables into the model when I do enter the co-variate. I understand that the order is very important relates back to the scientific hypothesis, but I am equally interested in the main effects of Zoop, Diversity, and the nested effect of Phyto, so entering either of these variables before the other does not make sense from an ecological perspective, and because the results do change, the order cannot be ignored from a statistical perspective. Finally, I have tried using the Type II SS and received similar warnings. Do you have a recommendations? Anita. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] Cumulative frequency percentage and library (equate)
Does anyone know how to get cumulative frequency percentage and how to access library (equate)? Thanks. Grace [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] I need help in analyzing
Thanks very much for helping me, i will think about what you've write : thanks again. : -- View this message in context: http://r.789695.n4.nabble.com/I-need-help-in-analyzing-tp2244886p2244921.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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] R CMD in 2.11.1 error
Andy Zhu wrote: Hi, I have a set of user defined package which I have installed in 2.8.1 for quite some time. I installed 2.11.0 and 2.11.1 a couple of days ago while still having 2.8.1 version in my system. For the package, package.skeleton works fine in R 2.11. However, it comes problem when I run Rcmd check/intall. The intall.out shows below. I further tested that I reran R-2.8.1/bin/R CMD check in 2.8.1. it still works. Then I ran and test the doomed function, gzWrite, in R-2.11.1/binRgui, it also works fine. So, is this the problem in R-2.11.1/bin/Rcmd itself? How do I fix it? I have MinGW, Perl, etc. installed in my system. The problem is in the help file, not in the R code. You need to look somewhere near line 92 of quantplus/man/gzWrite.Rd. Duncan Murdoch I also attached my function gzWrite below. Thank you very much. 00check.out: * install options are ' --no-html' * installing *source* package 'quantplus' ... ** R ** preparing package for lazy loading ** help Warning: newline within quoted string at gzWrite.Rd:92 Warning: ./man/gzWrite.Rd:99: unknown macro '\n' Warning: newline within quoted string at gzWrite.Rd:92 Error in parse_Rd(./man/gzWrite.Rd, encoding = unknown, ...) : Unexpected end of input (in quoted string opened at gzWrite.Rd:99:46) ERROR: installing Rd objects failed for package 'quantplus' * removing 'd:/developer/projects/quant+/package_builder/quantplus.Rcheck/quantplus' the problem function: ** gzWrite = # write out a data frame into a gzip file in the format of write.table function(ds, outdir, outpfx, datepfx, sep='\t', quote=TRUE, row.names=FALSE, col.names=TRUE, na='NA', append=FALSE) { if (F) { ds = ds.price; outdir = pathPrice; outpfx = paste(pfx.price,'_',sep=''); datepfx = fdate; sep = '\t'; quote = TRUE; row.names = FALSE; col.names = TRUE; na = 'NULL'; append = FALSE; } file.out = paste(outdir, '\\', outpfx, datepfx, '.gz', sep=''); file.tmp = paste(outdir, '\\', outpfx, datepfx, '.txt',sep=''); write.table(ds, file=file.tmp, sep=sep, quote=quote, row.names=row.names, col.names=col.names, na=na, append=append); zz = gzfile(file.out, 'w'); raw = file(file.tmp, 'r'); cat(readLines(raw), file=zz, append=F, sep='\n'); close(zz); close(raw); unlink(file.tmp); invisible(NA); } [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] Cumulative frequency percentage and library (equate)
For cumulative frequencies, see ?cumsum https://stat.ethz.ch/pipermail/r-help/2007-September/141499.html To access the _package_ equate, you have to install it first. Then, you just use library(equate). Cheers Joris On Sun, Jun 6, 2010 at 3:26 PM, ying_chen wang gracedrop.w...@gmail.com wrote: Does anyone know how to get cumulative frequency percentage and how to access library (equate)? Thanks. Grace [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] Wrong symbol rendering in plots (Ubuntu)
Yvonnick NOEL yvonnick.noel at uhb.fr writes: Hello, I have the very same problem. Plotting code that used to work before I upgraded to Ubuntu Lucid Lynx does not work anymore. For example: plot(1:10) text(6,4,expression(pi)) The 'pi' greek letter appear as a \neq (different from symbol). Yvonnick Noel Does the workaround pointed out later in the thread you're responding to (from the last paragraph of a very long 'Note' section of ?pdf) help? If not it might be worth continuing this thread on r-devel . It does seem that there are two (related?) issues, one with pch=1 and the other with Symbol (???) fonts ... For reference: http://ubuntuforums.org/showthread.php?t=1325289 although it's also not clear whether this is exactly the same issue, or a related/similar one. On some systems the default plotting character ‘pch = 1’ is displayed in some PDF viewers incorrectly as a ‘q’ character. (These seem to be viewers based on the ‘poppler’ PDF rendering library). This may be due to incorrect or incomplete mapping of font names to those used by the system. Adding the following lines to ‘~/.fonts.conf’ or ‘/etc/fonts/local.conf’ may circumvent this problem. alias binding=same familyZapfDingbats/family acceptfamilyDingbats/family/accept /alias __ R-help@r-project.org mailing list 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 usage to update data.frame
Good morning! I have two datasets with the same structure, one containing all my values and the second one that update same of these values (see example below). I want to create a data.frame with all the values of the first dataset except when an entry is present in the second dataset, in which case the second dataset value is taken. Is there a better method than my last line kludge? Thanks for your help! mario t1 - textConnection(AAA 1 BBB 2 CCC 3) a - read.table(t1, stringsAsFactors=FALSE) close(t1) t2 - textConnection(BBB 22) u - read.table(t2, stringsAsFactors=FALSE) close(t2) m - merge(a, u, by=V1, all.x=TRUE) out - data.frame(V1=m$V1, V2=ifelse(is.na(m$V2.y), m$V2.x, m$V2.y)) -- Ing. Mario Valle Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 __ R-help@r-project.org mailing list 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] prettyR
Hi all, does anyone have any practical examples of how this command can be used in prettyR? add.value.labels(x,value.labels) I mean, can we have the SPSS style of using numbers and/or labels if we want to? Thank you for your time Jason Dr. Iasonas Lamprianou Assistant Professor (Educational Research and Evaluation) Department of Education Sciences European University-Cyprus P.O. Box 22006 1516 Nicosia Cyprus Tel.: +357-22-713178 Fax: +357-22-590539 Honorary Research Fellow Department of Education The University of Manchester Oxford Road, Manchester M13 9PL, UK Tel. 0044 161 275 3485 iasonas.lampria...@manchester.ac.uk __ R-help@r-project.org mailing list 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] Why did TukeyHSD not work when I used it for post-hoc for 2way within-subjects anova?
Dear R people, I have a couple of questions about post-doc analyses for 2 by 2 within subjects ANOVA. I conducted a psycholinguistic study that combined a 2 by 2 design and a latin square design. Specifically, I had 32 items each of which generated 4 conditions. Participants saw each of the 32 items only once: 8 in Condition A, 8 in B, 8 in C, and 8 in D. The table below serves as an example. *Subject* *Factor1* *Factor2* *Condition* *ReadingTime* *Item* 1 A A A 238 Item1 1 A A A 369 Item5 1 A A A 494 Item9 *.* *.* *.* *.* *.* *.* *.* *.* *. * *.* *.* *.* 1 B A C 294 Item22 1 B A C 694 Item26 *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* 8 A A A 334 Item3 8 A A A 366 Item7 *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* I did ANOVA by using the following : result.subject=aov(ReadingTime~Factor1*Factor2 + Error(Subject/(Factor1*Factor2)), data=data), AND result.item=aov(ReadingTime~Factor1*Factor2 + Error(Item/(Factor1*Factor2)), data=data). Both both functions returned significances. Now I am confused as to what methods I should use to do post-hoc analysis and how to use them. I attempted TukeyHSD, but it gave me an error message as shown below. I am not sure how to apply TukeyHSD properly since the help file was not clear enough on that. So I wonder if you can tell me what went wrong with my function. TukeyHSD(result.subject, c('Factor1','Factor2'), ordered=TRUE) Error in UseMethod(TukeyHSD) : no applicable method for 'TukeyHSD' applied to an object of class c('aovlist', 'listof') Also, I I attempted *pairwise.t.test* by averaging each participant's reading times in each condition (see the table below) with *p* values adjusted with Bonferroni method (*e.g. *pairwise.t.test(y,group, bonferroni, pair=TRUE)), . It gave me significant results. But I am not sure if it is a proper method to use (Sorry I know this is more of a statistics related problem). So I wonder if you can tell me if pairwise.t.test is a proper method. If not, what other functions might be useful for post-hoc analysis. Thank you in advance!! *Subject* *Condition* *AvgRT* 1 A 210 2 A 309 . . . . . . 19 A 305 20 A 502 1 B 480 2 B 209 . . . . . . 19 B 400 20 B 270 . . . . . . 19 D 190 20 D 254 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Creating pdf report
I'm looking for a way to create a pdf report that contains multiple graphs on one page as well as tables (ideally with some lines below categories etc.) . I have used the pdf(filename) followed by dev.off() to date but this prints one graph per page and does not seem to have functionality for tables. Thanks Sent from my BlackBerry® wireless device __ R-help@r-project.org mailing list 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] Howto modify a drawn graph with igraph
Hello, I am using the igraph package, and I wonder how to add or modify informations on a drawn graph. Example: library(igraph) M - matrix( nc=12, nr=12 , 0) M[ 1,]=c(0,1,0,0,1,1,0,0,0,0,0,0) M[ 2,]=c(1,0,1,1,1,0,0,0,0,0,0,0) M[ 3,]=c(0,1,0,0,0,1,1,0,0,0,0,0) M[ 4,]=c(0,1,0,0,0,1,0,0,0,0,0,0) M[ 5,]=c(1,1,0,0,0,0,0,0,0,0,0,0) M[ 6,]=c(1,0,1,1,0,0,0,0,0,0,0,0) M[ 7,]=c(0,0,1,0,0,0,0,1,1,0,0,1) M[ 8,]=c(0,0,0,0,0,0,1,0,1,0,0,1) M[ 9,]=c(0,0,0,0,0,0,1,1,0,0,1,1) M[10,]=c(0,0,0,0,0,0,0,0,0,0,1,0) M[11,]=c(0,0,0,0,0,0,1,0,1,0,0,0) M[12,]=c(0,0,0,0,0,0,0,1,1,0,0,0) g - graph.adjacency( M,mode=undirected ) mlayout= layout.kamada.kawai(g) plot(g,layout=mlayout) #And now howto add a weight associated on edges on the picture? #Or howto change the color of an edge, or a vertice? Thanks for help. Etienne __ R-help@r-project.org mailing list 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] fitting multinomial logistic regression
Sir, I want to fit a multinomial logistic regression in R.I think mlogit() is the function for doing this. mlogit () is in packege globaltest.But, I can not install this package. I use the following: install.packages(globaltest) Can you help me? Regards, Suman Dhara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Generalized DCC GARCH ML estimation
-- View this message in context: http://r.789695.n4.nabble.com/Generalized-DCC-GARCH-ML-estimation-tp2245125p2245125.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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] Generalized DCC GARCH ML estimation
Hi everyone, I want to do a maximum likelihood estimation for the Generalized Dynamic Conditional Correlation (GDCC) Model of Hafner and Franses (2009), but I don't know how exactly. I hope you can help me. This is what I have so far. Well first of all Hafner models the conditional covariance matrix H_t as follows: H=D*R*D, where D is a diagonal matrix with the square root of the estimated univariate GARCH variances, R is a correlation matrix: R_t=diag(Q_t)^(-1/2)*Q_t*diag(Q_t)^(-1/2) and Q_t=S(1-mean(a)^2-mean(b)^2)+ aa' * (eps_(t-1)*eps')+ bb'*Q_(t-1) a and b are parameter vectors and S is the sample correlation matrix of the eps. There is a two-step estimation method, but I only need the second step. So first of all I want to calculate the correlations gdcc=function (dvar,alpha,beta) { T=dim(dvar)[1] N=dim(dvar)[2] uncR=cor(dvar) R=list() Q=list() Q[[1]]=uncR R[[1]]=diag(diag(uncR)^(-1/2))%*%uncR%*%diag(diag(uncR)^(-1/2)) for (i in 2:T) { Q[[i]]=uncR*(1-mean(alpha)^2-mean(beta)^2)+tcrossprod(alpha)*tcrossprod(dvar[i-1,])+tcrossprod(beta)*Q[[i-1]] R[[i]]=diag(diag(Q[[i]])^(-1/2))%*%Q[[i]]%*%diag(diag(Q[[i]])^(-1/2)) GDCC[i,]=as.vector(R[[i]]) } GDCC } and the log-likelihood function is as follows: loglik.gdcc2=function (alpha,beta,dvar) { T - dim(dvar)[1] N - dim(dvar)[2] GDCC=gdcc(dvar,alpha,beta) lf - numeric(N) for (i in 1:T) { R - matrix(GDCC[i,], N, N) invR - solve(R) lf[i] - 0.5 * (log(det(R)) + sum(dvar[i, ] * crossprod(invR, dvar[i, ]))) } -sum(lf) } I want to use the nlm method. How can I estimate the parameter vectors a and b? I really would appreciate it if anyone could help me. Thank you very much. Best regards, drinky_1 -- View this message in context: http://r.789695.n4.nabble.com/Generalized-DCC-GARCH-ML-estimation-tp2245135p2245135.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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] R2HTML problem
Which editor could I use on Windows? The program that already works with TinnR... will work with this new editor? Thanks! On Sat, Jun 5, 2010 at 11:40 PM, Joris FA Meys [via R] ml-node+2244582-437396255-277...@n4.nabble.comml-node%2b2244582-437396255-277...@n4.nabble.com wrote: Tinn-R is using the R2HTML package itself for communication with R. You could ask JC Faria who wrote Tinn-R what exactly is going on there. You might get more help here : http://sourceforge.net/projects/tinn-r/support Personally, I'd just use a different editor in this case. I love Tinn-R, but it's no use programming in an editor that interacts with your code. Cheers Joris On Sat, Jun 5, 2010 at 4:57 PM, RGtk2User [hidden email]http://user/SendEmail.jtp?type=nodenode=2244582i=0 wrote: Im developing an application with R and Gtk+. It's just a simple GUI which helps new users to interactuate with R. Thing is, when you do a statistical analysis, I also want to provide a HTML report, but HTMLStart doesnt work propperly when executing from TinnR. It does create the file but not empty, I've tried some examples from different websites, and it's always the same.. it works if I execute it from the R prompt, but doesnt when it comes to execute it from TinnR. So, any ideas? Im trying to divide the internal code of the HTMLStart function to find out where it crashes, but I couldnt find it yet. Thanks in advance __ [hidden email] http://user/SendEmail.jtp?type=nodenode=2244582i=1mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 [hidden email] http://user/SendEmail.jtp?type=nodenode=2244582i=2 --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ [hidden email] http://user/SendEmail.jtp?type=nodenode=2244582i=3mailing list 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. -- View message @ http://r.789695.n4.nabble.com/R2HTML-problem-tp2244294p2244582.html To unsubscribe from R2HTML problem, click here (link removed) ==. -- View this message in context: http://r.789695.n4.nabble.com/R2HTML-problem-tp2244294p2245140.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Creating pdf report
On 06/06/10 19:26, bjlwilkin...@gmail.com wrote: I'm looking for a way to create a pdf report that contains multiple graphs on one page as well as tables (ideally with some lines below categories etc.) . I have used the pdf(filename) followed by dev.off() to date but this prints one graph per page and does not seem to have functionality for tables. Thanks Look at ?Sweave. PhG Sent from my BlackBerry® wireless device __ R-help@r-project.org mailing list 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 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] geom_ribbon removes missing values
Hi Hadley, On 5/31/10 9:51 PM, Hadley Wickham wrote: There's no easy way to do this because behind the scenes geom_ribbon uses grid.polygon. A possible workaround might be to have grid.polygon draw multiple polygons, one for each interval. We can do this by constructing vectors with coordinates for the first polygon, then NA, then coordinates for the second polygon, etc. Here are the vectors for my initial example: x - c(x[1:4], x[4:1], NA, x[7:10], x[10:7]) y - c(ymax[1:4], ymin[4:1], NA, ymax[7:10], ymin[10:7]) I worked on a simple (but ugly) patch to GeomRibbon in ggplot2 that does the job using an iteration: /Library/Frameworks/R.framework/Versions/2.10/Resources/library/ggplot2/R$ diff ggplot2-orig ggplot2 5047,5048d5046 data - remove_missing(data, na.rm, c(x,ymin,ymax), name = geom_ribbon) 5050a5049,5069 start - 0 polyx - c() polyy - c() for (i in 1:(length(data$x)+1)) { if (i length(data$x) || is.na(data$ymin[i]) || is.na(data$ymax[i])) { if (start 0) { polyx - c(polyx, data$x[start:(i-1)], data$x[(i-1):start], NA) polyy - c(polyy, data$ymax[start:(i-1)], data$ymin[start:(i-1)], NA) start - 0 } } else { if (start == 0) { start - i } } } polyx - head(polyx, length(polyx) - 1) polyy - head(polyy, length(polyy) - 1) 5052c5071 coordinates$munch(data.frame(x=c(x, rev(x)), y=c(ymax, rev(ymin))), scales) --- coordinates$munch(data.frame(x = polyx, y = polyy), scales) Do you like the described approach? Can you help me make my patch better? In particular, I'd want to avoid iterating over the data frame and extract start and end index of intervals separated by NA. Is there a function for this or at least a better approach? Also, probably a stupid question: How do I tell R to use the cloned ggplot2 sources instead of the installed ggplot2 package? As you can see, I modified the installed package, but I'd rather work with Git here. Thanks, --Karsten On Sun, May 30, 2010 at 7:26 AM, Karsten Loesing karsten.loes...@gmx.net wrote: Hi everyone, it looks like geom_ribbon removes missing values and plots a single ribbon over the whole interval of x values. However, I'd rather want it to act like geom_line, that is, interrupt the ribbon for the interval of missing values and continue once there are new values. Here's an example: library(ggplot2) df - data.frame( date = seq(from = as.Date(2010-05-15), to = as.Date(2010-05-24), by = 1 day), low = c(4, 5, 4, 5, NA, NA, 4, 5, 4, 5), mid = c(8, 9, 8, 9, NA, NA, 8, 9, 8, 9), high = c(12, 13, 12, 13, NA, NA, 12, 13, 12, 13)) ggplot(df, aes(x = date, y = mid, ymin = low, ymax = high)) + geom_line() + geom_ribbon(fill = alpha(blue, 0.5)) When running this code, R tells me: Warning message: Removed 2 rows containing missing values (geom_ribbon). When you look at the graph, you can see that the line stops at May 18 and starts again on May 21. But the ribbon reaches from May 15 to 24, even though there are no values on May 19 and 20. Is there an option that I could set? Or a geom/stat that I should use instead? In my pre-ggplot2 times I used polygon(), but I figured there must be something better in ggplot2 (as there has always been so far). Thanks, --Karsten __ R-help@r-project.org mailing list 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 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] Why did TukeyHSD not work when I used it for post-hoc for 2way within-subjects anova?
Sorry, that in the last message the tables were messed up. Here is a link to the tables http://www-scf.usc.edu/~hex/data.txt http://www-scf.usc.edu/~hex/data.txtThanks! On Sun, Jun 6, 2010 at 10:18 AM, Xiao He praguewaterme...@gmail.com wrote: Dear R people, I have a couple of questions about post-doc analyses for 2 by 2 within subjects ANOVA. I conducted a psycholinguistic study that combined a 2 by 2 design and a latin square design. Specifically, I had 32 items each of which generated 4 conditions. Participants saw each of the 32 items only once: 8 in Condition A, 8 in B, 8 in C, and 8 in D. The table below serves as an example. *Subject* *Factor1* *Factor2* *Condition* *ReadingTime* *Item* 1 A A A 238 Item1 1 A A A 369 Item5 1 A A A 494 Item9 *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* 1 B A C 294 Item22 1 B A C 694 Item26 *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* *.* 8 A A A 334 Item3 8 A A A 366 Item7 *.* *.* *. * *.* *.* *.* *.* *.* *.* *.* *.* *.* I did ANOVA by using the following : result.subject=aov(ReadingTime~Factor1*Factor2 + Error(Subject/(Factor1*Factor2)), data=data), AND result.item=aov(ReadingTime~Factor1*Factor2 + Error(Item/(Factor1*Factor2)), data=data). Both both functions returned significances. Now I am confused as to what methods I should use to do post-hoc analysis and how to use them. I attempted TukeyHSD, but it gave me an error message as shown below. I am not sure how to apply TukeyHSD properly since the help file was not clear enough on that. So I wonder if you can tell me what went wrong with my function. TukeyHSD(result.subject, c('Factor1','Factor2'), ordered=TRUE) Error in UseMethod(TukeyHSD) : no applicable method for 'TukeyHSD' applied to an object of class c('aovlist', 'listof') Also, I I attempted *pairwise.t.test* by averaging each participant's reading times in each condition (see the table below) with *p* values adjusted with Bonferroni method (*e.g. *pairwise.t.test(y,group, bonferroni, pair=TRUE)), . It gave me significant results. But I am not sure if it is a proper method to use (Sorry I know this is more of a statistics related problem). So I wonder if you can tell me if pairwise.t.test is a proper method. If not, what other functions might be useful for post-hoc analysis. Thank you in advance!! *Subject* *Condition* *AvgRT* 1 A 210 2 A 309 . . . . . . 19 A 305 20 A 502 1 B 480 2 B 209 . . . . . . 19 B 400 20 B 270 . . . . . . 19 D 190 20 D 254 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Creating pdf report
For multiple figures on one page have a look at An introduction to R (pdf, downloadable from the net), page 72 For printing the data have a look at: library(gplots) help(textplot) HTH Jannis bjlwilkin...@gmail.com schrieb: I'm looking for a way to create a pdf report that contains multiple graphs on one page as well as tables (ideally with some lines below categories etc.) . I have used the pdf(filename) followed by dev.off() to date but this prints one graph per page and does not seem to have functionality for tables. Thanks Sent from my BlackBerry® wireless device __ R-help@r-project.org mailing list 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 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] fitting multinomial logistic regression
suman dhara suman.dhara89 at gmail.com writes: I want to fit a multinomial logistic regression in R.I think mlogit() is the function for doing this. mlogit () is in packege globaltest.But, I can not install this package. I use the following: install.packages(globaltest) Can you help me? Only if you give us some kind of clue about what precisely is not working. What version of R are you using (post results of sessionInfo() ) , what repository did you choose when prompted, do you have a working internet connection, *exactly* what error message appeared ... ? (Hint: I got package ‘globaltest’ is not available. When I did library(sos) ## install this if necessary findFn(mlogit) I found that there was an mlogit package, which installed fine for me.) (Hint #2: it appears that globaltest is in Bioconductor. You might want to post this query on the bioconductor mailing list.) __ R-help@r-project.org mailing list 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] fitting multinomial logistic regression
To install this package, start R and enter: source(http://bioconductor.org/biocLite.R;) biocLite(globaltest) Hope that helps On Mon, Jun 7, 2010 at 12:15 AM, Ben Bolker bol...@ufl.edu wrote: suman dhara suman.dhara89 at gmail.com writes: I want to fit a multinomial logistic regression in R.I think mlogit() is the function for doing this. mlogit () is in packege globaltest.But, I can not install this package. I use the following: install.packages(globaltest) Can you help me? Only if you give us some kind of clue about what precisely is not working. What version of R are you using (post results of sessionInfo() ) , what repository did you choose when prompted, do you have a working internet connection, *exactly* what error message appeared ... ? (Hint: I got package globaltest is not available. When I did library(sos) ## install this if necessary findFn(mlogit) I found that there was an mlogit package, which installed fine for me.) (Hint #2: it appears that globaltest is in Bioconductor. You might want to post this query on the bioconductor mailing list.) __ R-help@r-project.org mailing list 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 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] prettyR
Sorry if I could not understand your problem properly. Are you looking for this type of example? assign(paste(x, 1, level, sep=), 4) x1level [1] 4 Thanks, -- View this message in context: http://r.789695.n4.nabble.com/prettyR-tp2245115p2245210.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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] geom_ribbon removes missing values
On 6/6/10 7:46 PM, Karsten Loesing wrote: Hi Hadley, On 5/31/10 9:51 PM, Hadley Wickham wrote: There's no easy way to do this because behind the scenes geom_ribbon uses grid.polygon. A possible workaround might be to have grid.polygon draw multiple polygons, one for each interval. We can do this by constructing vectors with coordinates for the first polygon, then NA, then coordinates for the second polygon, etc. Here are the vectors for my initial example: x - c(x[1:4], x[4:1], NA, x[7:10], x[10:7]) y - c(ymax[1:4], ymin[4:1], NA, ymax[7:10], ymin[10:7]) I worked on a simple (but ugly) patch to GeomRibbon in ggplot2 that does the job using an iteration: /Library/Frameworks/R.framework/Versions/2.10/Resources/library/ggplot2/R$ diff ggplot2-orig ggplot2 5047,5048d5046 data - remove_missing(data, na.rm, c(x,ymin,ymax), name = geom_ribbon) 5050a5049,5069 start - 0 polyx - c() polyy - c() for (i in 1:(length(data$x)+1)) { if (i length(data$x) || is.na(data$ymin[i]) || is.na(data$ymax[i])) { if (start 0) { polyx - c(polyx, data$x[start:(i-1)], data$x[(i-1):start], NA) polyy - c(polyy, data$ymax[start:(i-1)], data$ymin[start:(i-1)], NA) Whoops, change that to: data$ymin[(i-1):start], NA) start - 0 } } else { if (start == 0) { start - i } } } polyx - head(polyx, length(polyx) - 1) polyy - head(polyy, length(polyy) - 1) 5052c5071 coordinates$munch(data.frame(x=c(x, rev(x)), y=c(ymax, rev(ymin))), scales) --- coordinates$munch(data.frame(x = polyx, y = polyy), scales) Do you like the described approach? Can you help me make my patch better? In particular, I'd want to avoid iterating over the data frame and extract start and end index of intervals separated by NA. Is there a function for this or at least a better approach? Also, probably a stupid question: How do I tell R to use the cloned ggplot2 sources instead of the installed ggplot2 package? As you can see, I modified the installed package, but I'd rather work with Git here. Thanks, --Karsten On Sun, May 30, 2010 at 7:26 AM, Karsten Loesing karsten.loes...@gmx.net wrote: Hi everyone, it looks like geom_ribbon removes missing values and plots a single ribbon over the whole interval of x values. However, I'd rather want it to act like geom_line, that is, interrupt the ribbon for the interval of missing values and continue once there are new values. Here's an example: library(ggplot2) df - data.frame( date = seq(from = as.Date(2010-05-15), to = as.Date(2010-05-24), by = 1 day), low = c(4, 5, 4, 5, NA, NA, 4, 5, 4, 5), mid = c(8, 9, 8, 9, NA, NA, 8, 9, 8, 9), high = c(12, 13, 12, 13, NA, NA, 12, 13, 12, 13)) ggplot(df, aes(x = date, y = mid, ymin = low, ymax = high)) + geom_line() + geom_ribbon(fill = alpha(blue, 0.5)) When running this code, R tells me: Warning message: Removed 2 rows containing missing values (geom_ribbon). When you look at the graph, you can see that the line stops at May 18 and starts again on May 21. But the ribbon reaches from May 15 to 24, even though there are no values on May 19 and 20. Is there an option that I could set? Or a geom/stat that I should use instead? In my pre-ggplot2 times I used polygon(), but I figured there must be something better in ggplot2 (as there has always been so far). Thanks, --Karsten __ R-help@r-project.org mailing list 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 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] fitting multinomial logistic regression
On Sun, 6 Jun 2010, suman dhara wrote: Sir, I want to fit a multinomial logistic regression in R.I think mlogit() is the function for doing this. mlogit () is in packege globaltest.But, I can not install this package. I use the following: To add to some of the previously given advice: - The globaltest package provides an mlogit() function that estimates a multinomial logit model using (as far as I can see) sum contrasts for the coefficients. - The nnet package provides the function multinom() for the multinomial logit model using treatment contrasts for the coefficients. - The mlogit package provides a different function mlogit() that provides a wider range of multinomial logit models using not only individual-specific variables (as the previous two functions) but also alternative-specific variables. If you have alternative-specific variables, you should probably look at the mlogit package. If not, then I would personally prefer the multinom() function in nnet because it provides a few more extractor functions and is described in the MASS book by Venables Ripley. In addition to that, there are more packages for different flavors of multinomial models, including the multinom family in the VGAM package, among others... hth, Z install.packages(globaltest) Can you help me? Regards, Suman Dhara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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 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] Creating pdf report
Hi, ggplot2 and lattice also provide convenient ways to arrange multiple plots on a page. For tables, there's also a function based on Grid graphics in the gridExtra package. A typical dummy example might be, library(ggplot2) library(gridExtra) p = qplot(Sepal.Length, Petal.Length, data=iris, colour=Species) + facet_grid(~Species) tab = tableGrob(head(iris)) pdf(plotandtable.pdf) arrange(p, tab) dev.off() HTH, baptiste On 6 June 2010 19:26, bjlwilkin...@gmail.com wrote: I'm looking for a way to create a pdf report that contains multiple graphs on one page as well as tables (ideally with some lines below categories etc.) . I have used the pdf(filename) followed by dev.off() to date but this prints one graph per page and does not seem to have functionality for tables. Thanks Sent from my BlackBerry® wireless device __ R-help@r-project.org mailing list 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. -- Baptiste Auguié Departamento de Química Física, Universidade de Vigo, Campus Universitario, 36310, Vigo, Spain tel: +34 9868 18617 http://webs.uvigo.es/coloides __ R-help@r-project.org mailing list 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] sem R: singular and Could not compute QR decomposition of Hessian
Dear Ana, I copy here the response that I sent to you directly, for the other people reading this thread on r-help: I've now had a chance to look at your model. Because of its unusual structure, it's hard for me to know its identification status. For example, you specify that almost all of the exogenous latent variables are uncorrelated with each other. Similarly, you've specified that the exogenous observed variables, y1, y2, y3, y8, y9, and y10, are uncorrelated. Not only do these restrictions make it hard to figure out identification, but they also make it very unlikely that the model will fit the data reasonably; in fact, I'd be very surprised -- identified or not -- whether the model can be estimated. Although I haven't demonstrated that it is underidentified, the model has a very large number of latent variables, 11, relative to the number of observed variables, 22, and two of the latent variables, N4 and E6, are tied to only one indicator each. In addition, as explained in ?sem, C is the reproduced rather than directly observed covariance matrix covariance matrix of the observed variables. From your remarks, the observed covariance matrix S is close to singular, but not exactly so. That sem computes a singular C (after how many iterations?) may reflect an underidentified model, as would aliased parameters. It is odd that you seem to get different results with the same input, but I suspect that you mean that you get different results for slightly different models, though all of them possible symptoms of underidentification. Regards, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of sanchez ana Sent: June-04-10 3:31 PM To: r-help@r-project.org Subject: [R] sem R: singular and Could not compute QR decomposition of Hessian Can somebody help me with the following issue (SEM in R), please: When I run the model (includes second order models) in R, it gives me the following: 1) In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars, : Could not compute QR decomposition of Hessian. Optimization probably did not converge. 2) I have aliased parameters and NaNS or sometimes when I run it again I have the following message: 1) Error in solve.default(C) : The system is computationally singular: condition number = 4.28182e-19 (it says so in Spanish) Since the items are measured in likert scales I was using polychoric correlations, however, I saw that it can cause troubles, so I decided not to use it anymore. I also check the following: 1) Variables with variance 0 (I do not have) 2) Linear combinations of variables (I do not have high correlations) 3) I already used initial values for the aliased parameters 4) I do not have missing data 5) The eigenvalues of the S matrix are all positive (no zeros) 6) I calculate the determinant of the correlation matrix, adding one variable at a time, in order to look for multivariate dependencies, but the determinants are not cero, the lowest one is:0.0004054475 Since the model has constructs that are measured with only one item, I decided to connect directly the variable (item) to the other constructs. Thanks Ana [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Merge usage to update data.frame
try this: a V1 V2 1 AAA 1 2 BBB 2 3 CCC 3 u V1 V2 1 BBB 22 a$V2[match(u$V1, a$V1)] - u$V2 a V1 V2 1 AAA 1 2 BBB 22 3 CCC 3 On Sun, Jun 6, 2010 at 12:41 PM, Mario Valle mva...@cscs.ch wrote: Good morning! I have two datasets with the same structure, one containing all my values and the second one that update same of these values (see example below). I want to create a data.frame with all the values of the first dataset except when an entry is present in the second dataset, in which case the second dataset value is taken. Is there a better method than my last line kludge? Thanks for your help! mario t1 - textConnection(AAA 1 BBB 2 CCC 3) a - read.table(t1, stringsAsFactors=FALSE) close(t1) t2 - textConnection(BBB 22) u - read.table(t2, stringsAsFactors=FALSE) close(t2) m - merge(a, u, by=V1, all.x=TRUE) out - data.frame(V1=m$V1, V2=ifelse(is.na(m$V2.y), m$V2.x, m$V2.y)) -- Ing. Mario Valle Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 __ R-help@r-project.org mailing list 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list 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] Loading an image/picture (png/jpeg/...) to screen...
baptiste auguie baptiste.auguie at googlemail.com writes: Hi, Try this, library(png) example(readPNG) [...] If rasterImage would be available, I think this would be the right hint. But it isn't. So I can load the pic, but not display it. :( Ciao, Oliver __ R-help@r-project.org mailing list 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] separating data into columns
Hi All- I have been trying to separate data into columns - specifically the date - and then aggregate the rest of the data to calculate summer hourly means. However, now I would like to calculate hourly means just over one day at a time. And, I am not able to figure out how to do this. I read some help files that I think indicated that I can only use the method below for months, years and quarters. Perhaps just separating the date into the following columns would work - Yr Mon Day Hr Min??? I originally used zoo and chron as follows for the monthly means: library(zoo) library(chron) z - read.zoo(C:/R/SPL JJA 2006 2008.txt, header = TRUE, na.strings = -999, format = %y%m%d%H%M, FUN = as.chron, colClasses = c(character, rep(numeric, 10))) mph - z[months(time(z)) %in% c(Jun, Jul, Aug),] mphagg - aggregate(mph, hours, mean) Here is a sample data set: YYMMDDhhmm Precip mph DegDegF Fuel Rel volts DegMx mphgust wm 060601 0.004.6 97.5 42.1 -999 39.5 -999 -999 5.20.3 0606010005 0.004.6 97.6 42.0 -999 38.8 -999 -999 5.70.3 0606010010 0.002.6 97.6 41.9 -999 36.9 -999 -999 3.50.3 0606010015 0.002.3 97.6 41.8 -999 37.1 -999 -999 3.70.3 0606010020 0.001.8 97.6 41.5 -999 36.3 -999 -999 1.80.3 0606010025 0.001.8 97.6 41.1 -999 36.1 -999 -999 1.80.3 0606010030 0.001.8 97.6 40.8 -999 36.1 -999 -999 1.80.3 0606010035 0.001.8 97.6 40.4 -999 35.3 -999 -999 1.80.3 0606010040 0.001.8 97.7 40.1 -999 36.0 -999 -999 1.80.3 0606010045 0.001.8 97.7 39.7 -999 36.7 -999 -999 1.80.3 0606010050 0.001.8 97.7 39.3 -999 37.3 -999 -999 1.80.3 0606010055 0.001.8 97.7 38.9 -999 38.0 -999 -999 1.80.3 0606010100 0.001.8 97.7 38.6 -999 38.9 -999 -999 1.80.3 Any help is appreciated- Thanks- Sherri Heck University of Colorado __ R-help@r-project.org mailing list 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] separating data into columns
This calculates hourly means: aggregate(z, trunc(time(z), 01:00:00), mean) Precip mphDeg DegF Fuel Rel volts DegMx mphgust wm (06/01/06 00:00:00) 0 2.375 97.625 40.8 NA 37.00833NANA 2.708333 0.3 (06/01/06 01:00:00) 0 1.800 97.700 38.6 NA 38.9NANA 1.80 0.3 Also note that in the examples section of help(read.zoo) is an example of aggregating as you read the data in using read.zoo. On Sun, Jun 6, 2010 at 7:40 PM, sh...@ucar.edu wrote: Hi All- I have been trying to separate data into columns - specifically the date - and then aggregate the rest of the data to calculate summer hourly means. However, now I would like to calculate hourly means just over one day at a time. And, I am not able to figure out how to do this. I read some help files that I think indicated that I can only use the method below for months, years and quarters. Perhaps just separating the date into the following columns would work - Yr Mon Day Hr Min??? I originally used zoo and chron as follows for the monthly means: library(zoo) library(chron) z - read.zoo(C:/R/SPL JJA 2006 2008.txt, header = TRUE, na.strings = -999, format = %y%m%d%H%M, FUN = as.chron, colClasses = c(character, rep(numeric, 10))) mph - z[months(time(z)) %in% c(Jun, Jul, Aug),] mphagg - aggregate(mph, hours, mean) Here is a sample data set: YYMMDDhhmm Precip mph Deg DegF Fuel Rel volts DegMx mphgust wm 060601 0.00 4.6 97.5 42.1 -999 39.5 -999 -999 5.2 0.3 0606010005 0.00 4.6 97.6 42.0 -999 38.8 -999 -999 5.7 0.3 0606010010 0.00 2.6 97.6 41.9 -999 36.9 -999 -999 3.5 0.3 0606010015 0.00 2.3 97.6 41.8 -999 37.1 -999 -999 3.7 0.3 0606010020 0.00 1.8 97.6 41.5 -999 36.3 -999 -999 1.8 0.3 0606010025 0.00 1.8 97.6 41.1 -999 36.1 -999 -999 1.8 0.3 0606010030 0.00 1.8 97.6 40.8 -999 36.1 -999 -999 1.8 0.3 0606010035 0.00 1.8 97.6 40.4 -999 35.3 -999 -999 1.8 0.3 0606010040 0.00 1.8 97.7 40.1 -999 36.0 -999 -999 1.8 0.3 0606010045 0.00 1.8 97.7 39.7 -999 36.7 -999 -999 1.8 0.3 0606010050 0.00 1.8 97.7 39.3 -999 37.3 -999 -999 1.8 0.3 0606010055 0.00 1.8 97.7 38.9 -999 38.0 -999 -999 1.8 0.3 0606010100 0.00 1.8 97.7 38.6 -999 38.9 -999 -999 1.8 0.3 Any help is appreciated- Thanks- Sherri Heck University of Colorado __ R-help@r-project.org mailing list 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 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] separating data into columns
I am sure there is a more sophisticated way, but I would do it like this: hourindex - round(as.numeric(YYMMDDHHmm)/100,digits=0) hourly.means - aggregate(dataset,hourindex,mean) For aggregate you just need an index with the length of the amount of rows that your dataset has, that assigns a unique number to each hour. Still I am sure there are ways to extract, for example, the amount of hours since origin from a zoo object and use this as the hourindex. HTH Jannis sh...@ucar.edu schrieb: Hi All- I have been trying to separate data into columns - specifically the date - and then aggregate the rest of the data to calculate summer hourly means. However, now I would like to calculate hourly means just over one day at a time. And, I am not able to figure out how to do this. I read some help files that I think indicated that I can only use the method below for months, years and quarters. Perhaps just separating the date into the following columns would work - Yr Mon Day Hr Min??? I originally used zoo and chron as follows for the monthly means: library(zoo) library(chron) z - read.zoo(C:/R/SPL JJA 2006 2008.txt, header = TRUE, na.strings = -999, format = %y%m%d%H%M, FUN = as.chron, colClasses = c(character, rep(numeric, 10))) mph - z[months(time(z)) %in% c(Jun, Jul, Aug),] mphagg - aggregate(mph, hours, mean) Here is a sample data set: YYMMDDhhmm Precip mph DegDegF Fuel Rel volts DegMx mphgust wm 060601 0.004.6 97.5 42.1 -999 39.5 -999 -999 5.20.3 0606010005 0.004.6 97.6 42.0 -999 38.8 -999 -999 5.70.3 0606010010 0.002.6 97.6 41.9 -999 36.9 -999 -999 3.50.3 0606010015 0.002.3 97.6 41.8 -999 37.1 -999 -999 3.70.3 0606010020 0.001.8 97.6 41.5 -999 36.3 -999 -999 1.80.3 0606010025 0.001.8 97.6 41.1 -999 36.1 -999 -999 1.80.3 0606010030 0.001.8 97.6 40.8 -999 36.1 -999 -999 1.80.3 0606010035 0.001.8 97.6 40.4 -999 35.3 -999 -999 1.80.3 0606010040 0.001.8 97.7 40.1 -999 36.0 -999 -999 1.80.3 0606010045 0.001.8 97.7 39.7 -999 36.7 -999 -999 1.80.3 0606010050 0.001.8 97.7 39.3 -999 37.3 -999 -999 1.80.3 0606010055 0.001.8 97.7 38.9 -999 38.0 -999 -999 1.80.3 0606010100 0.001.8 97.7 38.6 -999 38.9 -999 -999 1.80.3 Any help is appreciated- Thanks- Sherri Heck University of Colorado __ R-help@r-project.org mailing list 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 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] paste together a string object later to be utilized in a function
Dear r-listers, I need to pass a string to a function. However the length of the string is dependent on the length of a vector. b-length(h) v-paste(rep(names(ts$a[,1:b,]),ts$a[,1:b,]),sep=) Is it possible somehow to pass this as an argument to a function later on ? Regards, //M __ R-help@r-project.org mailing list 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] paste together a string object later to be utilized in a function
Wild guess, but it looks like you are looking at : ts - list(a=1:5) names(ts$a) - letters[1:5] v-paste(rep(names(ts$a[,1:b,]),ts$a[,1:b,]),sep=) sapply(v,function(x){eval(parse(,text=x))}) $`rep(names(ts$a[1]),ts$a[1])` [1] a $`rep(names(ts$a[2]),ts$a[2])` [1] b b $`rep(names(ts$a[3]),ts$a[3])` [1] c c c $`rep(names(ts$a[4]),ts$a[4])` [1] d d d d $`rep(names(ts$a[5]),ts$a[5])` [1] e e e e e assign(test,eval(parse(text=v[3]))) test [1] c c c Cheers Joris On Sun, Jun 6, 2010 at 9:51 PM, moleps mole...@gmail.com wrote: Dear r-listers, I need to pass a string to a function. However the length of the string is dependent on the length of a vector. b-length(h) v-paste(rep(names(ts$a[,1:b,]),ts$a[,1:b,]),sep=) Is it possible somehow to pass this as an argument to a function later on ? Regards, //M __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] Loading an image/picture (png/jpeg/...) to screen...
There might be a way doing that in R, but if you really need to take measures of a picture in some standardized way, I suggest you take a look at ImageJ. More than R that seems the right tool for the job. Some people have been experimenting with connecting ImageJ and R, but even without connection a simple text file can get the data where it has to be. Cheers Joris On Mon, Jun 7, 2010 at 1:16 AM, Oliver oli...@first.in-berlin.de wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Hi, Try this, library(png) example(readPNG) [...] If rasterImage would be available, I think this would be the right hint. But it isn't. So I can load the pic, but not display it. :( Ciao, Oliver __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] prettyR
Very simple as explained in the help files: X - 1:5 X [1] 1 2 3 4 5 add.value.labels(X,letters[1:5]) [1] 1 2 3 4 5 attr(,value.labels) a b c d e 1 2 3 4 5 X [1] 1 2 3 4 5 X didn't change. X - add.value.labels(X,letters[1:5]) X [1] 1 2 3 4 5 attr(,value.labels) a b c d e 1 2 3 4 5 X changed. Mind you, those value labels are only read by functions that use it. functions like names(), colnames(), rownames() and the likes won't use those labels. If you really want to use a kind of labels that works in almost every situation, just use factors. Cheers Joris On Sun, Jun 6, 2010 at 6:49 PM, Iasonas Lamprianou lampria...@yahoo.com wrote: Hi all, does anyone have any practical examples of how this command can be used in prettyR? add.value.labels(x,value.labels) I mean, can we have the SPSS style of using numbers and/or labels if we want to? Thank you for your time Jason Dr. Iasonas Lamprianou Assistant Professor (Educational Research and Evaluation) Department of Education Sciences European University-Cyprus P.O. Box 22006 1516 Nicosia Cyprus Tel.: +357-22-713178 Fax: +357-22-590539 Honorary Research Fellow Department of Education The University of Manchester Oxford Road, Manchester M13 9PL, UK Tel. 0044 161 275 3485 iasonas.lampria...@manchester.ac.uk __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] R2HTML problem
Take a look at eclipse : http://www.splusbook.com/R_Eclipse_StatET.pdf And yes, your program should work. The editor doesn't do anything else but sending your code to R. It is R that decides what to do with it. Cheers Joris On Sun, Jun 6, 2010 at 7:25 PM, RGtk2User iagoco...@gmail.com wrote: Which editor could I use on Windows? The program that already works with TinnR... will work with this new editor? Thanks! On Sat, Jun 5, 2010 at 11:40 PM, Joris FA Meys [via R] ml-node+2244582-437396255-277...@n4.nabble.comml-node%2b2244582-437396255-277...@n4.nabble.com wrote: Tinn-R is using the R2HTML package itself for communication with R. You could ask JC Faria who wrote Tinn-R what exactly is going on there. You might get more help here : http://sourceforge.net/projects/tinn-r/support Personally, I'd just use a different editor in this case. I love Tinn-R, but it's no use programming in an editor that interacts with your code. Cheers Joris On Sat, Jun 5, 2010 at 4:57 PM, RGtk2User [hidden email]http://user/SendEmail.jtp?type=nodenode=2244582i=0 wrote: Im developing an application with R and Gtk+. It's just a simple GUI which helps new users to interactuate with R. Thing is, when you do a statistical analysis, I also want to provide a HTML report, but HTMLStart doesnt work propperly when executing from TinnR. It does create the file but not empty, I've tried some examples from different websites, and it's always the same.. it works if I execute it from the R prompt, but doesnt when it comes to execute it from TinnR. So, any ideas? Im trying to divide the internal code of the HTMLStart function to find out where it crashes, but I couldnt find it yet. Thanks in advance __ [hidden email] http://user/SendEmail.jtp?type=nodenode=2244582i=1mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 [hidden email] http://user/SendEmail.jtp?type=nodenode=2244582i=2 --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ [hidden email] http://user/SendEmail.jtp?type=nodenode=2244582i=3mailing list 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. -- View message @ http://r.789695.n4.nabble.com/R2HTML-problem-tp2244294p2244582.html To unsubscribe from R2HTML problem, click here (link removed) ==. -- View this message in context: http://r.789695.n4.nabble.com/R2HTML-problem-tp2244294p2245140.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php __ R-help@r-project.org mailing list 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] Computing day-over-day log return for a matrix containing multiple time series
Hi all, Thanks a lot for anyone's help in advance. I am trying to find a way to compute the day-to-day return (log return) from a n x r matrix containing, n different stocks and price quotes over r days. The time series of prices are already split by using unstack function. For the result, I would like to see a n x (r-1) matrix, where by each entry is the day-over-day return of each stock. I tried to look into the zoo package, however it seems to give only the plots but not the actual data. Would apply function work in this case? Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] how can I control the x-axis tick labels
I am trying to generate a plot whose x-axis values are the following: data_out[,1] [1] 1979 1958 1937 1916 1895 1874 1853 1832 1811 1790 1769 1748 1727 1706 1685 1664 1643 1622 1601 1580 1559 [22] 1538 1517 1496 1475 1454 1433 1412 1391 1370 1349 1328 1307 1286 1265 1244 1223 1202 1181 1160 1139 1118 [43] 1097 1076 1055 1034 1013 992 971 950 929 908 887 866 845 824 803 782 761 740 719 698 677 [64] 656 635 614 593 572 551 530 509 488 467 446 425 404 383 362 341 320 299 278 257 236 [85] 215 194 173 152 131 110 89 68 47 26 25 24 23 22 21 20 19 18 17 16 15 [106] 14 13 12 11 10987654321 The y-axis values are: data_out[,2] [1] 1.01709 1.09454 1.16331 1.21673 1.26098 1.30297 1.33905 1.37466 1.40690 1.43407 1.46022 [12] 1.48497 1.50939 1.53382 1.55764 1.58068 1.60422 1.62692 1.64918 1.67210 1.69456 1.71653 [23] 1.73706 1.75634 1.77562 1.79505 1.81393 1.83259 1.85197 1.87105 1.88949 1.90792 1.92649 [34] 1.94479 1.96263 1.98029 1.99677 2.01212 2.02692 2.04183 2.05648 2.07071 2.08329 2.09510 [45] 2.10593 2.11636 2.12563 2.13423 2.14317 2.15116 2.15739 2.16426 2.17121 2.17796 2.18490 [56] 2.19103 2.19751 2.20357 2.21056 2.21642 2.22264 2.22861 2.23448 2.24007 2.24601 2.25113 [67] 2.25593 2.25842 2.26077 2.26183 2.26223 2.26224 2.26133 2.25868 2.25493 2.25130 2.24704 [78] 2.24123 2.23236 2.22251 2.20842 2.19076 2.17490 2.15480 2.13716 2.11967 2.10428 2.08815 [89] 2.07497 2.06104 2.05527 2.05412 2.06270 2.08828 2.09092 2.09158 2.09290 2.09495 2.09370 [100] 2.09703 2.10551 2.10771 2.10916 2.11557 2.12741 2.13782 2.14946 2.16577 2.18978 2.21518 [111] 2.25129 2.27978 2.32903 2.40820 2.50683 2.64452 3.06182 3.97841 35.81950 I cannot get my ploy start with the tick label 1. Surprisingly it keeps starting from 0 regardless of the usage of the graphic parameter xlim. I tried many different combinations of the parameters appearing in the plot instruction. I also tried to sort the x-axis value in increasing order. plot(sort(data_out[,1]),sort(data_out[,2],decreasing=T),xlim=c(1,1979),ylim=c(1,35),main=Intrinsic Dimensionality of 2D Swiss Roll,font.main=2,cex.main=1.5,col.main=red,xlab=Number of Nearest-Neighbors,ylab=Dimension,type=l,lab=c(10,10,3)) How can I get the x-axis tick labels to be (a subset of) the x-axis values, that is: 123456789 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 47 68 89 110 131 152 173 194 215 236 257 278 299 320 341 362 383 404 425 446 467 488 509 530 551 572 593 614 635 656 677 698 719 740 761 782 803 824 845 866 887 908 929 950 971 992 1013 1034 1055 1076 1097 1118 1139 1160 1181 1202 1223 1244 1265 1286 1307 1328 1349 1370 1391 1412 1433 1454 1475 1496 1517 1538 1559 1580 1601 1622 1643 1664 1685 1706 1727 1748 1769 1790 1811 1832 1853 1874 1895 1916 1937 1958 1979 Thank you in advance, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] how can I control the x-axis tick labels
Try: plot(, xaxt='n', ) axis(1, at=c(1,2,3,4,5, ... all the rest of them ...) ) You might also need to use the label argument to axis() -Don At 5:18 AM +0200 6/7/10, mau...@alice.it wrote: I am trying to generate a plot whose x-axis values are the following: data_out[,1] [1] 1979 1958 1937 1916 1895 1874 1853 1832 1811 1790 1769 1748 1727 1706 1685 1664 1643 1622 1601 1580 1559 [22] 1538 1517 1496 1475 1454 1433 1412 1391 1370 1349 1328 1307 1286 1265 1244 1223 1202 1181 1160 1139 1118 [43] 1097 1076 1055 1034 1013 992 971 950 929 908 887 866 845 824 803 782 761 740 719 698 677 [64] 656 635 614 593 572 551 530 509 488 467 446 425 404 383 362 341 320 299 278 257 236 [85] 215 194 173 152 131 110 89 68 47 26 25 24 23 22 21 20 19 18 17 16 15 [106] 14 13 12 11 10987654321 The y-axis values are: data_out[,2] [1] 1.01709 1.09454 1.16331 1.21673 1.26098 1.30297 1.33905 1.37466 1.40690 1.43407 1.46022 [12] 1.48497 1.50939 1.53382 1.55764 1.58068 1.60422 1.62692 1.64918 1.67210 1.69456 1.71653 [23] 1.73706 1.75634 1.77562 1.79505 1.81393 1.83259 1.85197 1.87105 1.88949 1.90792 1.92649 [34] 1.94479 1.96263 1.98029 1.99677 2.01212 2.02692 2.04183 2.05648 2.07071 2.08329 2.09510 [45] 2.10593 2.11636 2.12563 2.13423 2.14317 2.15116 2.15739 2.16426 2.17121 2.17796 2.18490 [56] 2.19103 2.19751 2.20357 2.21056 2.21642 2.22264 2.22861 2.23448 2.24007 2.24601 2.25113 [67] 2.25593 2.25842 2.26077 2.26183 2.26223 2.26224 2.26133 2.25868 2.25493 2.25130 2.24704 [78] 2.24123 2.23236 2.22251 2.20842 2.19076 2.17490 2.15480 2.13716 2.11967 2.10428 2.08815 [89] 2.07497 2.06104 2.05527 2.05412 2.06270 2.08828 2.09092 2.09158 2.09290 2.09495 2.09370 [100] 2.09703 2.10551 2.10771 2.10916 2.11557 2.12741 2.13782 2.14946 2.16577 2.18978 2.21518 [111] 2.25129 2.27978 2.32903 2.40820 2.50683 2.64452 3.06182 3.97841 35.81950 I cannot get my ploy start with the tick label 1. Surprisingly it keeps starting from 0 regardless of the usage of the graphic parameter xlim. I tried many different combinations of the parameters appearing in the plot instruction. I also tried to sort the x-axis value in increasing order. plot(sort(data_out[,1]),sort(data_out[,2],decreasing=T),xlim=c(1,1979),ylim=c(1,35),main=Intrinsic Dimensionality of 2D Swiss Roll,font.main=2,cex.main=1.5,col.main=red,xlab=Number of Nearest-Neighbors,ylab=Dimension,type=l,lab=c(10,10,3)) How can I get the x-axis tick labels to be (a subset of) the x-axis values, that is: 123456789 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 47 68 89 110 131 152 173 194 215 236 257 278 299 320 341 362 383 404 425 446 467 488 509 530 551 572 593 614 635 656 677 698 719 740 761 782 803 824 845 866 887 908 929 950 971 992 1013 1034 1055 1076 1097 1118 1139 1160 1181 1202 1223 1244 1265 1286 1307 1328 1349 1370 1391 1412 1433 1454 1475 1496 1517 1538 1559 1580 1601 1622 1643 1664 1685 1706 1727 1748 1769 1790 1811 1832 1853 1874 1895 1916 1937 1958 1979 Thank you in advance, Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. -- - Don MacQueen Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 m...@llnl.gov __ R-help@r-project.org mailing list 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] Merge usage to update data.frame
That is! Match, not merge is the solution. Ahhh, memory, memory... Thanks a lot! mario On 07-Jun-10 0:09, jim holtman wrote: try this: a V1 V2 1 AAA 1 2 BBB 2 3 CCC 3 u V1 V2 1 BBB 22 a$V2[match(u$V1, a$V1)]- u$V2 a V1 V2 1 AAA 1 2 BBB 22 3 CCC 3 On Sun, Jun 6, 2010 at 12:41 PM, Mario Vallemva...@cscs.ch wrote: Good morning! I have two datasets with the same structure, one containing all my values and the second one that update same of these values (see example below). I want to create a data.frame with all the values of the first dataset except when an entry is present in the second dataset, in which case the second dataset value is taken. Is there a better method than my last line kludge? Thanks for your help! mario t1- textConnection(AAA 1 BBB 2 CCC 3) a- read.table(t1, stringsAsFactors=FALSE) close(t1) t2- textConnection(BBB 22) u- read.table(t2, stringsAsFactors=FALSE) close(t2) m- merge(a, u, by=V1, all.x=TRUE) out- data.frame(V1=m$V1, V2=ifelse(is.na(m$V2.y), m$V2.x, m$V2.y)) -- Ing. Mario Valle Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 __ R-help@r-project.org mailing list 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. -- Ing. Mario Valle Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 __ R-help@r-project.org mailing list 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] Loading an image/picture (png/jpeg/...) to screen...
On 7 June 2010 01:16, Oliver oli...@first.in-berlin.de wrote: baptiste auguie baptiste.auguie at googlemail.com writes: Hi, Try this, library(png) example(readPNG) [...] If rasterImage would be available, I think this would be the right hint. It is available when you use the latest release of R. For an alternative, you might want to check the wiki http://rwiki.sciviews.org/doku.php?id=tips:graphics-misc:display-imagess=graphics . Another example using Grid graphics, library(gridExtra) library(EBImage) library(RGraphics) x - readImage(http://www.google.com/logos/teachersday09.gif;) g1 - ebimageGrob(x) dev.new(width=g1$width, height=g1$height) grid.draw(g1) HTH, baptiste But it isn't. So I can load the pic, but not display it. :( Ciao, Oliver __ R-help@r-project.org mailing list 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 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.