Re: [R] Outer product from matrix by row and a vector
Hi Jeff, David, what I'm trying to do is speed the currently used nest for loop a-matrix(c(1:6),ncol=3) b-c(1,2,3,4) result-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)[1]) for(ii in 1:dim(a)[1]){ for(jj in 1:length(b)){ result[ii,jj]-a[ii,1]+a[ii,3]/b[jj] } } giving the result [,1] [,2] [,3] [1,]135 [2,]246 Thanks for taking a look. Cheers, Ingo From: Jeff Newmiller [jdnew...@dcn.davis.ca.us] Sent: Wednesday, August 08, 2012 6:40 AM To: Ingo Reinhold; r-help@r-project.org Subject: Re: [R] Outer product from matrix by row and a vector Can you post what you want your answer to be for the a and b you have given already? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Ingo Reinhold in...@kth.se wrote: Dear all, I am facing a challenge when applying the outer product with a matrix by rows. What I have is a rather big matrix, which I would like to convert into a different matrix by doing something like outer(matrix_row, vector, function(x,y) x[1]+5*x[4]/y) In order to get there, I tried to get the matrix into a list using the mefa package, as subsetting the original data appears too complicated. However, if I apply the following code I always get a dimensional error, as the unlist() function is applied to the whole list. library(mefa) a-matrix(c(1:6),ncol=3) b-c(1,2,3,4) a-mat2list(a,MARGIN=1) outer(a,b,function(x,y){unlist(a)[1]+unlist(a)[3]/b}) Any idea how to do this more elegantly than a nested for-loop? Many thanks, Ingo [[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] Outer product from matrix by row and a vector
On Wed, Aug 08, 2012 at 06:03:19AM +, Ingo Reinhold wrote: Hi Jeff, David, what I'm trying to do is speed the currently used nest for loop a-matrix(c(1:6),ncol=3) b-c(1,2,3,4) result-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)[1]) for(ii in 1:dim(a)[1]){ for(jj in 1:length(b)){ result[ii,jj]-a[ii,1]+a[ii,3]/b[jj] } } giving the result [,1] [,2] [,3] [1,]135 [2,]246 Hi. The printed matrix is a. The above code yields on my computer [,1] [,2] [,3] [,4] [1,]6 3.5 2.67 2.25 [2,]8 5.0 4.00 3.50 Try the following out - a[, 1] + a[, 3] %o% (1/b) max(abs(out - result)) [1] 4.440892e-16 Hope this helps. Petr Savicky. __ 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] Can not find lme
Dear all, Can anyone help me, my R software can not run a nested linear regression by using the lme funcion. The message that appears is Error: could not find function lme I already downloaded and loaded the package, please see below. Thank you in advance for any help! Nadia. data-read.csv(/Users/nadiasan1/Desktop/MOE and MOR.csv) attach(data) names(data)[1] Species LME   LMR   WD    install.packages(lme4)trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesalso installing the dependencies âmlmRevâ, âMEMSSâ, âsfsmiscâ, âMatrixModelsâ trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/mlmRev_1.0-1.tgz'Content type 'application/x-gzip' length 1832388 bytes (1.7 Mb)opened URL==downloaded 1.7 Mb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MEMSS_0.9-0.tgz'Content type 'application/x-gzip' length 236762 bytes (231 Kb)opened URL==downloaded 231 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/sfsmisc_1.0-19.tgz'Content type 'application/x-gzip' length 386160 bytes (377 Kb)opened URL==downloaded 377 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MatrixModels_0.3-1.tgz'Content type 'application/x-gzip' length 204787 bytes (199 Kb)opened URL==downloaded 199 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesLoading required package: MatrixLoading required package: lattice Attaching package: âMatrixâ The following object(s) are masked from âpackage:baseâ:   det Attaching package: âlme4â The following object(s) are masked from âpackage:statsâ:   AIC, BIC starting httpd help server ... done model1-lme(LME~WD, random=~1|Species, ML)Error: could not find function lme [[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] Can not find lme
You loaded package lme4. The function lme is in package nlme. Try doing library(nlme) first. Simon. On 08/08/12 16:22, Santini Silvana wrote: Dear all, Can anyone help me, my R software can not run a nested linear regression by using the lme funcion. The message that appears is Error: could not find function lme I already downloaded and loaded the package, please see below. Thank you in advance for any help! Nadia. data-read.csv(/Users/nadiasan1/Desktop/MOE and MOR.csv) attach(data) names(data)[1] Species LME   LMR   WD    install.packages(lme4)trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesalso installing the dependencies ‘mlmRev’, ‘MEMSS’, ‘sfsmisc’, ‘MatrixModels’ trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/mlmRev_1.0-1.tgz'Content type 'application/x-gzip' length 1832388 bytes (1.7 Mb)opened URL==downloaded 1.7 Mb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MEMSS_0.9-0.tgz'Content type 'application/x-gzip' length 236762 bytes (231 Kb)opened URL==downloaded 231 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/sfsmisc_1.0-19.tgz'Content type 'application/x-gzip' length 386160 bytes (377 Kb)opened URL==downloaded 377 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MatrixModels_0.3-1.tgz'Content type 'application/x-gzip' length 204787 bytes (199 Kb)opened URL==downloaded 199 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesLoading required package: MatrixLoading required package: lattice Attaching package: ‘Matrix’ The following object(s) are masked from ‘package:base’:   det Attaching package: ‘lme4’ The following object(s) are masked from ‘package:stats’:   AIC, BIC starting httpd help server ... done model1-lme(LME~WD, random=~1|Species, ML)Error: could not find function lme [[alternative HTML version deleted]] -- Simon Blomberg, BSc (Hons), PhD, MAppStat, AStat. Lecturer and Consultant Statistician School of Biological Sciences The University of Queensland St. Lucia Queensland 4072 Australia T: +61 7 3365 2506 email: S.Blomberg1_at_uq.edu.au http://www.uq.edu.au/~uqsblomb/ Policies: 1. I will NOT analyse your data for you. 2. Your deadline is your problem. Statistics is the grammar of science - Karl Pearson. __ 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] Can not find lme
Hello, Function lme is provided by the nlme package. HTH Pascal Le 08/08/2012 15:22, Santini Silvana a écrit : Dear all, Can anyone help me, my R software can not run a nested linear regression by using the lme funcion. The message that appears is Error: could not find function lme I already downloaded and loaded the package, please see below. Thank you in advance for any help! Nadia. data-read.csv(/Users/nadiasan1/Desktop/MOE and MOR.csv) attach(data) names(data)[1] Species LME LMR WD install.packages(lme4)trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesalso installing the dependencies ‘mlmRev’, ‘MEMSS’, ‘sfsmisc’, ‘MatrixModels’ trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/mlmRev_1.0-1.tgz'Content type 'application/x-gzip' length 1832388 bytes (1.7 Mb)opened URL==downloaded 1.7 Mb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MEMSS_0.9-0.tgz'Content type 'application/x-gzip' length 236762 bytes (231 Kb)opened URL==downloaded 231 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/sfsmisc_1.0-19.tgz'Content type 'application/x-gzip' length 386160 bytes (377 Kb)opened URL==downloaded 377 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MatrixModels_0.3-1.tgz'Content type 'application/x-gzip' length 204787 bytes (199 Kb)opened URL==downloaded 199 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesLoading required package: MatrixLoading required package: lattice Attaching package: ‘Matrix’ The following object(s) are masked from ‘package:base’: det Attaching package: ‘lme4’ The following object(s) are masked from ‘package:stats’: AIC, BIC starting httpd help server ... done model1-lme(LME~WD, random=~1|Species, ML)Error: could not find function lme [[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] process evaluation packages (slightly off topic)
Thanks Bert However this package is quite simple and actually it is just only plotting routine for already prepared list. This can be done by reading appropriate file but need a step before - prepare timeline from oriented graph which I did not find yet and the only way I know is pencil/paper and manual transformation of such oriented graph to a kind of Gantt diagramme. Thank you again anyway. Maybe in some time the plan package will evolve to more complex routine. Dest regards Petr Search on R package Gantt, where you will find, among others, http://cran.r-project.org/web/packages/plan/plan.pdf -- Bert On Tue, Aug 7, 2012 at 1:28 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Dear all I need to perform some process evaluation. Sorry for not posting data and code - I do not have any, I ask only for pointing me to correct direction. Suppose I have several connected processes P1, P2, ..., Pn. Each process takes some time and have some capacity (let say like preparing a dinner for several persons - only one stove, limited capacity of utensils, heating and cooling takes some time) and some processes can by cyclic (fry onion in pan, put it aside, in the same pan fry meat, put an onion and some water and simmer for a while...). I can prepare some oriented graph (paper/pencil) or Word or drawing programme, I can also evaluate whole process by shading spreadsheet cells but those two tasks are not connected. Is there any R package/other software suitable for simplifying or helping in such tasks? E.g. When I prepare oriented graph with capacity and time for each node is there any automatic way to transfer this graph to timeline to see how long whole process will take, where are bottlenecks or so? Thank you Petr __ 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb- biostatistics/pdb-ncb-home.htm __ 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] RQuantLib: SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'
# Hi all, # trying to run the following example code # from 'RQuantLib' package... HullWhite - list(term = 0.055, alpha = 0.03, sigma = 0.01, gridIntervals = 40) Price - rep(as.double(100),24) Type - rep(as.character(C), 24) Date - seq(as.Date(2006-09-15), by = '3 months', length = 24) callSch - data.frame(Price, Type, Date) callSch$Type - as.character(callSch$Type) bondparams - list(faceAmount=100, issueDate = as.Date(2004-09-16), maturityDate=as.Date(2012-09-16), redemption=100, callSch = callSch) dateparams - list(settlementDays=3, calendar=us, dayCounter = ActualActual, period=Quarterly, businessDayConvention = Unadjusted, terminationDateConvention= Unadjusted) coupon - c(0.0465) CallableBond(bondparams, HullWhite, coupon, dateparams) # ...I get the following error: # --- SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol' --- # Wandering through Internet, I found something similar to my # issue which has been solved by updating packages. # I tried the same but no results :( # Two weeks ago the same code worked properly. # Any idea about what changed in the meantime? # Thanks :) -- View this message in context: http://r.789695.n4.nabble.com/RQuantLib-SET-VECTOR-ELT-can-only-be-applied-to-a-list-not-a-symbol-tp4639542.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] Decimal number
Probably a problem in your setting or envirenment or print function Here is what I get x1-64.90 x2-17.7025 c(x1,x2) [1] 64.9000 17.7025 x-c(x1,x2) x [1] 64.9000 17.7025 Regards Petr HI i have a little problem please help me to solve it this is the code in R: beta0 [1] 64.90614 beta1 [1] 17.7025 beta [1] 17 64 her beta- c(beta0, beta1) thank you in advance hafida -- View this message in context: http://r.789695.n4.nabble.com/Decimal- number-tp4639428.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] RQuantLib: SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'
Cren wrote # trying to run the following example code # from 'RQuantLib' package... # Obviously, run require(RQuantLib) # before executing the example :) -- View this message in context: http://r.789695.n4.nabble.com/RQuantLib-SET-VECTOR-ELT-can-only-be-applied-to-a-list-not-a-symbol-tp4639542p4639544.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] Can not find lme
Perhaps you should read the help for that package, where you would discover that it does not contain an lme function. library(help=lme4) You could type help.search(lme) and discover that there is an lme function in the nlme package. At that point you could perhaps confirm what you really want to do. You might also want to avoid calling your data data, since that is the name of a builtin function. Also, many useRs recommend against the use of the attach function (at all), instead preferring the use of data= arguments to functions such as lme, or directly using the $ operator to specify the data frame and column. The attach function can easily leads to subtle confusions in data names. It is even possible that next time you might read the posting guide and post in plain text. On Wed, 8 Aug 2012, Santini Silvana wrote: Dear all, Can anyone help me, my R software can not run a nested linear regression by using the lme funcion. The message that appears is?? Error: could not find function lme I already downloaded and loaded the package, please see below. Thank you in advance for any help! Nadia. data-read.csv(/Users/nadiasan1/Desktop/MOE and MOR.csv) attach(data) names(data)[1] Species LME ?? ?? LMR ?? ?? WD ?? install.packages(lme4)trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesalso installing the dependencies ???mlmRev???, ???MEMSS???, ???sfsmisc???, ???MatrixModels??? trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/mlmRev_1.0-1.tgz'Content type 'application/x-gzip' length 1832388 bytes (1.7 Mb)opened URL==downloaded 1.7 Mb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MEMSS_0.9-0.tgz'Content type 'application/x-gzip' length 236762 bytes (231 Kb)opened URL==downloaded 231 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/sfsmisc_1.0-19.tgz'Content type 'application/x-gzip' length 386160 bytes (377 Kb)opened URL==downloaded 377 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/MatrixModels_0.3-1.tgz'Content type 'application/x-gzip' length 204787 bytes (199 Kb)opened URL==downloaded 199 Kb trying URL 'http://cran.csiro.au/bin/macosx/leopard/contrib/2.14/lme4_0.999375-42.tgz'Content type 'application/x-gzip' length 1453067 bytes (1.4 Mb)opened URL==downloaded 1.4 Mb The downloaded packages are in /var/folders/yx/l4kkhz8j24179y5vq0hp9md0gp/T//Rtmpqsa0o1/downloaded_packagesLoading required package: MatrixLoading required package: lattice Attaching package: ???Matrix??? The following object(s) are masked from ???package:base???: ?? ?? det Attaching package: ???lme4??? The following object(s) are masked from ???package:stats???: ?? ?? AIC, BIC starting httpd help server ... done model1-lme(LME~WD, random=~1|Species, ML)Error: could not find function lme [[alternative HTML version deleted]] --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k __ 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] Problem with global variable building a package
Hello, Greg: That is one of the solutions I have tried; the problem is that I can't obtain a package in this way, because an glo-internal.R file is generated (glo is the name of the package) and when I try to create the package an error message appears (a parse error). The content of the glo-internal.R file is the following: .glo.env - environment where .glo.env is the name of the new environment I create in my source code. What am I doing wrong?. Thanks again for your help. Regards. Eva --- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió: De: Greg Snow 538...@gmail.com Asunto: Re: [R] Problem with global variable building a package Para: Eva Prieto Castro evapcas...@yahoo.es CC: R-help@r-project.org Fecha: martes, 7 de agosto, 2012 23:30 Probably the best thing to do is create an environment within the package that you can assign to and read from. Somewhere in the source code for the package include a line like: my.env - new.env() then within any functions defined after that line you can set variables within the environment with code like:  my.env$paramA - 3 and other functions can then read my.env$paramA. This way you don't need to worry about assign or - and all your functions will have access to the same set of variables (but they won't interfere with the users workspace). On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote: Hi, My name is Eva and this is my first message here. My English is not very good, but I hope you can understand my question, in the context of an academic project. I have developed several functions in R and the idea is that the user can access functions in order to: 1) Alter parameters in relation with data and type of analysis. 2) Run statistical analysis (Text and pdf files with results will be generated). 3) View the value of the most important parameters. All the parameters I need are stored in a list object, and this list is used in all the functions along the cycle performed by the user, but I would like the user does not need to pass the name of the list as argument when he/she runs the different functions, so I think I need to treat the list as a global variable. Firstly, I used the global assignment operator (â-â); secondly, I used âgetâ and âassignâ functions and even I used a new.env() in order to use a new environment exclusively for my list. However, when I try to build a package with all my functions I donât reach this end, because of an error in parse process. My question for you is the following: taking into account that my end is to build a package, what can I do with this âglobalâ list?. How can I treat it?. Thanks in advance. Regards, Eva       [[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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.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] which R version to connect with .net?
Dear community, I want to call R from .net. I've been reading this article: http://www.codeproject.com/Articles/25819/The-R-Statistical-Language-and-C-NET-Foundations. It says that first I need to download the COM server. When I do this, I see that the COM server is from 2008; http://cran.es.r-project.org/contrib/extra/dcom/ I've been using R 2.14, but, to use this server, would i need to use the R version from 2008 (If so, how can I download an old version of R ) ??? Isn't there a COM server so i can keep on using R 2.14? Thanks in advance, u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/which-R-version-to-connect-with-net-tp4639540.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] Problem with global variable building a package
Hi Michael, I did not know those alternatives you mention (setCompilerOptions() and setRmetricsOptions()), so I will study them (apart to find out why I can not create a package when I use a new environment, as I was telling Greg). Thanks again for your help. Regards. Eva --- El mar, 7/8/12, R. Michael Weylandt michael.weyla...@gmail.com escribió: De: R. Michael Weylandt michael.weyla...@gmail.com Asunto: Re: [R] Problem with global variable building a package Para: Eva Prieto Castro evapcas...@yahoo.es CC: R-help@r-project.org Fecha: martes, 7 de agosto, 2012 20:35 On Tue, Aug 7, 2012 at 2:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote: Hi, My name is Eva and this is my first message here. My English is not very good, but I hope you can understand my question, in the context of an academic project. I have developed several functions in R and the idea is that the user can access functions in order to: 1) Alter parameters in relation with data and type of analysis. 2) Run statistical analysis (Text and pdf files with results will be generated). 3) View the value of the most important parameters. All the parameters I need are stored in a list object, and this list is used in all the functions along the cycle performed by the user, but I would like the user does not need to pass the name of the list as argument when he/she runs the different functions, so I think I need to treat the list as a global variable. Firstly, I used the global assignment operator (â-â); secondly, I used âgetâ and âassignâ functions and even I used a new.env() in order to use a new environment exclusively for my list. However, when I try to build a package with all my functions I donât reach this end, because of an error in parse process. My question for you is the following: taking into account that my end is to build a package, what can I do with this âglobalâ list?. How can I treat it?. Hi Eva, I was actually doing something similar just the other day -- for a quick and dirty solution, you can use assignInNamespace() or assignInMyNamespace() but the help pages suggest CRAN won't look kindly thereupon. To avoid that, I simply used a hidden [starting with a dot] variable in the user's global environment (i.e., I defined it on package load with the .onAttach() function and then just referenced it when needed) but the best practices solution is probably to use options() or something similar. See, e.g., setCompilerOptions() of the compiler package or setRmetricsOptions() of the Rmetrics bundle. Best, Michael Thanks in advance. Regards, Eva       [[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] label_wrap_gen question
Hi, Brian So, I could only rename the label by myself such as Light and heavy\ngood vehicles (diesel) -\nGVX in order to get Light and heavy good vehicles (diesel) - GVX Right? -- View this message in context: http://r.789695.n4.nabble.com/label-wrap-gen-question-tp4639364p4639539.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] GEV distribution fitted by L-moment graph
Hi, I have been having difficulties in finding packages/ codes that simplify plotting of a GEV fitted to dataset (by L-moments) that would print out graph comprising dataset versus gumbel reduced variate n return period at the same. Anyone can help me on this? Thanks. [[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] r-forge down?
On Wed, Aug 8, 2012 at 12:40 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: This is presumably a temporary condition. It has been up recently, but it is summer, and some people take vacations, so I won't give an expected uptime. There's a note on that web page now explaining there's maintenance going on. http://www.downforeveryoneorjustme.com/ is an alternative to asking on R-help when a site seems 'down' to you. 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] test if elements of a character vector contain letters
On Tue, Aug 7, 2012 at 10:26 PM, Marc Schwartz marc_schwa...@me.com wrote: since there are alpha-numerics present, whereas the first option will: grepl([^[:alnum:]], ab%) [1] TRUE So, use the first option. And I should start reading more carefully. The above works fine for me. I ended up defining the following wrappers: is_alpha - function(x) {grepl([[:alpha:]], x)} ##Alphabetic characters is_digit - function(x) {grepl([[:digit:]], x)} ##Digits is_alnum - function(x) {grepl([[:alnum:]], x)} ##Alphanumeric characters is_punct - function(x) {grepl([[:punct:]], x)} ##Punctuation characters is_notalnum - function(x) {grepl([^[:alnum:]], x)} ##Non-Alphanumeric characters Thanks again Liviu __ 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] RQuantLib: SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'
Am 08.08.2012 09:54, schrieb Cren: # Hi all, # trying to run the following example code # from 'RQuantLib' package... HullWhite - list(term = 0.055, alpha = 0.03, sigma = 0.01, gridIntervals = 40) Price - rep(as.double(100),24) Type - rep(as.character(C), 24) Date - seq(as.Date(2006-09-15), by = '3 months', length = 24) callSch - data.frame(Price, Type, Date) callSch$Type - as.character(callSch$Type) bondparams - list(faceAmount=100, issueDate = as.Date(2004-09-16), maturityDate=as.Date(2012-09-16), redemption=100, callSch = callSch) dateparams - list(settlementDays=3, calendar=us, dayCounter = ActualActual, period=Quarterly, businessDayConvention = Unadjusted, terminationDateConvention= Unadjusted) coupon - c(0.0465) CallableBond(bondparams, HullWhite, coupon, dateparams) # ...I get the following error: # --- SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol' I cannot reproduce this error. I get Concise summary of valuation for CallableBond Net present value : 64.73968 clean price : 64.003 dirty price : 64.74 accrued coupon : 0.73689 yield : 9.2989 cash flows : Date Amount 2004-12-16 1.1561 2005-03-16 1.1460 2005-06-16 1.1721 2005-09-16 1.1721 ##... sessionInfo() R version 2.15.1 (2012-06-22) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5] LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RQuantLib_0.3.8 Rcpp_0.9.13 Regards, Enrico __ 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] Problem with global variable building a package
On 08.08.2012 08:53, Eva Prieto Castro wrote: Hello, Greg: That is one of the solutions I have tried; the problem is that I can't obtain a package in this way, because an glo-internal.R file is generated (glo is the name of the package) and when I try to create the package an error message appears (a parse error). The content of the glo-internal.R file is the following: .glo.env - environment To avoid parser errors, replace environment by something that is syntactically valid, in this case: new.env(). Best, Uwe Ligges where .glo.env is the name of the new environment I create in my source code. What am I doing wrong?. Thanks again for your help. Regards. Eva --- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió: De: Greg Snow 538...@gmail.com Asunto: Re: [R] Problem with global variable building a package Para: Eva Prieto Castro evapcas...@yahoo.es CC: R-help@r-project.org Fecha: martes, 7 de agosto, 2012 23:30 Probably the best thing to do is create an environment within the package that you can assign to and read from. Somewhere in the source code for the package include a line like: my.env - new.env() then within any functions defined after that line you can set variables within the environment with code like:  my.env$paramA - 3 and other functions can then read my.env$paramA. This way you don't need to worry about assign or - and all your functions will have access to the same set of variables (but they won't interfere with the users workspace). On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote: Hi, My name is Eva and this is my first message here. My English is not very good, but I hope you can understand my question, in the context of an academic project. I have developed several functions in R and the idea is that the user can access functions in order to: 1) Alter parameters in relation with data and type of analysis. 2) Run statistical analysis (Text and pdf files with results will be generated). 3) View the value of the most important parameters. All the parameters I need are stored in a list object, and this list is used in all the functions along the cycle performed by the user, but I would like the user does not need to pass the name of the list as argument when he/she runs the different functions, so I think I need to treat the list as a global variable. Firstly, I used the global assignment operator (“-“); secondly, I used “get� and “assign� functions and even I used a new.env() in order to use a new environment exclusively for my list. However, when I try to build a package with all my functions I don’t reach this end, because of an error in parse process. My question for you is the following: taking into account that my end is to build a package, what can I do with this “global� list?. How can I treat it?. Thanks in advance. Regards, Eva       [[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-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] process evaluation packages (slightly off topic)
Thanks Rui igraph seems to be more related to my problem, so I will try to play with it. Regards Petr Hello, There's also, apparently for simple needs, plotrix::gantt.chart See an example in http://addictedtor.free.fr/graphiques/sources/source_74.R To transfer graphs to timelines, etc, (or anything graph related) package igraph. Hope this helps, Rui Barradas Em 07-08-2012 14:46, Bert Gunter escreveu: Search on R package Gantt, where you will find, among others, http://cran.r-project.org/web/packages/plan/plan.pdf -- Bert On Tue, Aug 7, 2012 at 1:28 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Dear all I need to perform some process evaluation. Sorry for not posting data and code - I do not have any, I ask only for pointing me to correct direction. Suppose I have several connected processes P1, P2, ..., Pn. Each process takes some time and have some capacity (let say like preparing a dinner for several persons - only one stove, limited capacity of utensils, heating and cooling takes some time) and some processes can by cyclic (fry onion in pan, put it aside, in the same pan fry meat, put an onion and some water and simmer for a while...). I can prepare some oriented graph (paper/pencil) or Word or drawing programme, I can also evaluate whole process by shading spreadsheet cells but those two tasks are not connected. Is there any R package/other software suitable for simplifying or helping in such tasks? E.g. When I prepare oriented graph with capacity and time for each node is there any automatic way to transfer this graph to timeline to see how long whole process will take, where are bottlenecks or so? Thank you Petr __ 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] RQuantLib: SET_VECTOR_ELT() can only be applied to a 'list', not a 'symbol'
Enrico Schumann-2 wrote I cannot reproduce this error. I get... sessionInfo() *R version 2.15.1* (2012-06-22) # Thank you for testing, Enrico (Italian? ), # it seems an updating issue. # I am trying to update everything possible to the latest # version because of compatibility. -- View this message in context: http://r.789695.n4.nabble.com/RQuantLib-SET-VECTOR-ELT-can-only-be-applied-to-a-list-not-a-symbol-tp4639542p4639564.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] help to program my function
Hi Maybe it is time for you to read some basic stuff like R intro. It seems to me that you expect R to behave like some other language you know but probably your expectation is wrong. See inline HI i have a problem please help me to solve it: http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf i want to calculate the vecteur a[j] where j: 1...8 this is the code in R: aj.fun - function(j, i, X, z, E, beta0, beta1){ + n - length(X) + iX - order(X) + iz - order(z) + e1 - -(beta)*z[ iz[1:(i - 1)] ] where do you get beta + numer - E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) ) + e2 - -(beta)*z[ iz[i:n] ] + denom - sum( exp(e2) ) + numer/denom + } iX-order(X) iX [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54 64 76 56 [26] 58 48 67 46 63 28 62 36 49 47 66 1 42 41 19 39 43 22 51 68 33 27 9 15 11 [51] 10 59 32 40 45 44 52 16 18 34 4 53 21 23 31 7 6 13 14 12 17 24 5 8 2 [76] 3 iZ-order(Z) iZ [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [76] 76 e1 - -(beta)*Z[ iZ[1:(i - 1)] ] Warning message: In 1:(i - 1) : numerical expression has 76 elements: only the first used As somebody already mentioned i is probably vector and in this case only first value is taken. i seems to have the firs value 3. e1 [1] -442 -1664 numer - E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1)) Warning message: In 1:(i - 1) : numerical expression has 76 elements: only the first used numer [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5 Here j is vector of 8 values therefore 8 values e2 - -(beta)*Z[ iZ[i:n] ] Warning message: In i:n : numerical expression has 76 elements: only the first used e2 [1] -442 -1664 -442 -1792 -476 -1792 -476 -1792 -510 -1920 -510 -1920 [13] -510 -1920 -510 -1920 -510 -1920 -510 -2048 -544 -2048 -544 -2048 [25] -544 -2048 -544 -2048 -544 -2048 -544 -2048 -544 -2048 -578 -2176 [37] -578 -2176 -578 -2176 -578 -2176 -578 -2176 -578 -2176 -578 -2176 [49] -578 -2176 -578 -2176 -578 -2304 -612 -2304 -612 -2304 -612 -2304 [61] -612 -2304 -612 -2304 -612 -2304 -612 -2304 -646 -2432 -646 -2432 [73] -646 -2432 -646 -2432 Strange, here first value of i seems to be 1 as n shall be 76 and final e2 length is 76. denom - sum( exp(e2) ) numer/denom [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 [6] 4.313746e+192 4.313746e+192 4.313746e+192 my problem that the vecteur a[j] could not have the same number!!! I do not understand. Your numer is 9.5 repeted 8 times. If you divide it by one number you will get nine times the same number. You send us a code but no data so it is difficult to understand what is your goal. It would be better to send input data j, i, X, z, E, beta0, beta1 and assumed result in whole not in chunks scattered in several mails. Regards Petr thank you in advance hafida -- View this message in context: http://r.789695.n4.nabble.com/help-to- program-my-function-tp4639434.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] Overlapping a Plot with Dataframe
On 08/07/2012 10:57 PM, mhimanshu wrote: Hello Everyone, I am trying to overlap a plot with a data set in the form of a data frame. Its very easy to overlap the data using points function. But the only problem I am facing is Standard deviation bar on the plot. data- data.frame( x = c(3.00,2.00,3.80,2.40,2.00), error = c(0.0,0.4,1.1,0.7,0.5) ) I tried plotrix, segments but they are making a new plot with data points n error bar. I want to Overlap this data sets on a plot with its Error bar. Hi Himanshu, Have you tried the following? plot(data$x,ylim=c(1,5)) library(plotrix) dispersion(1:5,data$x,data$error) and data is probably not the best name for your data frame. 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] Overlapping a Plot with Dataframe
Thanks Jim, Yes its working now. Thanks, Himanshu On Wed, Aug 8, 2012 at 12:10 PM, Jim Lemon j...@bitwrit.com.au wrote: On 08/07/2012 10:57 PM, mhimanshu wrote: Hello Everyone, I am trying to overlap a plot with a data set in the form of a data frame. Its very easy to overlap the data using points function. But the only problem I am facing is Standard deviation bar on the plot. data- data.frame( x = c(3.00,2.00,3.80,2.40,2.00), error = c(0.0,0.4,1.1,0.7,0.5) ) I tried plotrix, segments but they are making a new plot with data points n error bar. I want to Overlap this data sets on a plot with its Error bar. Hi Himanshu, Have you tried the following? plot(data$x,ylim=c(1,5)) library(plotrix) dispersion(1:5,data$x,data$**error) and data is probably not the best name for your data frame. Jim -- With Regards: Himanshu Doctorate Student, Leibniz Institute for Natural Product Research and Infection Biology e.V. Hans-Knöll-Institute (HKI) FSU, Jena Germany Contact: 0176 56526087 0151-63327536 email: bioinfo.himan...@gmail.com P.S: All good things come to those who wait..!! [[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] Interpreting predictions of svm
You should give us the data is what you should do :) Aside from that: you can only make probability predictions if you activated it when making the model. On 07.08.2012, at 17:23, Camomille wrote: Hi, I have some difficulties in interpreting the prediction of a svm model using the package e1071. y1 is the variable I want to predict. It is of type factor and has got two levels: 50% and 50%. z is the dataset. model - svm(y1 ~ ., data = z,type=C-classification, cross=10) model Call: svm(formula = y1 ~ ., data = z, type = C-classification, cross = 10) Parameters: SVM-Type: C-classification SVM-Kernel: radial cost: 1 gamma: 0.07142857 Number of Support Vectors: 68 pred - predict(model,newdata=z,probability=TRUE,decision.values = TRUE) table(pred) pred 50% 50% 414 0 The results of pred is not what I intended to get as, I expected this type of result: 50% 50% 50%8925 50% 38262 What should I do? -- View this message in context: http://r.789695.n4.nabble.com/Interpreting-predictions-of-svm-tp4639405.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-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 versus SAS
On 12-08-07 10:46 PM, Kjetil Halvorsen wrote: I found this on CrossValidated: A medical statistician once told me, that they use SAS because if they make mistakes due to software bugs and it comes to lawsuits, SAS will recompensate them. R comes without warranty. I suspect that statistician has never tried to collect. The statement on the SAS website refers to the website, not the software, but it has a statement that is pretty typical of commercial software licenses: Warranties and Disclaimers EXCEPT WHERE EXPRESSLY PROVIDED OTHERWISE IN AN AGREEMENT BETWEEN YOU AND SAS, ALL INFORMATION, SOFTWARE, PRODUCTS AND SERVICES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL SAS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE, DATA OR USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT, ARISING FROM YOUR ACCESS TO, OR USE OF, THIS Web SITE OR ANY OTHER HYPERLINKED Web SITE. I would quote from the actual software license, but it doesn't appear to be online. The R license is online, and gives you just as strong a warranty (i.e. none!) plus quite a few more rights than the typical commercial software license. Duncan Murdoch __ 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 with convUL (PBSmapping)
Thank you. Il giorno 07/ago/2012, alle ore 20.36, R. Michael Weylandt ha scritto: This looks like a fairly low level problem that you might need the maintainer to look at. To get contact information, type maintainer(PBSmapping) at the R prompt. Best, Michael On Tue, Aug 7, 2012 at 7:21 AM, niandra rmaill...@yahoo.it wrote: Hi all, I'm trying to use the function convUL from the Package PBSmapping but i get i weird error with my data but also with the example in the convUL's help. Here is the example script with the error message: data(nepacLL, package=PBSmapping) #--- set the zone attribute #--- use a zone that is most central to the mapped region attr(nepacLL, zone) - 6 #--- convert and plot the result nepacUTM - convUL(nepacLL) Error in .C(convUL, inXY = as.double(inXY), inVerts = as.integer(inVerts), : C symbol name convUL not in DLL for package PBSmapping someone can help me? Thanks [[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] Pass Conditional loop argument into a function
Dear R community, I have been spending hours to solve my problem myself but I'm just unable to do it. So excuse me if I demand your time. My problem is, that inside my function, I want to pass conditional arguments (that are the result of a loop) into a function. I am sure that my approach is kind of stupid but I cannot think of another way to do it. I apologize... foo - function(..., degree=..){ degree-3 # example conditional.argument - rep(NA,degree) for(i in 1:(degree-1)) conditional.argument[i] - paste(X^,i,+,sep=) conditional.argument[degree] - paste(X^,degree,sep=) conditional.argument - paste(conditional.argument,collapse=) conditional.argument # X^1+X^2+X^3 fit - lm(Y~conditional.argument) ... return(fit) } I know that there is the poly() function which I am not looking for. I am having this problem as well when I want to do a boxplot with variable number of groups to compare. multiple.boxplot - function(...,nvariables){ conditional.argument - data[,1], data[,2], ...,data[,nvariables] # should look like that in the end boxplot(conditional.argument) } Can anyone give me a hint? Daniel Hoop -- View this message in context: http://r.789695.n4.nabble.com/Pass-Conditional-loop-argument-into-a-function-tp4639580.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] Outer product from matrix by row and a vector
On Aug 7, 2012, at 11:26 PM, Petr Savicky wrote: On Wed, Aug 08, 2012 at 06:03:19AM +, Ingo Reinhold wrote: Hi Jeff, David, what I'm trying to do is speed the currently used nest for loop a-matrix(c(1:6),ncol=3) b-c(1,2,3,4) result-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)[1]) for(ii in 1:dim(a)[1]){ for(jj in 1:length(b)){ result[ii,jj]-a[ii,1]+a[ii,3]/b[jj] } } giving the result [,1] [,2] [,3] [1,]135 [2,]246 That is not what result equals (as Petr illustrates.) Hi. The printed matrix is a. The above code yields on my computer [,1] [,2] [,3] [,4] [1,]6 3.5 2.67 2.25 [2,]8 5.0 4.00 3.50 Try the following out - a[, 1] + a[, 3] %o% (1/b) max(abs(out - result)) [1] 4.440892e-16 Hope this helps. It's also the case that the printed result is just the transpose of what I earlier offered as a possible implementation of the OP's pseudo- code.: identical( t( apply(a, 1, function(x) { x[1] + x[3]/ b } ) ), result) [1] TRUE -- David Winsemius, MD Alameda, CA, USA __ 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] Cannot create Java virtual machine (-1)
All, I am trying to get the XLConnect package to work on one of my servers and I am getting an error that XLConnectJars cannot create the java virtual machine. The server is a 32-bit Windows Server 2003 machine with R 2.15.1. The version of Java installed on the server is J2SE Environment 5.0 update 8. I know this not the latest version of Java, and I will try to update it when I get exclusive access to the server, but in the meantime is there anything else anyone can suggest for this error? Loading required package: XLConnectJars Loading required package: rJava Error : .onLoad failed in loadNamespace() for 'XLConnectJars', details: call: .jinit() error: Cannot create Java virtual machine (-4) Error: package 'XLConnectJars' could not be loaded library(rJava) library(XLConnect) Loading required package: XLConnectJars Error : .onLoad failed in loadNamespace() for 'XLConnectJars', details: call: .jinit() error: Cannot create Java virtual machine (-1) Error: package 'XLConnectJars' could not be loaded library(XLConnectJars) Error : .onLoad failed in loadNamespace() for 'XLConnectJars', details: call: .jinit() error: Cannot create Java virtual machine (-1) Error: package/namespace load failed for 'XLConnectJars' .jinit() Error in .jinit() : Cannot create Java virtual machine (-1) Thanks, Roger *** This message is for the named person's use only. It may\...{{dropped:11}} __ 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] Repeated Aggregation with data.table
On Aug 7, 2012, at 9:28 PM, arun wrote: HI, Try this: fun1-function(x,.expr){ .expr-expression(list(mean.z=mean(z),sd.z=sd(z))) z1-eval(.expr) } #or fun1-function(x,.expr){ .expr-expression(list(mean.z=mean(z),sd.z=sd(z))) z1-.expr } dat[,eval(z1),list(x)] dat[,eval(z1),list(y)] dat[,eval(z1),list(x,y)] I'm not seeing the connection between those functions and the data.table call. (Running that code produces an error on my machine.) If the goal is to have an expression result then just create it with expression(). In the example: flist - expression( list(mean.z = mean(z), sd.z = sd(z)) ) dat[ , eval(flist), list(x)] x mean.z sd.z 1: 2 0.04436034 1.039615 2: 3 -0.06354504 1.077686 3: 1 -0.08879671 1.066916 -- David. A.K. - Original Message - From: Elliot Joel Bernstein elliot.bernst...@fdopartners.com To: r-help@r-project.org Cc: Sent: Tuesday, August 7, 2012 5:36 PM Subject: [R] Repeated Aggregation with data.table I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use to aggregate over different groups. For example, require(plyr) dat - data.frame(x = sample(3, 100, replace=TRUE), y = sample(3, 100, replace = TRUE), z = rnorm(100)) f - function(x) { data.frame(mean.z = mean(x$z), sd.z = sd(x$z)) } ddply(dat, x, f) ddply(dat, y, f) ddply(dat, c(x, y), f) I recently discovered the data.table package, which dramatically speeds up the aggregation: require(data.table) dat - data.table(dat) dat[, list(mean.z = mean(z), sd.z = sd(z)), list(x)] dat[, list(mean.z = mean(z), sd.z = sd(z)), list(y)] dat[, list(mean.z = mean(z), sd.z = sd(z)), list(x,y)] But I can't figure out how to save the aggregation function list(mean.z = mean(z), sd.z = sd(z)) as a variable that I can reuse, similar to the function f above. Can someone please explain how to do that? Thanks. - Elliot -- Elliot Joel Bernstein, Ph.D. | Research Associate | FDO Partners, LLC 134 Mount Auburn Street | Cambridge, MA | 02138 Phone: (617) 503-4619 | Email: elliot.bernst...@fdopartners.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. David Winsemius, MD Alameda, CA, USA __ 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] Hearsay -- was R vs SAS
I would ask contributors to this list to at least note that the sort of FUD (Fear Uncertainty and Doubt) of the type mentioned by the poster is hearsay. Do we have any contractual promises from SAS Inc. or other companies that they will guarantee their software? Have there been documented compensation payments? If so, then that is information that should be provided, rather than someone said to someone and they told their dog and he barked to me that Perhaps someone from Revolution can comment (and maybe provide documentation) if they provide a warranty or insurance for their implementation of R. Warranties and insurance for open source are not unknown: http://www.computerweekly.com/feature/How-to-use-open-source-with-confidence http://news.cnet.com/2100-7344_3-5143326.html Another aspect to this hearsay issue is the pricing for commercial software. I happened to see the invoice for SAS for a single, albeit powerful, laptop that was about $90,000 per year. But I have yet to find a published price list for SAS, nor for many commercial packages, and I cannot document what I saw. At least I can give you the price of R, though I always am careful to tell potential users that it is not without cost -- you really do have to join the community if you want to be a true R user. This is not a gripe about SAS or other commercial software vendors, whose pricing and service strategies are rightly their own choice, even if we dislike them. It is a commentary that we, who work in the Free/Libre software should not assist those strategies by promoting unsubstantiated opinions that work against us. Given how email works, the poster may in fact disagree with the opinion he communicated, and was trying to alert the community to such views. I just want to note that, as a community, we need to be alert not to accept FUD for fact. John Nash On 08/08/2012 12:39 AM, r-help-requ...@r-project.org wrote: Date: Tue, 7 Aug 2012 22:46:25 -0400 From: Kjetil Halvorsen kjetilbrinchmannhalvor...@gmail.com To: r-help r-help@r-project.org Subject: [R] R versus SAS Message-ID: cacu_y08aedjquzgauchdgiry8c2b6usnh+dxaerxmw+8acb...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 I found this on CrossValidated: A medical statistician once told me, that they use SAS because if they make mistakes due to software bugs and it comes to lawsuits, SAS will recompensate them. R comes without warranty. Kjetil __ 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] Pass Conditional loop argument into a function
First thing; are you trying to fit a model specified as y ~ X + X^2 + X^3 ? ... because if you are you're unlikely to get anything useful. That uses formula syntax in which ^ does not have the arithmetic power meaning; see section 11.1 'Defining statistical models; formulae' in 'an introduction to R' in your HTML help system. This formula only specifies one term, X, so all you'll get is the result of y ~ X If you wanted to fit a polynomial the hard (and not generally good) way you'd have to do y ~ I(X )+ I(X^2) + I(X^3) Next, in your line fit - lm(Y~conditional.argument) you have asked lm to fit Y to a character string formed by paste(). That is also unlikely to be useful. You would need to create the complete formula as a string (eg Y~X+I(X^2)+I(X^3) ) and then use as.formula to convert that to a formula lm can use. Then there's the unnecessary loop. You can get your formula string without a loop from an integer 'degree' using formstring - paste(Y ~ , paste(I(X^,1:degree,) , sep=, collapse= + )) And then you can convert formstring to a formula object and use the formula object in lm: form - as.formula(formstring) #be careful with this; it looks for the terms in the current environment... lm(form) Or, if 'degree' were a vector (say degree-c(1, 3, 5) formstring - paste(Y ~ , paste(I(X^,degree,) , sep=, collapse= + )) and so on. I am having this problem as well when I want to do a boxplot with variable number of groups to compare. I don't know what you're trying to achieve with boxplot, but if you gave boxplot itself your vectors it would plot them by itself: x-rnorm(17) y-runif(23) z-c(x,y) boxplot(x,y,z) Incidentally, this: conditional.argument - data[,1], data[,2], ...,data[,nvariables] # is not a valid assignment in R, so it cannot be the code you used. And using something called 'data' (or any other object) in a function that does not have an named argument by the same name is asking for trouble; there is no telling where it will get 'data' from but there is a very good chance it will sometimes be from somewhere you don't expect. S Ellison -Original Message- I am sure that my approach is kind of stupid but I cannot think of another way to do it. I apologize... foo - function(..., degree=..){ degree-3 # example conditional.argument - rep(NA,degree) for(i in 1:(degree-1)) conditional.argument[i] - paste(X^,i,+,sep=) conditional.argument[degree] - paste(X^,degree,sep=) conditional.argument - paste(conditional.argument,collapse=) conditional.argument # X^1+X^2+X^3 fit - lm(Y~conditional.argument) ... return(fit) } I know that there is the poly() function which I am not looking for. I am having this problem as well when I want to do a boxplot with variable number of groups to compare. multiple.boxplot - function(...,nvariables){ conditional.argument - data[,1], data[,2], ...,data[,nvariables] # should look like that in the end boxplot(conditional.argument) } Can anyone give me a hint? Daniel Hoop -- View this message in context: http://r.789695.n4.nabble.com/Pass-Conditional-loop-argument-i nto-a-function-tp4639580.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. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] lm with a single X and step with several Xi-s, beta coef. quite different:
Hi, Sounds like suppression -- see e.g., http://www.jstor.org/stable/2988294?seq=1 for a discussion. Since this is not an R question but a statistical one, it may be more appropriate to post this question to a statistics forum such as http://stats.stackexchange.com/ Best, Ista On Tue, Aug 7, 2012 at 3:28 PM, Aldi Kraja a...@wustl.edu wrote: Hi, (R version 2.15.0) I am running a pgm with 1 response (earlier standardized Y) and 44 independent vars (Xi) from the same data =a2: When I run the 'lm' function on single Xi at a time, the beta coefficient for let's say X1 is = -0.08 (se=0.03256) But when I run the same Y with 44 Xi-s with the 'step' function (because I left direction parameter empty, I assume a backward multiple reg is implemented), 12 Xia-a remain in the final model where X1 is still present, the X1 beta coefficient becomes = --0.43402 (se=0.06847) I did not expect such a drastic change (4 times smaller) in the beta coeff. from lm with X1 (bx1=-0.08) to step with final 12 Xis including X1 (bx1=--0.43402). I understand that step function is producing partial reg coeff, when all other Xi-s are held constant, but is there any good reason why X1 in a multivariate reg. can become so significant (from lm px1=0.00296 ** to step px1=2.55e-10 ***)? Some of the 44 Xi-s are correlated to each other, but I am hoping that stepwise reg will drop some of those correlated ones. The Xi-s represent variables coded numerically as 0,1,2 to apply a linear regression on them. For example the frequency of X1 is: [1] x1 Levels: x1 0 1 2 3459 985 96 output of lm(Y ~ X1): == obj1-lm(y ~ x1, data=a2) summary(obj1) Call: lm(formula = y ~ x1, data = a2) Residuals: Min 1Q Median 3Q Max -3.3418 -0.7240 -0.0462 0.6577 4.2929 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.03635 0.01781 2.042 0.04124 * x1 -0.09682 0.03256 -2.973 0.00296 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.024 on 4255 degrees of freedom Multiple R-squared: 0.002074, Adjusted R-squared: 0.001839 F-statistic: 8.842 on 1 and 4255 DF, p-value: 0.002961 output from the step function on 44 Xi-s: a2 -na.omit(ac16g761[,3:(44+2+1)]) lm.a2-lm(y ~ ., data=a2) lm.final -step(lm.a2,trace=F) summary(lm.final) Call: lm(formula = y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12, data = a2) Residuals: Min 1Q Median 3Q Max -3.2955 -0.7210 -0.0611 0.6623 4.1064 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.01065 0.02637 0.404 0.686412 x1 -0.43402 0.06847 -6.339 2.55e-10 *** x2 -0.17109 0.11370 -1.505 0.132464 x3 0.23552 0.11552 2.039 0.041533 * x4 -0.19898 0.10133 -1.964 0.049625 * x5 0.06653 0.03796 1.752 0.079769 . x6 0.18319 0.08592 2.132 0.033070 * x7 -0.17443 0.05095 -3.424 0.000624 *** x8 0.24013 0.06516 3.685 0.000232 *** x9 0.19202 0.08009 2.398 0.016543 * x10 -0.17257 0.05576 -3.095 0.001983 ** x11 -0.23537 0.05704 -4.126 3.75e-05 *** x12 0.25992 0.06260 4.152 3.35e-05 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.02 on 4244 degrees of freedom Multiple R-squared: 0.01353, Adjusted R-squared: 0.01074 F-statistic: 4.851 on 12 and 4244 DF, p-value: 5.466e-08 Thank you in advance, Aldi P.S. Sorry that I cannot distribute these data for a test. -- __ 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] Coloring specific cells
Hi , I have a data frame XYZ. i want to color the cells where ever we find G it should be green,Y yellow,R redetc and i want to send it from R to ppt.can any one help me on this. My data frame looks as below. XYZ: GY RTG Y RT AA 00 00 AA 1 1 11 BB 00 00 BB 1 1 11 CC 00 00 CC 1 1 11 G Y RT G Y R T AA 2 2 22 AA3 3 3 3 BB 2 2 22 BB3 3 3 3 CC 2 2 22 CC3 3 3 3 Thanks, Namit -- View this message in context: http://r.789695.n4.nabble.com/Coloring-specific-cells-tp4639578.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] dimnames in array
Hello, I'm working with an array; I'm trying to make it so that an array of dim(42,2,2) has names whose length corresponds to that of the array, and am hoping someone with experience with this can see what I'm not doing correctly: data11 = array(0,c(41,2,2)) y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc infer package# y = y[,2:3] data11-array(0,c(41,2,2)) m8-cbind(.29,1:41) m9-as.array(m8,dim=c(41,2)) data11[,1,] = y+m9 data11[,2,] = y+m9 rownames(data2, do.NULL = FALSE, prefix=row) varnames=c(V,R) colnames(data6)=c(one,two) colnames(data10)=colnames(data6) dimnames(data11)=list(rownames(data2),varnames,colnames(data10)) data11a-as.array(data11,dimnames=dimnames(data11)) attributes(data11a) #so this seems to print out the array attributes as they should be: two sets of two columns each, and the first column of each set is called 'v' and the second 'r'- no problem# now the analysis from colloc infer(I've put it in below*) takes this array but will not complete the analysis, saying Error in `colnames-`(`*tmp*`, value = c(V, R)) : length of 'dimnames' [2] not equal to array extent When I type in length(dimnames(data11a)[2]) I get the answer: [1] 1 which seems odd when dimnames(data11a)[2] gives [[1]] [1] V R I would like to ask How can I get the names of the second dimension of the array(data11a) to have length 2 ? It seems to me that the analysis will run if I can make this array have the correct length dimnames I thank you for your help. * fd.data11a = data11a DEfd11a = Data2fd(fd.data11a, times, bbasis, fdnames=list(NULL,NULL,varnames)) profile11a.obj=LS.setup(pars,DEfd11a$coefs,fhn,basisvals=bbasis,lambda,fd.obj=NULL, more=NULL,data=data11a,weights=NULL,times=times,quadrature=NULL,eps=1e-6, posproc=FALSE,poslik=FALSE,discrete=FALSE,names=NULL,sparse=FALSE) lik = profile11a.obj$lik proc = profile11a.obj$proc qwts = rep(1/length(knots),length(knots)) qwts = qwts %*% t(lambda) weights = array(1,dim(data11a)) likmore = make.id() likmore$weights = weights lik = make.SSElik() lik$more = likmore lik$bvals = eval.basis(times,bbasis) procmore = make.fhn() procmore$weights = qwts procmore$qpts = qpts procmore$names = varnames procmore$parnames = parnames proc = make.SSEproc() proc$more = procmore proc$bvals = list(bvals = eval.basis(procmore$qpts,bbasis,0), dbvals = eval.basis(procmore$qpts,bbasis,1)) res11a = inneropt(coefs, times=times, data=data11a, lik=lik, proc=proc, pars=spars, in.meth='nlminb', control.in=control.out) __ 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] Can any one help me on this Issue
Thanks Arunthis problem is resolved -- View this message in context: http://r.789695.n4.nabble.com/Can-any-one-help-me-on-this-Issue-tp4638664p4639579.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] map axis on projected shapefiles
Hi, I have overlayed 2 projected shapefiles using the plot function. When I plot them the numbers next to the x-axis ticks are printed in scientific format (e.g. -4e+05, -3e+05,...,), and the problem is these dont match up to the projected point locations I also wish to overlay from my dataset. For example, according to the x-axis ticks the prime meridian (0°) is in totally the wrong position. I have tried degAxis which only changes the axis to 4e+05°W, 3e+05°W,..., and I cant seem to get map.grid to work. Does anyone know why this would happen or what I have done wrong? #Code is shelfline - readOGR(dsn=C:\\ArcGIS\\phy_bathy_contours.shp, layer = phy_bathy_contours) world - readOGR(dsn=C:\\ArcGIS\\phy_coastline_plus_ssi_so.shp, layer = phy_coastline_plus_ssi_so) plot(shelfline, axes=T,xlab=expression(Longitude^o), ylab=expression(Latitude^o), yaxt=n, xaxt=n) plot(world, col=lightslategray, add=T) #attempts to alter axes degAxis(1) map.grid(col=black, labels=TRUE, pretty=TRUE, lty=2) Many thanks -- View this message in context: http://r.789695.n4.nabble.com/map-axis-on-projected-shapefiles-tp4639554.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] ERROR : cannot allocate vector of size (in MB GB)
Hi Arun, But I am using Windows(XP). From: arun kirshna [via R] [mailto:ml-node+s789695n4639435...@n4.nabble.com] Sent: Tuesday, August 07, 2012 10:49 PM To: Akkara, Antony (GE Energy, Non-GE) Subject: Re: ERROR : cannot allocate vector of size (in MB GB) HI, If you are using linux, this should split the file in linux prompt: #Assuming your file size is a 160KB file: split -b 40k file.csv outputfilename #This will output four 40KB files: outputfilename+suffix(aa,ab,ac,ad) A.K. If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/ERROR-cannot-allocate-vector-of-size-in-MB -GB-tp4637597p4639435.html To unsubscribe from ERROR : cannot allocate vector of size (in MB GB), click here http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscrib e_by_codenode=4637597code=YW50b255LmFra2FyYUBnZS5jb218NDYzNzU5N3wxNTUx OTQzMDI5 . NAML http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_view erid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.Bas icNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.tem plate.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml -instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemai l.naml -- View this message in context: http://r.789695.n4.nabble.com/ERROR-cannot-allocate-vector-of-size-in-MB-GB-tp4637597p4639548.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] sweave problem with special danish characters
Dear all, I use Sweave to create my reports. my pdf output contains only NA's whenever my text contains special Danish characters like ø, ø and å. I have upgraded R from 2.13 to 2.15 and the scripts worked fine under R 2.13. Sweave(Test.Rnw, encoding = utf8) texi2dvi(Test.tex, pdf = TRUE) %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This is a test that works \end{document} %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This doesn't æ ø å and pdf document only contains NA \end{document} Any suggestions? Best wishes Jonas Hal _ BRFkredit sender e-mails og vedhæftede dokumenter i ikke-krypteret form. Hvis du ikke ønsker at modtage oplysninger fra BRFkredit pr. e-mail, beder vi dig meddele os det via brev eller e-mail. Denne e-mail kan indeholde fortrolig information. Hvis du modtager e-mailen ved en fejl, beder vi dig informere os om det hurtigst muligt. Samtidig beder vi dig slette e-mailen uden at videresende eller kopiere indholdet. _ [[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] Overlapping a Plot with Dataframe
Hello John, in simple term, I have a Plot as an Output. Now I want to overlap the plot with a Dataframe having error bar. -- View this message in context: http://r.789695.n4.nabble.com/Overlapping-a-Plot-with-Dataframe-tp4639396p4639555.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] how to call R commands from .net
Dear community, I want to call R from .net. Precisely I´d really like to call rpart from .net, plot decision trees and predict with them. I have installed the COM server (http://cran.es.r-project.org/contrib/extra/dcom/). Just to note, because it is from 2008, the only way to work with this server in .net seems to be with R 2.11 version, isn't it? The connection is correct. But I don´t know how to call rpart from .net: - how do I write in .net? : myrpart - rpart(vind ~ vd1 + vd2+ .. + vd15 , data = mydata.frame, method=anova, control=list(minsplit=20, cp=0.001)) - how do i have to store the variables vind and vdi ? Thanks in advance, u...@host.com as u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/how-to-call-R-commands-from-net-tp4639558.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] party with the mob - fitted model lines in the terminal nodes
Hi useRs, I built a logistic-regression-based tree using mob (from package party) and am wondering if anyone could pinpoint to me where I can find the documentation for how the fitted model lines in the terminal nodes are computed. I am partitioning a data set based on a logistic model with interaction terms and would like to learn how the fitted model lines in the corresponding spinograms are drawn in this case. Many thanks. Tudor -- View this message in context: http://r.789695.n4.nabble.com/party-with-the-mob-fitted-model-lines-in-the-terminal-nodes-tp4639571.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] How can we compare two vectors?
x=c(5, 8, 28, 29, 30) y=c(5, 8, 28, 29, 31) How can we compare these two vectors, whether each element is exactly matched with the elements in the other vector ? How can we get the non matched elements from both the vectors? Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-6692tel:%2B91-40-6692 and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). [[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] Save reload list objects
So it was simple, or so it seemed. Now to throw a spanner in the works! I got this error when testing it on my more powerful desktop (using one of my lists put in to a new object) : #put list in to new object called temp temp-rg.lmer #save save(temp,file=C:\\Users\\...\\R Data\\rg.lmer.txt) #remove temp list from workspace to test load rm(temp) #load list in to a new object, again called temp. temp-load(C:\\Users\\...\\R Data\\rg.lmer.txt) temp-load(C:\\Users\\...\\R Data\\rg.lmer.txt) Error: cannot allocate vector of size 98 Kb In addition: Warning messages: 1: Reached total allocation of 8148Mb: see help(memory.size) 2: Reached total allocation of 8148Mb: see help(memory.size) The save process takes a very long time but works so I wonder if there is a quicker way to get the same result. The load takes a long time to throw out this error message. Again I hope there is a more efficient way to do it because it defeats the point of saving it in the first place if it takes as long as running the original script to make the list! Also it means I haven't been able to check if the load works and will produce the desired list. *Summary: Is there a better way than save / load, if not how can I get around this error message?* Rob -- View this message in context: http://r.789695.n4.nabble.com/Save-reload-list-objects-tp4639397p4639581.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] time series, uneven length
I have 4 univariate time series that I believe have correlation between them, I want to create a VAR model between them all. However I have an issue as 3 of them are the same length, however the 4th is smaller. meaning that i cannot use the 4th variable , is there anyway R can get round this issue? length(tstemp) [1] 746 length(tspres) [1] 746 length(tswind) [1] 746 length(tsozon) [1] 658 ccf(tstemp,tsozon) Error in ccf(tstemp, tsozon) : univariate time series only thanks -- View this message in context: http://r.789695.n4.nabble.com/time-series-uneven-length-tp4639582.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] GEV distribution fitted by L-moment graph
On 2012-08-08 04:22, Al Ehan wrote: Hi, I have been having difficulties in finding packages/ codes that simplify plotting of a GEV fitted to dataset (by L-moments) that would print out graph comprising dataset versus gumbel reduced variate n return period at the same. Anyone can help me on this? Thanks. [[alternative HTML version deleted]] The help file for function evplot() in package lmom has an example that does exactly what you ask. J. R. M. Hosking __ 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] Repeated Aggregation with data.table
HI David, Thanks for testing. It's a bit strange. Yesterday, the function was working perfectly. Today, it is not working in my system. Not sure what happened. A.K. - Original Message - From: David Winsemius dwinsem...@comcast.net To: arun smartpink...@yahoo.com Cc: Elliot Joel Bernstein elliot.bernst...@fdopartners.com; R help r-help@r-project.org Sent: Wednesday, August 8, 2012 9:17 AM Subject: Re: [R] Repeated Aggregation with data.table On Aug 7, 2012, at 9:28 PM, arun wrote: HI, Try this: fun1-function(x,.expr){ .expr-expression(list(mean.z=mean(z),sd.z=sd(z))) z1-eval(.expr) } #or fun1-function(x,.expr){ .expr-expression(list(mean.z=mean(z),sd.z=sd(z))) z1-.expr } dat[,eval(z1),list(x)] dat[,eval(z1),list(y)] dat[,eval(z1),list(x,y)] I'm not seeing the connection between those functions and the data.table call. (Running that code produces an error on my machine.) If the goal is to have an expression result then just create it with expression(). In the example: flist - expression( list(mean.z = mean(z), sd.z = sd(z)) ) dat[ , eval(flist), list(x)] x mean.z sd.z 1: 2 0.04436034 1.039615 2: 3 -0.06354504 1.077686 3: 1 -0.08879671 1.066916 -- David. A.K. - Original Message - From: Elliot Joel Bernstein elliot.bernst...@fdopartners.com To: r-help@r-project.org Cc: Sent: Tuesday, August 7, 2012 5:36 PM Subject: [R] Repeated Aggregation with data.table I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use to aggregate over different groups. For example, require(plyr) dat - data.frame(x = sample(3, 100, replace=TRUE), y = sample(3, 100, replace = TRUE), z = rnorm(100)) f - function(x) { data.frame(mean.z = mean(x$z), sd.z = sd(x$z)) } ddply(dat, x, f) ddply(dat, y, f) ddply(dat, c(x, y), f) I recently discovered the data.table package, which dramatically speeds up the aggregation: require(data.table) dat - data.table(dat) dat[, list(mean.z = mean(z), sd.z = sd(z)), list(x)] dat[, list(mean.z = mean(z), sd.z = sd(z)), list(y)] dat[, list(mean.z = mean(z), sd.z = sd(z)), list(x,y)] But I can't figure out how to save the aggregation function list(mean.z = mean(z), sd.z = sd(z)) as a variable that I can reuse, similar to the function f above. Can someone please explain how to do that? Thanks. - Elliot -- Elliot Joel Bernstein, Ph.D. | Research Associate | FDO Partners, LLC 134 Mount Auburn Street | Cambridge, MA | 02138 Phone: (617) 503-4619 | Email: elliot.bernst...@fdopartners.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. David Winsemius, MD Alameda, CA, USA __ 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, please! matrix operations inside 3 nested loops
hello, this is my script: #1) read in data: daten-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep=\t) daten-as.matrix(daten) #2) create empty matrix: indxind-matrix(nrow=617, ncol=617) indxind[1:20,1:19] #3) compare cells to each other, score: for (s in 3:34) { #walks though the matrix colum by colum, starting at colum 3 for (z1 in 1:617) { #for each current colum, take one row (z1)... for (z2 in 1:617) { #...and compare it to another row (z2) of the current colum if (z1!=z2) {topf-indxind[z1,z2] if (daten[2*z1-1,s]==daten[2*z2-1,s]) topf-topf+1 #actually, 2 rows make up 1 individual, if (daten[2*z1-1,s]==daten[2*z2,s]) topf-topf+1 #therefore i compare 2 rows if (daten[2*z1,s]==daten[2*z2-1,s]) topf-topf+1 #with another 2 rows if (daten[2*z1,s]==daten[2*z2,s]) topf-topf+1 indxind[z1,z2]-topf indxind[z2,z1]-topf } #print(c(s,z1,z2,indxind[1,2])) ##counts s, z1 and z2 properly, but gives NA for indxind[1,2] } #indxind[1:5,1:5] #empty matrix } #indxind[1:5,1:5] #empty matrix } #4) check: indxind[1:5,1:5] this results no errors, but my matrix indxind remains empty (only NAs). though all columns and rows are counted properly. R needs quite a while to get through all this (there are probably smarter and faster ways to calculate this but i am not too deep into R and bioinformatics, and i need to calculate this only once). could the 3 for-loops already be too computationally intense for adding matrix operations? any help would be much appreciated! thx, frido -- View this message in context: http://r.789695.n4.nabble.com/help-please-matrix-operations-inside-3-nested-loops-tp4639592.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] Coloring specific cells
If its just a few tables, can't you just copy the text and color it in PowerPoint? If you'd like Latex output i could help maybe, but i'm not sure what you expect. On 08.08.2012, at 14:19, namit wrote: Hi , I have a data frame XYZ. i want to color the cells where ever we find G it should be green,Y yellow,R redetc and i want to send it from R to ppt.can any one help me on this. My data frame looks as below. XYZ: GY RTG Y RT AA 00 00 AA 1 1 11 BB 00 00 BB 1 1 11 CC 00 00 CC 1 1 11 G Y RT G Y R T AA 2 2 22 AA3 3 3 3 BB 2 2 22 BB3 3 3 3 CC 2 2 22 CC3 3 3 3 Thanks, Namit -- View this message in context: http://r.789695.n4.nabble.com/Coloring-specific-cells-tp4639578.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] How can we compare two vectors?
Either == or %in% if you care about order or not. Michael On Aug 8, 2012, at 7:00 AM, Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com wrote: x=c(5, 8, 28, 29, 30) y=c(5, 8, 28, 29, 31) How can we compare these two vectors, whether each element is exactly matched with the elements in the other vector ? How can we get the non matched elements from both the vectors? Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-6692tel:%2B91-40-6692 and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). [[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 can we compare two vectors?
x=c(5, 8, 28, 29, 30) y=c(5, 8, 28, 29, 31) x==y [1] TRUE TRUE TRUE TRUE FALSE which(x==y) [1] 1 2 3 4 which(x!=y) [1] 5 x[x!=y] [1] 30 y[x!=y] [1] 31 RTFM! - just kidding ;) also, this might not work for floating point numbers, theres a section in the documentation/faq somewhere about it. On 08.08.2012, at 14:00, Sri krishna Devarayalu Balanagu wrote: x=c(5, 8, 28, 29, 30) y=c(5, 8, 28, 29, 31) How can we compare these two vectors, whether each element is exactly matched with the elements in the other vector ? How can we get the non matched elements from both the vectors? Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-6692tel:%2B91-40-6692 and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). [[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] sweave problem with special danish characters
On 08/08/2012 6:15 AM, Jonas Hal wrote: Dear all, I use Sweave to create my reports. my pdf output contains only NA's whenever my text contains special Danish characters like ø, ø and å. I have upgraded R from 2.13 to 2.15 and the scripts worked fine under R 2.13. Sweave(Test.Rnw, encoding = utf8) texi2dvi(Test.tex, pdf = TRUE) %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This is a test that works \end{document} %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This doesn't æ ø å and pdf document only contains NA \end{document} Any suggestions? I think you need to give more information. I just tried it in 2.15.1 patched on Windows 32 bit, and it worked fine. What OS are you using? Is the file really encoded using utf-8? What version of R were you using (there's no such thing as 2.15)? Where did you find the texi2dvi function? (There's one in the tools package, but it isn't normally attached. Are you using that one, or your own?) Duncan Murdoch __ 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 we compare two vectors?
Hi krishna, 1.How can we compare these two vectors,whether each element is exactly matched with the elements in the other vector? x=c(5, 8, 28, 29, 30) y=c(5, 8, 28, 29, 31) z-(x %in% y) z [1] TRUE TRUE TRUE TRUE FALSE (OR) z-identical(x,y) z [1] FALSE (OR) to get values that are matching z-x[x %in% y] z [1] 5 8 28 29 2.How can we get the non matched elements from both the vectors? z-setdiff(x,y) z [1] 30 i hope this will help Regards Ramakanth Reddy Guntuka --- Life Sc. Informatics Bonn-Aachen International Center for Information Technology University of Bonn, Germany Mob: +49-015141366412 On 8 August 2012 14:00, Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com wrote: x=c(5, 8, 28, 29, 30) y=c(5, 8, 28, 29, 31) How can we compare these two vectors, whether each element is exactly matched with the elements in the other vector ? How can we get the non matched elements from both the vectors? Can anyone help? Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-6692tel:%2B91-40-6692 and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). [[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. -- Herzlichen Gruß, Ramakanth Reddy Guntuka --- Life Sc. Informatics Programme Bonn-Aachen International Center for Information Technology University of Bonn, Germany Mob: +49-015141366412 [[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] sapply and matrix command
Hi, I have made some progress speeding up my code. This is what I have at the moment: M1=sum(sapply(1:m, function(k){sum(sapply(1:m,function(j){w[k]*w[j]*LGD^2 (pmnorm(c(qnorm(Q[k]),qnorm(Q[j])),c(0,0),equicorr(2,rho[k,j]))-Q[k]*Q[j])}))})) I tried setting up a function as so: f1 - function(k,j) {w[k]*w[j]*LGD^2*(pmnorm(c(qnorm(Q[k]),qnorm(Q[j])),c(0,0),equicorr(2,rho[k,j]))-Q[k]*Q[j])} Then run outer and sum as so: sum(outer(1:m,1:m,foo)) Unfortunately outer doesn't seem to like the equicorr or matrix commands like my problem above. Is there any way around this or am I stuck with the double sapply? Thanks again for your help! ___ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/sapply-and-matrix-command-tp4637769p4639595.html To unsubscribe from sapply and matrix command, visit http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4637769code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDYzNzc2OXwtNzg0MjM1NTA4 [[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] map axis on projected shapefiles
Since posting this I've figured out the problem was due to the shapefiles I was reading in. As they were already projected they were in meters, as oppose to decimal degrees. By opening the shapefiles in ArcGIS, reprojecting them to WGS1984 and exporting, I could then reload them in R in decimal degrees before reprojecting to my desired projection. Thanks -- View this message in context: http://r.789695.n4.nabble.com/map-axis-on-projected-shapefiles-tp4639554p4639596.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] Overlapping a Plot with Dataframe
John Kane Kingston ON Canada -Original Message- From: bioinfo.himan...@gmail.com Sent: Wed, 8 Aug 2012 02:12:00 -0700 (PDT) To: r-help@r-project.org Subject: Re: [R] Overlapping a Plot with Dataframe Hello John, in simple term, I have a Plot as an Output. Now I want to overlap the plot with a Dataframe having error bar. That's not what the data suggests. data- data.frame( x = c(3.00,2.00,3.80,2.40,2.00), error = c(0.0,0.4,1.1,0.7,0.5) ) -- seems to imply that you are plotting a vector of a data frame and if Jim is correct you then want to plot error bars on the plot, using the error vector in 'data'. It is just a wording problem but I don't think that you really mean to overlap the plot with another dataframe because you are only showing one data.frame. In any case, assuming Jim's correct his solution works nicely. Another approach is using ggplot--note I have added an x-axis to the data.frame. library(ggplot2) dat- data.frame( y = c(3.00,2.00,3.80,2.40,2.00), x = 1:5,error = c(0.0,0.4,1.1,0.7,0.5)) limits - aes(ymax = y + error, ymin=y - error) p - p - ggplot(dat , aes( x, y )) + geom_point() + geom_errorbar(limits) p FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ 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] sweave problem with special danish characters
Hi Johas, I've run into a similar problem due to Emacs on OSX setting my locale to C. If you're on Mac or Linux you can try setting Sys.setlocale(category = LC_ALL, locale = UTF-8) before calling Sweave() Best, Ista This doesn't æ ø å and pdf document only contains NA On Wed, Aug 8, 2012 at 6:15 AM, Jonas Hal j...@brf.dk wrote: Dear all, I use Sweave to create my reports. my pdf output contains only NA's whenever my text contains special Danish characters like ø, ø and å. I have upgraded R from 2.13 to 2.15 and the scripts worked fine under R 2.13. Sweave(Test.Rnw, encoding = utf8) texi2dvi(Test.tex, pdf = TRUE) %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This is a test that works \end{document} %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This doesn't æ ø å and pdf document only contains NA \end{document} Any suggestions? Best wishes Jonas Hal _ BRFkredit sender e-mails og vedhæftede dokumenter i ikke-krypteret form. Hvis du ikke ønsker at modtage oplysninger fra BRFkredit pr. e-mail, beder vi dig meddele os det via brev eller e-mail. Denne e-mail kan indeholde fortrolig information. Hvis du modtager e-mailen ved en fejl, beder vi dig informere os om det hurtigst muligt. Samtidig beder vi dig slette e-mailen uden at videresende eller kopiere indholdet. _ [[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] dimnames in array
On Aug 8, 2012, at 3:19 AM, aleksandr russell wrote: Hello, I'm working with an array; I'm trying to make it so that an array of dim(42,2,2) has names whose length corresponds to that of the array, and am hoping someone with experience with this can see what I'm not doing correctly: data11 = array(0,c(41,2,2)) y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc infer package# y = y[,2:3] data11-array(0,c(41,2,2)) m8-cbind(.29,1:41) m9-as.array(m8,dim=c(41,2)) data11[,1,] = y+m9 data11[,2,] = y+m9 I didn't run that code since your difficulties did not seem to have anything to do with the values inside the array but only with the dimension labeling. rownames(data2, do.NULL = FALSE, prefix=row) What is 'data2'? varnames=c(V,R) colnames(data6)=c(one,two) Ditto... what is 'data6'? colnames(data10)=colnames(data6) dimnames(data11)=list(rownames(data2),varnames,colnames(data10)) data11a-as.array(data11,dimnames=dimnames(data11)) attributes(data11a) #so this seems to print out the array attributes as they should be: For which object? two sets of two columns each, and the first column of each set is called 'v' and the second 'r'- no problem# The data11 object had three dimenstions. now the analysis from colloc infer(I've put it in below*) takes this array but will not complete the analysis, saying Error in `colnames-`(`*tmp*`, value = c(V, R)) : length of 'dimnames' [2] not equal to array extent Here's one way to label a 41 x 2 x 2 array: dimnames(data11)- c(list(X=paste0(X,1:41)), list(Y=paste0(Y, 1:2)), list(Z=paste0(Z,1:2)) ) attributes(data11) $dim [1] 41 2 2 $dimnames $dimnames$X [1] X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 [20] X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35 X36 X37 X38 [39] X39 X40 X41 $dimnames$Y [1] Y1 Y2 $dimnames$Z [1] Z1 Z2 When I type in length(dimnames(data11a)[2]) I get the answer: [1] 1 which seems odd when dimnames(data11a)[2] gives [[1]] [1] V R It is a one element list whose single element is a 2 element vector. I would like to ask How can I get the names of the second dimension of the array(data11a) to have length 2 ? It seems to me that the analysis will run if I can make this array have the correct length dimnames I thank you for your help. * fd.data11a = data11a DEfd11a = Data2fd(fd.data11a, times, bbasis, fdnames=list(NULL,NULL,varnames)) profile11a.obj=LS.setup(pars,DEfd11a $coefs,fhn,basisvals=bbasis,lambda,fd.obj=NULL, more =NULL,data=data11a,weights=NULL,times=times,quadrature=NULL,eps=1e-6, posproc=FALSE,poslik=FALSE,discrete=FALSE,names=NULL,sparse=FALSE) lik = profile11a.obj$lik proc = profile11a.obj$proc qwts = rep(1/length(knots),length(knots)) qwts = qwts %*% t(lambda) weights = array(1,dim(data11a)) likmore = make.id() likmore$weights = weights lik = make.SSElik() lik$more = likmore lik$bvals = eval.basis(times,bbasis) procmore = make.fhn() procmore$weights = qwts procmore$qpts = qpts procmore$names = varnames procmore$parnames = parnames proc = make.SSEproc() proc$more = procmore proc$bvals = list(bvals = eval.basis(procmore$qpts,bbasis,0), dbvals = eval.basis(procmore$qpts,bbasis,1)) res11a = inneropt(coefs, times=times, data=data11a, lik=lik, proc=proc, pars=spars, in.meth='nlminb', control.in=control.out) -- David Winsemius, MD Alameda, CA, USA __ 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] sweave problem with special danish characters
I am using win xp, R 2.15.0 and texi2dvi from the tools package. Regards Jonas -Oprindelig meddelelse- Fra: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sendt: 8. august 2012 16:43 Til: Jonas Hal Cc: r-help@r-project.org Emne: Re: [R] sweave problem with special danish characters On 08/08/2012 6:15 AM, Jonas Hal wrote: Dear all, I use Sweave to create my reports. my pdf output contains only NA's whenever my text contains special Danish characters like ø, ø and å. I have upgraded R from 2.13 to 2.15 and the scripts worked fine under R 2.13. Sweave(Test.Rnw, encoding = utf8) texi2dvi(Test.tex, pdf = TRUE) %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This is a test that works \end{document} %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This doesn't æ ø å and pdf document only contains NA \end{document} Any suggestions? I think you need to give more information. I just tried it in 2.15.1 patched on Windows 32 bit, and it worked fine. What OS are you using? Is the file really encoded using utf-8? What version of R were you using (there's no such thing as 2.15)? Where did you find the texi2dvi function? (There's one in the tools package, but it isn't normally attached. Are you using that one, or your own?) Duncan Murdoch _ BRFkredit sender e-mails og vedhæftede dokumenter i ikke-krypteret form. Hvis du ikke ønsker at modtage oplysninger fra BRFkredit pr. e-mail, beder vi dig meddele os det via brev eller e-mail. Denne e-mail kan indeholde fortrolig information. Hvis du modtager e-mailen ved en fejl, beder vi dig informere os om det hurtigst muligt. Samtidig beder vi dig slette e-mailen uden at videresende eller kopiere indholdet. __ 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] Save reload list objects
Hi Rob, On Wed, Aug 8, 2012 at 8:50 AM, robgriffin247 rg.rfo...@hotmail.co.uk wrote: So it was simple, or so it seemed. Now to throw a spanner in the works! I got this error when testing it on my more powerful desktop (using one of my lists put in to a new object) : #put list in to new object called temp temp-rg.lmer #save save(temp,file=C:\\Users\\...\\R Data\\rg.lmer.txt) It is conventional to save R workspace with .Rdata extension rather than .txt, although I don't think it actually makes a difference. #remove temp list from workspace to test load rm(temp) #load list in to a new object, again called temp. temp-load(C:\\Users\\...\\R Data\\rg.lmer.txt) Don't assign the return value of load to an object(). Just do load(C:\\Users\\...\\R Data\\rg.lmer.txt) temp-load(C:\\Users\\...\\R Data\\rg.lmer.txt) Error: cannot allocate vector of size 98 Kb In addition: Warning messages: 1: Reached total allocation of 8148Mb: see help(memory.size) 2: Reached total allocation of 8148Mb: see help(memory.size) The save process takes a very long time but works so I wonder if there is a quicker way to get the same result. The load takes a long time to throw out this error message. Again I hope there is a more efficient way to do it because it defeats the point of saving it in the first place if it takes as long as running the original script to make the list! Also it means I haven't been able to check if the load works and will produce the desired list. *Summary: Is there a better way than save / load, if not how can I get around this error message?* Maybe, but I would start be trying again, starting from a clean R session (either restart of run rm(list=ls()) to delete everything in your workspace), and properly using load() as I illustrated above. If you still have memory problems then you can start looking for another solution. Best, Ista Rob -- View this message in context: http://r.789695.n4.nabble.com/Save-reload-list-objects-tp4639397p4639581.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] sweave problem with special danish characters
On 08/08/2012 10:58 AM, Jonas Hal wrote: I am using win xp, R 2.15.0 and texi2dvi from the tools package. I'd suggest checking the encoding of your file (if I use latin1, I get an NA like you did). If that's not it, then you should upgrade to the latest release, or to the current patched version. Duncan Murdoch Regards Jonas -Oprindelig meddelelse- Fra: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sendt: 8. august 2012 16:43 Til: Jonas Hal Cc: r-help@r-project.org Emne: Re: [R] sweave problem with special danish characters On 08/08/2012 6:15 AM, Jonas Hal wrote: Dear all, I use Sweave to create my reports. my pdf output contains only NA's whenever my text contains special Danish characters like ø, ø and å. I have upgraded R from 2.13 to 2.15 and the scripts worked fine under R 2.13. Sweave(Test.Rnw, encoding = utf8) texi2dvi(Test.tex, pdf = TRUE) %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This is a test that works \end{document} %Test.Rnw \documentclass{article} \usepackage [danish]{babel} \usepackage[utf8]{inputenc} \begin{document} This doesn't æ ø å and pdf document only contains NA \end{document} Any suggestions? I think you need to give more information. I just tried it in 2.15.1 patched on Windows 32 bit, and it worked fine. What OS are you using? Is the file really encoded using utf-8? What version of R were you using (there's no such thing as 2.15)? Where did you find the texi2dvi function? (There's one in the tools package, but it isn't normally attached. Are you using that one, or your own?) Duncan Murdoch _ BRFkredit sender e-mails og vedhæftede dokumenter i ikke-krypteret form. Hvis du ikke ønsker at modtage oplysninger fra BRFkredit pr. e-mail, beder vi dig meddele os det via brev eller e-mail. Denne e-mail kan indeholde fortrolig information. Hvis du modtager e-mailen ved en fejl, beder vi dig informere os om det hurtigst muligt. Samtidig beder vi dig slette e-mailen uden at videresende eller kopiere indholdet. _ __ 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] sapply and matrix command
On Wed, Aug 8, 2012 at 9:17 AM, alijk1989 [via R] ml-node+s789695n4639595...@n4.nabble.com wrote: Hi, I have made some progress speeding up my code. This is what I have at the moment: M1=sum(sapply(1:m, function(k){sum(sapply(1:m,function(j){w[k]*w[j]*LGD^2 (pmnorm(c(qnorm(Q[k]),qnorm(Q[j])),c(0,0),equicorr(2,rho[k,j]))-Q[k]*Q[j])}))})) I tried setting up a function as so: f1 - function(k,j) {w[k]*w[j]*LGD^2*(pmnorm(c(qnorm(Q[k]),qnorm(Q[j])),c(0,0),equicorr(2,rho[k,j]))-Q[k]*Q[j])} Then run outer and sum as so: sum(outer(1:m,1:m,foo)) Unfortunately outer doesn't seem to like the equicorr or matrix commands like my problem above. Is there any way around this or am I stuck with the double sapply? Thanks again for your help! I'm afraid we have no context for what you're trying to do -- the vast majority of us don't use Nabble. Could you enlighten us? Also, please do try to make your code more legible by breaking things up into multiple lines. Finally, try to make a reproducible example according to the hints herein: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Cheers, Michael __ 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, uneven length
On Wed, Aug 8, 2012 at 7:53 AM, joel.green joel.gr...@live.co.uk wrote: I have 4 univariate time series that I believe have correlation between them, I want to create a VAR model between them all. However I have an issue as 3 of them are the same length, however the 4th is smaller. meaning that i cannot use the 4th variable , is there anyway R can get round this issue? length(tstemp) [1] 746 length(tspres) [1] 746 length(tswind) [1] 746 length(tsozon) [1] 658 ccf(tstemp,tsozon) Error in ccf(tstemp, tsozon) : univariate time series only Good morning Joel, I'm afraid it's not the length issue that gives the error: x - ts(rnorm(746)); y - ts(rnorm(646)); ccf(x, y) but rather that one of your series is actually multivariate already (i.e., has multiple columns) -- check NCOL(x) for each of them and you'll find the problem. If that doesn't help, try to work up a reproducible example as described here: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Cheers, Michael thanks -- View this message in context: http://r.789695.n4.nabble.com/time-series-uneven-length-tp4639582.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] help, please! matrix operations inside 3 nested loops
On Wed, Aug 8, 2012 at 9:06 AM, Fridolin smells_like_r...@gmx.net wrote: hello, this is my script: #1) read in data: daten-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep=\t) daten-as.matrix(daten) #2) create empty matrix: indxind-matrix(nrow=617, ncol=617) indxind[1:20,1:19] #3) compare cells to each other, score: for (s in 3:34) { #walks though the matrix colum by colum, starting at colum 3 for (z1 in 1:617) { #for each current colum, take one row (z1)... for (z2 in 1:617) { #...and compare it to another row (z2) of the current colum if (z1!=z2) {topf-indxind[z1,z2] if (daten[2*z1-1,s]==daten[2*z2-1,s]) topf-topf+1 #actually, 2 rows make up 1 individual, if (daten[2*z1-1,s]==daten[2*z2,s]) topf-topf+1 #therefore i compare 2 rows if (daten[2*z1,s]==daten[2*z2-1,s]) topf-topf+1 #with another 2 rows if (daten[2*z1,s]==daten[2*z2,s]) topf-topf+1 indxind[z1,z2]-topf indxind[z2,z1]-topf } #print(c(s,z1,z2,indxind[1,2])) ##counts s, z1 and z2 properly, but gives NA for indxind[1,2] } #indxind[1:5,1:5] #empty matrix } #indxind[1:5,1:5] #empty matrix } #4) check: indxind[1:5,1:5] this results no errors, but my matrix indxind remains empty (only NAs). though all columns and rows are counted properly. R needs quite a while to get through all this (there are probably smarter and faster ways to calculate this but i am not too deep into R and bioinformatics, and i need to calculate this only once). could the 3 for-loops already be too computationally intense for adding matrix operations? any help would be much appreciated! thx, frido Hi Frido, I'm afraid I get a little lost in your code, but I'd be willing to bet we can cut the loops out entirely and speed things up. Can you give us a big picture description of the algorithm you're implementing as well as (if it's not too hard) a small reproducible example [1]? Note also that most of us don't use Nabble so you'll need to explicitly quote any relevant context. Thanks, Michael [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example __ 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] help to program my function
HI peter there is the function that i want to programm (joint in pdf folder). my data is dataexpv Ti1 265.792 26 1579.523 26 2323.704 28 68.855 28 426.076 28 110.297 28 108.298 28 1067.609 30 17.0510 30 22.6611 30 21.0212 30 175.8813 30 139.0714 30 144.1215 30 20.4616 30 43.4017 30 194.9018 30 47.3019 307.7420 320.4021 32 82.8522 32 9.8823 32 89.2924 32 215.1025 321.7526 320.7927 32 15.9328 32 3.9129 320.2730 320.6931 32 100.5832 32 27.8033 32 13.9534 32 53.2435 340.9636 344.1537 340.1938 340.7839 348.0140 34 31.7541 347.3542 346.5043 348.2744 34 33.9145 34 32.5246 34 3.1647 344.8548 342.7849 344.6750 341.3151 34 12.0652 34 36.7153 34 72.8954 361.9755 360.5956 362.5857 361.6958 36 2.7159 36 25.5060 360.3561 360.9962 363.9963 363.6764 36 2.0765 360.9666 365.3567 362.9068 36 13.7769 380.4770 38 0.7371 381.4072 380.7473 380.3974 38 ! 1.1375 380.0976 382.38 NB X-Ti thanks for helping mehafida Date: Wed, 8 Aug 2012 03:13:28 -0700 From: ml-node+s789695n463956...@n4.nabble.com To: hafida...@hotmail.fr Subject: Re: help to program my function Hi Maybe it is time for you to read some basic stuff like R intro. It seems to me that you expect R to behave like some other language you know but probably your expectation is wrong. See inline HI i have a problem please help me to solve it: http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf i want to calculate the vecteur a[j] where j: 1...8 this is the code in R: aj.fun - function(j, i, X, z, E, beta0, beta1){ + n - length(X) + iX - order(X) + iz - order(z) + e1 - -(beta)*z[ iz[1:(i - 1)] ] where do you get beta + numer - E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) ) + e2 - -(beta)*z[ iz[i:n] ] + denom - sum( exp(e2) ) + numer/denom + } iX-order(X) iX [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54 64 76 56 [26] 58 48 67 46 63 28 62 36 49 47 66 1 42 41 19 39 43 22 51 68 33 27 9 15 11 [51] 10 59 32 40 45 44 52 16 18 34 4 53 21 23 31 7 6 13 14 12 17 24 5 8 2 [76] 3 iZ-order(Z) iZ [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [76] 76 e1 - -(beta)*Z[ iZ[1:(i - 1)] ] Warning message: In 1:(i - 1) : numerical expression has 76 elements: only the first used As somebody already mentioned i is probably vector and in this case only first value is taken. i seems to have the firs value 3. e1 [1] -442 -1664 numer - E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1)) Warning message: In 1:(i - 1) : numerical expression has 76 elements: only the first used numer [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5 Here j is vector of 8 values therefore 8 values e2 - -(beta)*Z[ iZ[i:n] ] Warning message: In i:n : numerical expression has 76 elements: only the first used e2 [1] -442 -1664 -442 -1792 -476 -1792 -476 -1792 -510 -1920 -510 -1920 [13] -510 -1920 -510 -1920 -510 -1920 -510 -2048 -544 -2048 -544 -2048 [25] -544 -2048 -544 -2048 -544 -2048 -544 -2048 -544 -2048 -578 -2176 [37] -578 -2176 -578 -2176 -578 -2176 -578 -2176 -578 -2176 -578 -2176 [49] -578 -2176 -578 -2176 -578 -2304 -612 -2304 -612 -2304 -612 -2304 [61] -612 -2304 -612 -2304 -612 -2304 -612 -2304 -646 -2432 -646 -2432 [73] -646 -2432 -646 -2432 Strange, here first value of i seems to be 1 as n shall be 76 and final e2 length is 76. denom - sum( exp(e2) ) numer/denom [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 [6] 4.313746e+192 4.313746e+192 4.313746e+192 my problem that the vecteur a[j] could not have the same number!!! I do not understand. Your numer is 9.5 repeted 8 times. If you divide it by one number you will get nine times the same number. You send us a code but no data so it is difficult to understand what is your goal. It would be better to send input data j, i, X, z, E, beta0, beta1 and assumed result in whole not in chunks scattered in several mails. Regards Petr thank you in advance hafida -- View this message in context: http://r.789695.n4.nabble.com/help-to- program-my-function-tp4639434.html Sent from the R help mailing list archive at Nabble.com. __ [hidden email] 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] help, please! matrix operations inside 3 nested loops
Fridolin wrote hello, this is my script: #1) read in data: daten-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep=\t) daten-as.matrix(daten) #2) create empty matrix: indxind-matrix(nrow=617, ncol=617) indxind[1:20,1:19] You should at least initialize indxind to 0 with indxind-matrix(0,nrow=617, ncol=617) because the default for matrix is to use NA for data. Berend -- View this message in context: http://r.789695.n4.nabble.com/help-please-matrix-operations-inside-3-nested-loops-tp4639592p4639621.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] Odp: help, please! matrix operations inside 3 nested loops
Hi hello, this is my script: #1) read in data: daten-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', header=TRUE, sep=\t) daten-as.matrix(daten) If there is any column with nonnumeric values it will transfer all numeric values from daten data.frame to character values. #2) create empty matrix: indxind-matrix(nrow=617, ncol=617) indxind[1:20,1:19] #3) compare cells to each other, score: for (s in 3:34) { #walks though the matrix colum by colum, starting at colum 3 for (z1 in 1:617) { #for each current colum, take one row (z1)... for (z2 in 1:617) { #...and compare it to another row (z2) of the current colum if (z1!=z2) {topf-indxind[z1,z2] if (daten[2*z1-1,s]==daten[2*z2-1,s]) topf-topf+1 #actually, 2 rows make up 1 individual, if (daten[2*z1-1,s]==daten[2*z2,s]) topf-topf+1 #therefore i compare 2 rows if (daten[2*z1,s]==daten[2*z2-1,s]) topf-topf+1 #with another 2 rows if (daten[2*z1,s]==daten[2*z2,s]) topf-topf+1 indxind[z1,z2]-topf indxind[z2,z1]-topf } The above code is rather clumsy and it is difficult to understand what it shall do without extensive study. AFAIU you first set topf to NA and then try to add 1 to topf. The result is again NA regardless of your sophisticated z constuction. Therefore you are just computing NA in each cycle, so you can not expect other result them NA. #print(c(s,z1,z2,indxind[1,2])) ##counts s, z1 and z2 properly, but gives NA for indxind[1,2] } #indxind[1:5,1:5] #empty matrix } #indxind[1:5,1:5] #empty matrix } #4) check: indxind[1:5,1:5] this results no errors, but my matrix indxind remains empty (only NAs). though all columns and rows are counted properly. R needs quite a while to get through all this (there are probably smarter and faster ways to calculate this but i am not too deep into R and bioinformatics, and i need to calculate this only once). could the 3 for-loops already be too What is this. Please try to set up small example with what do you have and what do you want to achive. Unless you can explain better what do you want, you probably will not get better answer. I, however, may be proven wrong as some clever people in this list are far better in mind reading then I am :-) Regards Petr computationally intense for adding matrix operations? any help would be much appreciated! thx, frido -- View this message in context: http://r.789695.n4.nabble.com/help-please- matrix-operations-inside-3-nested-loops-tp4639592.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] help to program my function
Hi please cc your post also to Rhelp list, others may give you better/quicker answer. HI peter there is the function that i want to programm (joint in pdf folder). No pdf allowed. my data is dataexpv Ti1 265.792 26 1579.523 26 2323.704 28 68.855 28 426.076 28 110.297 28 108.298 28 1067.609 30 17. 0510 30 22.6611 30 21.0212 30 175.8813 30 139.0714 30 144.1215 30 20.4616 30 43.4017 30 194.9018 30 47.3019 307.7420 320.4021 32 82.8522 329.8823 32 89.2924 32 215.1025 321.7526 32 0. 7927 32 15.9328 323.9129 320.2730 320.6931 32 100.5832 32 27.8033 32 13.9534 32 53.2435 340.9636 344.1537 340.1938 340.7839 348.0140 34 31.7541 347.3542 346.5043 34 8. 2744 34 33.9145 34 32.5246 343.1647 344.8548 342.7849 34 4.6750 341.3151 34 12.0652 34 36.7153 34 72.8954 361.9755 36 0.5956 362.5857 361.6958 362.7159 36 25.5060 360.3561 36 0.9962 363.9963 363.6764 362.0765 360.9666 365.3567 36 2.9068 36 13.7769 380.4770 380.7371 381.4072 380.7473 38 0.3974 38 ! 1.1375 380.0976 382.38 Use dput(your.data) and copy it to mail. It is directly redable by R and not scrambled like above. NB X-Ti thanks for helping mehafida Not at all. I did not help much yet. Regards Petr Date: Wed, 8 Aug 2012 03:13:28 -0700 From: ml-node+s789695n463956...@n4.nabble.com To: hafida...@hotmail.fr Subject: Re: help to program my function Hi Maybe it is time for you to read some basic stuff like R intro. It seems to me that you expect R to behave like some other language you know but probably your expectation is wrong. See inline HI i have a problem please help me to solve it: http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf i want to calculate the vecteur a[j] where j: 1...8 this is the code in R: aj.fun - function(j, i, X, z, E, beta0, beta1){ + n - length(X) + iX - order(X) + iz - order(z) + e1 - -(beta)*z[ iz[1:(i - 1)] ] where do you get beta + numer - E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) ) + e2 - -(beta)*z[ iz[i:n] ] + denom - sum( exp(e2) ) + numer/denom + } iX-order(X) iX [1] 75 37 29 60 73 20 69 55 30 70 72 38 26 35 65 61 74 50 71 57 25 54 64 76 56 [26] 58 48 67 46 63 28 62 36 49 47 66 1 42 41 19 39 43 22 51 68 33 27 9 15 11 [51] 10 59 32 40 45 44 52 16 18 34 4 53 21 23 31 7 6 13 14 12 17 24 5 8 2 [76] 3 iZ-order(Z) iZ [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [76] 76 e1 - -(beta)*Z[ iZ[1:(i - 1)] ] Warning message: In 1:(i - 1) : numerical expression has 76 elements: only the first used As somebody already mentioned i is probably vector and in this case only first value is taken. i seems to have the firs value 3. e1 [1] -442 -1664 numer - E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1)) Warning message: In 1:(i - 1) : numerical expression has 76 elements: only the first used numer [1] 9.5 9.5 9.5 9.5 9.5 9.5 9.5 9.5 Here j is vector of 8 values therefore 8 values e2 - -(beta)*Z[ iZ[i:n] ] Warning message: In i:n : numerical expression has 76 elements: only the first used e2 [1] -442 -1664 -442 -1792 -476 -1792 -476 -1792 -510 -1920 -510 -1920 [13] -510 -1920 -510 -1920 -510 -1920 -510 -2048 -544 -2048 -544 -2048 [25] -544 -2048 -544 -2048 -544 -2048 -544 -2048 -544 -2048 -578 -2176 [37] -578 -2176 -578 -2176 -578 -2176 -578 -2176 -578 -2176 -578 -2176 [49] -578 -2176 -578 -2176 -578 -2304 -612 -2304 -612 -2304 -612 -2304 [61] -612 -2304 -612 -2304 -612 -2304 -612 -2304 -646 -2432 -646 -2432 [73] -646 -2432 -646 -2432 Strange, here first value of i seems to be 1 as n shall be 76 and final e2 length is 76. denom - sum( exp(e2) ) numer/denom [1] 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 4.313746e+192 [6] 4.313746e+192 4.313746e+192 4.313746e+192 my problem that the vecteur a[j] could not have the same number!!! I do not understand. Your numer is 9.5 repeted 8 times. If you divide it by one number you will get nine times the same number. You send us a code but no data so it is difficult to understand what is your goal. It would be better to send input data j, i, X, z, E, beta0, beta1 and assumed result in whole not in chunks scattered in several mails. Regards
Re: [R] dimnames in array
Hi again, Thanks for your suggestion. I think I can clarify the thing by looking at the bare bones: data11 = array(0,c(41,2,2)) m8-cbind(.29,1:41) m9-as.array(m8,dim=c(41,2)) data11[,1,]=m9 data11[,2,]=m9 varnames=c(V,R) colnames(data11)=c(one,two) dimnames(data11)=list(rownames(data11),varnames,colnames(data11)) data11a-as.array(data11,dimnames=dimnames(data11)) Just running the above, some artificial data, I come out with an array that seems to be have the right attributes: typing attributes(data11a) I get dimnames for each dimension. The problem is that [package 'colloc infer' says] (and I quote): Error in `colnames-`(`*tmp*`, value = c(V, R)) : length of 'dimnames' [2] not equal to array extent It seems that the names for the second dimension of the array must have length of 2 -- rather than the present 1 for the analysis to work. Again, typing length(dimnames(data11a)[2]) I get [1] 1 I've tried your suggestion for the dimnames but I'm getting an error could not find function paste0 Maybe you're using R later than 2.41? thanks, Alexander On Wed, Aug 8, 2012 at 10:52 AM, David Winsemius dwinsem...@comcast.net wrote: On Aug 8, 2012, at 3:19 AM, aleksandr russell wrote: Hello, I'm working with an array; I'm trying to make it so that an array of dim(42,2,2) has names whose length corresponds to that of the array, and am hoping someone with experience with this can see what I'm not doing correctly: data11 = array(0,c(41,2,2)) y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc infer package# y = y[,2:3] data11-array(0,c(41,2,2)) m8-cbind(.29,1:41) m9-as.array(m8,dim=c(41,2)) data11[,1,] = y+m9 data11[,2,] = y+m9 I didn't run that code since your difficulties did not seem to have anything to do with the values inside the array but only with the dimension labeling. rownames(data2, do.NULL = FALSE, prefix=row) What is 'data2'? varnames=c(V,R) colnames(data6)=c(one,two) Ditto... what is 'data6'? colnames(data10)=colnames(data6) dimnames(data11)=list(rownames(data2),varnames,colnames(data10)) data11a-as.array(data11,dimnames=dimnames(data11)) attributes(data11a) #so this seems to print out the array attributes as they should be: For which object? two sets of two columns each, and the first column of each set is called 'v' and the second 'r'- no problem# The data11 object had three dimenstions. now the analysis from colloc infer(I've put it in below*) takes this array but will not complete the analysis, saying Error in `colnames-`(`*tmp*`, value = c(V, R)) : length of 'dimnames' [2] not equal to array extent Here's one way to label a 41 x 2 x 2 array: dimnames(data11)- c(list(X=paste0(X,1:41)), list(Y=paste0(Y,1:2)), list(Z=paste0(Z,1:2)) ) attributes(data11) $dim [1] 41 2 2 $dimnames $dimnames$X [1] X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 [20] X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35 X36 X37 X38 [39] X39 X40 X41 $dimnames$Y [1] Y1 Y2 $dimnames$Z [1] Z1 Z2 When I type in length(dimnames(data11a)[2]) I get the answer: [1] 1 which seems odd when dimnames(data11a)[2] gives [[1]] [1] V R It is a one element list whose single element is a 2 element vector. I would like to ask How can I get the names of the second dimension of the array(data11a) to have length 2 ? It seems to me that the analysis will run if I can make this array have the correct length dimnames I thank you for your help. * fd.data11a = data11a DEfd11a = Data2fd(fd.data11a, times, bbasis, fdnames=list(NULL,NULL,varnames)) profile11a.obj=LS.setup(pars,DEfd11a$coefs,fhn,basisvals=bbasis,lambda,fd.obj=NULL, more=NULL,data=data11a,weights=NULL,times=times,quadrature=NULL,eps=1e-6, posproc=FALSE,poslik=FALSE,discrete=FALSE,names=NULL,sparse=FALSE) lik = profile11a.obj$lik proc = profile11a.obj$proc qwts = rep(1/length(knots),length(knots)) qwts = qwts %*% t(lambda) weights = array(1,dim(data11a)) likmore = make.id() likmore$weights = weights lik = make.SSElik() lik$more = likmore lik$bvals = eval.basis(times,bbasis) procmore = make.fhn() procmore$weights = qwts procmore$qpts = qpts procmore$names = varnames procmore$parnames = parnames proc = make.SSEproc() proc$more = procmore proc$bvals = list(bvals = eval.basis(procmore$qpts,bbasis,0), dbvals = eval.basis(procmore$qpts,bbasis,1)) res11a = inneropt(coefs, times=times, data=data11a, lik=lik, proc=proc, pars=spars, in.meth='nlminb', control.in=control.out) -- David Winsemius, MD Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
[R] R help
Hi I'm trying to increase the memory limit but Im facing this problem Error: unexpected symbol in C:\\Program Files\\R\\R-2.15.0\\bin\\i386\\Rgui.exe --max-mem-size=500M Hope you can help me out Thank You [[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] sapply and matrix command
Hi Michael, Thanks for your response. Here is a simple example of what I am trying to do: w=rep(0.02,10) Q=rep(0.02,10) rho=matrix(0.5,nrow=10,ncol=10) m=10 LGD=0.45 M1=sum(sapply(1:m, function(k){sum(sapply(1:m,function(j){w[k]*w[j]*LGD^2*(pmnorm(c(qnorm(Q[k]),qnorm(Q[j])),c(0,0),equicorr(2,rho[k,j]))-Q[k]*Q[j])}))})) It uses the mnormt and QRM packages. I am trying to reproduce the following sum: \sum\limits_{j=1}^M \sum\limits_{k=1}^M w_j w_k LGD^2[N_2(N^{-1}[Q(j)],N^{-1}[Q(k)],\rho_{jk})-Q(j)Q(k)] ___ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/sapply-and-matrix-command-tp4637769p4639622.html To unsubscribe from sapply and matrix command, visit http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4637769code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDYzNzc2OXwtNzg0MjM1NTA4 [[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] ggplot2 with separate average lines
Hi I'm just starting off with R but is this correct? I have this data set. data Type ID Size 1 Reqd 244808 1024 2 Reqd 244045 512 3 Reqd 245427 800 4 Reqd 245423 1024 5 Reqd 244983 1024 6 Used 244808 615 7 Used 244045 33 8 Used 245427 261 9 Used 245423 461 10 Used 244983 1194 I want a scatterplot of the Size values grouped by the Type column. I also want 2 lines showing each group's average. library(ggplot2) data - read.table(mem.dat, header=T, sep=,) attach(data) ggplot(data.frame(Type, ID, Size), aes(x=ID, y=Size, shape=Type, color=Type)) + geom_point(shape=1) + scale_fill_hue(l=40) + geom_line(stat=hline, yintercept=mean, linetype=dashed) Regards, Alan [[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] Confidence bands around LOESS
I may have missed something entirely but I think ggplot2 will do this for you pretty well automatically library(ggplot2) mydata - read.csv(http://doylesdartden.com/smoothing.csv;, sep=,) p - ggplot(mydata , aes( X_Axis_Parameter, Y_Axis_Parameter )) + geom_point() + geom_smooth() p John Kane Kingston ON Canada -Original Message- From: kydaviddo...@gmail.com Sent: Tue, 7 Aug 2012 21:22:41 -0500 To: r-help@r-project.org Subject: [R] Confidence bands around LOESS Hi Folks, I'm looking to do Confidence bands around LOESS smoothing curve. If found the older post about using the Standard error to approximate it https://stat.ethz.ch/pipermail/r-help/2008-August/170011.html Also found this one http://www.r-bloggers.com/sab-r-metrics-basics-of-loess-regression/ But they both seem to be approximations of confidence intervals and I was wonder if there was a way to get the CIs? Below is the code I have so far and my data is no the net. Any help would be greatly appreciated. Take Care David - #Load your data. Is located on the web at the address below mydata - read.csv(http://doylesdartden.com/smoothing.csv;, sep=,) mydata - read.table(x.csv, header=TRUE, sep=,,) attach(mydata) reg1 - lm(Y_Axis_Parameter~X_Axis_Parameter) par(cex=1) * * * * #Plots the data but makes nondetects a different color and type based on column D_Y_Axis_Parameter being a 0 for ND and 1 for detect. plot(X_Axis_Parameter, Y_Axis_Parameter, col=ifelse(D_Y_Axis_Parameter, black, red),ylab = Y_Axis_Parameter, pch=ifelse(D_Y_Axis_Parameter, 19, 17), cex = 0.7) plx-predict(loess(Y_Axis_Parameter ~ X_Axis_Parameter, data=mydata), se=T) lines(mydata$X_Axis_Parameter,plx$fit+2*plx$s, lty=2) #rough ready CI lines(mydata$X_Axis_Parameter,plx$fit-2*plx$s, lty=2) # Apply loess smoothing using the default span value of 0.8. You can change the curve by changing the span value. y.loess - loess(y ~ x, span=0.8, data.frame(x=X_Axis_Parameter, y=Y_Axis_Parameter)) # Compute loess smoothed values for all points along the curve y.predict - predict(y.loess, data.frame(x=X_Axis_Parameter)) # Plots the curve. lines(X_Axis_Parameter,y.predict) * * #Add Legend to graY_Axis_Parameter. You can change the size of the box by changing cex = 0.75 Large # makes it larger. legend(topleft, c(Smoothing Curve, Detected, NonDetect), col = c(1, black,red), cex = 0.75, text.col = black, lty = c(1 ,-1, -1), pch = c(-1, 19, 17), merge = TRUE, bg = 'gray90') * * #Add title title(main=Locally Weighted Scatterplot Smoothing Curve) # Done [[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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ 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] Setting Number of Displayed Digits
On Tue, 7 Aug 2012, arun wrote: formatC() may work for you. Thanks for the lesson. Rich __ 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] dimnames in array
On Aug 8, 2012, at 8:43 AM, aleksandr russell wrote: Hi again, Thanks for your suggestion. I think I can clarify the thing by looking at the bare bones: data11 = array(0,c(41,2,2)) m8-cbind(.29,1:41) m9-as.array(m8,dim=c(41,2)) data11[,1,]=m9 data11[,2,]=m9 varnames=c(V,R) colnames(data11)=c(one,two) colnames(data11)=c(one,two); str(data11) num [1:41, 1:2, 1:2] 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 ... - attr(*, dimnames)=List of 3 ..$ : NULL ..$ : chr [1:2] one two ..$ : NULL dimnames(data11)=list(rownames(data11),varnames,colnames(data11)) data11a-as.array(data11,dimnames=dimnames(data11)) str(data11) num [1:41, 1:2, 1:2] 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 0.29 ... - attr(*, dimnames)=List of 3 ..$ : NULL ..$ : chr [1:2] V R ..$ : chr [1:2] one two Dimnames is a list with three lists. Just running the above, some artificial data, I come out with an array that seems to be have the right attributes: typing attributes(data11a) I get dimnames for each dimension. The problem is that [package 'colloc infer' says] (and I quote): Error in `colnames-`(`*tmp*`, value = c(V, R)) : length of 'dimnames' [2] not equal to array extent You are not offering code and data that would help understand the problem. It seems that the names for the second dimension of the array must have length of 2 -- rather than the present 1 for the analysis to work. Again, typing length(dimnames(data11a)[2]) I get [1] 1 I've tried your suggestion for the dimnames but I'm getting an error could not find function paste0 Maybe you're using R later than 2.41? Yes. R 2.15.1 has added paste0() which is basically paste(... , sep=). -- thanks, Alexander On Wed, Aug 8, 2012 at 10:52 AM, David Winsemius dwinsem...@comcast.net wrote: On Aug 8, 2012, at 3:19 AM, aleksandr russell wrote: Hello, I'm working with an array; I'm trying to make it so that an array of dim(42,2,2) has names whose length corresponds to that of the array, and am hoping someone with experience with this can see what I'm not doing correctly: data11 = array(0,c(41,2,2)) y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc infer package# y = y[,2:3] data11-array(0,c(41,2,2)) m8-cbind(.29,1:41) m9-as.array(m8,dim=c(41,2)) data11[,1,] = y+m9 data11[,2,] = y+m9 I didn't run that code since your difficulties did not seem to have anything to do with the values inside the array but only with the dimension labeling. rownames(data2, do.NULL = FALSE, prefix=row) What is 'data2'? varnames=c(V,R) colnames(data6)=c(one,two) Ditto... what is 'data6'? colnames(data10)=colnames(data6) dimnames(data11)=list(rownames(data2),varnames,colnames(data10)) data11a-as.array(data11,dimnames=dimnames(data11)) attributes(data11a) #so this seems to print out the array attributes as they should be: For which object? two sets of two columns each, and the first column of each set is called 'v' and the second 'r'- no problem# The data11 object had three dimenstions. now the analysis from colloc infer(I've put it in below*) takes this array but will not complete the analysis, saying Error in `colnames-`(`*tmp*`, value = c(V, R)) : length of 'dimnames' [2] not equal to array extent Here's one way to label a 41 x 2 x 2 array: dimnames(data11)- c(list(X=paste0(X,1:41)), list(Y=paste0(Y, 1:2)), list(Z=paste0(Z,1:2)) ) attributes(data11) $dim [1] 41 2 2 $dimnames $dimnames$X [1] X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 [20] X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 X33 X34 X35 X36 X37 X38 [39] X39 X40 X41 $dimnames$Y [1] Y1 Y2 $dimnames$Z [1] Z1 Z2 When I type in length(dimnames(data11a)[2]) I get the answer: [1] 1 which seems odd when dimnames(data11a)[2] gives [[1]] [1] V R It is a one element list whose single element is a 2 element vector. I would like to ask How can I get the names of the second dimension of the array(data11a) to have length 2 ? It seems to me that the analysis will run if I can make this array have the correct length dimnames I thank you for your help. * David Winsemius, MD Alameda, CA, USA __ 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] Confidence bands around LOESS
Please Note: loess() is a fitting algorithm, so no parameters are estimated and no _confidence_ intervals nor bands can be produced. What predict.loess() _does_ give is standard errors for the fits/predictions, and you can add and subtract as many of these as you like to produce standard error bands. This sort of vague uncertainty interval is presumably what is wanted anyway, but I do think it is important to make sure you get the nomenclature right -- and, in particular, no probabilistic claims are made about true underlying curves lying within the bands produced. Cheers, Bert On Wed, Aug 8, 2012 at 8:51 AM, John Kane jrkrid...@inbox.com wrote: I may have missed something entirely but I think ggplot2 will do this for you pretty well automatically library(ggplot2) mydata - read.csv(http://doylesdartden.com/smoothing.csv;, sep=,) p - ggplot(mydata , aes( X_Axis_Parameter, Y_Axis_Parameter )) + geom_point() + geom_smooth() p John Kane Kingston ON Canada -Original Message- From: kydaviddo...@gmail.com Sent: Tue, 7 Aug 2012 21:22:41 -0500 To: r-help@r-project.org Subject: [R] Confidence bands around LOESS Hi Folks, I'm looking to do Confidence bands around LOESS smoothing curve. If found the older post about using the Standard error to approximate it https://stat.ethz.ch/pipermail/r-help/2008-August/170011.html Also found this one http://www.r-bloggers.com/sab-r-metrics-basics-of-loess-regression/ But they both seem to be approximations of confidence intervals and I was wonder if there was a way to get the CIs? Below is the code I have so far and my data is no the net. Any help would be greatly appreciated. Take Care David - #Load your data. Is located on the web at the address below mydata - read.csv(http://doylesdartden.com/smoothing.csv;, sep=,) mydata - read.table(x.csv, header=TRUE, sep=,,) attach(mydata) reg1 - lm(Y_Axis_Parameter~X_Axis_Parameter) par(cex=1) * * * * #Plots the data but makes nondetects a different color and type based on column D_Y_Axis_Parameter being a 0 for ND and 1 for detect. plot(X_Axis_Parameter, Y_Axis_Parameter, col=ifelse(D_Y_Axis_Parameter, black, red),ylab = Y_Axis_Parameter, pch=ifelse(D_Y_Axis_Parameter, 19, 17), cex = 0.7) plx-predict(loess(Y_Axis_Parameter ~ X_Axis_Parameter, data=mydata), se=T) lines(mydata$X_Axis_Parameter,plx$fit+2*plx$s, lty=2) #rough ready CI lines(mydata$X_Axis_Parameter,plx$fit-2*plx$s, lty=2) # Apply loess smoothing using the default span value of 0.8. You can change the curve by changing the span value. y.loess - loess(y ~ x, span=0.8, data.frame(x=X_Axis_Parameter, y=Y_Axis_Parameter)) # Compute loess smoothed values for all points along the curve y.predict - predict(y.loess, data.frame(x=X_Axis_Parameter)) # Plots the curve. lines(X_Axis_Parameter,y.predict) * * #Add Legend to graY_Axis_Parameter. You can change the size of the box by changing cex = 0.75 Large # makes it larger. legend(topleft, c(Smoothing Curve, Detected, NonDetect), col = c(1, black,red), cex = 0.75, text.col = black, lty = c(1 ,-1, -1), pch = c(-1, 19, 17), merge = TRUE, bg = 'gray90') * * #Add title title(main=Locally Weighted Scatterplot Smoothing Curve) # Done [[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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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 with separate average lines
Looks like it works :) I'd suggest not using attach(). It can cause problems in some cases. gglot2 is set up to read the relevant data frame so p - ggplot( data , aes( Whatever. )) + and so on However data is a defined function in R so something like mydata or df1 is a better choice. John Kane Kingston ON Canada -Original Message- From: alan.mil...@synopsys.com Sent: Wed, 8 Aug 2012 15:32:23 + To: r-help@r-project.org Subject: [R] ggplot2 with separate average lines Hi I'm just starting off with R but is this correct? I have this data set. data Type ID Size 1 Reqd 244808 1024 2 Reqd 244045 512 3 Reqd 245427 800 4 Reqd 245423 1024 5 Reqd 244983 1024 6 Used 244808 615 7 Used 244045 33 8 Used 245427 261 9 Used 245423 461 10 Used 244983 1194 I want a scatterplot of the Size values grouped by the Type column. I also want 2 lines showing each group's average. library(ggplot2) data - read.table(mem.dat, header=T, sep=,) attach(data) ggplot(data.frame(Type, ID, Size), aes(x=ID, y=Size, shape=Type, color=Type)) + geom_point(shape=1) + scale_fill_hue(l=40) + geom_line(stat=hline, yintercept=mean, linetype=dashed) Regards, Alan [[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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ 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 help
There seem to be too many quotes in your error message... the path and name of the program should be quoted, the argument should not (or should be separately quoted). 500M isn't especially large these days... be sure to check your existing (default) value using the memory.limit() function before changing it this way. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. chong hui qi imgreee...@gmail.com wrote: Hi I'm trying to increase the memory limit but Im facing this problem Error: unexpected symbol in C:\\Program Files\\R\\R-2.15.0\\bin\\i386\\Rgui.exe --max-mem-size=500M Hope you can help me out Thank You [[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] Pass Conditional loop argument into a function
Thank you for your improvement suggestions. I forgot to write the I() and it's clear that I have to specify the data (which I was indicating with the '...' without explicitly writing it). In this special case where I need a formula you really helped me with the function as.formula() to transform the character string into a formula. But what if I want to insert something else (not necessarily an object of the class formula)? What I really need is something to remove the from the character string. I already read things about eval(), substitute(), parse(text=...), assign() and get() but that doesn't really help in my case or at least I don't know to handle it the way I would need it. Example: foo - function(data, variable.argument=data[,1],data[,2]) { *variable.argument - function that removes (variable.argument)* cbind(variable.argument) } Normally the variable.argument is defined inside of the function as I did it with the formula (my 1st question). I hope you understand what I mean and thank you for your help! Regards -- View this message in context: http://r.789695.n4.nabble.com/Pass-Conditional-loop-argument-into-a-function-tp4639580p4639637.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] Pass Conditional loop argument into a function
Hello, The other problem with the boxplot question is that it's ill defined. Those data[,1], ..., data[, n] variables, what are they? All of them numeric? If so, then where is the factor? Some time ago there was a question on multiple boxplots with cut() defining the factor. I wrote a beneral purpose function as an answer: https://www.stat.math.ethz.ch/pipermail/r-help/2012-July/317991.html # Example use. n - 200 set.seed(1920) ID - rep(LETTERS[1:4], n/4) x - matrix(runif(3*n, max=rep(c(2, 1, 1.5), each=n)), ncol=3) DF - data.frame(ID=ID, x=x) cols - grep(x, names(DF)) # something variable multi.boxplot(DF[, cols], DF$ID, col = rainbow(3)) Hope this helps, Rui Barradas Em 08-08-2012 14:43, S Ellison escreveu: First thing; are you trying to fit a model specified as y ~ X + X^2 + X^3 ? ... because if you are you're unlikely to get anything useful. That uses formula syntax in which ^ does not have the arithmetic power meaning; see section 11.1 'Defining statistical models; formulae' in 'an introduction to R' in your HTML help system. This formula only specifies one term, X, so all you'll get is the result of y ~ X If you wanted to fit a polynomial the hard (and not generally good) way you'd have to do y ~ I(X )+ I(X^2) + I(X^3) Next, in your line fit - lm(Y~conditional.argument) you have asked lm to fit Y to a character string formed by paste(). That is also unlikely to be useful. You would need to create the complete formula as a string (eg Y~X+I(X^2)+I(X^3) ) and then use as.formula to convert that to a formula lm can use. Then there's the unnecessary loop. You can get your formula string without a loop from an integer 'degree' using formstring - paste(Y ~ , paste(I(X^,1:degree,) , sep=, collapse= + )) And then you can convert formstring to a formula object and use the formula object in lm: form - as.formula(formstring) #be careful with this; it looks for the terms in the current environment... lm(form) Or, if 'degree' were a vector (say degree-c(1, 3, 5) formstring - paste(Y ~ , paste(I(X^,degree,) , sep=, collapse= + )) and so on. I am having this problem as well when I want to do a boxplot with variable number of groups to compare. I don't know what you're trying to achieve with boxplot, but if you gave boxplot itself your vectors it would plot them by itself: x-rnorm(17) y-runif(23) z-c(x,y) boxplot(x,y,z) Incidentally, this: conditional.argument - data[,1], data[,2], ...,data[,nvariables] # is not a valid assignment in R, so it cannot be the code you used. And using something called 'data' (or any other object) in a function that does not have an named argument by the same name is asking for trouble; there is no telling where it will get 'data' from but there is a very good chance it will sometimes be from somewhere you don't expect. S Ellison -Original Message- I am sure that my approach is kind of stupid but I cannot think of another way to do it. I apologize... foo - function(..., degree=..){ degree-3 # example conditional.argument - rep(NA,degree) for(i in 1:(degree-1)) conditional.argument[i] - paste(X^,i,+,sep=) conditional.argument[degree] - paste(X^,degree,sep=) conditional.argument - paste(conditional.argument,collapse=) conditional.argument # X^1+X^2+X^3 fit - lm(Y~conditional.argument) ... return(fit) } I know that there is the poly() function which I am not looking for. I am having this problem as well when I want to do a boxplot with variable number of groups to compare. multiple.boxplot - function(...,nvariables){ conditional.argument - data[,1], data[,2], ...,data[,nvariables] # should look like that in the end boxplot(conditional.argument) } Can anyone give me a hint? Daniel Hoop -- View this message in context: http://r.789695.n4.nabble.com/Pass-Conditional-loop-argument-i nto-a-function-tp4639580.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. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] Pass Conditional loop argument into a function
The quotes shown on a string when you print it are artifacts of making the string usable in source code... they are not present in the string as it is stored in memory. (Same goes for escape sequences, such that \n occupies one byte of UTF8 storage.) You can use the cat function to send the string directly to the output stream to prove this to yourself. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. greatest.possible.newbie daniel.h...@gmx.net wrote: Thank you for your improvement suggestions. I forgot to write the I() and it's clear that I have to specify the data (which I was indicating with the '...' without explicitly writing it). In this special case where I need a formula you really helped me with the function as.formula() to transform the character string into a formula. But what if I want to insert something else (not necessarily an object of the class formula)? What I really need is something to remove the from the character string. I already read things about eval(), substitute(), parse(text=...), assign() and get() but that doesn't really help in my case or at least I don't know to handle it the way I would need it. Example: foo - function(data, variable.argument=data[,1],data[,2]) { *variable.argument - function that removes (variable.argument)* cbind(variable.argument) } Normally the variable.argument is defined inside of the function as I did it with the formula (my 1st question). I hope you understand what I mean and thank you for your help! Regards -- View this message in context: http://r.789695.n4.nabble.com/Pass-Conditional-loop-argument-into-a-function-tp4639580p4639637.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] Interpreting predictions of svm
Jessica- Thanks for responding quickly to me; I have fund a solution to my problem this morning. Kind regards, Camille [[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] label_wrap_gen question
On 8/8/2012 12:30 AM, vd3000 wrote: Hi, Brian So, I could only rename the label by myself such as Light and heavy\ngood vehicles (diesel) -\nGVX in order to get Light and heavy good vehicles (diesel) - GVX Right? First an etiquette comment: it is customary to quote context when replying to the list; nabble does not do this by default (and I don't know how to enable it since I don't use nabble). I have restored the context (hopefully correctly). Now to answer your question. If you don't have many labels and you are concerned about exactly where the breaks occur, then doing it by hand, as you have above, would probably be best. If you want an automated solution that respects existing embedded newlines, then you could modify the labeller function to do so. Effectively split the strings on newlines, then wrap each part, and put them back together, restoring the newlines. label_wrap_respectn_gen - function(width = 25) { force(width) function(variable, value) { breakn - strsplit(as.character(value), \n) wrapped - llply(breakn, strwrap, width=width, simplify=FALSE) laply(llply(wrapped, lapply, paste, collapse=\n), paste, collapse=\n) } } You could roll all this up, since it is simple serial evaluation, but that may be harder to read and know what it does: label_wrap_respectn_gen - function(width = 25) { force(width) function(variable, value) { laply(llply(llply(strsplit(as.character(value), \n), strwrap, width=width, simplify=FALSE), lapply, paste, collapse=\n), paste, collapse=\n) } } This hasn't been tested extensively, but seem to work for your example. label_wrap - label_wrap_respectn_gen(width=15) label_wrap(NA, c(Light and heavy good vehicles (diesel) -\nGVX)) 1 Light and\nheavy good\nvehicles\n(diesel) -\nGVX compared to label_wrap - label_wrap_gen(width=15) label_wrap(NA, c(Light and heavy good vehicles (diesel) -\nGVX)) 1 Light and\nheavy good\nvehicles\n(diesel) - GVX On 8/7/2012 8:17 AM, Brian Diggs wrote: On 8/6/2012 9:07 PM, vd3000 wrote: Hi, all I am trying to use the label_wrap_gen function in this website. https://github.com/hadley/ggplot2/wiki/labeller I tried to make a long name like this Light and heavy good vehicles (diesel) -\nGVX f2 = facet_grid(vehicle ~ ., labeller=label_wrap_gen(width=15)) eventually, I got something like this in my label... *Light and heavy good vehicles (diesel) - GVX* I suppose the -n could break GVX to the next row but it failed... Is it a bug? or it has been overpowered by width=15?? so -n could not function well? Eventually I tried f2 = facet_grid(vehicle ~.) The -n did work and I got *Light and heavy good vehicles (diesel) - GVX* But it also failed because I could not show all the label properly... Anyone has idea about this? It is freaking me out~ I am sorry I am stupid on R Thanks in advance. VD label_wrap_gen uses strwrap to do the heavy lifting of figuring out how to actually split the text into lines. From the help page of strwrap, Whitespace (space, tab or newline characters) in the input is destroyed., so this is documented behavior. I don't see an option to strwrap to suppress this behavior. -- View this message in context: http://r.789695.n4.nabble.com/label-wrap-gen-question-tp4639364.html Sent from the R help mailing list archive at Nabble.com. -- Brian S. Diggs, PhD Senior Research Associate, Department of Surgery Oregon Health Science University -- View this message in context: http://r.789695.n4.nabble.com/label-wrap-gen-question-tp4639364p4639539.html Sent from the R help mailing list archive at Nabble.com. -- Brian S. Diggs, PhD Senior Research Associate, Department of Surgery Oregon Health Science University __ 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] getting started with R and mysql
I have a mysql database I installed on my Ubuntu server, and I'm trying to figure out how to access and analyze it from a Win XP machine running R 2.15.1. I thought that RMySQL was the way to go. (Is there an easier way?) I tried to follow the instructions at http://www.r-bloggers.com/installing-the-rmysql-package-on-windows-7/ so I installed mysql-installer-community-5.5.27.0.msi, then set the environment variable MYSQL_HOME, and tried to install RMySQL within R. It failed, as shown below, but I can't see what is wrong. What's missing? If I only want to read tables from the database and work on them in R, is there an easier package? Sys.getenv(MYSQL_HOME) [1] C:\\Program Files\\MySQL\\MySQL Server 5.5 install.packages('RMySQL',type='source') also installing the dependency ‘DBI’ trying URL 'http://probability.ca/cran/src/contrib/DBI_0.2-5.tar.gz' Content type 'application/x-gzip' length 308395 bytes (301 Kb) opened URL downloaded 301 Kb trying URL 'http://probability.ca/cran/src/contrib/RMySQL_0.9-3.tar.gz' Content type 'application/x-gzip' length 165363 bytes (161 Kb) opened URL downloaded 161 Kb * installing *source* package 'DBI' ... ** R ** inst ** preparing package for lazy loading Creating a generic function for 'summary' from package 'base' in package 'DBI' ** help *** installing help indices ** building package indices ** installing vignettes 'DBI.Rnw' ** testing if installed package can be loaded * DONE (DBI) * installing *source* package 'RMySQL' ... ** package 'RMySQL' successfully unpacked and MD5 sums checked checking for $MYSQL_HOME... C:\Program Files\MySQL\MySQL Server 5.5 test: Files\MySQL\MySQL: unknown operand ** libs Warning: this package has a non-empty 'configure.win' file, so building only the main architecture gcc -IC:/R/R-215~1.1/include -DNDEBUG -IC:\Program Files\MySQL\MySQL Server 5.5/include -O3 -Wall -std=gnu99 -mtune=core2 -c RS-DBI.c -o RS-DBI.o RS-DBI.c:1: error: bad value (core2) for -mtune= switch make: *** [RS-DBI.o] Error 1 ERROR: compilation failed for package 'RMySQL' * removing 'C:/R/R-2.15.1/library/RMySQL' The downloaded source packages are in ‘C:\Documents and Settings\friendly\Local Settings\Temp\RtmpCU2QBs\downloaded_packages’ Warning messages: 1: running command 'C:/R/R-2.15.1/bin/i386/R CMD INSTALL -l C:/R/R-2.15.1/library C:\DOCUME~1\friendly\LOCALS~1\Temp\RtmpCU2QBs/downloaded_packages/RMySQL_0.9-3.tar.gz' had status 1 2: In install.packages(RMySQL, type = source) : installation of package ‘RMySQL’ had non-zero exit status -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ 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] getting started with R and mysql
I have a mysql database I installed on my Ubuntu server, and I'm trying to figure out how to access and analyze it from a Win XP machine running R 2.15.1. I thought that RMySQL was the way to go. (Is there an easier way?) We use RODBC. Is there a reason that won't work? cur -- Curt Seeliger, Data Ranger Raytheon Information Services - Contractor to ORD seeliger.c...@epa.gov 541/754-4638 [[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] Advice: How to best ensure column values match in different vectors?
Hello all, I would like some advice on how to order elements in a vector. Background: my company is running a k-means clustering model on our historical data warehouse of products, which will produce a matrix of cluster centers. Then, on our production web servers, we will take newly created products and find the cluster that is closest to the new product (we're calling this scoring the product). Simple stuff. The complex part is that the data source for the model is different from the source of the new product. My concern is how to best ensure that the order of the product attributes in the clustering model matches the attributes of the new product vector. Here's what I'm considering doing: Say my company keeps the attributes height, width, and length on our products (in reality we'll have over 200 attributes). I will create a constant of the column (i.e. attribute) names: PRODUCT.ATTRIBUTE.COLS - c(H,W,L) PRODUCT.ATTRIBUTE.COUNT - length( PRODUCT.ATTRIBUTE.COLS ) All new vectors (both during modeling and scoring) will be created with NaN values: product.vector - rep(NaN, PRODUCT.ATTRIBUTE.COUNT) names( product.vector ) - PRODUCT.ATTRIBUTE.COLS The vector will then be populated with attribute values like this. The values will be retrieved from whatever DB we're using: product.vector[H] - height.from.db product.vector[W] - width.from.db product.vector[L] - length.from.db Is this a reasonable way to do this? If so, one thing I'd like to add is error checking that validates that the attribute name exists, so if the code attempted to do: product.vector[WEIGHT] - weight.from.db it would throw some sort of error. What's the best way for handling that? Can I set the length of the vector to a fixed size? Thanks for any guidance, DG __ 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] Installing HDF5 package
Dear all I am a new user of R and I have been trying to install the HDF5 package but I don't seem to find any easily. I tried looking in the archives but I didn't succeed in installing the packages there. I guess they must be for Unix If any body succeeded in installing this library, please give me some hints on how to do so? Thank you in advance -- View this message in context: http://r.789695.n4.nabble.com/Installing-HDF5-package-tp4639633.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] help to program my function
hi peter the pdf folder is in http://r.789695.n4.nabble.com/file/n4639434/aj.pdf -- View this message in context: http://r.789695.n4.nabble.com/help-to-program-my-function-tp4639434p4639629.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] Cannot create Java virtual machine (-1)
Hi Roger, note that since version 0.1-7 of XLConnect Java 1.6 is required - it won't work with Java 1.5. However, the problem you describe is another one. It's most likely related to your Java setup/configuration and therefore independent of XLConnect. You can verify this by running the following statements in R: library(rJava) .jinit() You should actually see the same error message. What version of rJava are you using and do you have any environment variables like JAVA_HOME or PATH set? Also the output of sessionInfo() could be of interest. Best regards, Martin -- View this message in context: http://r.789695.n4.nabble.com/Cannot-create-Java-virtual-machine-1-tp4639585p4639650.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] Wilcoxon test
Dear list, I am facing a problem in my statistical analyses on R. My experiments are about plants, I record there growth after each cutting (every 3 weeks). 'BC' is for the plant, and '1' to '5' is the time of cutting and recording. The data and R script are : BourdCoup - c(21, 7.2, 9.2, 0, 8.52, 14.7, 8.31, 6.2, 127.05, 115.2, 100.7, 24, 162.64, 136.8, 95.1, 78.93, 104.7, 21.2, 35.8, 21, 66, 103.4, 74.9, 43.8, 32.1, 14.9, 2.1, 14.4, 36.1, 35, 53.2, 28.9, 0,0,0,8.7,2.7,4.2,0,21.2) groupBC - as.factor(rep(c(BC1,BC2,BC3,BC4,BC5), times=1, each=8)) BC1 - BourdCoup[groupBC==BC1] BC2 - BourdCoup[groupBC==BC2] BC3 - BourdCoup[groupBC==BC3] BC4 - BourdCoup[groupBC==BC4] BC5 - BourdCoup[groupBC==BC5] I therefore realise a wilcoxon test for paired series, and compare them one by one. wilcox.test(BC1,BC2, paired=T) Wilcoxon signed rank test data: BC1 and BC2 V = 0, p-value = 0.007813 alternative hypothesis: true location shift is not equal to 0 The problem is that it always gives me the same p-value (0.007813), whatever vectors I try. And when I remove paired=T from the script, all p-values differ. Could you help me please ? Juliette BELLAY --- Stagiaire Compagnie Nationale du Rhône Direction de l'Ingénierie, Cours d'Eau et Navigation Tél : 04 72 00 18 44 --- [https://www.cnr.tm.fr/imagesEcoGeste/disclaimer_small.png] ÉCO-GESTE SIMPLE : N'IMPRIMEZ CET EMAIL QU'EN CAS DE NÉCESSITÉ Ce message électronique et tous les documents attachés qu'il contient sont confidentiels et destinés exclusivement à la personne à laquelle ils sont destinés. Si vous avez reçu ce message par erreur, veuillez le détruire immédiatement; vous voudrez bien également vous abstenir de toute référence aux informations qui y figurent. Sauf mention expresse, les idées et opinions présentées dans ce message sont celles de son auteur, et n'engagent pas la CNR. La publication, l'usage, la distribution, l'impression ou la copie non autorisée de ce message et des fichiers attachés qu'il contient sont strictement interdits. La CNR a pris toute précaution pour éviter la présence de virus, mais nous ne pouvons vous garantir l'absence de virus. Vous devez donc prendre toute disposition utile pour la vérification de l'absence de virus. La CNR dégage toute responsabilité en cas de problème posé par des virus. [[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] summing and combining rows
HI, From the ?aggregate(), formula: a formula, such as ‘y ~ x’ or ‘cbind(y1, y2) ~ x1 + x2’, where the ‘y’ variables are numeric data to be split into groups according to the grouping ‘x’ variables (usually factors). So, I converted your data to factors for the grouping variable, the results are the same. convert.type1 - function(obj,types){ for (i in 1:length(obj)){ FUN - switch(types[i],character = as.character, numeric = as.numeric, factor = as.factor) obj[,i] - FUN(obj[,i]) } obj } dat2-convert.type1(dat1,c(factor,factor,factor,factor,factor,factor,factor,factor,numeric,factor,factor)) str(dat2) 'data.frame': 8 obs. of 11 variables: $ Data : Factor w/ 1 level VTM: 1 1 1 1 1 1 1 1 $ Plot : Factor w/ 4 levels 39C16,39F11,..: 1 1 2 2 3 3 4 4 $ Lat : Factor w/ 4 levels 39.54522,39.56214,..: 4 4 3 3 2 2 1 1 $ LatCat : Factor w/ 1 level Lat6: 1 1 1 1 1 1 1 1 $ Elevation: Factor w/ 3 levels 500,900,1500: 3 3 1 1 3 3 2 2 $ ElevCat : Factor w/ 1 level Elev1: 1 1 1 1 1 1 1 1 $ Type : Factor w/ 1 level Conifer: 1 1 1 1 1 1 1 1 $ SizeClass: Factor w/ 2 levels Class3,Class4: 1 2 1 2 1 2 1 2 $ Stems : num 0 1 0 0 3 1 1 2 $ Area : Factor w/ 3 levels 694.0784,751.5347,..: 2 2 2 2 1 1 3 3 $ Density : Factor w/ 3 levels 0,13.08926,..: 1 3 1 1 1 1 2 1 #Taking out Density will group for the combinations of other factors aggregate(Stems~Plot+Data+Lat+LatCat+Elevation+Type+Area,data=dat2,sum) Plot Data Lat LatCat Elevation Type Area Stems 1 39F13 VTM 39.56214 Lat6 1500 Conifer 694.0784 4 2 39F11 VTM 39.57721 Lat6 500 Conifer 751.5347 0 3 39C16 VTM 39.76282 Lat6 1500 Conifer 751.5347 1 4 39F14 VTM 39.54522 Lat6 900 Conifer 763.985 3 #but, it won't go lower than this as there are four levels for Plot and Lat, unless you drop those aggregate(Stems~Data+LatCat+Elevation+Type,data=dat2,sum) Data LatCat Elevation Type Stems 1 VTM Lat6 500 Conifer 0 2 VTM Lat6 900 Conifer 3 3 VTM Lat6 1500 Conifer 5 A.K. - Original Message - From: Christopher R. Dolanc crdol...@ucdavis.edu To: arun smartpink...@yahoo.com Cc: Sent: Wednesday, August 8, 2012 2:00 PM Subject: Re: [R] summing and combining rows OK. I can make this work. Thank you for helping me figure this out. On 8/8/2012 10:49 AM, arun wrote: Hello, I tried with ddply ddply(dat1,.(Data,Plot,Lat,LatCat,Elevation,Type,Area,Density),summarize,sum(Stems)) Data Plot Lat LatCat Elevation Type Area Density ..1 1 VTM 39C16 39.76282 Lat6 1500 Conifer 751.5347 0.0 0 2 VTM 39C16 39.76282 Lat6 1500 Conifer 751.5347 13.30611 1 3 VTM 39F11 39.57721 Lat6 500 Conifer 751.5347 0.0 0 4 VTM 39F13 39.56214 Lat6 1500 Conifer 694.0784 0.0 4 5 VTM 39F14 39.54522 Lat6 900 Conifer 763.9850 0.0 2 6 VTM 39F14 39.54522 Lat6 900 Conifer 763.9850 13.08926 1 Results look same as in aggregate. Suppose, if you take out density, ddply(dat1,.(Data,Plot,Lat,LatCat,Elevation,Type,Area),summarize,sum(Stems)) Data Plot Lat LatCat Elevation Type Area ..1 1 VTM 39C16 39.76282 Lat6 1500 Conifer 751.5347 1 2 VTM 39F11 39.57721 Lat6 500 Conifer 751.5347 0 3 VTM 39F13 39.56214 Lat6 1500 Conifer 694.0784 4 4 VTM 39F14 39.54522 Lat6 900 Conifer 763.9850 3 I guess now it is summed. A.K. - Original Message - From: Christopher R. Dolanc crdol...@ucdavis.edu To: arun smartpink...@yahoo.com Cc: Sent: Wednesday, August 8, 2012 1:19 PM Subject: Re: [R] summing and combining rows ok, so it looks like aggregate lists them separately unless everything in the 2 rows matches. Below, we have 2 plots where the density is different in Class3 than Class4, and these are not summed. Is that your understanding? Thanks for your help. Chris On 8/7/2012 4:18 PM, arun wrote: HI, I tried two ways in aggregate. The results are the same. dat1-read.table(text= Data Plot Lat LatCat Elevation ElevCat Type SizeClass Stems Area Density VTM 39C16 39.76282 Lat6 1500 Elev1 Conifer Class3 0 751.5347 0.0 VTM 39C16 39.76282 Lat6 1500 Elev1 Conifer Class4 1 751.5347 13.30611 VTM 39F11 39.57721 Lat6 500 Elev1 Conifer Class3 0 751.5347 0.0 VTM 39F11 39.57721 Lat6 500 Elev1 Conifer Class4 0 751.5347 0.0 VTM 39F13 39.56214 Lat6 1500 Elev1 Conifer Class3 3 694.0784 0.0 VTM 39F13 39.56214 Lat6 1500 Elev1 Conifer Class4 1 694.0784 0.0 VTM 39F14 39.54522 Lat6 900
Re: [R] summing and combining rows
Hello, I tried with ddply ddply(dat1,.(Data,Plot,Lat,LatCat,Elevation,Type,Area,Density),summarize,sum(Stems)) Data Plot Lat LatCat Elevation Type Area Density ..1 1 VTM 39C16 39.76282 Lat6 1500 Conifer 751.5347 0.0 0 2 VTM 39C16 39.76282 Lat6 1500 Conifer 751.5347 13.30611 1 3 VTM 39F11 39.57721 Lat6 500 Conifer 751.5347 0.0 0 4 VTM 39F13 39.56214 Lat6 1500 Conifer 694.0784 0.0 4 5 VTM 39F14 39.54522 Lat6 900 Conifer 763.9850 0.0 2 6 VTM 39F14 39.54522 Lat6 900 Conifer 763.9850 13.08926 1 Results look same as in aggregate. Suppose, if you take out density, ddply(dat1,.(Data,Plot,Lat,LatCat,Elevation,Type,Area),summarize,sum(Stems)) Data Plot Lat LatCat Elevation Type Area ..1 1 VTM 39C16 39.76282 Lat6 1500 Conifer 751.5347 1 2 VTM 39F11 39.57721 Lat6 500 Conifer 751.5347 0 3 VTM 39F13 39.56214 Lat6 1500 Conifer 694.0784 4 4 VTM 39F14 39.54522 Lat6 900 Conifer 763.9850 3 I guess now it is summed. A.K. - Original Message - From: Christopher R. Dolanc crdol...@ucdavis.edu To: arun smartpink...@yahoo.com Cc: Sent: Wednesday, August 8, 2012 1:19 PM Subject: Re: [R] summing and combining rows ok, so it looks like aggregate lists them separately unless everything in the 2 rows matches. Below, we have 2 plots where the density is different in Class3 than Class4, and these are not summed. Is that your understanding? Thanks for your help. Chris On 8/7/2012 4:18 PM, arun wrote: HI, I tried two ways in aggregate. The results are the same. dat1-read.table(text= Data Plot Lat LatCat Elevation ElevCat Type SizeClass Stems Area Density VTM 39C16 39.76282 Lat6 1500 Elev1 Conifer Class3 0 751.5347 0.0 VTM 39C16 39.76282 Lat6 1500 Elev1 Conifer Class4 1 751.5347 13.30611 VTM 39F11 39.57721 Lat6 500 Elev1 Conifer Class3 0 751.5347 0.0 VTM 39F11 39.57721 Lat6 500 Elev1 Conifer Class4 0 751.5347 0.0 VTM 39F13 39.56214 Lat6 1500 Elev1 Conifer Class3 3 694.0784 0.0 VTM 39F13 39.56214 Lat6 1500 Elev1 Conifer Class4 1 694.0784 0.0 VTM 39F14 39.54522 Lat6 900 Elev1 Conifer Class3 1 763.9850 13.08926 VTM 39F14 39.54522 Lat6 900 Elev1 Conifer Class4 2 763.9850 0.0 ,sep=,header=TRUE, stringsAsFactors=FALSE) with(dat1,aggregate(Stems,list(Plot,Data,Lat,LatCat,Elevation,Type,Area,Density),sum)) Group.1 Group.2 Group.3 Group.4 Group.5 Group.6 Group.7 Group.8 x 1 39F13 VTM 39.56214 Lat6 1500 Conifer 694.0784 0.0 4 2 39F11 VTM 39.57721 Lat6 500 Conifer 751.5347 0.0 0 3 39C16 VTM 39.76282 Lat6 1500 Conifer 751.5347 0.0 0 4 39F14 VTM 39.54522 Lat6 900 Conifer 763.9850 0.0 2 5 39F14 VTM 39.54522 Lat6 900 Conifer 763.9850 13.08926 1 6 39C16 VTM 39.76282 Lat6 1500 Conifer 751.5347 13.30611 1 aggregate(Stems~Plot+Data+Lat+LatCat+Elevation+Type+Area+Density,data=dat1,sum) Plot Data Lat LatCat Elevation Type Area Density Stems 1 39F13 VTM 39.56214 Lat6 1500 Conifer 694.0784 0.0 4 2 39F11 VTM 39.57721 Lat6 500 Conifer 751.5347 0.0 0 3 39C16 VTM 39.76282 Lat6 1500 Conifer 751.5347 0.0 0 4 39F14 VTM 39.54522 Lat6 900 Conifer 763.9850 0.0 2 5 39F14 VTM 39.54522 Lat6 900 Conifer 763.9850 13.08926 1 6 39C16 VTM 39.76282 Lat6 1500 Conifer 751.5347 13.30611 1 The rows with 39.57721 and 39.56214 are the same for SizeClass except the Stems #. It got summed. Otherwise, it is giving both Class3 and Class4 values separately. A.K. - Original Message - From: Christopher R. Dolanc crdol...@ucdavis.edu To: arun smartpink...@yahoo.com Cc: Sent: Tuesday, August 7, 2012 6:38 PM Subject: Re: [R] summing and combining rows Hmmm. It looks like it's only giving me the values for Class3, instead of summing, which is why I thought the + method might not be the appropriate coding. Here's the code I used: CH_Con_Elev1SC34a- aggregate(Stems~Plot+Data+Lat+LatCat+Elevation+Type+Area+Density, data=CH_Con_Elev1SC34, sum) CH_Con_Elev1SC34b- data.frame(CH_Con_Elev1SC34a, SizeClass=rep(Class34,)) If it helps, attached is a txt file with the data structure. On 8/7/2012 3:00 PM, arun wrote: Hi, Not sure why you mentioned + doesn't work. dat1-read.table(text= Plot Elevation Area SizeClass Stems 12 1200 132.4 Class3 0 12 1200 132.4 Class4 1 17 2320 209.1 Class3
[R] mgcv and gamm4: REML, GCV, and AIC
Hi, I've been using gamm4 to build GAMMs for exploring environmental influences on genetic ancestry. Things have gone well and I have 2 very straightforward questions: 1. I've used method=REML. Am I correct that this is an alternative method for estimating the smooth functions in GAMMs rather than GCV that is often used for GAMs? I've read up on REML and it makes sense, but I'm confused about whether GCV is used for any part of the model formation of a GAMM with method=REML. I think it is not. Is this why no GCV score is returned for GAMMs through mgcv and gamm4? For Gams I've always used the GCV scores to help with model selection, but I assume these aren't available for GAMMs estimated with REML. 2. Instead I've been using AIC values with GAMMs. Is it correct to use the AIC value from the underlying linear mixed model, i.e. extracted using summary(gamm1$mer)? Or is there another AIC calculated specifically for the gam object? Many thanks for help with these (admittedly simple and boring) questions, I really like the mgcv and gamm4 packages which I've found very user friendly in conjunction with Wood (2006). John [[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] Showing multiple Probability Plots on the same graph using the plot(cenros) command from the NADA library
I am currently conducting a performance analysis for an urban stormwater management facility which employs Low Impact Development practices. I have the Event Mean Concentrations (EMCs) of several water quality constituents (ex: Total Phosphorus (TP), Total Oxidized Nitrogen (OxN), etc) at inflow and outflow locations for a particular stormwater management practice. I wish to use the Effluent Probability Method to create a normal probability plot comparing the log-transform (most often) data of both inflow and outflow Event Mean Concentrations (EMCs) as a method to visually compare the water quality constituent EMCs at the inflow and outflow locations across all storm events. Due to the censored nature of environmental water quality data I am employing a probability plot function which uses a robust regression on ordered statistics (ROS) method to determine the placement of uncensored data in the probability plot. This robust ROS method takes the proportion of data which is censored, or below the reporting limit, into account when determining the position of the uncensored data in the probability plot. The plot(cenros(Observation, ObservationCensored)) command creates a censored lognormal ROS probability plot for the data. Where Observation=the raw data ObservationCensored=TRUE/FALSE Where: TRUE=a censored observation FALSE=an uncensored observation I have included the data and commands I used in R at the end of this message. If wanted, they can be pasted directly into R to see the result (as long as you have the NADA package installed). If you have copied the below input into R, then you will see two censored lognormal ROS probability plots overlaid onto a single graph. However you will also notice that the x- and y- scales for the axes do not line up properly. The following list describes how I have attempted to set the x- and y-limits to the same scale for the two probability plots: • I tried setting the x- and y-limits using xlim=c() and ylim=c() respectively in each plot() command however an error occurs because ‘formal argument “xlim” and “ylim” matched by multiple actual arguments’. • I also tried setting the second plot’s axes=FALSE within second plot() command however it did not seem to have an effect. • I have tried setting usr=c(x1,x2,y1,y2) within the par() command, again it didn’t have an effect. • I tried setting xaxs= “d” in the par() command however “d” is unimplemented in R and thus an error occurred. Same for yaxs=”d”. • I tried setting xaxt= “n” in the second graph to suppress plotting the axis however this only suppressed printing the values of the bottom x-axis and thus didn’t work for what I wanted. • Long story short, I have been unable to graph two probability plots on the same plot (with matching x-and y-axis). I would appreciate any help in how to make the x- and y-axes the same by setting the xlim and ylim modifiers equal in both probability plots and/or by using modifiers within the par(new=TRUE) command. Thank you for your time and consideration, Paul Below are the data and commands I used to create the two censored lognormal ROS probability plots overlaid onto a single graph for use in the Effluent Probability Method. If wanted, they can be pasted directly into R to see the result (as long as you have the NADA package installed). library(NADA) CUIN.TP.EMC-c(0.09,1.22748027,0.0414537,0.11796508,1.3,0.06,0.06,0.17495668,0.08997043,0.11922784,0.14,0.4,0.77,0.04573882,0.15,0.00531218,0.27376485,0.06,0.30250796,0.64581398,0.48,0.27,0.67655024,0.1,0.21) CUIN.TP.EMC.IV-c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE) CUOUT.TP.EMC-c(0.28,0.24,0.31,0.26,0.19,0.28,0.35,0.23,0.2,0.24,0.17,0.46,0.35) CUOUT.TP.EMC.IV-c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE) plot(cenros(CUIN.TP.EMC,CUIN.TP.EMC.IV)) par(new=TRUE) plot(cenros(CUOUT.TP.EMC,CUOUT.TP.EMC.IV)) -- View this message in context: http://r.789695.n4.nabble.com/Showing-multiple-Probability-Plots-on-the-same-graph-using-the-plot-cenros-command-from-the-NADA-liby-tp4639651.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] decimal points midline
Hi, does anyone know how to make decimal points midline when plotting? The journal to which we are going to submit a manuscript require this particular formatting, and it gives direction how to do this on PC: hold down ALT key and type 0183 on the number pad Thanks John [[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] Installing HDF5 package
You have not told us what you have done or what your OS is. In any case R is case sensitive so try: install.packages(hdf5) John Kane Kingston ON Canada -Original Message- From: saadsihe...@gmail.com Sent: Wed, 8 Aug 2012 09:25:06 -0700 (PDT) To: r-help@r-project.org Subject: [R] Installing HDF5 package Dear all I am a new user of R and I have been trying to install the HDF5 package but I don't seem to find any easily. I tried looking in the archives but I didn't succeed in installing the packages there. I guess they must be for Unix If any body succeeded in installing this library, please give me some hints on how to do so? Thank you in advance -- View this message in context: http://r.789695.n4.nabble.com/Installing-HDF5-package-tp4639633.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. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! __ 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] Installing HDF5 package
On 08.08.2012 20:54, John Kane wrote: You have not told us what you have done or what your OS is. In any case R is case sensitive so try: install.packages(hdf5) Which won't work on Windows since binaries are not available under that platform. Another package brandnew on CRAN is h5r. Binaries are not yet available - but will be during the next couple of days. Uwe Ligges John Kane Kingston ON Canada -Original Message- From: saadsihe...@gmail.com Sent: Wed, 8 Aug 2012 09:25:06 -0700 (PDT) To: r-help@r-project.org Subject: [R] Installing HDF5 package Dear all I am a new user of R and I have been trying to install the HDF5 package but I don't seem to find any easily. I tried looking in the archives but I didn't succeed in installing the packages there. I guess they must be for Unix If any body succeeded in installing this library, please give me some hints on how to do so? Thank you in advance -- View this message in context: http://r.789695.n4.nabble.com/Installing-HDF5-package-tp4639633.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. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! __ 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] Installing HDF5 package
On 08/08/2012 12:10 PM, Uwe Ligges wrote: On 08.08.2012 20:54, John Kane wrote: You have not told us what you have done or what your OS is. In any case R is case sensitive so try: install.packages(hdf5) Which won't work on Windows since binaries are not available under that platform. Another package brandnew on CRAN is h5r. Binaries are not yet available - but will be during the next couple of days. There is also http://bioconductor.org/packages/release/bioc/html/rhdf5.html I wonder how much overlap there is between these hdf5 interfaces? Martin Uwe Ligges John Kane Kingston ON Canada -Original Message- From: saadsihe...@gmail.com Sent: Wed, 8 Aug 2012 09:25:06 -0700 (PDT) To: r-help@r-project.org Subject: [R] Installing HDF5 package Dear all I am a new user of R and I have been trying to install the HDF5 package but I don't seem to find any easily. I tried looking in the archives but I didn't succeed in installing the packages there. I guess they must be for Unix If any body succeeded in installing this library, please give me some hints on how to do so? Thank you in advance -- View this message in context: http://r.789695.n4.nabble.com/Installing-HDF5-package-tp4639633.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. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! __ 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. -- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 __ 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] decimal points midline
Can you point to an example? It sounds like the journal is still using typewriters. John Kane Kingston ON Canada -Original Message- From: arrayprof...@yahoo.com Sent: Wed, 8 Aug 2012 11:52:27 -0700 (PDT) To: r-help@r-project.org Subject: [R] decimal points midline Hi, does anyone know how to make decimal points midline when plotting? The journal to which we are going to submit a manuscript require this particular formatting, and it gives direction how to do this on PC: hold down ALT key and type 0183 on the number pad Thanks John [[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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ 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.