Re: [R] extract worksheet names from an Excel file
Thanks, Gabor! That's really helpful! ...Tao - Original Message - From: Gabor Grothendieck ggrothendi...@gmail.com To: Shi, Tao shida...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Sent: Friday, June 24, 2011 5:02 AM Subject: Re: [R] extract worksheet names from an Excel file On Fri, Jun 24, 2011 at 12:41 AM, Shi, Tao shida...@yahoo.com wrote: Hi list, Is there a R function I can use to extract the worksheet names from an Excel file? If no, any other automatic ways (not using R) to do this? thanks! Many or all of the Excel interfaces listed here: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windowss=excel can do that but be careful since one or more the packages listed there always returns the sheet names sorted in alphabetical order which means that you can't tell which is the first sheet, which is the second, etc. (if that is important). gdata has a specific function to do it: library(gdata) sheetNames(myfile.xls) -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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] What does class call mean? How do I make class formula into a call?
Hello R Users! I have a list called tabs that I would like to have the same structure as my list eqSystem. The two look like they have the same structure but they are different because when I look at their attributes, class(eqSystem[[1]]) is call but class(tabs[[1]]) is formula. I want to have class(tabs[[1]]) as a call too. So what does call mean? And how do I make an object of class formula be of class call? Thank you so much!!!--Rita class(tabs) [1] list class(tabs[1]) [1] list class(tabs[[1]]) [1] formula class(eqSystem) [1] list class(eqSystem[1]) [1] list class(eqSystem[[1]]) [1] call Rita = If you think education is expensive, try ignorance.--Derek Bok -- View this message in context: http://r.789695.n4.nabble.com/What-does-class-call-mean-How-do-I-make-class-formula-into-a-call-tp3623733p3623733.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] Need help on a R script part
Hi all, I need all your help on this. I have the next part of code:e1=x1-mean(x1)e2=x2-mean(x2)n1=length(x1)n2=length(x2N=(n1 + n2)nu2=sum( c( ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2 ) )/Nss=c(e1,e2) b3= N*sum(ss^4)/ (sum( ss^2)^2)what do lines 6-8 (mathematical notation)?Also the, what means part?for(j in 1:B){ ss11=sample(x1, n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) }I would appreciate you could help on my inquiry, and I am awaiting for your soon answer Thx in advance, Lusk [[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] Error in qr.solve(crossprod(xsar), t(xsar)) when using SpatialFiltering
I am using the R function SpatialFiltering to my land value dataset. I compute a 500 by 500 binary spatial weight matrix (W) based on the x and y coordinates in my land value dataset. The nearest 6 neighbours were given a value of 1. By construction Wii=0. So my weight matrix look like 0 ..1 0 0 ... 1 0 0..1.0... 0...1.. # of rows= 500. # of columns =500. Row sum =6 (because of nearest neighbour=6) Then I fed the data into the SpatialFiltering fxn: tmp = mat2listw(wt); results= SpatialFiltering(LandValue ~ 1+AI+Area_SF_08+Dist2CBD05, data=lu2, nb=tmp$neighbours, style=W, ExactEV=TRUE, zero.policy=TRUE) %%% Then an error message occur: Error in qr.solve(crossprod(xsar), t(xsar)) : singular matrix 'a' in solve Can someone help me out? Thank you so much in advance! Yiyi -- View this message in context: http://r.789695.n4.nabble.com/Error-in-qr-solve-crossprod-xsar-t-xsar-when-using-SpatialFiltering-tp3623943p3623943.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] a Weighted Least Square model for a binary response variable
Dear R Users, I would like to use R to fit a Weighted Least Square model for a binary response variable, say Y. The model is actually the model widely used for a binary dependent variable when the logistic model has not been invented. The weight is 1/(E(Y)(1-E(Y)). Could someone help me out? Thanks for any replies in advance! Best Regards, Vivian __ 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] Extract character from the end of a string
Thank you, Joshua! I got what I was looking for using this command: as.numeric(grepl(\\*$, qb$Player)) Where the variable name is Player in dataset qb. -- View this message in context: http://r.789695.n4.nabble.com/Extract-character-from-the-end-of-a-string-tp3621732p3624124.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] about partial response and partial residual
i use mgcv package First, what is the different between partial response and partial residual plot? actually, is it partial response is as same as partial regression? second, if I use log-link fuction, how to plot partial response and partial residual plot by R? Finally, If I want to plot partial resonse and partial residual plot, Should I create new gam equation by individual variable or all variables ? -- View this message in context: http://r.789695.n4.nabble.com/about-partial-response-and-partial-residual-tp3624198p3624198.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] Fastest way of finding if any members of vector x fall in the range of the rows of matrix y
yet another solution is: v - c(1, 2, 6, 5) w - matrix(c(1, 4, 3, 5, 8, 10), ncol = 2, byrow = TRUE) check - outer(w[, 1], v, -) * outer(w[, 2], v, -) v[which(check = 0, arr.ind = TRUE)[, 2]] Best, Dimitris On 6/24/2011 10:05 PM, Martin Morgan wrote: On 06/24/2011 11:12 AM, Dennis Murphy wrote: Hi: Not much different from Peter's approach, but here's another try: v- c(1, 2, 6, 5) w- matrix(c(1, 4, 3, 5, 8, 10), ncol = 2, byrow = TRUE) w [,1] [,2] [1,] 1 4 [2,] 3 5 [3,] 8 10 f- function(x) v[which(v= x[1] v= x[2])] unlist(apply(w, 1, f)) [1] 1 2 5 If you just do the apply() part, the function will return a list of those elements of v that fall within the i-th interval. Maybe v = c(1, 2, 6, 5) start = c(-Inf, 1, 3, 8) end = c(-Inf, 4, 5, 10) v[ v = end[findInterval(v, start)] ] Also IRanges::findOverlaps / countOverlaps in Bioconductor v[countOverlaps(IRanges(v, v), IRanges(start, end)) != 0] http://bioconductor.org/install Martin HTH, Dennis On Fri, Jun 24, 2011 at 9:52 AM, Salih Tunasaliht...@gmail.com wrote: Hi guys, let's assume i have the following 1 x = 2 6 5 1 4 y = 3 5 8 10 i want the code to report back 1, 2 and 5 from x. Basically it shopuld check whether each elements of x falls in the range of each row of x. 1 and 2 falls in between 1-4 and 5 falls in between 3-5. I do this with two for loops but in the case of very large list, it takes ages. best, salih On Fri, Jun 24, 2011 at 4:12 PM, Dennis Murphydjmu...@gmail.com wrote: Hi: That leaves open several possibilities. Could you please supply a small, reproducible example (i.e., one that someone can copy and paste into an R session) that illustrates the problem along with the solution you expect? TIA, Dennis On Fri, Jun 24, 2011 at 2:30 AM, Salih Tunasaliht...@gmail.com wrote: Hi Dimitris, Thanks for your reply. But this is not exactly what i am after. I want to find the probes that falls into certain regions. In your solution it will ignore the second probe if it falls into the same region as the first one. Is there any vector trickb uilt in R to find whether probes fall into certain regions? best, salih On Fri, Jun 24, 2011 at 10:23 AM, Dimitris Rizopoulos d.rizopou...@erasmusmc.nl wrote: One approach is the following: x- rnorm(5) y- matrix(rnorm(5*2), 5, 2) check- y - x check[, 1] * check[, 2] 0 I hope it helps. Best, Dimitris On 6/24/2011 10:57 AM, Salih Tuna wrote: Hi All, What is the fastest way of finding if any members of vector x fall in the range of the rows of matrix y? I do not want to use two for loops as this will take forever. Any help will be appreciated, best, salih [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 Web: http://www.erasmusmc.nl/**biostatistiek/http://www.erasmusmc.nl/biostatistiek/ [[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. -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 Web: http://www.erasmusmc.nl/biostatistiek/ __ 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] On .. glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x000000000209e210 ***
Saptarshi, if you look at the sheer number of shared libraries involved, heap corruption may have happened due to errors in any of these. Finding the reason for such problems is usually difficult, but almost impossible without a reproducible example. If you could boil it down to a minimal example still triggering the access violation, one could try to run it under control of a memory guard like valgrind. Best Hugo On Friday 24 June 2011 17:12:26 Saptarshi Guha wrote: Hello, I'm trying to use rjson to parse a JSON object. The object can be found here http://pastebin.com/np0s5hgM (you'll probably need to add quotes around the content) fromJSON returns the error glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x0209e210 *** Is there a fix coming soon? Maybe CRAN should also have an outstanding bug field - packages with unfixed bugs could be removed. Cheers Joy rjson- 0.2.3 and R.version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 13.0 year 2011 month 04 day13 svn rev55427 language R version.string R version 2.13.0 (2011-04-13) __ 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] Access R functions from web
I need a way to send R objects and call R functions from web. Is there any project close or similar to that? I want to be able to send an HTTP rquest from an existing application with some data. And obtain a plot from R. Thanks in advance Caveman [[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] On .. glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x000000000209e210 ***
On 25.06.2011 02:12, Saptarshi Guha wrote: Hello, I'm trying to use rjson to parse a JSON object. The object can be found here http://pastebin.com/np0s5hgM (you'll probably need to add quotes around the content) fromJSON returns the error glibc detected home/sguha/lib64/R/bin/exec/R: realloc(): invalid next size: 0x0209e210 *** Is there a fix coming soon? Maybe CRAN should also have an outstanding bug field - packages with unfixed bugs could be removed. But rather than posting to this list, you should send a message to the package maintainer including reproducible examples. Otherwise the package maintainer may not even be aware of any bug nor can he or she reproduce. Uwe Ligges Cheers Joy rjson- 0.2.3 and R.version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 13.0 year 2011 month 04 day13 svn rev55427 language R version.string R version 2.13.0 (2011-04-13) __ 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] Problems setting language in R-2.13.0 and opening RData
Dear list, I just recently installed R-2.13.0 on my Windows7. I used to run R-2.10.0. First of all, I used to be able to install R in English (in R-2.10.0) during the installation procedure. My PC is in a Japanese environment but I want R to be in English because I won't be able to interpret any errors if they are in Japanese (I am Japanese so I can read them but I won't be able to understand them). However, it seems that under R-2.13.0, the option to install in English simply does not exist and I have to associate LANGUAGE=en in the properties of all short cuts to R. This leads to my second problem. I usually open a saved work space by double clicking on a .RData file. I had no problems in R-2.10.0 but in R-2.13.0, even though I associated R-2.13.0 with RData files during installation, I had problems opening them by double-clicking (it always came up with a RTerm window) but I found a R for Windows GUI front-end that I can associate my RData with which enabled me to open RData in the R GUI. However, this R window is in Japanese. So my question is: is there a way to set R itself in English (including this R for Windows GUI front-end) and not just the pathways from short cuts? Any suggestions would be most appreciated. many thanks in advance. Manabu -- Manabu Sakamoto, PhD School of Earth Sciences University of Bristol manabu.sakam...@googlemail.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] Extract character from the end of a string
1. Please always quote the original message when sending messages to this *mailing list*. 2. Please send your answers and comments also to the original poster who may not be aware you posted to the list. Uwe Ligges On 25.06.2011 06:55, jwehr wrote: Thank you, Joshua! I got what I was looking for using this command: as.numeric(grepl(\\*$, qb$Player)) Where the variable name is Player in dataset qb. -- View this message in context: http://r.789695.n4.nabble.com/Extract-character-from-the-end-of-a-string-tp3621732p3624124.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-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] Time-series analysis with treatment effects - statistical approach
Date: Thu, 23 Jun 2011 15:41:25 -0700 From: jmo...@student.canterbury.ac.nz To: r-help@r-project.org Subject: Re: [R] Time-series analysis with treatment effects - statistical approach Mike Marchywka wrote: I discovered a way to do repetitive tasks that can be concisely specified using something called a computer. Now that's funny :) well, there is a point to that and that is that with cheap computations you can do different analyses than you did in the past. There were not controlled tests. It was a field experiment testing the effects that various pavement designs have on underlying soil moisture. Two designs incorporated a porous pavement surface course, while two others were based on standard impervious concrete pavement...the control was just bare, exposed soil. As you can see from the graph, the control responds quickly to rainfall events, but dries out quickly as well due to evaporation. The porous pavement allows for quick infiltration of precipitation, while the impervious pavement eventually allows infiltration of rainfall, but it's delayed. My objective is to be able to differentiate between the pavement treatments, such that I can state with statistical confidence that porous pavements affects underlying soil moisture differently than impervious pavements. I think this is obvious just looking at it, but I wanted to be able to back it up with stats. What I'd done previously is to average by week. But as I mentioned, I thought that an anova table with 104 rows relating to each week was a poor way of analyzing the data. But that being said, it effectively allows me to check for treatment-related differences. I don't think we've mentioned R in the past few posts but I guess pointing people to useful things that R can do is not too big a problem and if you have ever dealt with analysis for the sake of rationalization you can appreciation that is a huge problem :) Generally you'd like to have reproducible results and if you don't have IID ( stationary parameters of the population you wish to characterize) you are not even asking a good question about the system. It may be helpful as quick check of something but otherwise difficult to interpret- do your results mean these things are different in the desert? You appear to have data points from a bunch of different situations. After the fact selection is often helpful but generally stats people frown on that as backing up anything ( unless it supports sponsor's opinion LOL). http://www.itl.nist.gov/div898/handbook/prc/section4/prc432.htm I guess I'd either go with dynamic model or convert into dollars and then see if you have clinically and statistically significant differences in things of relevance. Thanks for the suggestions to date. Maybe the more I explain what I'm trying to achieve, the more focussed the suggestions will be. The vaguer the question, the broader the response, right? Thanks again, Justin -- View this message in context: http://r.789695.n4.nabble.com/Time-series-analysis-with-treatment-effects-statistical-approach-tp3615856p3621179.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. [[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] Need help on a R script part
Lusk, if I were in your business, I would tackle such a problem with help from a little formatting ... e1=x1-mean(x1) e2=x2-mean(x2) n1=length(x1) n2=length(x2) N=(n1 + n2) nu2=sum( c( ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2 ) )/N ss=c(e1,e2) b3=N*sum(ss^4)/(sum( ss^2)^2) for(j in 1:B){ ss11=sample(x1, n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) } ... afterwards I'd correct for missing parenthesis and such. But I understand that this approach was really not conducive when the main intention was to target the public by giving the unhappy college student who infelicitously bumped into a mountain of WWI-style razor wire. The wire-cutter equivalent tool the R interpreter provides you with is the question mark. Here are some examples how to use it: ?mean ?length ?sum ?sample ?^ ?for ?in ?: ?= ?- ?+ ?* ?/ Hope this helps. Kind regards On Friday 24 June 2011 15:31:44 Lusk Aris wrote: Hi all, I need all your help on this. I have the next part of code:e1=x1-mean(x1)e2=x2-mean(x2)n1=length(x1)n2=length(x2N=(n1 + n2)nu2=sum( c( ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2 ) )/Nss=c(e1,e2) b3= N*sum(ss^4)/ (sum( ss^2)^2)what do lines 6-8 (mathematical notation)?Also the, what means part?for(j in 1:B){ ss11=sample(x1, n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) }I would appreciate you could help on my inquiry, and I am awaiting for your soon answer Thx in advance, Lusk [[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] Competing-risks nomogram
Many thanks for the prompt response. However, I am afraid that it is not completely clear for me. I apologize, I am not a statistician. Sorry, may be what I will say make totally non sense, but what I understood is the following: Let's suppose that I need to predict cancer-specific survival using the variables X and Y. What I need to do is to develop a model that include these variables and predict cancer-specific survival using the competing-risks regression. Then, I shall calculate the predictions of this model at a certain time point, then I shall use these prediction as an endpoint, and predict it using a linear regression model that include the same variables, i.e X and Y. Finally, I use the coefficients of this final model to develop a nomogram. Is that correct? Many thanks again Should I calculate the prediction of the competing-risks regression model, and then use this prediction as an endpoint and predict it using a linear regression by including the same variables as predictors? On Fri, Jun 24, 2011 at 1:27 PM, Frank Harrell [via R] ml-node+3622291-345449798-247...@n4.nabble.com wrote: Replace the Design package with the rms package. Â Use the ordinary linear regression trick to predict the linear predictor from the competing risk regression, then use nomogram on this new model (that merely represents the fit of interest). Frank Firas Abdollah wrote: Hi R users, I'd like to draw a nomogram using a competing-risks regression (crr function in R), rather than a cox regression. However, the nomogram function provided in the Design package is not good for this purpose. Do you have any suggestion. I really appreciate your help Many thanks F.Abdollah, MD San-Raffele hospital Milan, Italy Frank Harrell Department of Biostatistics, Vanderbilt University If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Competing-risks-nomogram-tp3621907p3622291.html To unsubscribe from Competing-risks nomogram, click here. -- Firas Abdollah, MD Dept. of Urology San Raffaele Hospital Vita-Salute University, Via Olgettina 60, 20132, Milan, Italy Tel. +39 02 2643 7286 Fax. +39 02 2643 7298 E-mail: firas.abdol...@gmail.com -- View this message in context: http://r.789695.n4.nabble.com/Competing-risks-nomogram-tp3621907p3624283.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] Access R functions from web
From: orvaq...@gmail.com To: r-help@r-project.org Subject: [R] Access R functions from web I need a way to send R objects and call R functions from web. Is there any project close or similar to that? I want to be able to send an HTTP rquest from an existing application with some data. And obtain a plot from R. This should be a faq but it can take a while to find, see Rserve and Rapache. I have been using Rapache now on red hat and debian and it works nicely. Also, the goog visualization API works in some limited testing but apparently a lot of that requires flash ( which I either did not have or had turned off LOL). Thanks in advance Caveman [[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. [[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] Problems setting language in R-2.13.0 and opening RData
On 25.06.2011 11:48, Manabu Sakamoto wrote: Dear list, I just recently installed R-2.13.0 on my Windows7. I used to run R-2.10.0. First of all, I used to be able to install R in English (in R-2.10.0) during the installation procedure. My PC is in a Japanese environment but I want R to be in English because I won't be able to interpret any errors if they are in Japanese (I am Japanese so I can read them but I won't be able to understand them). However, it seems that under R-2.13.0, the option to install in English simply does not exist and I have to associate LANGUAGE=en in the properties of all short cuts to R. The choice for a language in the installer was always just for the installer itself, not for R. This has not changed. Of course you can set a glöobal environment variable LANGUAGE=en, which would be used by any R started on your machine (as well as for any other software that reads such a variable) Uwe Ligges This leads to my second problem. I usually open a saved work space by double clicking on a .RData file. I had no problems in R-2.10.0 but in R-2.13.0, even though I associated R-2.13.0 with RData files during installation, I had problems opening them by double-clicking (it always came up with a RTerm window) but I found a R for Windows GUI front-end that I can associate my RData with which enabled me to open RData in the R GUI. However, this R window is in Japanese. So my question is: is there a way to set R itself in English (including this R for Windows GUI front-end) and not just the pathways from short cuts? Any suggestions would be most appreciated. many thanks in advance. Manabu __ 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] try to generate graph for each element of my list
On 24.06.2011 21:29, n.via...@libero.it wrote: Dear all, I have the following problem. I have a List of time series dataframe.I'm trying to produce specific graph for each element of my list. The code is: This is my list: Lista_import-lapply(Lista_import, function(x){ x2-subset(x, select=c(ANNO,DICHIARANTE,PARTNER, quota)) x2-cast(x2, ANNO+DICHIARANTE~PARTNER) x2- as.xts(as.matrix(as.timeSeries(x2))) return(x2)}) each list have the following shape: $AUS $DEU and data inside...I'm not showing you the content cause I think is not relevant For the GRaph the code is c-lapply(Lista_import,function(x){ for(i in names(Lista_import)){ legenda- read.csv (/home/fturrini/Tessile/01_Dati_complementari/Legenda_paese.csv,header=TRUE) The lihne above is independent from i in the loop, hence move it outside and rename the stuff below. leg- data.frame(ISO3=colnames(x),inutile=1) legenda- merge(legenda,leg, by=ISO3, all.y=TRUE) png(paste(/home/Tessile/Output/Gra/MaxM/QuoteEXperPaese_,i,.png), width=1661,height=828) - ou should really prettify your code in order to make it readable. Use tabs and spaces where appropriate! - You probably want paste(., sep=) above graph-{par(bg=grey97, font=3,font.axis=3,bty=l,las=1, mar=c(8,6,4,2), xpd=FALSE) yrange-c(min(x,na.rm=TRUE), 1.05*max(x,na.rm=TRUE)) colori- c(Blue,Aquamarine1, Firebrick3, Chocolate4, BlueViolet, Yellow3) chart.TimeSeries(x, type=l,lwd=5, ylab=, xlab=, main=, date.format=% Y, ylim=yrange, col=colori, cex.axis=1.6, major.ticks=years, minor.ticks=FALSE, grid.color=gray50, grid.lty=dotted) legend(topleft,as.character(legenda$PAESE),bty=n,cex=1.7,lwd=5, ncol=2, col=colori, horiz=F) You want to write FALSE rather than F above. I have not found the actual error, since your example is nopt reproducible and we do not know how your data look like. Uwe Ligges mtext(Fonte: Unctad, Pctas, side=1,line=5,adj=1,cex=1.8,col=grey20) mtext(p, side=1,line=5,adj=0,cex=1.5,col=grey10)}} dev.off() rm(grafico) }) The results is that I get the same graph for each element of my list. Someone knows how to get one graph for each element of my list pasting the names' list element in the .png file?? Thanks for your attention! __ 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] What does class call mean? How do I make class formula into a call?
On Jun 24, 2011, at 6:12 PM, StellathePug wrote: Hello R Users! I have a list called tabs that I would like to have the same structure as my list eqSystem. The two look like they have the same structure but they are different because when I look at their attributes, class(eqSystem[[1]]) is call but class(tabs[[1]]) is formula. I want to have class(tabs[[1]]) as a call too. So what does call mean? An as yet unevaluated function invocation with first as the named function followed by quoted arguments is a call: See the help(call) page: f - round A - 10.5 (g - as.call(list(f, quote(A .Primitive(round)(A) eval(g) [1] 10 call(mean, quote( c(1,2,3))) mean(c(1, 2, 3)) eval( call(mean, quote( c(1,2,3 [1] 2 It seems very unlikely that a formula object could be coerced into a valid call simply by altering its class. To convince us otherwise you need to provide more information than you have supplied to the present. The results of str() on these objects might be a first step. -- David. And how do I make an object of class formula be of class call? Thank you so much!!!--Rita class(tabs) [1] list class(tabs[1]) [1] list class(tabs[[1]]) [1] formula class(eqSystem) [1] list class(eqSystem[1]) [1] list class(eqSystem[[1]]) [1] call Rita = If you think education is expensive, try ignorance.--Derek Bok -- View this message in context: http://r.789695.n4.nabble.com/What-does-class-call-mean-How-do-I-make-class-formula-into-a-call-tp3623733p3623733.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. David Winsemius, MD West Hartford, CT __ 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] Installation of bigmemory fails
Premal, Package authors generally welcome direct emails. We've been away from this project since the release of 2.13.0 and I only just noticed the build errors. These generally occur because of some (usually small and solvable) problem with compilers and the BOOST libraries. We'll look at it and see what we can do. Please email us if you don't hear back in the next week or so. Thanks, Jay --- Hello All, I tried to intall the bigmemory package from a CRAN mirror site and received the following output while installing. Any idea what's going on and how to fix it? The system details are provided below. - begin error messages --- * installing *source* package 'bigmemory' ... checking for Sun Studio compiler...no checking for Darwin...yes ** libs g++45 -I/usr/local/lib/R/include -I../inst/include -fpic -O2 -fno-strict-aliasing -pipe -Wl,-rpath=/usr/local/lib/gcc45 -c B\ igMatrix.cpp -o BigMatrix.o g++45 -I/usr/local/lib/R/include -I../inst/include -fpic -O2 -fno-strict-aliasing -pipe -Wl,-rpath=/usr/local/lib/gcc45 -c S\ haredCounter.cpp -o SharedCounter.o g++45 -I/usr/local/lib/R/include -I../inst/include -fpic -O2 -fno-strict-aliasing -pipe -Wl,-rpath=/usr/local/lib/gcc45 -c b\ igmemory.cpp -o bigmemory.o bigmemory.cpp: In function 'bool TooManyRIndices(index_type)': bigmemory.cpp:40:27: error: 'powl' was not declared in this scope *** Error code 1 Stop in /tmp/Rtmpxwe3p4/R.INSTALL4f539336/bigmemory/src. ERROR: compilation failed for package 'bigmemory' * removing '/usr/local/lib/R/library/bigmemory' The downloaded packages are in '/tmp/RtmpMZCOVp/downloaded_packages' Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(bigmemory) : installation of package 'bigmemory' had non-zero exit status - end error messages - It's a 64-bit FreeBSD 7.2 system running R version 2-13.0. Thanks, Premal -- John W. Emerson (Jay) Associate Professor of Statistics Department of Statistics Yale University http://www.stat.yale.edu/~jay __ 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] AUTO: Chalk, Alan has a new email address
I am out of the office until 01/05/2012. Please note that I have changed email address. You can contact me at alan.ch...@uk.rsagroup.com Note: This is an automated response to your message R-help Digest, Vol 100, Issue 26 [Virus checked] sent on 25/06/2011 11:00:11. This is the only notification you will receive while this person is away. Notice of Confidentiality This transmission contains information that may be confidential and that may also be privileged. Unless you are the intended recipient of the message (or authorised to receive it for the intended recipient) you may not copy, forward, or otherwise use it, or disclose it or its contents to anyone else. If you have received this transmission in error please notify us immediately and delete it from your system. RSA Insurance Group plc. Registered in England No. 2339826. The Registered Office is 9th Floor, One Plantation Place, 30 Fenchurch Street, London EC3M 3BD [[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] texi2dvi runs but produces no output
Christiaan, Sorry I did not respond earlier. I have been away on vacation. With all the changes in LyX 2.x to make Sweave stuff easier, I suspect this problem should go away. I have not upgraded my system, but a couple folks that have done so reported no problems with a setup like yours. Probably best to send a request to the LyX users' list to get this resolved, as LyX development is very interested in this aspect nowadays. http://www.lyx.org/MailingLists#toc4 - Dave 2011/6/17 Uwe Ligges lig...@statistik.tu-dortmund.de: On 17.06.2011 09:24, christiaan pauw wrote: Thanks for the advice. I tried to install the package as instructed. Command and results below: install.packages(patchDVI, repos=http://R-Forge.R-project.org;) Installing package(s) into ‘C:/Users/nova/Documents/R/win-library/2.13’ (as ‘lib’ is unspecified) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘patchDVI’ is not available (for R version 2.13.0) The problem is that the Windows binary of that package is really not available on R-Forge. You can install from sources if you ask R to: install.packages(patchDVI, repos=http://R-Forge.R-project.org;, type=source) given you have the Rtools installed. I then ran the tests in Rtools. Which tests in Rtools??? I suspect the fact that I have I have installed R in a path containing spaces may be the problem - maybe also for Paths with spaces generate problems for LaTeX and R tries to work around, but may fail. Not sure why you do the stuff below at all and why R cannot change the working directory. Uwe Ligges the Sweave part. Is there any other remedy but to re-install R or can I insert a link in a path without spaces ? library(tools) testInstalledBasic(both) running strict specific tests running code in ‘eval-etc.R’ unable to open output file FAILED [1] 1 Warning message: running command 'C:/PROGRA~1/R/R-213~1.0/bin/i386/R CMD BATCH --vanilla --no-timing eval-etc.R eval-etc.Rout' had status 2 testInstalledPackages(base) Error in setwd(outDir) : cannot change working directory testInstalledPackages(recommended) Error in setwd(outDir) : cannot change working directory On 16 June 2011 14:10, Duncan Murdochmurdoch.dun...@gmail.com wrote: On 11-06-16 7:50 AM, christiaan pauw wrote: Hi everybody. Was the problem below ever solved? I have the same problem on Windows 7 with R 2.13.0 and LyX 2 - everything freshly installed. My Rweave.bat and MakeSweave.R files are similar to below (I followed http://wiki.lyx.org/uploads/**LaTeX/SweaveR/lyx_with_r_and_** sweave_instructions.pdfhttp://wiki.lyx.org/uploads/LaTeX/SweaveR/lyx_with_r_and_sweave_instructions.pdf ) I don't use LyX or that batch file, I use some code I wrote that's in the patchDVI package (https://r-forge.r-project.**org/R/?group_id=233https://r-forge.r-project.org/R/?group_id=233) that I wrote. You might want to try it. The single line to run Sweave and pdflatex is Rscript -e patchDVI::SweavePDF( '$1' ) where $1 is the name of the .Rnw file. If that doesn't work for you, I might be able to help with debugging. Duncan Murdoch [[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] Need help on a R script part
I'm curious about what would cause this (see below), if it isn't a joke. Is it possible that it didn't look ridiculous in the deleted HTML but the text looked bad? It's almost unreadable. I guess the HTML gets deleted because it is a waste of space, but I received a 14 MB message from this list the other day. Mike On Fri, 24 Jun 2011, Lusk Aris wrote: Hi all, I need all your help on this. I have the next part of code:e1=x1-mean(x1)e2=x2-mean(x2)n1=length(x1)n2=length(x2N=(n1 + n2)nu2=sum( c( ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2 ) )/Nss=c(e1,e2) b3= N*sum(ss^4)/ (sum( ss^2)^2)what do lines 6-8 (mathematical notation)?Also the, what means part?for(j in 1:B){ ss11=sample(x1, n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) }I would appreciate you could help on my inquiry, and I am awaiting for your soon answer Thx in advance, Lusk [[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] integration function
Hi all, Can anyone please take a look at the following two functions. The answer does not seem to be right. Thank you very much! f1 - function(x) {integrand - function (x, mu){ dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf,x)$val } f2 - function(x) {integrand - function (x, mu){ dnorm(x, mean=mu, sd=1)*mu^2*dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf,x)$val } [[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] Vector with factors inside lists/tuples
Hi, this seems like a strange question, but in R is there a function that can handle vectors containing factors inside lists/tuples? Or is there some other approach/functions I can use? Like for example V1 {Harry,Brown) {Brown,Harry) I want to use these variables in a machine learning setting, And don't want to convert these into multiple vectors, given share number of factors. -- Håvard Wahl Kongsgård http://havard.security-review.net/ [[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] integration function
On 2011-06-25 08:48, li li wrote: Hi all, Can anyone please take a look at the following two functions. The answer does not seem to be right. Thank you very much! f1- function(x) {integrand- function (x, mu){ dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf,x)$val } f2- function(x) {integrand- function (x, mu){ dnorm(x, mean=mu, sd=1)*mu^2*dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf,x)$val } Your x and mu will get mightily confused. The argument x in f1 is in fact used as the argument mu in integrand() because, as the help page clearly indicates, additional arguments follow the lower/upper limits in integrate(). A cleaner version of what you're doing is the following: f1 - function(mu){ integrand - function (x, mu){ dnorm(x, mean=mu, sd=1) * dnorm(mu, mean=2, sd=1) } integrate(integrand, -Inf, Inf, mu)[[value]] } But then again, you could just evaluate dnorm(mu, 2, 1). So I suspect that you want something different. Ditto for f2. Peter Ehlers [[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] Vector with factors inside lists/tuples
Well, when a think of it using an array would be a simple solution. But to what extent are arrays supported by other R functions? -Håvard 2011/6/25 Håvard Wahl Kongsgård haavard.kongsga...@gmail.com Hi, this seems like a strange question, but in R is there a function that can handle vectors containing factors inside lists/tuples? Or is there some other approach/functions I can use? Like for example V1 {Harry,Brown) {Brown,Harry) I want to use these variables in a machine learning setting, And don't want to convert these into multiple vectors, given share number of factors. -- Håvard Wahl Kongsgård http://havard.security-review.net/ [[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] Vector with factors inside lists/tuples
On Jun 25, 2011, at 12:49 PM, Håvard Wahl Kongsgård wrote: Hi, this seems like a strange question, but in R is there a function that can handle vectors containing factors inside lists/tuples? Yes, A very strange question, indeed ... since dataframes are lists that commonly contain vectors of factors and you should have encountered them very early in your self-study of R. The number of functions that operate on dataframes is large. Are you very early in efforts at learning R? Have you read the Posting Guide? (You're still posting html format.) ?factor ?list ?dataframe Or is there some other approach/functions I can use? Like for example V1 {Harry,Brown) {Brown,Harry) Is that an example that would make sense in some other language? (Opening curly-brace and closing paren makes no sense in R or for that matter in what small amount I know of set theory.) Since your example makes no sense, it remains possible that you're looking for set operations: ?union I want to use these variables in a machine learning setting, And don't want to convert these into multiple vectors, given share number of factors. Lists (of which dataframes are one specific example) are the usual method of handling structures of arbitrary structure (including factors). 'lapply' is the usual choice for repetitive application of a function to elements of lists. The is also 'rapply' for recursive application lapply(list(factor(letters[1:10]), list(c(1:10), c(20:30) ), letters[10:20]), length) [[1]] [1] 10 [[2]] # second element is a list with two members [1] 2 # lapply() only works with the first 'level' of a list [[3]] [1] 11 rapply(list(factor(letters[1:10]), list(c(1:10), c(20:30) ), letters[10:20]), length) [1] 10 10 11 11 lapply(list(factor(letters[1:10]), list(c(1:10), c(20:30) ), letters[10:20]), class) [[1]] [1] factor [[2]] [1] list [[3]] [1] character -- David Winsemius, MD West Hartford, CT __ 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 to export to pdf in landscape orientation?
Does anybody know how to get a pdf file with landscape orientation?. pdf(file= 'my_file.pdf' ,onefile=T,paper='A4') plot(sin, -pi, 2*pi) dev.off() Thank's in advance Juan A. Hernandez Spain [[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] Vector with factors inside lists/tuples
On Jun 25, 2011, at 1:33 PM, Håvard Wahl Kongsgård wrote: Well, when a think of it using an array would be a simple solution. But to what extent are arrays supported by other R functions? Arrays are well supported by arithmetic, logical and accessor functions. Your questions seem very unfocussed. Arrays of factors might be a bit difficult since factors in R require preservation of attributes which arrays (and matrices) do not allow. -Håvard 2011/6/25 Håvard Wahl Kongsgård haavard.kongsga...@gmail.com Hi, this seems like a strange question, but in R is there a function that can handle vectors containing factors inside lists/tuples? Or is there some other approach/functions I can use? Like for example V1 {Harry,Brown) {Brown,Harry) I want to use these variables in a machine learning setting, And don't want to convert these into multiple vectors, given share number of factors. -- Håvard Wahl Kongsgård http://havard.security-review.net/ [[alternative HTML version deleted]] Still posting html format. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html -- David Winsemius, MD West Hartford, CT __ 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 export to pdf in landscape orientation?
Tell PDF the size of your piece of paper - here is what works for me: pdf( file = result.pdf, width = 28, height = 18 ) # numbers are cm some( stuff ) dev.off() Hope it helps, Rainer On Saturday 25 June 2011 18:46:28 Juan Andres Hernandez wrote: Does anybody know how to get a pdf file with landscape orientation?. pdf(file= 'my_file.pdf' ,onefile=T,paper='A4') plot(sin, -pi, 2*pi) dev.off() Thank's in advance Juan A. Hernandez Spain [[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] How to export to pdf in landscape orientation?
From the help for pdf: paper: the target paper size. The choices are ‘a4’, ‘letter’, ‘legal’ (or ‘us’) and ‘executive’ (and these can be capitalized), or ‘a4r’ and ‘USr’ for rotated (‘landscape’). So I'd use paper='a4r'. You can also set the width and height directly. Sarah On Sat, Jun 25, 2011 at 1:46 PM, Juan Andres Hernandez jhernandezcabr...@gmail.com wrote: Does anybody know how to get a pdf file with landscape orientation?. pdf(file= 'my_file.pdf' ,onefile=T,paper='A4') plot(sin, -pi, 2*pi) dev.off() Thank's in advance Juan A. Hernandez Spain -- Sarah Goslee http://www.functionaldiversity.org __ 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] Vector with factors inside lists/tuples
Hi, sorry my question was not really clear |Are you very early in efforts at learning R? No, have been a long term user of R, but only use R for the statistical stuff. The heart of the issue is that I have list of keywords that I want to analyse with a machine learning algorithm (20 000 keywords with a response variables). It's much like micro array data, but in my case it's not genes, but instead keywords. To get it to work in R, I could create a data frame with multiple vectors containing different factors. That would look like this V1, V2, Harry, Kline Brown, Larry If I am not mistaken if I used V1 and V2 with the standard GLM function the result would be like glm( V0 ~ HARRY + KLINE + Brown + Larry) Or I could create a complex ordered array where keywords are represented 1 and 0. If I used that in GLM I would get the same result with glm? But is there a better approach? -Håvard __ 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] Vector with factors inside lists/tuples
On Jun 25, 2011, at 2:13 PM, Håvard Wahl Kongsgård wrote: Hi, sorry my question was not really clear |Are you very early in efforts at learning R? No, have been a long term user of R, but only use R for the statistical stuff. The heart of the issue is that I have list of keywords that I want to analyse with a machine learning algorithm (20 000 keywords with a response variables). It's much like micro array data, but in my case it's not genes, but instead keywords. To get it to work in R, I could create a data frame with multiple vectors containing different factors. That would look like this V1, V2, Harry, Kline Brown, Larry If I am not mistaken if I used V1 and V2 with the standard GLM function the result would be like glm( V0 ~ HARRY + KLINE + Brown + Larry) No. You are mistaken. Assuming that V0 is defined and has the same length as there are rows in that data.frame, then V1 and V2 would be the arguments in the formula and they would not be quoted. ?glm # and work through the examples Or I could create a complex ordered array where keywords are represented 1 and 0. If I used that in GLM I would get the same result with glm? But is there a better approach? -Håvard David Winsemius, MD West Hartford, CT __ 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] Problems setting language in R-2.13.0 and opening RData
Please see the rw-FAQ. And your claims about 2.10.0 are simply not true. There only ever has been an option to choose the language of the installer: see the rw-FAQ. On Sat, 25 Jun 2011, Manabu Sakamoto wrote: Dear list, I just recently installed R-2.13.0 on my Windows7. I used to run R-2.10.0. First of all, I used to be able to install R in English (in R-2.10.0) during the installation procedure. My PC is in a Japanese environment but I want R to be in English because I won't be able to interpret any errors if they are in Japanese (I am Japanese so I can read them but I won't be able to understand them). However, it seems that under R-2.13.0, the option to install in English simply does not exist and I have to associate LANGUAGE=en in the properties of all short cuts to R. You can set environment variables globally, which it seems is what you want. Then any product using GNU gettext will give your messages in English. (Windows may still give your Japanese messages.) This leads to my second problem. I usually open a saved work space by double clicking on a .RData file. I had no problems in R-2.10.0 but in R-2.13.0, even though I associated R-2.13.0 with RData files during installation, I had problems opening them by double-clicking (it always came up with a RTerm window) but I found a R for Windows GUI front-end that I can associate my RData with which enabled me to open RData in the R GUI. However, this R window is in Japanese. So my question is: is there a way to set R itself in English (including this R for Windows GUI front-end) and not just the pathways from short cuts? Any suggestions would be most appreciated. many thanks in advance. Manabu -- Manabu Sakamoto, PhD School of Earth Sciences University of Bristol manabu.sakam...@googlemail.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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] Need help on a R script part
On 11-06-25 11:33 AM, Mike Miller wrote: I'm curious about what would cause this (see below), if it isn't a joke. Is it possible that it didn't look ridiculous in the deleted HTML but the text looked bad? It's almost unreadable. I guess the HTML gets deleted because it is a waste of space, but I received a 14 MB message from this list the other day. I imagine you need to contact the poster, and find out what they sent. It's hard to diagnose after it's been mangled. Duncan Murdoch Mike On Fri, 24 Jun 2011, Lusk Aris wrote: Hi all, I need all your help on this. I have the next part of code:e1=x1-mean(x1)e2=x2-mean(x2)n1=length(x1)n2=length(x2N=(n1 + n2)nu2=sum( c( ( x1 -mean(x1) )^2 , ( x2-mean(x2) )^2 ) )/Nss=c(e1,e2) b3= N*sum(ss^4)/ (sum( ss^2)^2)what do lines 6-8 (mathematical notation)?Also the, what means part?for(j in 1:B){ ss11=sample(x1, n1, replace=TRUE) ss12=sample(x2, n2, replace=TRUE) }I would appreciate you could help on my inquiry, and I am awaiting for your soon answer Thx in advance, Lusk [[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] Access R functions from web
Hi Caveman, On 06/25/2011 11:18 AM, Orvalho Augusto wrote: I need a way to send R objects and call R functions from web. Is there any project close or similar to that? I want to be able to send an HTTP rquest from an existing application with some data. And obtain a plot from R. This is one of the typical integration scenarios the R Service Bus is able to cope with. http://www.openanalytics.eu/r-service-bus The REST interface is documented here http://rsb.doc.openanalytics.eu/ http://rsb.doc.openanalytics.eu/wsdocs/index.html Best, Tobias __ 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] Competing-risks nomogram
Yes you use the linear predictor from your regression as the dependent variable in the rms package's ols function. You will get an R^2 of 1.0. You can depict the ols model with nomogram(). Note that there are so many statistical issues in competing risks that doing this without a statistician is risky. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Competing-risks-nomogram-tp3621907p3625011.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] Vector with factors inside lists/tuples
glm( V0 ~ HARRY + KLINE + Brown + Larry) No. You are mistaken. Assuming that V0 is defined and has the same length as there are rows in that data.frame, then V1 and V2 would be the arguments in the formula and they would not be quoted. ?glm # and work through the examples With the example I meant that the factors in the vector V1 and V2 would be treated like individual binary/dummy variables. Back to my real question; Is there no other way to do this in R??? 2011/6/25 David Winsemius dwinsem...@comcast.net: On Jun 25, 2011, at 2:13 PM, Håvard Wahl Kongsgård wrote: Hi, sorry my question was not really clear |Are you very early in efforts at learning R? No, have been a long term user of R, but only use R for the statistical stuff. The heart of the issue is that I have list of keywords that I want to analyse with a machine learning algorithm (20 000 keywords with a response variables). It's much like micro array data, but in my case it's not genes, but instead keywords. To get it to work in R, I could create a data frame with multiple vectors containing different factors. That would look like this V1, V2, Harry, Kline Brown, Larry If I am not mistaken if I used V1 and V2 with the standard GLM function the result would be like glm( V0 ~ HARRY + KLINE + Brown + Larry) No. You are mistaken. Assuming that V0 is defined and has the same length as there are rows in that data.frame, then V1 and V2 would be the arguments in the formula and they would not be quoted. ?glm # and work through the examples Or I could create a complex ordered array where keywords are represented 1 and 0. If I used that in GLM I would get the same result with glm? But is there a better approach? -Håvard David Winsemius, MD West Hartford, CT -- Håvard Wahl Kongsgård http://havard.security-review.net/ __ 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] What does class call mean? How do I make class formula into a call?
On Jun 25, 2011, at 15:24 , David Winsemius wrote: On Jun 24, 2011, at 6:12 PM, StellathePug wrote: Hello R Users! I have a list called tabs that I would like to have the same structure as my list eqSystem. The two look like they have the same structure but they are different because when I look at their attributes, class(eqSystem[[1]]) is call but class(tabs[[1]]) is formula. I want to have class(tabs[[1]]) as a call too. So what does call mean? An as yet unevaluated function invocation with first as the named function followed by quoted arguments is a call: See the help(call) page: f - round A - 10.5 (g - as.call(list(f, quote(A .Primitive(round)(A) eval(g) [1] 10 call(mean, quote( c(1,2,3))) mean(c(1, 2, 3)) eval( call(mean, quote( c(1,2,3 [1] 2 It seems very unlikely that a formula object could be coerced into a valid call simply by altering its class. To convince us otherwise you need to provide more information than you have supplied to the present. The results of str() on these objects might be a first step. Actually, no. Any unevaluated expression in R is mode call, unless atomic or symbol. It will also be class call, unless expressedly overridden by an S3 class assignment. Notice that operators are really function calls. I.e. mode(quote(x+y)) [1] call class(quote(x+y)) [1] call But class(quote(x)) [1] name class(quote(3.14159)) [1] numeric (This is why the R docs keep talking about unevaluated expressions instead of call objects: They aren't always that.) The ~ operator is also a function call. However, evaluating ~ returns an object which is the actual call assigned class formula (plus an environment attribute). f - y ~ x class(f) [1] formula unclass(f) y ~ x attr(,.Environment) environment: R_GlobalEnv mode(f) [1] call class(unclass(f)) [1] call I.e., an unevaluated formulae expression (as in quote(y~x)) is class call, as is an unclassed formula object. So it is pretty easy to have objects of class formula very similar to objects of class call. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.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] Vector with factors inside lists/tuples
On Jun 25, 2011, at 4:01 PM, Håvard Wahl Kongsgård wrote: glm( V0 ~ HARRY + KLINE + Brown + Larry) No. You are mistaken. Assuming that V0 is defined and has the same length as there are rows in that data.frame, then V1 and V2 would be the arguments in the formula and they would not be quoted. ?glm # and work through the examples With the example I meant that the factors in the vector V1 and V2 would be treated like individual binary/dummy variables. They would have been with the call I offered. I get the sense that the best advice might be to consult a local statistician. Back to my real question; Is there no other way to do this in R??? Do this? You have offered no workable example and only the vaguest of descriptions of the task. -- David. 2011/6/25 David Winsemius dwinsem...@comcast.net: On Jun 25, 2011, at 2:13 PM, Håvard Wahl Kongsgård wrote: Hi, sorry my question was not really clear |Are you very early in efforts at learning R? No, have been a long term user of R, but only use R for the statistical stuff. The heart of the issue is that I have list of keywords that I want to analyse with a machine learning algorithm (20 000 keywords with a response variables). It's much like micro array data, but in my case it's not genes, but instead keywords. To get it to work in R, I could create a data frame with multiple vectors containing different factors. That would look like this V1, V2, Harry, Kline Brown, Larry If I am not mistaken if I used V1 and V2 with the standard GLM function the result would be like glm( V0 ~ HARRY + KLINE + Brown + Larry) No. You are mistaken. Assuming that V0 is defined and has the same length as there are rows in that data.frame, then V1 and V2 would be the arguments in the formula and they would not be quoted. ?glm # and work through the examples Or I could create a complex ordered array where keywords are represented 1 and 0. If I used that in GLM I would get the same result with glm? But is there a better approach? -Håvard David Winsemius, MD West Hartford, CT -- Håvard Wahl Kongsgård http://havard.security-review.net/ David Winsemius, MD West Hartford, CT __ 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 export to pdf in landscape orientation?
Hey Juan, paper=a4r or USr for rotated (landscape)) i.e. pdf(file='my_file.pdf', onefile=T, paper='A4r') plot(sin, -pi, 2*pi) ; dev.off() Greetings from Potsdam University, Germany, Berry Boessenkool From: jhernandezcabr...@gmail.com Date: Sat, 25 Jun 2011 18:46:28 +0100 To: r-help@r-project.org Subject: [R] How to export to pdf in landscape orientation? Does anybody know how to get a pdf file with landscape orientation?. pdf(file= 'my_file.pdf' ,onefile=T,paper='A4') plot(sin, -pi, 2*pi) dev.off() Thank's in advance Juan A. Hernandez Spain [[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. [[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] Moving average in a data table
Hi, I'm trying to figure out common approach on calculating MA on a dataset that contains column time. After digging around, I believe functions rollmean and rollaply should be used. However I don't quite understand the requirements for the underlying data. Should it be zoo object type? Formatted in a special way? As an example, I'm looking to get calculated avg=MA(variable) over 15 sec period on time_sec column: date variable time_sec avg 2011-05-17 132.55 11:29:59.579 132.55 2011-05-17 132.65 11:29:59.946 132.60 2011-05-17 132.5 11:29:59.946 132.57 2011-05-17 132.5 11:29:59.946 132.55 2011-05-17 132.55 11:29:59.946 132.55 2011-05-17 132.6 11:29:59.946 132.56 2011-05-17 132.55 11:29:59.946 132.56 2011-05-17 132.65 11:29:59.947 132.57 2011-05-17 132.85 11:30:00.45 132.60 2011-05-17 132.9 11:30:00.45 132.63 2011-05-17 133.05 11:30:00.45 132.67 2011-05-17 132.2 11:30:00.45 132.63 2011-05-17 132.5 11:30:00.45 132.62 2011-05-17 132.7 11:30:00.50 132.63 2011-05-17 132.75 11:30:00.57 132.63 2011-05-17 132.55 11:30:00.70 132.63 2011-05-17 132.25 11:30:00.70 132.61 2011-05-17 132.25 11:30:00.71 132.59 2011-05-17 132.35 11:30:00.173 132.57 2011-05-17 132.45 11:30:00.173 132.57 Any help is really appreciated. Thanks, --Roman N. __ 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] Competing-risks nomogram
Many thanks On Sat, Jun 25, 2011 at 10:00 PM, Frank Harrell [via R] ml-node+3625011-8897305-247...@n4.nabble.com wrote: Yes you use the linear predictor from your regression as the dependent variable in the rms package's ols function. Â You will get an R^2 of 1.0. Â You can depict the ols model with nomogram(). Â Note that there are so many statistical issues in competing risks that doing this without a statistician is risky. Frank Frank Harrell Department of Biostatistics, Vanderbilt University If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Competing-risks-nomogram-tp3621907p3625011.html To unsubscribe from Competing-risks nomogram, click here. -- Firas Abdollah, MD Dept. of Urology San Raffaele Hospital Vita-Salute University, Via Olgettina 60, 20132, Milan, Italy Tel. +39 02 2643 7286 Fax. +39 02 2643 7298 E-mail: firas.abdol...@gmail.com -- View this message in context: http://r.789695.n4.nabble.com/Competing-risks-nomogram-tp3621907p3625088.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.
[R] log-link function problem
y-gam(a~s(b),family=gaussian(link=log),data) y-gam(loga~s(b), family =gaussian (link=identity),data) y-gam(loga~s(b),family=gaussian(link=log),data) what are the diffent these 3 equations? -- View this message in context: http://r.789695.n4.nabble.com/log-link-function-problem-tp3625014p3625014.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] Multivariate normal density in C for R
Does anyone know of a package that uses C code to calculate a multivariate normal density? My goal is to find a faster way to calculate MVN densities and avoid R loops or apply functions, such as when X and mu are N x K matrices, as opposed to vectors, and in this particular case, speed really matters. I would like to be able to use .C or .Call to pass X, mu, Sigma, and N to a C program and have it return a vector of log densities to R. I'm new to putting C in R, but am sure I'll figure it out. Thanks for any suggestions. -- View this message in context: http://r.789695.n4.nabble.com/Multivariate-normal-density-in-C-for-R-tp3624602p3624602.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] calling R from C
I read R extensions on calling R within c code. I am on windows vista, cygwin and R-2.13.0.I can compile link the c code with following commands$gcc -I/cygdrive/c/Progra~1/R/R-2.13.0/include -c -ggdb Rhello.c gcc-L/cygdrive/c/Progra~1/R/R-2.13.0/bin/i386 -oRhello Rhello.o -lR However I cant run the resulting .exe file with following command LD_LIBRARY_PATH=/cygdrive/c/Progra~1/R/R-2.13.0/bin R_HOME=/cygdrive/c/Progra ~1/R/R-2.13.0 ./Rhello.exe I get a pop up window and it just hangs when I try to run exe file. I assume calling R via c program on cygwin/windowsvista is known to be working. if so, can some one comment on how to run above exe file. thanks-kris [[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] ggplot2 month and year boxplot x axis order problem
Hi, Thanks, although I dont think it was the Date.Time variable that was the problem because my x variable was Month.Year. I realise now that this month variable was a factor and I changed the order of the factor using the following : fish$MonthYr-factor(fish$MOYR,levels=c(05,2010,06,2010,07,2010,08,2010,09,2010,10,2010,11,2010,12,2010,01,2011,02,2011,03,2011,04,2011)) This seems to have ordered my x axis (factors)in the correct fashion. Thanks again for your help Phil -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-month-and-year-boxplot-x-axis-order-problem-tp3623029p3624680.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] Moving average in a data table
On Sat, Jun 25, 2011 at 3:15 PM, Roman Naumenko ro...@naumenko.ca wrote: Hi, I'm trying to figure out common approach on calculating MA on a dataset that contains column time. After digging around, I believe functions rollmean and rollaply should be used. However I don't quite understand the requirements for the underlying data. Should it be zoo object type? Formatted in a special way? As an example, I'm looking to get calculated avg=MA(variable) over 15 sec period on time_sec column: date variable time_sec avg 2011-05-17 132.55 11:29:59.579 132.55 2011-05-17 132.65 11:29:59.946 132.60 2011-05-17 132.5 11:29:59.946 132.57 2011-05-17 132.5 11:29:59.946 132.55 2011-05-17 132.55 11:29:59.946 132.55 2011-05-17 132.6 11:29:59.946 132.56 2011-05-17 132.55 11:29:59.946 132.56 2011-05-17 132.65 11:29:59.947 132.57 2011-05-17 132.85 11:30:00.45 132.60 2011-05-17 132.9 11:30:00.45 132.63 2011-05-17 133.05 11:30:00.45 132.67 2011-05-17 132.2 11:30:00.45 132.63 2011-05-17 132.5 11:30:00.45 132.62 2011-05-17 132.7 11:30:00.50 132.63 2011-05-17 132.75 11:30:00.57 132.63 2011-05-17 132.55 11:30:00.70 132.63 2011-05-17 132.25 11:30:00.70 132.61 2011-05-17 132.25 11:30:00.71 132.59 2011-05-17 132.35 11:30:00.173 132.57 2011-05-17 132.45 11:30:00.173 132.57 rollapply and rollmean are for fixed offsets such as 5 rows before and after. For this problem modify the following depending on your precise requirements: Lines - date variable time_sec avg 2011-05-17 132.55 11:29:59.579 132.55 2011-05-17 132.65 11:29:59.946 132.60 2011-05-17 132.5 11:29:59.946 132.57 2011-05-17 132.5 11:29:59.946 132.55 2011-05-17 132.55 11:29:59.946 132.55 2011-05-17 132.6 11:29:59.946 132.56 2011-05-17 132.55 11:29:59.946 132.56 2011-05-17 132.65 11:29:59.947 132.57 2011-05-17 132.85 11:30:00.45 132.60 2011-05-17 132.9 11:30:00.45 132.63 2011-05-17 133.05 11:30:00.45 132.67 2011-05-17 132.2 11:30:00.45 132.63 2011-05-17 132.5 11:30:00.45 132.62 2011-05-17 132.7 11:30:00.50 132.63 2011-05-17 132.75 11:30:00.57 132.63 2011-05-17 132.55 11:30:00.70 132.63 2011-05-17 132.25 11:30:00.70 132.61 2011-05-17 132.25 11:30:00.71 132.59 2011-05-17 132.35 11:30:00.173 132.57 2011-05-17 132.45 11:30:00.173 132.57 DF - read.table(textConnection(Lines), header = TRUE) DF - transform(DF, datetime = as.POSIXct(paste(date, time_sec))) f - function(i) { is.near - abs(as.numeric(DF$datetime[i] - DF$datetime)) 7.5 mean(DF$variable[is.near]) } sapply(1:nrow(DF), f) -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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] What does class call mean? How do I make class formula into a call?
On Jun 25, 2011, at 4:33 PM, peter dalgaard wrote: On Jun 25, 2011, at 15:24 , David Winsemius wrote: On Jun 24, 2011, at 6:12 PM, StellathePug wrote: Hello R Users! I have a list called tabs that I would like to have the same structure as my list eqSystem. The two look like they have the same structure but they are different because when I look at their attributes, class(eqSystem[[1]]) is call but class(tabs[[1]]) is formula. I want to have class(tabs[[1]]) as a call too. So what does call mean? An as yet unevaluated function invocation with first as the named function followed by quoted arguments is a call: See the help(call) page: f - round A - 10.5 (g - as.call(list(f, quote(A .Primitive(round)(A) eval(g) [1] 10 call(mean, quote( c(1,2,3))) mean(c(1, 2, 3)) eval( call(mean, quote( c(1,2,3 [1] 2 It seems very unlikely that a formula object could be coerced into a valid call simply by altering its class. To convince us otherwise you need to provide more information than you have supplied to the present. The results of str() on these objects might be a first step. Actually, no. Any unevaluated expression in R is mode call, unless atomic or symbol. It will also be class call, unless expressedly overridden by an S3 class assignment. Notice that operators are really function calls. I.e. mode(quote(x+y)) [1] call class(quote(x+y)) [1] call But class(quote(x)) [1] name class(quote(3.14159)) [1] numeric (This is why the R docs keep talking about unevaluated expressions instead of call objects: They aren't always that.) The ~ operator is also a function call. However, evaluating ~ returns an object which is the actual call assigned class formula (plus an environment attribute). f - y ~ x class(f) [1] formula unclass(f) y ~ x attr(,.Environment) environment: R_GlobalEnv mode(f) [1] call class(unclass(f)) [1] call I.e., an unevaluated formulae expression (as in quote(y~x)) is class call, as is an unclassed formula object. So it is pretty easy to have objects of class formula very similar to objects of class call. Not the first time I have stumbled on such matters. Chamber's SfDA would be one obvious place to study. Do yu have any others that pop to mind? The last example suggests that mode and class can each be call so that 'call' is somehow more primitive than function or formula. And by way of directly addressing the OP's questions, it sounds as though applying unclass() to the formula objects might be attempted? -- David Winsemius, MD West Hartford, CT __ 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] calling R from C
On Jun 25, 2011, at 11:18 AM, Desi Ap wrote: I read R extensions on calling R within c code. I am on windows vista, cygwin and R-2.13.0.I can compile link the c code with following commands$gcc -I/cygdrive/c/Progra~1/R/R-2.13.0/include -c - ggdb Rhello.c gcc-L/cygdrive/c/Progra~1/R/R-2.13.0/bin/i386 -oRhello Rhello.o -lR However I cant run the resulting .exe file with following command LD_LIBRARY_PATH=/cygdrive/c/Progra~1/R/R-2.13.0/bin R_HOME=/cygdrive/ c/Progra ~1/R/R-2.13.0 ./Rhello.exe I get a pop up window and it just hangs when I try to run exe file. I assume calling R via c program on cygwin/windowsvista is known to be working. if so, can some one comment on how to run above exe file. It would be courteous posting behavior to put people on notice that this is an identical question to one posed earlier at SO: http://stackoverflow.com/questions/6478761/problem-running-c-code-that-has-r-in-it -- David Winsemius, MD West Hartford, CT __ 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] calling R from C
On Sat, Jun 25, 2011 at 4:18 PM, Desi Ap des...@yahoo.com wrote: I read R extensions on calling R within c code. I am on windows vista, cygwin and R-2.13.0.I can compile link the c code with following commands$gcc -I/cygdrive/c/Progra~1/R/R-2.13.0/include -c -ggdb Rhello.c gcc-L/cygdrive/c/Progra~1/R/R-2.13.0/bin/i386 -oRhello Rhello.o -lR However I cant run the resulting .exe file with following command LD_LIBRARY_PATH=/cygdrive/c/Progra~1/R/R-2.13.0/bin R_HOME=/cygdrive/c/Progra ~1/R/R-2.13.0 ./Rhello.exe I get a pop up window and it just hangs when I try to run exe file. I assume calling R via c program on cygwin/windowsvista is known to be working. if so, can some one comment on how to run above exe file. thanks-kris You need to read the documentation to discover that maybe you should be using the right tools. Namely MinGW and not Cygwin. Unless you've managed to compile the whole of R using cygwin of course... I hope having identical responses to mailing list messages and SO questions isn't as annoying as seeing identical questions posted to each is to everyone on the list... Barry __ 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] reading data from password protected url
Hi Steve RCurl can help you when you need to have more control over Web requests. The details vary from Web site to Web site and the different ways to specify passwords, etc. If the JSESSIONID and NCES_JSESSIONID are regular cookies and returned in the first request as cookies, then you can just have RCurl handle the cookies But the basics for your case are library(RCurl) h = getCurlHandle( cookiefile = ) Then make your Web request using getURLContent(), getForm() or postForm() but making certain to pass the curl handle stored in h in each call, e.g. ans = getForm(yourURL, login = bob, password = jane, curl = h) txt = getURLContent(dataURL, curl = h) If JSESSIONID and NCES_JSESSIONID are not returned as cookies but HTTP header fields, then you need to process the header. Something like rdr = dynCurlReader(h) ans = getForm(yourURL, login = bob, password = jane, curl = h, header = rdr$update) Then the header from the HTTP response is available as rdr$header() and you can use parseHTTPHeader(rdr$header()) to convert it into a named vector. HTH, D. On 6/24/11 2:12 PM, Steven R Corsi wrote: I am trying to retrieve data from a password protected database. I have login information and the proper url. When I make a request to the url, I get back some info, but need to read the hidden header information that has JSESSIONID and NCES_JSESSIONID. They need to be used to set cookies before sending off the actual url request that will result in the data transfer. Any help would be much appreciated. Thanks Steve __ 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] calling R from C
hey David:Newbie here. will avoid duplicates next time. thanks... -krishna --- On Sat, 6/25/11, David Winsemius dwinsem...@comcast.net wrote: From: David Winsemius dwinsem...@comcast.net Subject: Re: [R] calling R from C To: Desi Ap des...@yahoo.com Cc: r-help@r-project.org Date: Saturday, June 25, 2011, 10:38 PM On Jun 25, 2011, at 11:18 AM, Desi Ap wrote: I read R extensions on calling R within c code. I am on windows vista, cygwin and R-2.13.0.I can compile link the c code with following commands$gcc -I/cygdrive/c/Progra~1/R/R-2.13.0/include -c -ggdb Rhello.c gcc-L/cygdrive/c/Progra~1/R/R-2.13.0/bin/i386 -oRhello Rhello.o -lR However I cant run the resulting .exe file with following command LD_LIBRARY_PATH=/cygdrive/c/Progra~1/R/R-2.13.0/bin R_HOME=/cygdrive/c/Progra ~1/R/R-2.13.0 ./Rhello.exe I get a pop up window and it just hangs when I try to run exe file. I assume calling R via c program on cygwin/windowsvista is known to be working. if so, can some one comment on how to run above exe file. It would be courteous posting behavior to put people on notice that this is an identical question to one posed earlier at SO: http://stackoverflow.com/questions/6478761/problem-running-c-code-that-has-r-in-it --David Winsemius, MD West Hartford, CT [[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.