Re: [R] what constitutes a 'complete sentence'?
That exists already: last slide here — it looks like it is a know issue. BW F On 3 Jul 2015, at 14:13, Hadley Wickham h.wick...@gmail.com wrote: In that case, you need to create a minimal reproducible example and make it publicly available. Hadley On Friday, July 3, 2015, Federico Calboli federico.calb...@helsinki.fi wrote: On 3 Jul 2015, at 12:14, Hadley Wickham h.wick...@gmail.com wrote: It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Tried this and unfortunately it does not help. BW F Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
Third try -- I unsubscribed and re-subscribed. Sorry to Ravi for extra traffic. In case anyone gets a duplicate, R-help bounced my msg from non-member (I changed server, but not email yesterday, so possibly something changed enough). Trying again. JN I got the Wolfram answer as follows: library(Rmpfr) n163 - mpfr(163, 500) n163 pi500 - mpfr(pi, 500) pi500 pitan - mpfr(4, 500)*atan(mpfr(1,500)) pitan pitan-pi500 r500 - exp(sqrt(n163)*pitan) r500 check - 262537412640768743.25007259719818568887935385... savehistory(jnramanujan.R) Note that I used 4*atan(1) to get pi. It seems that may be important, rather than converting. JN On 15-07-03 06:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Thu, 2 Jul 2015 22:38:45 + From: Ravi Varadhan ravi.varad...@jhu.edu To: 'Richard M. Heiberger' r...@temple.edu, Aditya Singh aps...@yahoo.com Cc: r-help r-help@r-project.org Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R Message-ID: 14ad39aaf6a542849bbf3f62a0c2f...@dom-eb1-2013.win.ad.jhu.edu Content-Type: text/plain; charset=utf-8 Hi Rich, The Wolfram answer is correct. http://mathworld.wolfram.com/RamanujanConstant.html There is no code for Wolfram alpha. You just go to their web engine and plug in the expression and it will give you the answer. http://www.wolframalpha.com/ I am not sure that the precedence matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R There is a precedence error in your R attempt. You need to convert 163 to 120 bits first, before taking its square root. exp(sqrt(mpfr(163, 120)) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768333.51635812597335712954 ## just the last four characters to the left of the decimal point. tmp - c(baseR=8256, Wolfram=8744, Rmpfr=8333, wrongRmpfr=7837) tmp-tmp[2] baseRWolfram Rmpfr wrongRmpfr -488 0 -411 -907 You didn't give the Wolfram alpha code you used. There is no way of verifying the correct value from your email. Please check that you didn't have a similar precedence error in that code. Rich On Thu, Jul 2, 2015 at 2:02 PM, Aditya Singh via R-help r-help@r-project.org wrote: Ravi I am a chemical engineer by training. Is there not something like law of corresponding states in numerical analysis? Aditya -- On Thu 2 Jul, 2015 7:28 AM PDT Ravi Varadhan wrote: Hi, Ramanujan supposedly discovered that the number, 163, has this interesting property that exp(sqrt(163)*pi), which is obviously a transcendental number, is real close to an integer (close to 10^(-12)). If I compute this using the Wolfram alpha engine, I get: 262537412640768743.25007259719818568887935385... When I do this in R 3.1.1 (64-bit windows), I get: 262537412640768256. The absolute error between the exact and R's value is 488, with a relative error of about 1.9x10^(-15). In order to replicate Wolfram Alpha, I tried doing this in Rmfpr but I am unable to get accurate results: library(Rmpfr) exp(sqrt(163) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640767837.08771354274620169031 The above answer is not only inaccurate, but it is actually worse than the answer using the usual double precision. Any thoughts as to what I am doing wrong? Thank you, Ravi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R-es] símbolo delta en cursiva
Hola, alguien sabe como poner en un eje el símbolo delta en cursiva? Muchas gracias -- *Joan Giménez Verdugo* *PhD Student* *Severo Ochoa* Estación Biológica de Doñana (EBD-CSIC) Department of Conservation Biology Americo Vespucio Ave, s/n 41092 Sevilla (Spain) www.ebd.csic.es --- Research Gate: Joan Giménez https://www.researchgate.net/profile/Joan_Gimenez2 Phone: +34 619 176 849 ü Please consider the environment before printing this E-mail [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R] what constitutes a 'complete sentence'?
On 3 Jul 2015, at 12:14, Hadley Wickham h.wick...@gmail.com wrote: It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Tried this and unfortunately it does not help. BW F Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
Also when I try the following with Rmpfr, it works jut fine. exp(sqrt(mpfr(163, 120)) * Const(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768743.25007601 and exp(sqrt(mpfr(163, 400)) * Const(pi, 400)) 1 'mpfr' number of precision 400 bits [1] 262537412640768743.25007259719818568887935385633733699086270 753741037821064791011860731295118134618606450419548 Which compares very nicely with the following: In[10]:= N[Exp[Sqrt[163] Pi], 125] Out[10]= 2.6253741264076874325007259719818568887935385633733699086270 753741037821064791011860731295118134618606450419308389*10^17 In the multiprecision business, you can never be too certain that you are using the right precision throughout your calculations. Nordlund, Dan (DSHS/RDA NordlDJ at dshs.wa.gov writes: Ravi, Take a look at the following link. https://code.google.com/p/r-bc/ I followed the instructions to get a Windows version of the 'nix utility program , bc (a high precision calculator), and the source for an R to bc interface. After installing them, I executed exp(sqrt(bc(163))*4*atan(bc(1))) in R and got this result 262537412640768743.2500725971981856888793538563373369908627 075374103782106479101186073116295306145602054347 I don't know if this is helpful, but ... Dan Daniel Nordlund, PhD Research and Data Analysis Division Services Enterprise Support Administration Washington State Department of Social and Health Services __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Variance estimates for survreg vs. lm
I would like help understanding why a survival regression with no censored data-points does not give the same variance estimates as a linear model (see code below). I think it must be something to do with the fact that the variance is an actual parameter in the survival version via the log(scale), and possibly that different assumptions are made about the distribution of the variance. But I really don't know, I'm just guessing. The reason I ask is because I am moving a process, that has always been modelled using a linear model, to a survival model (because there are sometimes a few censored data points). In the past, the censored data points have been treated as missing which imparts bias. The variance of the estimates in this process is key, so I need to know why they are changing in this systematic way?! library(survival) ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) ctl.surv - Surv(ctl) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) lmod - lm (ctl ~ trt) smod - survreg(ctl.surv ~ trt,dist=gaussian) coef(lmod) coef(smod) # same vcov(lmod) vcov(smod) # smod is smaller diag(vcov(lmod)) / diag(vcov(smod))[1:2] # 1.25 == 0.5*(n/(n-1)) ( summary(lmod)$coef [ ,Std. Error] / summary(smod)$table[1:2,Std. Error] )^2# 1.25 = 0.5*(n/(n-1)) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] timePlot legend
Dear all I am plotting a time series using time Plot function. All goes well until i try to modify the legend by taking it from the standard location at the bottom, to the right side in a vertical way. How can i do this? This is my code: filename - sprintf('%s/TS_CO_all.png',folderPLOTS) y_lab - sprintf('CO (ug/m3)') tit - sprintf('EU Receptors 2010') png(filename, width = 18 * 360, height = 9 * 360, res = 360, pointsize=240) timePlot(data2,pollutant=models, group=TRUE, y.relation=same, avg.time =month, lwd = 3, ylab = y_lab, main = tit) #pLOT THE DATA AS IS dev.off() Best regards -- View this message in context: http://r.789695.n4.nabble.com/timePlot-legend-tp4709366.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] matrix - delete last row - list
Good day R-community, i just wondered if it is a bug or a feature... When i have a matrix mat with one column and i delete the last row with mat - mat[-nrow(mat),] the result is a list. So my next call mat[10,] will throw an wrong dimension error. The proper call must be: mat - as.matrix(mat[-nrow(mat),]) So is this desired behavior or a bug? I use R-version 2.15.3, but reconstructed this behavior in 3.2.0 as well. greetings -- *Joscha Zander* Roche Diagnostics GmbH DXRDDD..6164 Sandhofer Strasse 116 68305 Mannheim / Germany mailto:joscha.zan...@roche.com joscha.zan...@roche.com *Roche Diagnostics GmbH* Sandhofer Straße 116; D‑68305 Mannheim; Telefon +49‑621‑759‑0; Telefax +49‑621‑759‑2890 Sitz der Gesellschaft: Mannheim - Registergericht: AG Mannheim HRB 3962 - Geschäftsführung: Dr. Ursula Redeker, Sprecherin; Edgar Vieth - Aufsichtsratsvorsitzender: Dr. Severin Schwan *Confidentiality Note* This message is intended only for the use of the named recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient, please contact the sender and delete the message. Any unauthorized use of the information contained in this message is prohibited. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] igraph plot slowness
Here is what it does locally on my PC: library(igraph) topo_data - read.table(text = ibcore01ibswitch01 + ibcore01ibswitch02 + ibcore01ibswitch03 + ibcore02ibswitch01 + ibcore02ibswitch02 + ibcore02ibswitch03 + ibswitch01 node001 + ibswitch01 node002 + ibswitch01 node003 + ibswitch02 node004 + ibswitch02 node005 + ibswitch02 node006 + ibswitch03 node007 + ibswitch03 node008 + ibswitch03 node009 ,head=FALSE) system.time({ + network_data -graph.data.frame(topo_data, directed=F) + plot(network_data) + }) user system elapsed 0.010.010.03 Does not seem too slow. Creating a PDF file takes a little longer: library(igraph) topo_data - read.table(text = ibcore01ibswitch01 + ibcore01ibswitch02 + ibcore01ibswitch03 + ibcore02ibswitch01 + ibcore02ibswitch02 + ibcore02ibswitch03 + ibswitch01 node001 + ibswitch01 node002 + ibswitch01 node003 + ibswitch02 node004 + ibswitch02 node005 + ibswitch02 node006 + ibswitch03 node007 + ibswitch03 node008 + ibswitch03 node009 ,head=FALSE) system.time({ + network_data -graph.data.frame(topo_data, directed=F) + pdf('test.pdf') + plot(network_data) + dev.off() + }) user system elapsed 0.090.000.16 The PDF file is attached. So maybe it is something with your remote connection. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jul 3, 2015 at 3:21 AM, Loris Bennett loris.benn...@fu-berlin.de wrote: Hi, With the following data ibcore01ibswitch01 ibcore01ibswitch02 ibcore01ibswitch03 ibcore02ibswitch01 ibcore02ibswitch02 ibcore02ibswitch03 ibswitch01 node001 ibswitch01 node002 ibswitch01 node003 ibswitch02 node004 ibswitch02 node005 ibswitch02 node006 ibswitch03 node007 ibswitch03 node008 ibswitch03 node009 in the file topology.txt and the following code: library(igraph) topo_data - read.csv(file=topology.txt,head=FALSE,sep=\t) network_data -graph.data.frame(topo_data, directed=F) plot(network_data) it takes about 5 seconds for the plot to be drawn with R 3.2.0 on a 12-core 2.67 GHz Xeon X5650 server with no other CPU-intensive processes running. This strikes me as rather slow, particularly as my full network has over 120 components and the plot takes around 50 seconds. Am I doing anything wrong? (I am working over an ssh connection with X forwarding, but plotting to a PDF file on the server does not seem to be faster.) Cheers, Loris -- This signature is currently under construction. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. test.pdf Description: Adobe PDF document __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice: set col = black for box.rectangle and box.umbrella
On Fri, 3 Jul 2015, Duncan Mackay wrote: I usually avoid global settings as they may change between graphs therefore I use the par.settings in each plot My settings are ... Duncan, Thank you very much. Sound advice and excellent example. I suspect that part of my issues with trying to do this is that Deepayan's book is now about 8 years past when he wrote it and the lattice package has evolved quite a bit since then. So, while I read the on-line man pages I did not see the answers I needed with sufficient clarity. Regards, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] what constitutes a 'complete sentence'?
Hi without going deep into this matter, what if you remove / from your sentence. Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Hadley Wickham Sent: Friday, July 03, 2015 1:14 PM To: Federico Calboli Cc: R-help Subject: Re: [R] what constitutes a 'complete sentence'? In that case, you need to create a minimal reproducible example and make it publicly available. Hadley On Friday, July 3, 2015, Federico Calboli federico.calb...@helsinki.fi wrote: On 3 Jul 2015, at 12:14, Hadley Wickham h.wick...@gmail.com javascript:; wrote: It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Tried this and unfortunately it does not help. BW F Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi javascript:; wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; __ R-help@r-project.org javascript:; mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; -- http://had.co.nz/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a
Re: [R] what constitutes a 'complete sentence'?
On 03/07/15 20:09, Federico Calboli wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? If that is your understanding you need to go back to school and learn some grammar. What you have is a noun (Functions) modified by an adjectival clause. No verb in sight. Ergo *not* a complete sentence. OTOH you are probably in good company in not knowing your grammar. The CRAN folks most likely don't know grammar either. I suspect that they *don't* actually demand a complete sentence. Such a demand would in fact be rather pedantic. Moreover I really can't see how the package checker could possibly check for complete sentences. This would require some very sophisticated programming, it seems to me. If it turns out that you *really* need a complete sentence, you could say (for instance): This package consists of functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. The foregoing *is* a complete sentence. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] no slot of name fixef for this object of class lmerMod
Dear Thierry, Thank you very much. Do you mean I should add a line to the function with the code fixef(my.model), retaining everything else, even the beta0 - as.numeric(mod@fixef) line? Or should I replace something? Also, when you say fixef(my.model), do you mean fixef(mod) (as in my case mod - lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE)? Thank you very much again. Iker __ Dr. Iker Vaquero-Alba Daphne du Maurier Centre for Ecology and Conservation College of Life and Environmental Sciences University of Exeter, Cornwall Campus TR10 9FE Penryn U.K. http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/ https://eric.exeter.ac.uk/repository/handle/10036/3381 De: Thierry Onkelinx thierry.onkel...@inbo.be Para: Iker Vaquero Alba karrasp...@yahoo.es CC: r-help@r-project.org Enviado: Viernes 3 de julio de 2015 11:00 Asunto: Re: [R] no slot of name fixef for this object of class lmerMod Dear Iker,The internals of the mer model have changed. Use fixef(your.model). Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht BelgiumTo call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John TukeyOp 2 jul. 2015 22:17 schreef Iker Vaquero Alba karrasp...@yahoo.es: Hello everyone. I am trying to re-analyse some data with an R function I last used in 2011. Everything seemed to work fine then, but now, using the same code, it gives me this error: Error in R.pe(y, group1, group2, returnR = FALSE) : no slot of name fixef for this object of class lmerMod This is the part of the function that I think is relevant for the problem: # preparation #n - rowSums(y) N - length(y) k - length(unique(group1)) # clone g - length(unique(group2)) # round # require(lme4) # functions R.pe - function(y, group1, group2, returnR=TRUE) { mod - lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE) VarComp - lme4::VarCorr(mod) beta0 - as.numeric(mod@fixef) var.e - attr(VarComp, sc)^2 # residual variance var.a1 - (as.numeric(VarComp[1])) # e.g. get clone R var.a2 - (as.numeric(VarComp[2])) # e.g. get round R R.group1 - var.a1/(var.a1+var.e) # clone level R.group2 - var.a2/(var.a2+var.e) R.groupr - var.a1/(var.a1+var.e+var.a2) if(returnR) return(list(R.group1=R.group1,R.group2=R.group2,R.groupr=R.groupr)) else return(list(beta0=beta0, var.e=var.e, var.a1=var.a1, var.a2=var.a2)) } I would appreciate any help about this. Let me know if you need more code, the function is obviously longer. Thank you very much in advance. Iker __ Dr. Iker Vaquero-Alba Daphne du Maurier Centre for Ecology and Conservation College of Life and Environmental Sciences University of Exeter, Cornwall Campus TR10 9FE Penryn U.K. http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/ https://eric.exeter.ac.uk/repository/handle/10036/3381 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] what constitutes a 'complete sentence'?
As I said, I found a formulation that pleased the check and that’s it for me. I am befuddled by the check in the first place though. BW F On 3 Jul 2015, at 15:14, PIKAL Petr petr.pi...@precheza.cz wrote: Hi without going deep into this matter, what if you remove / from your sentence. Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Hadley Wickham Sent: Friday, July 03, 2015 1:14 PM To: Federico Calboli Cc: R-help Subject: Re: [R] what constitutes a 'complete sentence'? In that case, you need to create a minimal reproducible example and make it publicly available. Hadley On Friday, July 3, 2015, Federico Calboli federico.calb...@helsinki.fi wrote: On 3 Jul 2015, at 12:14, Hadley Wickham h.wick...@gmail.com javascript:; wrote: It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Tried this and unfortunately it does not help. BW F Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi javascript:; wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; __ R-help@r-project.org javascript:; mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; -- http://had.co.nz/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with
Re: [R] matrix - delete last row - list
Hi, On Fri, Jul 3, 2015 at 10:33 AM, Zander, Joscha joscha.zan...@roche.com wrote: Good day R-community, i just wondered if it is a bug or a feature... When i have a matrix mat with one column and i delete the last row with mat - mat[-nrow(mat),] the result is a list. I have no idea how you're getting a list from a matrix (see below). Perhaps you mean a data frame? So my next call mat[10,] will throw an wrong dimension error. The proper call must be: mat - as.matrix(mat[-nrow(mat),]) So is this desired behavior or a bug? If you check ?[ you'll see the drop argument, which is what I guess you want. Compare: mat - matrix(1:6, nrow=2) mat - mat[-nrow(mat), ] class(mat) # not a list [1] integer dim(mat) NULL is.list(mat) # see? really not a list [1] FALSE mat [1] 1 3 5 mat - matrix(1:6, nrow=2) mat - mat[-nrow(mat), , drop=FALSE] class(mat) [1] matrix dim(mat) [1] 1 3 mat [,1] [,2] [,3] [1,]135 I use R-version 2.15.3, but reconstructed this behavior in 3.2.0 as well. greetings -- *Joscha Zander* -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix - delete last row - list
On Jul 3, 2015, at 9:33 AM, Zander, Joscha joscha.zan...@roche.com wrote: Good day R-community, i just wondered if it is a bug or a feature... When i have a matrix mat with one column and i delete the last row with mat - mat[-nrow(mat),] the result is a list. So my next call mat[10,] will throw an wrong dimension error. The proper call must be: mat - as.matrix(mat[-nrow(mat),]) So is this desired behavior or a bug? I use R-version 2.15.3, but reconstructed this behavior in 3.2.0 as well. greetings -- *Joscha Zander* See: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-my-matrices-lose-dimensions_003f mat - matrix(1:12, ncol = 1) str(mat) int [1:12, 1] 1 2 3 4 5 6 7 8 9 10 ... mat[-nrow(mat), ] [1] 1 2 3 4 5 6 7 8 9 10 11 # This is a vector, not a list str(mat[-nrow(mat), ]) int [1:11] 1 2 3 4 5 6 7 8 9 10 … mat[-nrow(mat), , drop = FALSE] [,1] [1,]1 [2,]2 [3,]3 [4,]4 [5,]5 [6,]6 [7,]7 [8,]8 [9,]9 [10,] 10 [11,] 11 # This is a matrix str(mat[-nrow(mat), , drop = FALSE]) int [1:11, 1] 1 2 3 4 5 6 7 8 9 10 … Regards, Marc Schwartz P.S. are you restricted in being able to upgrade from a version of R that is two years old? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] no slot of name fixef for this object of class lmerMod
Yes, use fixef(mod) instead of mod@fixef. It is recommended to use the accessor functions instead of reading the slots with the @. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey Op 3 jul. 2015 13:59 schreef Iker Vaquero Alba karrasp...@yahoo.es: Dear Thierry, Thank you very much. Do you mean I should *add* a line to the function with the code fixef(my.model), retaining everything else, even the beta0- as.numeric(mod@fixef) line? Or should I replace something? Also, when you say fixef(my.model), do you mean fixef(mod) (as in my case mod - lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE)? Thank you very much again. Iker __ Dr. Iker Vaquero-Alba Daphne du Maurier Centre for Ecology and Conservation College of Life and Environmental Sciences University of Exeter, Cornwall Campus TR10 9FE Penryn U.K. http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/ https://eric.exeter.ac.uk/repository/handle/10036/3381 -- *De:* Thierry Onkelinx thierry.onkel...@inbo.be *Para:* Iker Vaquero Alba karrasp...@yahoo.es *CC:* r-help@r-project.org *Enviado:* Viernes 3 de julio de 2015 11:00 *Asunto:* Re: [R] no slot of name fixef for this object of class lmerMod Dear Iker, The internals of the mer model have changed. Use fixef(your.model). Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey Op 2 jul. 2015 22:17 schreef Iker Vaquero Alba karrasp...@yahoo.es: Hello everyone. I am trying to re-analyse some data with an R function I last used in 2011. Everything seemed to work fine then, but now, using the same code, it gives me this error: Error in R.pe(y, group1, group2, returnR = FALSE) : no slot of name fixef for this object of class lmerMod This is the part of the function that I think is relevant for the problem: # preparation #n - rowSums(y) N - length(y) k - length(unique(group1)) # clone g - length(unique(group2)) # round # require(lme4) # functions R.pe - function(y, group1, group2, returnR=TRUE) { mod - lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE) VarComp - lme4::VarCorr(mod) beta0- as.numeric(mod@fixef) var.e - attr(VarComp, sc)^2 # residual variance var.a1 - (as.numeric(VarComp[1])) # e.g. get clone R var.a2 - (as.numeric(VarComp[2])) # e.g. get round R R.group1 - var.a1/(var.a1+var.e) # clone level R.group2 - var.a2/(var.a2+var.e) R.groupr - var.a1/(var.a1+var.e+var.a2) if(returnR) return(list(R.group1=R.group1,R.group2=R.group2,R.groupr=R.groupr)) else return(list(beta0=beta0, var.e=var.e, var.a1=var.a1, var.a2=var.a2)) } I would appreciate any help about this. Let me know if you need more code, the function is obviously longer. Thank you very much in advance. Iker __ Dr. Iker Vaquero-Alba Daphne du Maurier Centre for Ecology and Conservation College of Life and Environmental Sciences University of Exeter, Cornwall Campus TR10 9FE Penryn U.K. http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/ https://eric.exeter.ac.uk/repository/handle/10036/3381 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html http://www.r-project.org/posting-guide.html and provide
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
On Jul 3, 2015, at 8:08 AM, John Nash john.n...@uottawa.ca wrote: Third try -- I unsubscribed and re-subscribed. Sorry to Ravi for extra traffic. In case anyone gets a duplicate, R-help bounced my msg from non-member (I changed server, but not email yesterday, so possibly something changed enough). Trying again. JN I got the Wolfram answer as follows: library(Rmpfr) n163 - mpfr(163, 500) n163 pi500 - mpfr(pi, 500) pi500 pitan - mpfr(4, 500)*atan(mpfr(1,500)) pitan pitan-pi500 r500 - exp(sqrt(n163)*pitan) r500 check - 262537412640768743.25007259719818568887935385... savehistory(jnramanujan.R) Note that I used 4*atan(1) to get pi. RK got it right by following the example in the help page for mpfr: Const(pi, 120) The R `pi` constant is not recognized by mpfr as being anything other than another double . There are four special values that mpfr recognizes. — Best; David It seems that may be important, rather than converting. JN On 15-07-03 06:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Thu, 2 Jul 2015 22:38:45 + From: Ravi Varadhan ravi.varad...@jhu.edu To: 'Richard M. Heiberger' r...@temple.edu, Aditya Singh aps...@yahoo.com Cc: r-help r-help@r-project.org Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R Message-ID: 14ad39aaf6a542849bbf3f62a0c2f...@dom-eb1-2013.win.ad.jhu.edu Content-Type: text/plain; charset=utf-8 Hi Rich, The Wolfram answer is correct. http://mathworld.wolfram.com/RamanujanConstant.html There is no code for Wolfram alpha. You just go to their web engine and plug in the expression and it will give you the answer. http://www.wolframalpha.com/ I am not sure that the precedence matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R There is a precedence error in your R attempt. You need to convert 163 to 120 bits first, before taking its square root. exp(sqrt(mpfr(163, 120)) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768333.51635812597335712954 ## just the last four characters to the left of the decimal point. tmp - c(baseR=8256, Wolfram=8744, Rmpfr=8333, wrongRmpfr=7837) tmp-tmp[2] baseRWolfram Rmpfr wrongRmpfr -488 0 -411 -907 You didn't give the Wolfram alpha code you used. There is no way of verifying the correct value from your email. Please check that you didn't have a similar precedence error in that code. Rich On Thu, Jul 2, 2015 at 2:02 PM, Aditya Singh via R-help r-help@r-project.org wrote: Ravi I am a chemical engineer by training. Is there not something like law of corresponding states in numerical analysis? Aditya -- On Thu 2 Jul, 2015 7:28 AM PDT Ravi Varadhan wrote: Hi, Ramanujan supposedly discovered that the number, 163, has this interesting property that exp(sqrt(163)*pi), which is obviously a transcendental number, is real close to an integer (close to 10^(-12)). If I compute this using the Wolfram alpha engine, I get: 262537412640768743.25007259719818568887935385... When I do this in R 3.1.1 (64-bit windows), I get: 262537412640768256. The absolute error between the exact and R's value is 488, with a relative error of about 1.9x10^(-15). In order to replicate Wolfram Alpha, I tried doing this in Rmfpr but I am unable to get accurate results: library(Rmpfr) exp(sqrt(163) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640767837.08771354274620169031 The above answer is not only inaccurate, but it is actually worse than the answer using the usual double precision. Any thoughts as to what I am doing wrong? Thank you, Ravi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
Re: [R] what constitutes a 'complete sentence'?
Sigh, how natural it is to say This package ..., but you probably don't know a package can be easily rejected by CRAN simply because of this phrase This package (it has been clearly stated in the R-exts manual). I don't think the grammar is the problem here. When in doubt, I always check what MASS does: http://cran.rstudio.com/web/packages/MASS/index.html Turns out its description is not a complete sentence, either. Sounds like R has become a language for statistical computing and graphics, plus English grammar since 3.0.x. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Fri, Jul 3, 2015 at 8:43 AM, Rolf Turner r.tur...@auckland.ac.nz wrote: On 03/07/15 20:09, Federico Calboli wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? If that is your understanding you need to go back to school and learn some grammar. What you have is a noun (Functions) modified by an adjectival clause. No verb in sight. Ergo *not* a complete sentence. OTOH you are probably in good company in not knowing your grammar. The CRAN folks most likely don't know grammar either. I suspect that they *don't* actually demand a complete sentence. Such a demand would in fact be rather pedantic. Moreover I really can't see how the package checker could possibly check for complete sentences. This would require some very sophisticated programming, it seems to me. If it turns out that you *really* need a complete sentence, you could say (for instance): This package consists of functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. The foregoing *is* a complete sentence. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to feed graphic device (png, jpeg etc) with different files names
Dear list, I define a function to export a bunch of plots. A sample code is something like the follow export.plots-function(export.type='pdf',...){ match.fun(export.type) (...) print(plot.func1(...)) print(plot.func2(...)) print(plot.func3(...)) ... print(plot.funcn(...)) dev.off() } If I do pdf , everything can be exported into one file. But for other devices, each graph is one file. Since I have so many graphs to export, I can't tell which is what from the file names. I was thinking if I can construct a file name for each of the 'print function then to feed the information to the graphic device to have an informative file name. Is it possible? Thanks. Jun [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] what constitutes a 'complete sentence'?
On 04/07/2015 12:26 AM, Rolf Turner wrote: On 04/07/15 06:27, Yihui Xie wrote: Sigh, how natural it is to say This package ..., but you probably don't know a package can be easily rejected by CRAN simply because of this phrase This package (it has been clearly stated in the R-exts manual). Urrr! I *did* know that, but had forgotten. Apologies for my wrong-headed suggestion. Thanks for pointing out my error. I don't think the grammar is the problem here. When in doubt, I always check what MASS does: http://cran.rstudio.com/web/packages/MASS/index.html Turns out its description is not a complete sentence, either. Sounds like R has become a language for statistical computing and graphics, plus English grammar since 3.0.x. The CRAN guidelines should be rewritten so that they say what they *mean*. If a complete sentence is not actually required --- and it seems abundantly clear that it is not --- then guidelines should not say so. Rather they should say, clearly and comprehensibly, what actually *is* required. There's often a difference between a requirement and the test for it. If you meet the requirement, you should pass the test, but you can often pass the test without meeting the requirement, and then you may find that the test is improved in a later version. (Requirements may also be changed, of course.) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] what constitutes a 'complete sentence'?
On 03-07-2015, at 14:18, Federico Calboli federico.calb...@helsinki.fi wrote: As I said, I found a formulation that pleased the check and that’s it for me. I am befuddled by the check in the first place though. And what would that formulation be (replacing the original one) ? Berend BW F On 3 Jul 2015, at 15:14, PIKAL Petr petr.pi...@precheza.cz wrote: Hi without going deep into this matter, what if you remove / from your sentence. Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Hadley Wickham Sent: Friday, July 03, 2015 1:14 PM To: Federico Calboli Cc: R-help Subject: Re: [R] what constitutes a 'complete sentence'? In that case, you need to create a minimal reproducible example and make it publicly available. Hadley On Friday, July 3, 2015, Federico Calboli federico.calb...@helsinki.fi wrote: On 3 Jul 2015, at 12:14, Hadley Wickham h.wick...@gmail.com javascript:; wrote: It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Tried this and unfortunately it does not help. BW F Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi javascript:; wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; __ R-help@r-project.org javascript:; mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; -- http://had.co.nz/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or
Re: [R] How to feed graphic device (png, jpeg etc) with different files names
Use dev.off and re-open the device. --- 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. On July 3, 2015 8:05:44 PM PDT, Jun Shen jun.shen...@gmail.com wrote: Dear list, I define a function to export a bunch of plots. A sample code is something like the follow export.plots-function(export.type='pdf',...){ match.fun(export.type) (...) print(plot.func1(...)) print(plot.func2(...)) print(plot.func3(...)) ... print(plot.funcn(...)) dev.off() } If I do pdf , everything can be exported into one file. But for other devices, each graph is one file. Since I have so many graphs to export, I can't tell which is what from the file names. I was thinking if I can construct a file name for each of the 'print function then to feed the information to the graphic device to have an informative file name. Is it possible? Thanks. Jun [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question
Lida, I expect that there is a better way to solve your problem than the process you propose. However, something like this may do what you want. ### ## met - read.csv(your_met_file”) ## Since I do not have your file a made a small 5*1 character vector. met - c(glycine_imp, Nacetylglycine_imp, sarcosine_imp, dimethylglycine_imp, betaine_imp) for (i in seq_along(met)) { my_formula - paste0(met[i], ~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER) prep - Scores(Z=metalofGT, formula = my_formula) save(prep, file = paste0(prep, i)) } ### Mark R. Mark Sharp, Ph.D. Director of Primate Records Database Southwest National Primate Research Center Texas Biomedical Research Institute P.O. Box 760549 San Antonio, TX 78245-0549 Telephone: (210)258-9476 e-mail: msh...@txbiomed.org On Jul 2, 2015, at 11:48 AM, Lida Zeighami lid.z...@gmail.com wrote: Thank you so much for replying me! for better understanding my problem, I explain my problem more: I have a 682*1 matrix called met , the first 5 rows similar below: rownames(met)[1:5] [1] glycine_imp [2] Nacetylglycine_imp [3] sarcosine_imp [4] dimethylglycine_imp [5] betaine_imp and I have a function in R that each time use one of the row names of met matrix and create a new object file and I should save the objects! my function is Scores(Z=metalofGT,formula=met[i]~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER) that each time just I should change the met[i] and replace by row names met one by one and for each of them I should rename the function and after that I should save each object! for example for first row of met I have prep1- Scores(Z=metalofGT,formula=glycine_imp~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER) #creat the object file for first row and called prep1### save(prep1, file=prep1.RData, compress=bzip2) ##save the object file as prep1.RData# I should do this process for 682 row names of met matrix and at the end I should haveprep1.RData , prep2.RData , prep3.RData so, would you please help me how to do it? Many Thanks, Ati On Wed, Jul 1, 2015 at 1:07 PM, Lida Zeighami lid.z...@gmail.com wrote: I have 682 variables in a data frame , and a function that I should feed 682 variables in this function one by one and each time save the file as a special name! for emaple: my data frame file includes 682 names : 1 aaa 2 bbb 3 dfdsfg 4 fghh . 682 fgfhg and a function like prep(Z, aaa, .) and each time I should change the variable name in this function and read the variable from the data frame and each time I should save the file as a special name such as: prep1- prep(z, aaa,...) prep2- prep(z, bbb,...) prep3- prep(z, dfdsfg,..) Prep4- prep(z, fghh,...) How can I use loop function in R to that? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
On Jul 3, 2015, at 5:08 PM, David Winsemius dwinsem...@comcast.net wrote: It doesn’t appear to me that mpfr was ever designed to handle expressions as the first argument. This could be a start. Obviously one would wnat to include code to do other substitutions probably using the all.vars function to pull out the other “constants” and ’numeric’ values to make them of equivalent precision. I’m guessing you want to follow the parse-tree and then testing the numbers for integer-ness and then replacing by paste0( “mpfr(“, val, “L, “, prec,”)” ) Pre - function(expr, prec){ sexpr - deparse(substitute(expr) ) spi - paste0(Const('pi',,prec,”)”) sexpr - gsub(pi, spi, sexpr) print( eval(parse(text=sexpr))) } # Very minimal testing Pre(pi,120) 1 'mpfr' number of precision 120 bits [1] 3.1415926535897932384626433832795028847 Pre(exp(pi),120) 1 'mpfr' number of precision 120 bits [1] 23.140692632779269005729086367948547394 Pre(log(exp(pi)),120) 1 'mpfr' number of precision 120 bits [1] 3.1415926535897932384626433832795028847 At the moment it still needs to ahve other numbers mpfr-ified to succeed: Pre(pi-4*atan(1),120) 1 'mpfr' number of precision 120 bits [1] 1.2246467991473531772315719253130892016e-16 Pre(pi-4*atan(mpfr(1,120)),120) 1 'mpfr' number of precision 120 bits [1] 0 Best; David. — David On Jul 3, 2015, at 12:01 PM, Ravi Varadhan ravi.varad...@jhu.edu wrote: Thank you all. I did think about declaring `pi' as a special constant, but for some reason didn't actually try it. Would it be easy to have the mpfr() written such that its argument is automatically of extended precision? In other words, if I just called: mpfr(exp(sqrt(163)*pi, 120), then all the constants, 163, pi, are automatically of 120 bits precision. Is this easy to do? Best, Ravi From: David Winsemius dwinsem...@comcast.net Sent: Friday, July 3, 2015 2:06 PM To: John Nash Cc: r-help; Ravi Varadhan Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R On Jul 3, 2015, at 8:08 AM, John Nash john.n...@uottawa.ca wrote: Third try -- I unsubscribed and re-subscribed. Sorry to Ravi for extra traffic. In case anyone gets a duplicate, R-help bounced my msg from non-member (I changed server, but not email yesterday, so possibly something changed enough). Trying again. JN I got the Wolfram answer as follows: library(Rmpfr) n163 - mpfr(163, 500) n163 pi500 - mpfr(pi, 500) pi500 pitan - mpfr(4, 500)*atan(mpfr(1,500)) pitan pitan-pi500 r500 - exp(sqrt(n163)*pitan) r500 check - 262537412640768743.25007259719818568887935385... savehistory(jnramanujan.R) Note that I used 4*atan(1) to get pi. RK got it right by following the example in the help page for mpfr: Const(pi, 120) The R `pi` constant is not recognized by mpfr as being anything other than another double . There are four special values that mpfr recognizes. — Best; David It seems that may be important, rather than converting. JN On 15-07-03 06:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Thu, 2 Jul 2015 22:38:45 + From: Ravi Varadhan ravi.varad...@jhu.edu To: 'Richard M. Heiberger' r...@temple.edu, Aditya Singh aps...@yahoo.com Cc: r-help r-help@r-project.org Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R Message-ID: 14ad39aaf6a542849bbf3f62a0c2f...@dom-eb1-2013.win.ad.jhu.edu Content-Type: text/plain; charset=utf-8 Hi Rich, The Wolfram answer is correct. http://mathworld.wolfram.com/RamanujanConstant.html There is no code for Wolfram alpha. You just go to their web engine and plug in the expression and it will give you the answer. http://www.wolframalpha.com/ I am not sure that the precedence matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R There is a precedence error in your R attempt. You need to convert 163 to 120 bits first, before taking its square root. exp(sqrt(mpfr(163, 120)) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768333.51635812597335712954 ## just the last four characters to the left of the decimal point. tmp - c(baseR=8256, Wolfram=8744, Rmpfr=8333, wrongRmpfr=7837) tmp-tmp[2] baseRWolfram Rmpfr wrongRmpfr -488 0 -411 -907 You didn't give the Wolfram alpha code you used. There is no way of verifying the correct value from your email. Please check that you didn't have a similar precedence error in
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
Thank you all. I did think about declaring `pi' as a special constant, but for some reason didn't actually try it. Would it be easy to have the mpfr() written such that its argument is automatically of extended precision? In other words, if I just called: mpfr(exp(sqrt(163)*pi, 120), then all the constants, 163, pi, are automatically of 120 bits precision. Is this easy to do? Best, Ravi From: David Winsemius dwinsem...@comcast.net Sent: Friday, July 3, 2015 2:06 PM To: John Nash Cc: r-help; Ravi Varadhan Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R On Jul 3, 2015, at 8:08 AM, John Nash john.n...@uottawa.ca wrote: Third try -- I unsubscribed and re-subscribed. Sorry to Ravi for extra traffic. In case anyone gets a duplicate, R-help bounced my msg from non-member (I changed server, but not email yesterday, so possibly something changed enough). Trying again. JN I got the Wolfram answer as follows: library(Rmpfr) n163 - mpfr(163, 500) n163 pi500 - mpfr(pi, 500) pi500 pitan - mpfr(4, 500)*atan(mpfr(1,500)) pitan pitan-pi500 r500 - exp(sqrt(n163)*pitan) r500 check - 262537412640768743.25007259719818568887935385... savehistory(jnramanujan.R) Note that I used 4*atan(1) to get pi. RK got it right by following the example in the help page for mpfr: Const(pi, 120) The R `pi` constant is not recognized by mpfr as being anything other than another double . There are four special values that mpfr recognizes. — Best; David It seems that may be important, rather than converting. JN On 15-07-03 06:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Thu, 2 Jul 2015 22:38:45 + From: Ravi Varadhan ravi.varad...@jhu.edu To: 'Richard M. Heiberger' r...@temple.edu, Aditya Singh aps...@yahoo.com Cc: r-help r-help@r-project.org Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R Message-ID: 14ad39aaf6a542849bbf3f62a0c2f...@dom-eb1-2013.win.ad.jhu.edu Content-Type: text/plain; charset=utf-8 Hi Rich, The Wolfram answer is correct. http://mathworld.wolfram.com/RamanujanConstant.html There is no code for Wolfram alpha. You just go to their web engine and plug in the expression and it will give you the answer. http://www.wolframalpha.com/ I am not sure that the precedence matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R There is a precedence error in your R attempt. You need to convert 163 to 120 bits first, before taking its square root. exp(sqrt(mpfr(163, 120)) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768333.51635812597335712954 ## just the last four characters to the left of the decimal point. tmp - c(baseR=8256, Wolfram=8744, Rmpfr=8333, wrongRmpfr=7837) tmp-tmp[2] baseRWolfram Rmpfr wrongRmpfr -488 0 -411 -907 You didn't give the Wolfram alpha code you used. There is no way of verifying the correct value from your email. Please check that you didn't have a similar precedence error in that code. Rich On Thu, Jul 2, 2015 at 2:02 PM, Aditya Singh via R-help r-help@r-project.org wrote: Ravi I am a chemical engineer by training. Is there not something like law of corresponding states in numerical analysis? Aditya -- On Thu 2 Jul, 2015 7:28 AM PDT Ravi Varadhan wrote: Hi, Ramanujan supposedly discovered that the number, 163, has this interesting property that exp(sqrt(163)*pi), which is obviously a transcendental number, is real close to an integer (close to 10^(-12)). If I compute this using the Wolfram alpha engine, I get: 262537412640768743.25007259719818568887935385... When I do this in R 3.1.1 (64-bit windows), I get: 262537412640768256. The absolute error between the exact and R's value is 488, with a relative error of about 1.9x10^(-15). In order to replicate Wolfram Alpha, I tried doing this in Rmfpr but I am unable to get accurate results: library(Rmpfr) exp(sqrt(163) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640767837.08771354274620169031 The above answer is not only inaccurate, but it is actually worse than the answer using the usual double precision. Any thoughts as to what I am doing wrong? Thank you, Ravi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the
Re: [R] what constitutes a 'complete sentence'?
On 04/07/15 06:27, Yihui Xie wrote: Sigh, how natural it is to say This package ..., but you probably don't know a package can be easily rejected by CRAN simply because of this phrase This package (it has been clearly stated in the R-exts manual). Urrr! I *did* know that, but had forgotten. Apologies for my wrong-headed suggestion. Thanks for pointing out my error. I don't think the grammar is the problem here. When in doubt, I always check what MASS does: http://cran.rstudio.com/web/packages/MASS/index.html Turns out its description is not a complete sentence, either. Sounds like R has become a language for statistical computing and graphics, plus English grammar since 3.0.x. The CRAN guidelines should be rewritten so that they say what they *mean*. If a complete sentence is not actually required --- and it seems abundantly clear that it is not --- then guidelines should not say so. Rather they should say, clearly and comprehensibly, what actually *is* required. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [FORGED] Re: matrix - delete last row - list
On 04/07/15 03:43, Sarah Goslee wrote: Hi, On Fri, Jul 3, 2015 at 10:33 AM, Zander, Joscha joscha.zan...@roche.com wrote: Good day R-community, i just wondered if it is a bug or a feature... When i have a matrix mat with one column and i delete the last row with mat - mat[-nrow(mat),] the result is a list. I have no idea how you're getting a list from a matrix (see below). Perhaps you mean a data frame? SNIP No. The Zander person just means a vector. Psigh. Note to the Zander person: It is important in R programming to get your concepts straight. It is also important in communicating with others to get your terminology straight. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
It doesn’t appear to me that mpfr was ever designed to handle expressions as the first argument. — David On Jul 3, 2015, at 12:01 PM, Ravi Varadhan ravi.varad...@jhu.edu wrote: Thank you all. I did think about declaring `pi' as a special constant, but for some reason didn't actually try it. Would it be easy to have the mpfr() written such that its argument is automatically of extended precision? In other words, if I just called: mpfr(exp(sqrt(163)*pi, 120), then all the constants, 163, pi, are automatically of 120 bits precision. Is this easy to do? Best, Ravi From: David Winsemius dwinsem...@comcast.net Sent: Friday, July 3, 2015 2:06 PM To: John Nash Cc: r-help; Ravi Varadhan Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R On Jul 3, 2015, at 8:08 AM, John Nash john.n...@uottawa.ca wrote: Third try -- I unsubscribed and re-subscribed. Sorry to Ravi for extra traffic. In case anyone gets a duplicate, R-help bounced my msg from non-member (I changed server, but not email yesterday, so possibly something changed enough). Trying again. JN I got the Wolfram answer as follows: library(Rmpfr) n163 - mpfr(163, 500) n163 pi500 - mpfr(pi, 500) pi500 pitan - mpfr(4, 500)*atan(mpfr(1,500)) pitan pitan-pi500 r500 - exp(sqrt(n163)*pitan) r500 check - 262537412640768743.25007259719818568887935385... savehistory(jnramanujan.R) Note that I used 4*atan(1) to get pi. RK got it right by following the example in the help page for mpfr: Const(pi, 120) The R `pi` constant is not recognized by mpfr as being anything other than another double . There are four special values that mpfr recognizes. — Best; David It seems that may be important, rather than converting. JN On 15-07-03 06:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Thu, 2 Jul 2015 22:38:45 + From: Ravi Varadhan ravi.varad...@jhu.edu To: 'Richard M. Heiberger' r...@temple.edu, Aditya Singh aps...@yahoo.com Cc: r-help r-help@r-project.org Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R Message-ID: 14ad39aaf6a542849bbf3f62a0c2f...@dom-eb1-2013.win.ad.jhu.edu Content-Type: text/plain; charset=utf-8 Hi Rich, The Wolfram answer is correct. http://mathworld.wolfram.com/RamanujanConstant.html There is no code for Wolfram alpha. You just go to their web engine and plug in the expression and it will give you the answer. http://www.wolframalpha.com/ I am not sure that the precedence matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R There is a precedence error in your R attempt. You need to convert 163 to 120 bits first, before taking its square root. exp(sqrt(mpfr(163, 120)) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768333.51635812597335712954 ## just the last four characters to the left of the decimal point. tmp - c(baseR=8256, Wolfram=8744, Rmpfr=8333, wrongRmpfr=7837) tmp-tmp[2] baseRWolfram Rmpfr wrongRmpfr -488 0 -411 -907 You didn't give the Wolfram alpha code you used. There is no way of verifying the correct value from your email. Please check that you didn't have a similar precedence error in that code. Rich On Thu, Jul 2, 2015 at 2:02 PM, Aditya Singh via R-help r-help@r-project.org wrote: Ravi I am a chemical engineer by training. Is there not something like law of corresponding states in numerical analysis? Aditya -- On Thu 2 Jul, 2015 7:28 AM PDT Ravi Varadhan wrote: Hi, Ramanujan supposedly discovered that the number, 163, has this interesting property that exp(sqrt(163)*pi), which is obviously a transcendental number, is real close to an integer (close to 10^(-12)). If I compute this using the Wolfram alpha engine, I get: 262537412640768743.25007259719818568887935385... When I do this in R 3.1.1 (64-bit windows), I get: 262537412640768256. The absolute error between the exact and R's value is 488, with a relative error of about 1.9x10^(-15). In order to replicate Wolfram Alpha, I tried doing this in Rmfpr but I am unable to get accurate results: library(Rmpfr) exp(sqrt(163) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640767837.08771354274620169031 The above answer is not only inaccurate, but it is actually worse than the answer using the usual double precision. Any thoughts as to what I am doing
Re: [R] Lattice: set col = black for box.rectangle and box.umbrella
Rich Just a thought Have you set pch colour values somewhere else? see also https://stat.ethz.ch/pipermail/r-help/2010-March/230329.html Duncan -Original Message- From: rshep...@localhost.appl-ecosys.com [mailto:rshep...@localhost.appl-ecosys.com] On Behalf Of Rich Shepard Sent: Saturday, 4 July 2015 01:58 To: Duncan Mackay Subject: Re: [R] Lattice: set col = black for box.rectangle and box.umbrella On Fri, 3 Jul 2015, Duncan Mackay wrote: My settings are par.settings = list(fontsize = list(text = 10.5, points = 8), strip.background = list(col = transparent), box.dot = list(col = #FF, # red Duncan, This is interesting: the color of the horizontal line remains black, rather than displaying in red whether I use the numeric code or the word. I need to explore why. Thanks again, Rich -- Richard B. Shepard, Ph.D. Applied Ecosystem Services, Inc. Troutdale, OR 97060 USA www[dot]appl-ecosys[dot]com Voice: 503-667-4517Fax: 503-667-8863 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Removing rows in a data frame
Try y - x[ -( 30596:678013 ), ] Please note that I have replaced 30595 with 30596 which is I think what you mean. You can add a new column with y$new - new_column # this is your vector of length 30595 Good luck, Rainer On Friday 03 July 2015 07:23:28 Charles Thuo wrote: I have a data frame whose rows are 678013 . I would like to remove rows from 30696 to 678013 and then attach a new column with a length of 30595. I tried Y- X[-30595:678013,] and its not working In addition how do i add a new column Kindly assist. Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] igraph plot slowness
Hi, With the following data ibcore01ibswitch01 ibcore01ibswitch02 ibcore01ibswitch03 ibcore02ibswitch01 ibcore02ibswitch02 ibcore02ibswitch03 ibswitch01 node001 ibswitch01 node002 ibswitch01 node003 ibswitch02 node004 ibswitch02 node005 ibswitch02 node006 ibswitch03 node007 ibswitch03 node008 ibswitch03 node009 in the file topology.txt and the following code: library(igraph) topo_data - read.csv(file=topology.txt,head=FALSE,sep=\t) network_data -graph.data.frame(topo_data, directed=F) plot(network_data) it takes about 5 seconds for the plot to be drawn with R 3.2.0 on a 12-core 2.67 GHz Xeon X5650 server with no other CPU-intensive processes running. This strikes me as rather slow, particularly as my full network has over 120 components and the plot takes around 50 seconds. Am I doing anything wrong? (I am working over an ssh connection with X forwarding, but plotting to a PDF file on the server does not seem to be faster.) Cheers, Loris -- This signature is currently under construction. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R
Hi Rich, The Wolfram answer is correct. http://mathworld.wolfram.com/RamanujanConstant.html There is no code for Wolfram alpha. You just go to their web engine and plug in the expression and it will give you the answer. http://www.wolframalpha.com/ I am not sure that the precedence matters in Rmpfr. Even if it does, the answer you get is still wrong as you showed. Thanks, Ravi -Original Message- From: Richard M. Heiberger [mailto:r...@temple.edu] Sent: Thursday, July 02, 2015 6:30 PM To: Aditya Singh Cc: Ravi Varadhan; r-help Subject: Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R There is a precedence error in your R attempt. You need to convert 163 to 120 bits first, before taking its square root. exp(sqrt(mpfr(163, 120)) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640768333.51635812597335712954 ## just the last four characters to the left of the decimal point. tmp - c(baseR=8256, Wolfram=8744, Rmpfr=8333, wrongRmpfr=7837) tmp-tmp[2] baseRWolfram Rmpfr wrongRmpfr -488 0 -411 -907 You didn't give the Wolfram alpha code you used. There is no way of verifying the correct value from your email. Please check that you didn't have a similar precedence error in that code. Rich On Thu, Jul 2, 2015 at 2:02 PM, Aditya Singh via R-help r-help@r-project.org wrote: Ravi I am a chemical engineer by training. Is there not something like law of corresponding states in numerical analysis? Aditya -- On Thu 2 Jul, 2015 7:28 AM PDT Ravi Varadhan wrote: Hi, Ramanujan supposedly discovered that the number, 163, has this interesting property that exp(sqrt(163)*pi), which is obviously a transcendental number, is real close to an integer (close to 10^(-12)). If I compute this using the Wolfram alpha engine, I get: 262537412640768743.25007259719818568887935385... When I do this in R 3.1.1 (64-bit windows), I get: 262537412640768256. The absolute error between the exact and R's value is 488, with a relative error of about 1.9x10^(-15). In order to replicate Wolfram Alpha, I tried doing this in Rmfpr but I am unable to get accurate results: library(Rmpfr) exp(sqrt(163) * mpfr(pi, 120)) 1 'mpfr' number of precision 120 bits [1] 262537412640767837.08771354274620169031 The above answer is not only inaccurate, but it is actually worse than the answer using the usual double precision. Any thoughts as to what I am doing wrong? Thank you, Ravi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] what constitutes a 'complete sentence'?
Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R-es] Pregunta sobre RMarkdown
Hola buenos dias, ya he hecho la prueba, ha ido de maravilla Por un lado he aplicado la idea de Carlos Gil (donde la verdad, tenia que haberlo sabido yo pero estaba ofuscado y si no es por esas 3 lineas no lo veia claro), y por otro el codigo de mi tocayo, Francisco (cuyo primer apellido es igual al mio tambien) y con unas ligeras adaptaciones que os resumo a continuacion (eso me ha permitido ir directamente a la instruccion que necesito que era render y que la verdad, no sabia como iba a funcionar pero practicamente permite convertir un Rmd en una plantilla que la puedes llamar desde R, lo que es una idea muy potente que no conocia), por si a alguno que otro le puede ayudar, ha hecho exactamente lo que yo queria. Expongo el codigo que he usado para llamar a mi Rmd: library(rmarkdown) n.ayunt - 2 for (i in 1:n.ayunt){write.csv(i, D:\\ ... \\PRECONFIGURACION.csv) render(input = D:\\ ... \\Plantilla_01.Rmd,output_file = paste0(D:\\ ... \\SALIDA_FINAL\\Prueba, i, .html)) } Claramente la orden clave aqui es render, pero en la plantilla .Rmd tuve que hacer una ligera modificación para que leyera el dato que construyo por fuera a partir de un .csv (siguiendo la guia de Carlos) denominado PRECONFIGURACION, dicha modificacion implica que para que corra el proceso debo modificar la primera chunk que esta en mi .Rmd y que permite que se ejecute todo a traves de un valor de la variable i: ```{r echo = FALSE} ANIO_ACTUAL-2015 CONF - read.csv(D:\\ ... \\PRECONFIGURACION.csv, sep = ,) i - CONF$x ... ``` Como todos los calculos depende del valor de i que realmente es un puntero que busca en otros ficheros filas que contienen toda la informacion necesaria, se pudo hacer lo que queria. Realmente el tema de pasarlo a PDF es secundario. Para lo que quiero con esto es suficiente para seguir avanzando en el proyecto. De todos modos le dare mas adelante una vuelta al tema PDF cuando pueda hacer pruebas desde casa. Un saludo y muchas gracias por la ayuda PD Todo lo anterior lo he escrito en un word para que su legibilidad sea mejor porque el formato de la lista es el que es Date: Thu, 2 Jul 2015 19:35:14 +0200 From: fjr...@hotmail.com To: r-help-es@r-project.org; f.rodriguez.s...@gmail.com Subject: Re: [R-es] Pregunta sobre RMarkdown Gracias. Lo pruebo mañana y os comento, un saludo Enviado desde mi smartphone Sony Xperia™ Francisco Rodriguez Sanchez f.rodriguez.s...@gmail.com wrote: Hola Francisco, Es muy fácil generar múltiples informes basados en un único documento Rmarkdown. Simplemente ejecuta un código similar a este: library(rmarkdown) dataset - read.csv(your_dataset.csv) n.ayunt - 100# número de ayuntamientos (también se podría identificar a partir del dataset) for (i in 1:n.ayunt){ ayunt - dataset$ayuntamiento[i] render(input = myRmddoc.Rmd, output_file = paste0(ayunt, .html)) } El documento 'myRmddoc.Rmd' debe usar simplemente 'ayunt' como datos. El for loop hará que ayunt sea diferente cada vez. Más info aquí: http://stackoverflow.com/questions/28368150/automatically-generated-reports-using-rmarkdown Suerte! Paco El 02/07/2015 a las 16:24, Francisco Rodríguez escribió: Hola Carlos, qu� tal Me interesa el c�mo hacer el paso 2, es decir, me valdr�a que con un c�digo R pueda llamar al fichero Rmd, y que me permitieseguardar el html que genera con un nombre que yo mismo pudiese controlar. Trato de ver si encuentro algo, pero si me das alguna indicaci�n lo pruebo entre hoy y ma�ana Un saludo y gracias Date: Thu, 2 Jul 2015 16:16:52 +0200 From: c...@datanalytics.com To: r-help-es@r-project.org Subject: Re: [R-es] Pregunta sobre RMarkdown Hola, �qu� tal? Lo que puedes hacer es que tu fichero Rmd lea el par�metro de un fichero externo. Entonces, creas un script que: 1) Actualice el valor del �ndice en ese fichero externo. 2) Compile el Rmd y le d� el nombre que te interesa. 3) Vuelva a (1). Salud, Carlos J. Gil Bellosta http://www.datanalytics.com El d�a 2 de julio de 2015, 16:08, David Duncan dhduncan1...@gmail.com escribi�: Francisco, �As� que todo que quieres imprimir a html o pdf sea contenido dentro de un solo chunk? Quiz�s por mis limitaciones en el espa�ol no veo muy claro si tu problema pertenece espec�ficamente a markdown o no. Yo busco una soluci�n parecida en ingl�s el otro d�a, porque quiero generar y guardar en archivo conjuntos de datos ligeramente distintos para mis estudiantes (los que son mayoritariamente copiones). De modo que conseguir� este tema, y te aviso si encuentro algo por StackOverflow. 2015-07-02 8:33 GMT-05:00 Francisco Rodr�guez fjr...@hotmail.com: Hola Carlos, creo que no resuelve el problema, de hecho otra de las cosas que no he conseguido a�n es generar sencillamente el PDF (con los html para generarlos 1 a 1 sin pb). Siempre suelo obtener el
Re: [R] Removing rows in a data frame
In my experience package dplyr has all functions to deal with this kind of problems in a simple and compact way Sergio Il 03/lug/2015 07:26, Charles Thuo tcmui...@gmail.com ha scritto: I have a data frame whose rows are 678013 . I would like to remove rows from 30696 to 678013 and then attach a new column with a length of 30595. I tried Y- X[-30595:678013,] and its not working In addition how do i add a new column Kindly assist. Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question
Hi I cannot test it in absence of data. Anyway I would not use saving single objects but use list instead. Something like lll - vector(mode=list, nrow(met)) for (i in 1:nrow(met)) { form - as.formula(paste(met[i], ~ egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER)) lll[i] - Scores(Z=metalofGT,formula=form) } Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Lida Zeighami Sent: Thursday, July 02, 2015 6:48 PM To: r-help@r-project.org Subject: Re: [R] question Thank you so much for replying me! for better understanding my problem, I explain my problem more: I have a 682*1 matrix called met , the first 5 rows similar below: rownames(met)[1:5] [1] glycine_imp [2] Nacetylglycine_imp [3] sarcosine_imp [4] dimethylglycine_imp [5] betaine_imp and I have a function in R that each time use one of the row names of met matrix and create a new object file and I should save the objects! my function is Scores(Z=metalofGT,formula=met[i]~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+G ENDER) that each time just I should change the met[i] and replace by row names met one by one and for each of them I should rename the function and after that I should save each object! for example for first row of met I have prep1- Scores(Z=metalofGT,formula=glycine_imp~egfr_v1_ckdepi+pc1+pc2+pc3+V1AG E01+GENDER) #creat the object file for first row and called prep1### save(prep1, file=prep1.RData, compress=bzip2) ##save the object file as prep1.RData# I should do this process for 682 row names of met matrix and at the end I should haveprep1.RData , prep2.RData , prep3.RData so, would you please help me how to do it? Many Thanks, Ati On Wed, Jul 1, 2015 at 1:07 PM, Lida Zeighami lid.z...@gmail.com wrote: I have 682 variables in a data frame , and a function that I should feed 682 variables in this function one by one and each time save the file as a special name! for emaple: my data frame file includes 682 names : 1 aaa 2 bbb 3 dfdsfg 4 fghh . 682 fgfhg and a function like prep(Z, aaa, .) and each time I should change the variable name in this function and read the variable from the data frame and each time I should save the file as a special name such as: prep1- prep(z, aaa,...) prep2- prep(z, bbb,...) prep3- prep(z, dfdsfg,..) Prep4- prep(z, fghh,...) How can I use loop function in R to that? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům. Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému. Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat. Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu. V případě, že je tento e-mail součástí obchodního jednání: - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu. - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou. - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech. - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and
Re: [R] what constitutes a 'complete sentence'?
It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Getting predictions for skewed t-distribution
I have a small dataframe xxF, a summary of which looks like this: summary(xxF) T Dev Min. :10.44 Min. :0.008929 1st Qu.:10.44 1st Qu.:0.012048 Median :18.61 Median :0.031250 Mean :17.87 Mean :0.028286 3rd Qu.:22.24 3rd Qu.:0.041667 Max. :30.37 Max. :0.05 I managed to make a non-linear fit after a lot of fiddling with initial values but it looks overly complicated and biologically unconvincing in part. The general form of a skewed t-distribution looks more appropriate so I tried selm from the sn package thus: selmFt - with(xxF, selm(Dev ~ T, family = ST, method=MPLE)) coef(selmFt, param.type=DP) (Intercept.DP) T omega alpha nu -0.0158950990.0026892260.002306132 -5.6608704461.473210455 I wish to get predictions for values of T between 10 and 32 but I can't figure out how to use those coefficients. With an linear model or glm, even without a prediction method, it's fairly simple to get predictions from a range of values of the independent variable/s. For a skewed-t it's evidently less straightforward. Does it have to be done using CP type parameters? Ideas gratefully accepted In case it makes any difference sessionInfo() R version 3.2.1 (2015-06-18) Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats4grDevices utils stats graphics methods base other attached packages: [1] dplyr_0.3.0.2 nlmrt_2013-9.25RColorBrewer_1.1-2 plyr_1.8.3 [5] stringr_1.0.0 reshape2_1.4.1 sn_1.2-2 lattice_0.20-31 loaded via a namespace (and not attached): [1] Rcpp_0.11.3 assertthat_0.1grid_3.2.1DBI_0.3.1 [5] magrittr_1.0.1stringi_0.4-1 lazyeval_0.1.10 tools_3.2.1 [9] numDeriv_2014.2-1 parallel_3.2.1mnormt_1.5-3 -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question
Hi Ati, Let's start from the top and see where we finish up. I'll use a somewhat smaller matrix: met-matrix(runif(5),ncol=1) rownames(met)-c(glycine_imp,Nacetylglycine_imp,sarcosine_imp, dimethylglycine_imp,betaine_imp) met [,1] glycine_imp 0.61532855 Nacetylglycine_imp 0.04294675 sarcosine_imp 0.98840385 dimethylglycine_imp 0.00507230 betaine_imp 0.68528107 In your example, I think you are mixing up the names and the values of met. I suspect that you want to use the values for the computation and the names for the filenames. Also, a one column matrix will act very much like a vector, but there are a few problems if you treat it like one. For instance, if you extract a value as though met is a vector: met[2] [1] 0.04294675 you just get the value, not the rowname. Using both indices extracts both the value and the name. met[2,1] Nacetylglycine_imp 0.04294675 As I don't have any idea what the other values in your formula are, I will take the liberty of giving them some: metalofGT-100 egfr_v1_ckdepi-1.2 pc1-2.3 pc2-3.4 pc3-4.5 V1AGE01-27 GENDER-F Before embarking on the loop, I think you have confused the name of the function, which is Score, with the return value of the function. I don't think you want to change the function's name or it won't work unless you change the name in the function call. Therefore, I am going to make a blind guess and assume that you want the name of the return value of the function to be the rowname for the value that is used in the function. Now you can do something like this: for(i in 1:nrow(met)) { x-Scores(Z=metalofGT,formula=met[i]~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER) names(x)-names(met)[i] filename-paste(prep,i,.Rdata,sep=) save(x, file=filename, compress=bzip2) } This will produce five files with the names you requested, each containing whatever value the function Score produces. The name of that value will be the rowname of met that produced it. Jim On Fri, Jul 3, 2015 at 2:48 AM, Lida Zeighami lid.z...@gmail.com wrote: Thank you so much for replying me! for better understanding my problem, I explain my problem more: I have a 682*1 matrix called met , the first 5 rows similar below: rownames(met)[1:5] [1] glycine_imp [2] Nacetylglycine_imp [3] sarcosine_imp [4] dimethylglycine_imp [5] betaine_imp and I have a function in R that each time use one of the row names of met matrix and create a new object file and I should save the objects! my function is Scores(Z=metalofGT,formula=met[i]~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER) that each time just I should change the met[i] and replace by row names met one by one and for each of them I should rename the function and after that I should save each object! for example for first row of met I have prep1- Scores(Z=metalofGT,formula=glycine_imp~egfr_v1_ckdepi+pc1+pc2+pc3+V1AGE01+GENDER) #creat the object file for first row and called prep1### save(prep1, file=prep1.RData, compress=bzip2) ##save the object file as prep1.RData# I should do this process for 682 row names of met matrix and at the end I should haveprep1.RData , prep2.RData , prep3.RData so, would you please help me how to do it? Many Thanks, Ati On Wed, Jul 1, 2015 at 1:07 PM, Lida Zeighami lid.z...@gmail.com wrote: I have 682 variables in a data frame , and a function that I should feed 682 variables in this function one by one and each time save the file as a special name! for emaple: my data frame file includes 682 names : 1 aaa 2 bbb 3 dfdsfg 4 fghh . 682 fgfhg and a function like prep(Z, aaa, .) and each time I should change the variable name in this function and read the variable from the data frame and each time I should save the file as a special name such as: prep1- prep(z, aaa,...) prep2- prep(z, bbb,...) prep3- prep(z, dfdsfg,..) Prep4- prep(z, fghh,...) How can I use loop function in R to that? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] no slot of name fixef for this object of class lmerMod
Dear Iker, The internals of the mer model have changed. Use fixef(your.model). Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey Op 2 jul. 2015 22:17 schreef Iker Vaquero Alba karrasp...@yahoo.es: Hello everyone. I am trying to re-analyse some data with an R function I last used in 2011. Everything seemed to work fine then, but now, using the same code, it gives me this error: Error in R.pe(y, group1, group2, returnR = FALSE) : no slot of name fixef for this object of class lmerMod This is the part of the function that I think is relevant for the problem: # preparation #n - rowSums(y) N - length(y) k - length(unique(group1)) # clone g - length(unique(group2)) # round # require(lme4) # functions R.pe - function(y, group1, group2, returnR=TRUE) { mod - lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE) VarComp - lme4::VarCorr(mod) beta0- as.numeric(mod@fixef) var.e - attr(VarComp, sc)^2 # residual variance var.a1 - (as.numeric(VarComp[1])) # e.g. get clone R var.a2 - (as.numeric(VarComp[2])) # e.g. get round R R.group1 - var.a1/(var.a1+var.e) # clone level R.group2 - var.a2/(var.a2+var.e) R.groupr - var.a1/(var.a1+var.e+var.a2) if(returnR) return(list(R.group1=R.group1,R.group2=R.group2,R.groupr=R.groupr)) else return(list(beta0=beta0, var.e=var.e, var.a1=var.a1, var.a2=var.a2)) } I would appreciate any help about this. Let me know if you need more code, the function is obviously longer. Thank you very much in advance. Iker __ Dr. Iker Vaquero-Alba Daphne du Maurier Centre for Ecology and Conservation College of Life and Environmental Sciences University of Exeter, Cornwall Campus TR10 9FE Penryn U.K. http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/ https://eric.exeter.ac.uk/repository/handle/10036/3381 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] what constitutes a 'complete sentence'?
In that case, you need to create a minimal reproducible example and make it publicly available. Hadley On Friday, July 3, 2015, Federico Calboli federico.calb...@helsinki.fi wrote: On 3 Jul 2015, at 12:14, Hadley Wickham h.wick...@gmail.com javascript:; wrote: It might be a line break problem - I think you want: Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. Tried this and unfortunately it does not help. BW F Hadley On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli federico.calb...@helsinki.fi javascript:; wrote: Hi All, I am upgrading a package for CRAN, and I get this note: checking DESCRIPTION meta-information ... NOTE Malformed Description field: should contain one or more complete sentences. This is puzzling because: cat DESCRIPTION ... Description: Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data. ... In my understanding Functions designed to test for single gene/phenotype association and for pleiotropy on genetic and genomic data.” *is* a complete sentence. So, what is complete sentence in the opinion of whomever coded that check? Best F -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; __ R-help@r-project.org javascript:; mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ -- Federico Calboli Ecological Genetics Research Unit Department of Biosciences PO Box 65 (Biocenter 3, Viikinkaari 1) FIN-00014 University of Helsinki Finland federico.calb...@helsinki.fi javascript:; -- http://had.co.nz/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.