[R] Could R run Cox proportional hazard model with multiple failure time data
If my survival data includes more than two outcomes, for example death, disability and censored. Does R have corresponding packages or programes to run Cox proportional hazard model with multiple failure time data. Millions of thanks!! -- View this message in context: http://r.789695.n4.nabble.com/Could-R-run-Cox-proportional-hazard-model-with-multiple-failure-time-data-tp3821264p3821264.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] graph
Hello, I have downloaded graph package from http://www.bioconductor.org/packages/release/bioc/html/graph.html Is there anyone who can teach me how to install graph into R? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Planned comparison ANOVA
I am trying to do a priori ANOVA analysis for a class assignment. The professor uses SPSS and does not know R. I want to do a simple planned comparison but have been unable to find a function or specific help. There is a grouping variable with five levels and a subsequent response variable. I also created a few columns that contain my group contrasts to see if anything could come of that. My first hypothesis, for example, is that group 1 and group 5 differ. My second is that groups 1 2 differ from 4 5 and so on... I searched and found people wanting similar help, but their projects were a little beyond my R comprehension right now and the help given did not apply. -- View this message in context: http://r.789695.n4.nabble.com/Planned-comparison-ANOVA-tp3821357p3821357.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Tobit Fixed Effects
Thanks, Arne! But I'm having another problem now. When I transform my data into a pdata.frame form and try to run a tobit model with random effects I get an error. Below I provide the head of my data, the code I used and the error message. Any help? head(pdata) X X.1 year mun.cod uf.cod uf.name mun.name uf.mun ACACRELANDIA-2003 ACACRELANDIA-2003 1 2003 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2004CEIBIAPINA-2003 5561 2004 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2005 MGARACUAI-2007 11121 2005 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2006 MGSAO GERALDO-2006 16681 2006 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2007 PBSERTAOZINHO-2005 22241 2007 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2008PRPIEN-2008 27801 2008 1200013 12 AC ACRELANDIA ACACRELANDIA transfers populat agric.pib indust.pib servic.pib apu.pib tax.pib pib ACACRELANDIA-2003 9208695 31744.92 5292.439 26942.19 15955.14 4527.178 68506.73 ACACRELANDIA-2004 0 10668 48947.97 9353.529 33134.56 19922.54 5825.801 97261.86 ACACRELANDIA-2005 49287 11451 56291.90 11214.051 39326.32 23340.46 7661.003 114493.30 ACACRELANDIA-2006385000 11786 55290.26 11976.119 46405.99 27401.64 7730.059 121402.40 ACACRELANDIA-2007 1599730 11520 68478.03 15526.679 54555.67 31382.93 7550.055 146110.40 ACACRELANDIA-2008 1295000 11987 61736.50 12812.245 63688.96 37518.87 7824.615 146062.30 bol.fam ifdm mayor.party mayor.num mayor.name mayor.vot ACACRELANDIA-2003 0 0.4225000PSDB45 SEBASTI\xeaO BOCALOM RODRIGUES 2394 ACACRELANDIA-2004 402 0.3943083PSDB45 SEBASTI\xeaO BOCALOM RODRIGUES 2394 ACACRELANDIA-2005 742 0.5401000PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2006 779 0.5138000PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2007 932 0.5109000PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2008 968 0.5593250PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 mayor.vot.per mayor.coalt voters.able ACACRELANDIA-20030.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS / PDT6422 ACACRELANDIA-20040.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS / PDT6422 ACACRELANDIA-20050.4082 PP / PDT / PMDB / PPS / PFL / PSDB6422 ACACRELANDIA-20060.4082 PP / PDT / PMDB / PPS / PFL / PSDB6422 ACACRELANDIA-20070.4082 PP / PDT / PMDB / PPS / PFL / PSDB7548 ACACRELANDIA-20080.4082 PP / PDT / PMDB / PPS / PFL / PSDB7548 presd.turnout lula.vot lula.vot.per transfers.cap pt.dummy pres.turnout.cap ACACRELANDIA-2003 4282 2202 0.51425 0.10580790 0.4924669 ACACRELANDIA-2004 4282 2202 0.51425 0.0000 0.4013873 ACACRELANDIA-2005 4282 2202 0.51425 4.30416560 0.3739411 ACACRELANDIA-2006 4282 2202 0.5142532.66587480 0.3633124 ACACRELANDIA-2007 5461 2422 0.44400 138.86545140 0.4740451 ACACRELANDIA-2008 5461 2422 0.44400 108.03370320 0.4555769 pib.cap mun.vote mun.vote2 mun.vote3 mayor.party.r mayor.party.r2 lula.vot.weight ACACRELANDIA-2003 7.8788651PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2004 9.1171601PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2005 9.9985421PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2006 10.3005601PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2007 12.6831940 PSDB1.PSDB 0 2.Opposition5.592285e-06 ACACRELANDIA-2008 12.1850590 PSDB1.PSDB 0 2.Opposition5.592285e-06 trans.dummy transfers.cap.lag year2 district term pt.pt pt.coa pt.opp psdb.pt ACACRELANDIA-2003 1NA 2003-2004 PT/Opo0 0 0 1 0 ACACRELANDIA-2004 0NA 2003-2004 PT/Opo0 0 0 1 0 ACACRELANDIA-2005 1 474.56074 2005-2006 PT/Opo0 0 0 1 0 ACACRELANDIA-2006 1 22.94781 2005-2006 PT/Opo0 0 0 1 0 ACACRELANDIA-2007 1 0.0 2007-2008 PSDB/Opo1 0 0 0 0 ACACRELANDIA-2008 1 0.0 2007-2008 PSDB/Opo1 0 0 0 0 psdb.coa psdb.opp time transf.log
Re: [R] graph
Hi Sandy, This might help: http://stackoverflow.com/questions/1474081/how-do-i-install-an-r-package-from-source Best, Reza [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing matching values by related values
Thanks Michael. I tested it and it works for numeric values, but not for the 'text' values that I am comparing, thus comparing a with a,b, etc. Any advice how I can solve it? Thanks! -Oorspronkelijk bericht- Van: R. Michael Weylandt michael.weyla...@gmail.com [mailto:michael.weyla...@gmail.com] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm writing from my phone though) Michael Weylandt On Sep 17, 2011, at 4:33 PM, Janssen, K.J.M. k.j.m.jans...@umcutrecht.nl wrote: I am trying to replace values of a vector (consisting of 15 values) by a value that is related to a matching value in a dataset (consisting of 17 rows). Here's an example The vector: v - c(f,a,e,d,m,o,e,f,i,n,e,i,b,a,o) The dataset's columns consist of the following values d[,1] - c(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) d[,2] - 1:17 So I want to end up with a vector that consists of the values of the second colomn, when the value of the vector matches the value of the first colomn. Thus, I aim to end up with a vector with the following values c(6,1,5,4,13,15,5,6,9,14,5,9,2,1,15) Help is appreciated! -- De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. -- This message may contain confidential information and is...{{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] completing missing samples
Hello Michael, Joshua, Thanks alot for your replies, this really helps. As to my main problem - I am tryin to identify a cyclic behavior in a time-series using FFT, and I am struggiling with missing samples. It is not trivial that linear interpolation is the answer (it probably is not), but right now, I am toying with it. Thanks again for the help, Eran. On Sat, Sep 17, 2011 at 10:14 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: How are your time samples missing? If they are recorded as NA, the na.locf() function will fill them with the previous value (zero-order hold) and with the reversability arguments can give linear interpolation: library(xts) x = c(1:5,NA,6:10) x = xts(x,Sys.Date()+0:10) na.locf(x) (na.locf(x) + na.locf(x,fromLast=TRUE))/2 If the row is missing and you really want to put in data, the following may work -- though most time series analysis techniques are usually able to deal with irregularly spaced data, at least in my work -- library(xts) x = c(1:10) x = xts(x,c(Sys.Date() + 0:4,Sys.Date()+6:10)) tx = seq.Date(from = first(time(x)), to = last(time(x)), by = min(diff(time(x xNew = xts(rep(NA,length(tx)), tx) xNew[time(x)] - x then fill xNew as before. Hope this helps, Michael Weylandt On Mon, Sep 12, 2011 at 4:42 AM, Eran Eidinger e...@taykey.com wrote: Hello, I have a time-series that has some missing samples. I was thinking on completing them using either zero-order hold or linear interpolation. I am looking for an efiicient way (other than a loop...) of identifiying the missing time slots and filling them. Can you think of any methods that might help here? (obviously which(diff(time)min(diff(time))) will give the locations, but what then?) Thanks, Eran. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- * Eran Eidinger | Taykey Ltd | +972-54-5908077 | www.taykey.com * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Tobit Fixed Effects
Hi Felipe On 18 September 2011 09:09, Felipe Nunes felipnu...@gmail.com wrote: Thanks, Arne! But I'm having another problem now. When I transform my data into a pdata.frame form and try to run a tobit model with random effects I get an error. Below I provide the head of my data, the code I used and the error message. Any help? head(pdata) X X.1 year mun.cod uf.cod uf.name mun.name uf.mun ACACRELANDIA-2003 ACACRELANDIA-2003 1 2003 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2004 CEIBIAPINA-2003 5561 2004 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2005 MGARACUAI-2007 11121 2005 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2006 MGSAO GERALDO-2006 16681 2006 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2007 PBSERTAOZINHO-2005 22241 2007 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2008 PRPIEN-2008 27801 2008 1200013 12 AC ACRELANDIA ACACRELANDIA transfers populat agric.pib indust.pib servic.pib apu.pib tax.pib pib ACACRELANDIA-2003 920 8695 31744.92 5292.439 26942.19 15955.14 4527.178 68506.73 ACACRELANDIA-2004 0 10668 48947.97 9353.529 33134.56 19922.54 5825.801 97261.86 ACACRELANDIA-2005 49287 11451 56291.90 11214.051 39326.32 23340.46 7661.003 114493.30 ACACRELANDIA-2006 385000 11786 55290.26 11976.119 46405.99 27401.64 7730.059 121402.40 ACACRELANDIA-2007 1599730 11520 68478.03 15526.679 54555.67 31382.93 7550.055 146110.40 ACACRELANDIA-2008 1295000 11987 61736.50 12812.245 63688.96 37518.87 7824.615 146062.30 bol.fam ifdm mayor.party mayor.num mayor.name mayor.vot ACACRELANDIA-2003 0 0.4225000 PSDB 45 SEBASTI\xeaO BOCALOM RODRIGUES 2394 ACACRELANDIA-2004 402 0.3943083 PSDB 45 SEBASTI\xeaO BOCALOM RODRIGUES 2394 ACACRELANDIA-2005 742 0.5401000 PSDB 45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2006 779 0.5138000 PSDB 45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2007 932 0.5109000 PSDB 45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2008 968 0.5593250 PSDB 45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 mayor.vot.per mayor.coalt voters.able ACACRELANDIA-2003 0.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS / PDT 6422 ACACRELANDIA-2004 0.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS / PDT 6422 ACACRELANDIA-2005 0.4082 PP / PDT / PMDB / PPS / PFL / PSDB 6422 ACACRELANDIA-2006 0.4082 PP / PDT / PMDB / PPS / PFL / PSDB 6422 ACACRELANDIA-2007 0.4082 PP / PDT / PMDB / PPS / PFL / PSDB 7548 ACACRELANDIA-2008 0.4082 PP / PDT / PMDB / PPS / PFL / PSDB 7548 presd.turnout lula.vot lula.vot.per transfers.cap pt.dummy pres.turnout.cap ACACRELANDIA-2003 4282 2202 0.51425 0.1058079 0 0.4924669 ACACRELANDIA-2004 4282 2202 0.51425 0.000 0 0.4013873 ACACRELANDIA-2005 4282 2202 0.51425 4.3041656 0 0.3739411 ACACRELANDIA-2006 4282 2202 0.51425 32.6658748 0 0.3633124 ACACRELANDIA-2007 5461 2422 0.44400 138.8654514 0 0.4740451 ACACRELANDIA-2008 5461 2422 0.44400 108.0337032 0 0.4555769 pib.cap mun.vote mun.vote2 mun.vote3 mayor.party.r mayor.party.r2 lula.vot.weight ACACRELANDIA-2003 7.878865 1 PT 0.PT 0 2.Opposition 5.084315e-06 ACACRELANDIA-2004 9.117160 1 PT 0.PT 0 2.Opposition 5.084315e-06 ACACRELANDIA-2005 9.998542 1 PT 0.PT 0 2.Opposition 5.084315e-06 ACACRELANDIA-2006 10.300560 1 PT 0.PT 0 2.Opposition 5.084315e-06 ACACRELANDIA-2007 12.683194 0 PSDB 1.PSDB 0 2.Opposition 5.592285e-06 ACACRELANDIA-2008 12.185059 0 PSDB 1.PSDB 0 2.Opposition 5.592285e-06 trans.dummy transfers.cap.lag year2 district term pt.pt pt.coa pt.opp psdb.pt ACACRELANDIA-2003 1 NA 2003-2004 PT/Opo 0 0 0 1 0 ACACRELANDIA-2004 0 NA 2003-2004 PT/Opo 0 0 0 1 0 ACACRELANDIA-2005 1 474.56074 2005-2006 PT/Opo 0 0 0 1 0 ACACRELANDIA-2006 1 22.94781 2005-2006 PT/Opo 0 0 0 1 0 ACACRELANDIA-2007 1 0.0 2007-2008 PSDB/Opo 1 0
Re: [R] R kiteChart (plotrix) arguments
On 09/18/2011 04:42 AM, antqueen wrote: Hey, I hope someone is able to help. I've created a graph using kiteChart (in the plotrix package) but need to know how to perform some basic text alterations to the graph. I would like to re-orientate the text on the y-axis from vertical to horizontal. I understand that the argument normally for this is las=1. However, this does not seem to work. Perhaps kitechart uses an alternative argument? I also need to re-size the text on both axes. I've used both cex and cex.axis but again nothing seems to be working. However, I can get the axes labels to change size using cex.lab, but just not the numbers on the tick marks. Its a bit frustrating!!! Hi antqueen, Try this before calling kiteChart: par(las=1,cex.axis=1.2) Seems to work for me with the examples on the help page. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] completing missing samples
On Mon, Sep 12, 2011 at 4:42 AM, Eran Eidinger e...@taykey.com wrote: Hello, I have a time-series that has some missing samples. I was thinking on completing them using either zero-order hold or linear interpolation. I am looking for an efiicient way (other than a loop...) of identifiying the missing time slots and filling them. Can you think of any methods that might help here? (obviously which(diff(time)min(diff(time))) will give the locations, but what then?) The zoo package has na.approx, na.fill, na.locf, na, na.spline na.StructTS and the stinepack package has na.stinterp. Each of these fill in NAs in zoo series and certain other objects. See the help files for many examples. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] calculating VAR of a (Gumbel) copula
Hello, I am a new user of R (2.13.1), my operational system is Windows Vista. I have a problem with the attached file SFEVaRHAC.r, calculating the VAR of a Gumbel copula, based on the attached GumHAC_VaR_PL_w250_n1000_s2500.txt 1. I had a Error in file(file, rt) : cannot open the connection message. I solved it by reading a post in nabble to use setwd(choose.dir()) and read.table(file.choose()) and point the location of each file directly. 2. However, there is some other error - as I run the code now I get an output:* Null Devise 1* I am 100 % sure I have installed the used packages correctly and I don't have any idea what is wrong. Could somebody help me with this issue? Best, Iva http://r.789695.n4.nabble.com/file/n3821566/SFEVaRHAC.r SFEVaRHAC.r http://r.789695.n4.nabble.com/file/n3821566/GumHAC_VaR_PL_w250_n1000_s2500.txt GumHAC_VaR_PL_w250_n1000_s2500.txt -- View this message in context: http://r.789695.n4.nabble.com/calculating-VAR-of-a-Gumbel-copula-tp3821566p3821566.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R-help Digest, Vol 103, Issue 17
Szeptember 12-től 26-ig irodán kívül vagyok, és az emailjeimet nem érem el. Sürgős esetben kérem forduljon Kárpáti Edithez (karpati.e...@gyemszi.hu). Üdvözlettel, Mihalicza Péter I will be out of the office from 12 till 26 September with no access to my emails. In urgent cases please contact Ms. Edit Kárpáti (karpati.e...@gyemszi.hu). With regards, Peter Mihalicza __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R kiteChart (plotrix) arguments
excellent it worked, thanks so much Jim. I am new to R so still need time to get used to the commands! -- View this message in context: http://r.789695.n4.nabble.com/R-kiteChart-plotrix-arguments-tp3820688p3821729.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph
On Sep 17, 2011, at 10:45 PM, Sandy Mitchell wrote: Hello, I have downloaded graph package from http://www.bioconductor.org/packages/release/bioc/html/graph.html Is there anyone who can teach me how to install graph into R? What happens when you follow the instructions on that page? (They are right at the top.) -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] calculating VAR of a (Gumbel) copula
On Sep 18, 2011, at 5:51 AM, Iva wrote: Hello, I am a new user of R (2.13.1), my operational system is Windows Vista. I have a problem with the attached file SFEVaRHAC.r, calculating the VAR of a Gumbel copula, based on the attached GumHAC_VaR_PL_w250_n1000_s2500.txt 1. I had a Error in file(file, rt) : cannot open the connection message. I solved it by reading a post in nabble to use setwd(choose.dir()) and read.table(file.choose()) and point the location of each file directly. 2. However, there is some other error - as I run the code now I get an output:* Null Devise 1* I am 100 % sure I have installed the used packages correctly and I don't have any idea what is wrong. Maybe nothing? Could somebody help me with this issue? Perhaps the procedure succeeded and you are misinterpreting the console message about the current active device (in your case the NULL device) and in my case R says this: dev.off() quartz 2 Have you checked you working directory to see what PL_VaR_Gumbel 3D_0.05.pdf file looks like? -- David. Best, Iva http://r.789695.n4.nabble.com/file/n3821566/SFEVaRHAC.r SFEVaRHAC.r http://r.789695.n4.nabble.com/file/n3821566/GumHAC_VaR_PL_w250_n1000_s2500.txt GumHAC_VaR_PL_w250_n1000_s2500.txt -- View this message in context: http://r.789695.n4.nabble.com/calculating-VAR-of-a-Gumbel-copula-tp3821566p3821566.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing matching values by related values
On Sep 18, 2011, at 3:56 AM, Janssen, K.J.M. wrote: Thanks Michael. I tested it and it works for numeric values, but not for the 'text' values that I am comparing, thus comparing a with a,b, etc. Any advice how I can solve it? Solve what? You never posted full working code and an explicit example. Unless there were actually objects named a, b, c, etc. in your workspace then the code that started out: v - c(f,a,e,d,m, would not have been meaningful except to hint at the possibility that you might be comparing character vectors. I assumed that d[,2] was actually letters[1:17] rather than what you wrote. It's especially important to indicate whehte ryou have attached any objects. Post dput(head(d)) and dput(v) for the example part and include any code use to construct them. -- david. Thanks! -Oorspronkelijk bericht- Van: R. Michael Weylandt michael.weyla...@gmail.com [mailto:michael.weyla...@gmail.com ] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm writing from my phone though) Michael Weylandt On Sep 17, 2011, at 4:33 PM, Janssen, K.J.M. k.j.m.jans...@umcutrecht.nl wrote: I am trying to replace values of a vector (consisting of 15 values) by a value that is related to a matching value in a dataset (consisting of 17 rows). Here's an example The vector: v - c(f,a,e,d,m,o,e,f,i,n,e,i,b,a,o) The dataset's columns consist of the following values d[,1] - c(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) d[,2] - 1:17 So I want to end up with a vector that consists of the values of the second colomn, when the value of the vector matches the value of the first colomn. Thus, I aim to end up with a vector with the following values c(6,1,5,4,13,15,5,6,9,14,5,9,2,1,15) Help is appreciated! -- De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. -- This message may contain confidential information and is... {{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Removing a single element from an array
R 2.13.1 OS X Colleagues I frequently encounter a situation in which I want to remove a single element of an array. For example, if I am reading in a bunch of CSV files, I create the list of files to be read with: LIST- dir() However, sometimes I want to exclude one or more files. I can accomplish this with a second command: LIST- LIST[LIST != filename.to.be.excluded] This is cumbersome -- is there some more efficient code to accomplish this? Dennis Dennis Fisher MD P (The P Less Than Company) Phone: 1-866-PLessThan (1-866-753-7784) Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing matching values by related values
Apologies, I wanted to make life easier by shortly describing my problem. Indeed, it is better to post the full code. I am not familiar with the dput, but I have pasted the code that I have used below. d - matrix(NA,15,5) d - as.data.frame(d) colnames(d) - c(studynumber,t1,t2,t[,1],t[,2]) d$studynumber - c(1:15)# add study numbers to select studies in scenarios d$t1 -c(car_pac,car_pac,cis_vin,car_pac,cis_doc,cis_gem,cis_gem,cis_vin,car_pac,car_doc,car_pac,car_pac,car_doc.pac,cis_vin,cis_iri) d$t2 -c(gef,bev_car_pac,cet_cis_vin,gef,gef,bev_cis_gem,cis_pem,cet_cis_vin,car_gem_pac,car_pem,erl,cis_pac,cet_car_doc.pac,cis_doc,car_pac) # Link treatment to relating treatment number: make vector of all unique treatment options t1 - duplicated(c(d$t1,d$t2)) # returns TRUE and False, implying that we can need it so select t2 - c(d$t1,d$t2) # combine both vectors, as treatments can be both reference as index treatment t3 - na.omit(ifelse(t1==FALSE,c(d$t1,d$t2),NA))[1:nt] # omit double treatment #make dataset with first colomn all possible treatments, and second colomn their respective numbers t.n - matrix(NA,17,2) # list possible treatments (here 17), and link them to numbers t.n - as.data.frame(t.n) colnames(t.n) - c(treatment,numbers) t.n$treatment - t3 t.n$numbers - 1:17 # link treatments in d with treatment numbers in dataset t.n Here is where I aim to fill d$t[,1] and d$t[,2] with the corresrponding numbers from t.n Thanks. Kristel -Oorspronkelijk bericht- Van: David Winsemius [mailto:dwinsem...@comcast.net] Verzonden: zo 18-9-2011 15:20 Aan: Janssen, K.J.M. CC: michael.weyla...@gmail.com; r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values On Sep 18, 2011, at 3:56 AM, Janssen, K.J.M. wrote: Thanks Michael. I tested it and it works for numeric values, but not for the 'text' values that I am comparing, thus comparing a with a,b, etc. Any advice how I can solve it? Solve what? You never posted full working code and an explicit example. Unless there were actually objects named a, b, c, etc. in your workspace then the code that started out: v - c(f,a,e,d,m, would not have been meaningful except to hint at the possibility that you might be comparing character vectors. I assumed that d[,2] was actually letters[1:17] rather than what you wrote. It's especially important to indicate whehte ryou have attached any objects. Post dput(head(d)) and dput(v) for the example part and include any code use to construct them. -- david. Thanks! -Oorspronkelijk bericht- Van: R. Michael Weylandt michael.weyla...@gmail.com [mailto:michael.weyla...@gmail.com ] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm writing from my phone though) Michael Weylandt On Sep 17, 2011, at 4:33 PM, Janssen, K.J.M. k.j.m.jans...@umcutrecht.nl wrote: I am trying to replace values of a vector (consisting of 15 values) by a value that is related to a matching value in a dataset (consisting of 17 rows). Here's an example The vector: v - c(f,a,e,d,m,o,e,f,i,n,e,i,b,a,o) The dataset's columns consist of the following values d[,1] - c(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) d[,2] - 1:17 So I want to end up with a vector that consists of the values of the second colomn, when the value of the vector matches the value of the first colomn. Thus, I aim to end up with a vector with the following values c(6,1,5,4,13,15,5,6,9,14,5,9,2,1,15) Help is appreciated! -- De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. -- This message may contain confidential information and is... {{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
Re: [R] Removing a single element from an array
On Sep 18, 2011, at 10:47 AM, Dennis Fisher wrote: R 2.13.1 OS X Colleagues I frequently encounter a situation in which I want to remove a single element of an array. For example, if I am reading in a bunch of CSV files, I create the list of files to be read with: LIST- dir() However, sometimes I want to exclude one or more files. I can accomplish this with a second command: LIST- LIST[LIST != filename.to.be.excluded] This is cumbersome -- is there some more efficient code to accomplish this? Doesn't negative indexing provide this? ?Extract -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Alternatives to integrate?
Hello all, Returning to this question, I would like to ask for help on how to integrate the PMF of a discrete distribution - Michael's guess about the most immediate problem (Sep 01, 2011; 2:44pm). I was thinking in two ways to do this: First is numerically integrate the function but sampling it only at integer values. For this, I've used the rectangle method of integration: leftrect - function(f, from, to, n, ...) { h - (to - from) / n sum - 0 d - list(...) for(i in seq(from, to-h, h)) { dots - c(list(i), d) sum - sum + do.call(f, dots) } return(h * sum) } Second option in my mind is to, find and replace the discrete function by a continuous version, but I've no idea how to do this. First option don't gave results as good. May another method ... ? Is it possible to specify the sampling points in Integrate? Any comments are welcome. Thanks in advanve. On Wed, Sep 7, 2011 at 4:47 AM, Berend Hasselman b...@xs4all.nl wrote: . wrote: Hi, continuing the improvements... I've prepared a new code: ddae - function(individuals, frac, sad, samp=pois, trunc=0, ...) { dots - list(...) Compound - function(individuals, frac, n.species, sad, samp, dots) { print(c(Size:, length(individuals), Compound individuals:, individuals, End.)) RegDist - function(n.species, sad, dots) { # RegDist may be Exponential, Gamma, etc. dcom - paste(d, as.name(sad), sep=) dots - as.list(c(n.species, dots)) ans - do.call(dcom, dots) return(ans) } SampDist - function(individuals, frac, n.species, samp) { # SampDist may be Poisson or Negative Binomial dcom - paste(d, samp, sep=) lambda - frac * n.species dots - as.list(c(individuals, lambda)) ans - do.call(dcom, dots) return(ans) } ans - RegDist(n.species, sad, dots) * SampDist(individuals, frac, n.species, samp) return(ans) } IntegrateScheme - function(Compound, individuals, frac, sad, samp, dots) { print(c(Size:, length(individuals), Integrate individuals:, individuals)) ans - integrate(Compound, 0, 2000, individuals, frac, sad, samp, dots)$value return(ans) } ans - IntegrateScheme(Compound, individuals, frac, sad, samp, dots) return(ans) } ddae(2, 0.05, exp) Now I can't understand what happen to individuals, why is it changing in value and size? I've tried to traceback() and debug(), but I was not smart enough to understand what is going on. Could you, please, give some more help? From the help for integrate argument f : an R function taking a numeric first argument and returning a numeric vector of the same length. . Function Compound is passed to integrate. First argument is individuals and integrate is integrating over individuals. That is why it is changing in value and size: integrate is only doing what you asked it do. The code is too uncommented and convoluted to supply further comments. You really should simplify this Berend -- View this message in context: http://r.789695.n4.nabble.com/Alternatives-to-integrate-tp3783624p3795491.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Removing a single element from an array
On Sep 18, 2011, at 11:10 AM, David Winsemius wrote: On Sep 18, 2011, at 10:47 AM, Dennis Fisher wrote: R 2.13.1 OS X Colleagues I frequently encounter a situation in which I want to remove a single element of an array. For example, if I am reading in a bunch of CSV files, I create the list of files to be read with: LIST- dir() However, sometimes I want to exclude one or more files. I can accomplish this with a second command: LIST- LIST[LIST != filename.to.be.excluded] This is cumbersome -- is there some more efficient code to accomplish this? Doesn't negative indexing provide this? ?Extract The most general way to convert character vectors to numbers for this purpose is with grep which therefore supports regex patterns: LIST - dir(path=~/) length(LIST) [1] 551 LIST[1] [1] _train_1.dat LIST - LIST[ -grep(_train_1.dat, LIST) ] length(LIST) [1] 550 Patterns can also be used in the dir() call. -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing matching values by related values
in your assignment for t3 you use nt which is undefined. thus t.n$treatment is NAs but: df-data.frame(num=1:10,let=letters[1:10]) dat-data.frame(let=sample(letters[1:10],20,replace=T)) dat$matched-df$num[match(dat$let,df$let)] should get you started On Sun, Sep 18, 2011 at 7:56 AM, Janssen, K.J.M. k.j.m.jans...@umcutrecht.nl wrote: Apologies, I wanted to make life easier by shortly describing my problem. Indeed, it is better to post the full code. I am not familiar with the dput, but I have pasted the code that I have used below. d - matrix(NA,15,5) d - as.data.frame(d) colnames(d) - c(studynumber,t1,t2,t[,1],t[,2]) d$studynumber - c(1:15)# add study numbers to select studies in scenarios d$t1 -c(car_pac,car_pac,cis_vin,car_pac,cis_doc,cis_gem,cis_gem,cis_vin,car_pac,car_doc,car_pac,car_pac,car_doc.pac,cis_vin,cis_iri) d$t2 -c(gef,bev_car_pac,cet_cis_vin,gef,gef,bev_cis_gem,cis_pem,cet_cis_vin,car_gem_pac,car_pem,erl,cis_pac,cet_car_doc.pac,cis_doc,car_pac) # Link treatment to relating treatment number: make vector of all unique treatment options t1 - duplicated(c(d$t1,d$t2)) # returns TRUE and False, implying that we can need it so select t2 - c(d$t1,d$t2) # combine both vectors, as treatments can be both reference as index treatment t3 - na.omit(ifelse(t1==FALSE,c(d$t1,d$t2),NA))[1:nt] # omit double treatment #make dataset with first colomn all possible treatments, and second colomn their respective numbers t.n - matrix(NA,17,2) # list possible treatments (here 17), and link them to numbers t.n - as.data.frame(t.n) colnames(t.n) - c(treatment,numbers) t.n$treatment - t3 t.n$numbers - 1:17 # link treatments in d with treatment numbers in dataset t.n Here is where I aim to fill d$t[,1] and d$t[,2] with the corresrponding numbers from t.n Thanks. Kristel -Oorspronkelijk bericht- Van: David Winsemius [mailto:dwinsem...@comcast.net] Verzonden: zo 18-9-2011 15:20 Aan: Janssen, K.J.M. CC: michael.weyla...@gmail.com; r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values On Sep 18, 2011, at 3:56 AM, Janssen, K.J.M. wrote: Thanks Michael. I tested it and it works for numeric values, but not for the 'text' values that I am comparing, thus comparing a with a,b, etc. Any advice how I can solve it? Solve what? You never posted full working code and an explicit example. Unless there were actually objects named a, b, c, etc. in your workspace then the code that started out: v - c(f,a,e,d,m, would not have been meaningful except to hint at the possibility that you might be comparing character vectors. I assumed that d[,2] was actually letters[1:17] rather than what you wrote. It's especially important to indicate whehte ryou have attached any objects. Post dput(head(d)) and dput(v) for the example part and include any code use to construct them. -- david. Thanks! -Oorspronkelijk bericht- Van: R. Michael Weylandt michael.weyla...@gmail.com [mailto: michael.weyla...@gmail.com ] Verzonden: zo 18-9-2011 2:27 Aan: Janssen, K.J.M. CC: r-help@r-project.org Onderwerp: Re: [R] Replacing matching values by related values Try playing with match(). Something like d[match(v,d[,1]),2] Should work (untested bc I'm writing from my phone though) Michael Weylandt On Sep 17, 2011, at 4:33 PM, Janssen, K.J.M. k.j.m.jans...@umcutrecht.nl wrote: I am trying to replace values of a vector (consisting of 15 values) by a value that is related to a matching value in a dataset (consisting of 17 rows). Here's an example The vector: v - c(f,a,e,d,m,o,e,f,i,n,e,i,b,a,o) The dataset's columns consist of the following values d[,1] - c(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) d[,2] - 1:17 So I want to end up with a vector that consists of the values of the second colomn, when the value of the vector matches the value of the first colomn. Thus, I aim to end up with a vector with the following values c(6,1,5,4,13,15,5,6,9,14,5,9,2,1,15) Help is appreciated! -- De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct te informeren door het bericht te retourneren. Het Universitair Medisch Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197. Denk s.v.p aan het milieu voor u deze e-mail afdrukt. -- This message may contain confidential information and is... {{dropped:12}}
Re: [R] Extracting a a chunk of text from a pdf file
Unfortunately pdf2text doesn't seem to exist either in linux or mac osx. Ciao Vittorio Il giorno 17/set/2011, alle ore 21:00, Jeff Newmiller ha scritto: Doesn't seen like an R task, but see pdf2text? (From pdftools, UNIX command line tools) --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Victor vdem...@gmail.com wrote: In an R script I need to extract some figures from many web pages in pdf format. As an example see http://www.terna.it/LinkClick.aspx?fileticket=TTQuOPUf%2fs0%3damp;tabid=435amp;mid=3072 from which I would like to extract the Totale: 1,025,823). Is there any solution? Ciao Vittorio R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] troubles with a for loop
Dear all, I am a stata user and I am moving my first steps in R. I am dealing with a silly issue concerning looping over variables. I read previous posts on similar topics in the R help archive, but I did not find a solution. Here is my case: I run a simple bivariate linear regression saving the output in objects called: pd.memb.0, pd.memb.1, pd.memb.2, pd.memb.3 pd.memb.0 - lm(E.fs.memb ~ M.fs.memb, data, subset = (tag2 == 1)) pd.memb.1 - lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb = quantile(M.fs.memb, .25) tag2 == 1)) pd.memb.2 - lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .25) M.fs.memb = quantile(M.fs.memb, .75) tag2 == 1)) pd.memb.3 - lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .75) tag2 == 1)) Subsequently, I wish to plot my data superimposing a different line for each regression model. Here I am trying to apply my loop. Looking at the info I found around, the following code sound to me as correct, but I am wrong. plot(M.fs.memb , E.fs.memb) for(i = 1:3){ curve(coef(pd.memb.i)[1] + coef(pd.memb.i)[2]*x, add = T, cex = 100, col = red) } The plot is plotted, but the curves are not printed and I get the following error message: Error in coef(pd.memb.i) : error in evaluating the argument 'object' in selecting a method for function 'coef' }Error: unexpected '}' in } What am I doing wrong? Thanks a lot for your help, f. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extracting a a chunk of text from a pdf file
On Sun, Sep 18, 2011 at 7:44 AM, Victor vdem...@gmail.com wrote: Unfortunately pdf2text doesn't seem to exist either in linux or mac osx. I think Jeff's main point was to search for software specific for your task (convert a pdf to text). Formatting will be lost so once you get your text files, I would look at regular expressions to try to find the right part of text to grab. Some general functions that seem like they might be relevant: ## for getting the text into R ?readLines ?scan ## for finding the part you need ?regexp ?grep Cheers, Josh Ciao Vittorio Il giorno 17/set/2011, alle ore 21:00, Jeff Newmiller ha scritto: Doesn't seen like an R task, but see pdf2text? (From pdftools, UNIX command line tools) --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Victor vdem...@gmail.com wrote: In an R script I need to extract some figures from many web pages in pdf format. As an example see http://www.terna.it/LinkClick.aspx?fileticket=TTQuOPUf%2fs0%3damp;tabid=435amp;mid=3072 from which I would like to extract the Totale: 1,025,823). Is there any solution? Ciao Vittorio R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] troubles with a for loop
You don't have a variable named pd.memb.i Instead, you need something like: get(paste(pd.memb., i, sep=)) The error message you're getting, though, is because your loop syntax is wrong: for(i in 1:3) { do something } Sarah On Sun, Sep 18, 2011 at 12:05 PM, Francesco Sarracino f.sarrac...@gmail.com wrote: Dear all, I am a stata user and I am moving my first steps in R. I am dealing with a silly issue concerning looping over variables. I read previous posts on similar topics in the R help archive, but I did not find a solution. Here is my case: I run a simple bivariate linear regression saving the output in objects called: pd.memb.0, pd.memb.1, pd.memb.2, pd.memb.3 pd.memb.0 - lm(E.fs.memb ~ M.fs.memb, data, subset = (tag2 == 1)) pd.memb.1 - lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb = quantile(M.fs.memb, .25) tag2 == 1)) pd.memb.2 - lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .25) M.fs.memb = quantile(M.fs.memb, .75) tag2 == 1)) pd.memb.3 - lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .75) tag2 == 1)) Subsequently, I wish to plot my data superimposing a different line for each regression model. Here I am trying to apply my loop. Looking at the info I found around, the following code sound to me as correct, but I am wrong. plot(M.fs.memb , E.fs.memb) for(i = 1:3){ curve(coef(pd.memb.i)[1] + coef(pd.memb.i)[2]*x, add = T, cex = 100, col = red) } The plot is plotted, but the curves are not printed and I get the following error message: Error in coef(pd.memb.i) : error in evaluating the argument 'object' in selecting a method for function 'coef' }Error: unexpected '}' in } What am I doing wrong? Thanks a lot for your help, f. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Tobit Fixed Effects
Thanks! *Felipe Nunes* CAPES/Fulbright Fellow PhD Student Political Science - UCLA Web: felipenunes.bol.ucla.edu On Sun, Sep 18, 2011 at 2:19 AM, Arne Henningsen arne.henning...@googlemail.com wrote: Hi Felipe On 18 September 2011 09:09, Felipe Nunes felipnu...@gmail.com wrote: Thanks, Arne! But I'm having another problem now. When I transform my data into a pdata.frame form and try to run a tobit model with random effects I get an error. Below I provide the head of my data, the code I used and the error message. Any help? head(pdata) X X.1 year mun.cod uf.cod uf.name mun.name uf.mun ACACRELANDIA-2003 ACACRELANDIA-2003 1 2003 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2004CEIBIAPINA-2003 5561 2004 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2005 MGARACUAI-2007 11121 2005 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2006 MGSAO GERALDO-2006 16681 2006 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2007 PBSERTAOZINHO-2005 22241 2007 1200013 12 AC ACRELANDIA ACACRELANDIA ACACRELANDIA-2008PRPIEN-2008 27801 2008 1200013 12 AC ACRELANDIA ACACRELANDIA transfers populat agric.pib indust.pib servic.pib apu.pib tax.pib pib ACACRELANDIA-2003 9208695 31744.92 5292.439 26942.19 15955.14 4527.178 68506.73 ACACRELANDIA-2004 0 10668 48947.97 9353.529 33134.56 19922.54 5825.801 97261.86 ACACRELANDIA-2005 49287 11451 56291.90 11214.051 39326.32 23340.46 7661.003 114493.30 ACACRELANDIA-2006385000 11786 55290.26 11976.119 46405.99 27401.64 7730.059 121402.40 ACACRELANDIA-2007 1599730 11520 68478.03 15526.679 54555.67 31382.93 7550.055 146110.40 ACACRELANDIA-2008 1295000 11987 61736.50 12812.245 63688.96 37518.87 7824.615 146062.30 bol.fam ifdm mayor.party mayor.num mayor.name mayor.vot ACACRELANDIA-2003 0 0.4225000PSDB45 SEBASTI\xeaO BOCALOM RODRIGUES 2394 ACACRELANDIA-2004 402 0.3943083PSDB45 SEBASTI\xeaO BOCALOM RODRIGUES 2394 ACACRELANDIA-2005 742 0.5401000PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2006 779 0.5138000PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2007 932 0.5109000PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 ACACRELANDIA-2008 968 0.5593250PSDB45 SEBASTI\xcdO BOCALOM RODRIGUES 2173 mayor.vot.per mayor.coalt voters.able ACACRELANDIA-20030.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS / PDT6422 ACACRELANDIA-20040.5901 PSDB / PT / PC do B / PV / PMN / PSB / PPS / PDT6422 ACACRELANDIA-20050.4082 PP / PDT / PMDB / PPS / PFL / PSDB6422 ACACRELANDIA-20060.4082 PP / PDT / PMDB / PPS / PFL / PSDB6422 ACACRELANDIA-20070.4082 PP / PDT / PMDB / PPS / PFL / PSDB7548 ACACRELANDIA-20080.4082 PP / PDT / PMDB / PPS / PFL / PSDB7548 presd.turnout lula.vot lula.vot.per transfers.cap pt.dummy pres.turnout.cap ACACRELANDIA-2003 4282 2202 0.51425 0.1058079 0 0.4924669 ACACRELANDIA-2004 4282 2202 0.51425 0.000 0 0.4013873 ACACRELANDIA-2005 4282 2202 0.51425 4.3041656 0 0.3739411 ACACRELANDIA-2006 4282 2202 0.5142532.6658748 0 0.3633124 ACACRELANDIA-2007 5461 2422 0.44400 138.8654514 0 0.4740451 ACACRELANDIA-2008 5461 2422 0.44400 108.0337032 0 0.4555769 pib.cap mun.vote mun.vote2 mun.vote3 mayor.party.r mayor.party.r2 lula.vot.weight ACACRELANDIA-2003 7.8788651PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2004 9.1171601PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2005 9.9985421PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2006 10.3005601PT 0.PT 0 2.Opposition5.084315e-06 ACACRELANDIA-2007 12.6831940 PSDB1.PSDB 0 2.Opposition5.592285e-06 ACACRELANDIA-2008 12.1850590 PSDB1.PSDB 0 2.Opposition5.592285e-06 trans.dummy transfers.cap.lag year2 district term pt.pt pt.coa pt.opp psdb.pt ACACRELANDIA-2003 1NA 2003-2004 PT/Opo0 0 0 1 0 ACACRELANDIA-2004 0NA 2003-2004 PT/Opo0 0 0
Re: [R] troubles with a for loop
Sarah has told you how to get from where you are to where you want to be. However, it is easier to start somewhere else. The more R way to do what you are doing is to use a list to put the results of your regressions into. It is then very easy to use that list, and it is easier to keep track of. The two documents mentioned in my signature may help you get up and running in R. Since you are coming from Stata, you should also look at http://r4stats.com On 18/09/2011 17:05, Francesco Sarracino wrote: Dear all, I am a stata user and I am moving my first steps in R. I am dealing with a silly issue concerning looping over variables. I read previous posts on similar topics in the R help archive, but I did not find a solution. Here is my case: I run a simple bivariate linear regression saving the output in objects called: pd.memb.0, pd.memb.1, pd.memb.2, pd.memb.3 pd.memb.0- lm(E.fs.memb ~ M.fs.memb, data, subset = (tag2 == 1)) pd.memb.1- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb= quantile(M.fs.memb, .25) tag2 == 1)) pd.memb.2- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .25) M.fs.memb= quantile(M.fs.memb, .75) tag2 == 1)) pd.memb.3- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .75) tag2 == 1)) Subsequently, I wish to plot my data superimposing a different line for each regression model. Here I am trying to apply my loop. Looking at the info I found around, the following code sound to me as correct, but I am wrong. plot(M.fs.memb , E.fs.memb) for(i = 1:3){ curve(coef(pd.memb.i)[1] + coef(pd.memb.i)[2]*x, add = T, cex = 100, col = red) } The plot is plotted, but the curves are not printed and I get the following error message: Error in coef(pd.memb.i) : error in evaluating the argument 'object' in selecting a method for function 'coef' }Error: unexpected '}' in } What am I doing wrong? Thanks a lot for your help, f. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Patrick Burns pbu...@pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno') __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] troubles with a for loop
Furthermore, if you want to add lines to a plot, I'd advise against the curve() function, rather use lines() to add lines (or points() for, well, points) on a plot. E.g., x - seq(0,10,by=0.025) y - sin(x) y2 - cos(x) plot(x,y,type=l,col=red4,lwd=3) lines(x,y2) curve() wouldn't work for this Michael On Sun, Sep 18, 2011 at 1:23 PM, Patrick Burns pbu...@pburns.seanet.comwrote: Sarah has told you how to get from where you are to where you want to be. However, it is easier to start somewhere else. The more R way to do what you are doing is to use a list to put the results of your regressions into. It is then very easy to use that list, and it is easier to keep track of. The two documents mentioned in my signature may help you get up and running in R. Since you are coming from Stata, you should also look at http://r4stats.com On 18/09/2011 17:05, Francesco Sarracino wrote: Dear all, I am a stata user and I am moving my first steps in R. I am dealing with a silly issue concerning looping over variables. I read previous posts on similar topics in the R help archive, but I did not find a solution. Here is my case: I run a simple bivariate linear regression saving the output in objects called: pd.memb.0, pd.memb.1, pd.memb.2, pd.memb.3 pd.memb.0- lm(E.fs.memb ~ M.fs.memb, data, subset = (tag2 == 1)) pd.memb.1- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb= quantile(M.fs.memb, .25) tag2 == 1)) pd.memb.2- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .25) M.fs.memb= quantile(M.fs.memb, .75) tag2 == 1)) pd.memb.3- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .75) tag2 == 1)) Subsequently, I wish to plot my data superimposing a different line for each regression model. Here I am trying to apply my loop. Looking at the info I found around, the following code sound to me as correct, but I am wrong. plot(M.fs.memb , E.fs.memb) for(i = 1:3){ curve(coef(pd.memb.i)[1] + coef(pd.memb.i)[2]*x, add = T, cex = 100, col = red) } The plot is plotted, but the curves are not printed and I get the following error message: Error in coef(pd.memb.i) : error in evaluating the argument 'object' in selecting a method for function 'coef' }Error: unexpected '}' in } What am I doing wrong? Thanks a lot for your help, f. [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Patrick Burns pbu...@pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/**blog http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno') __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] calculating VAR of a (Gumbel) copula
Yes, David, you are right - I have misinterpreted the result. The.pdf is the exact output and the algorithm is working. Many thanks! Ivette -- View this message in context: http://r.789695.n4.nabble.com/calculating-VAR-of-a-Gumbel-copula-tp3821566p3822196.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extracting a a chunk of text from a pdf file
That's exactly the way I work. Here you are a chunk of text of my script. To put it in a nutshell I'm already extracting - by means of grep and gsub from indweb (luckily an html file) - the web addresses like http://www.terna.it/LinkClick.aspx?fileticket=TTQuOPUf%2fs0%3damp;tabid=435amp;mid=3072 and the likes, pdf files (unfortunately for me). That's why I need to translate the pdf into a txt file. Ciao Vittorio == indweb-http://www.terna.it/default/Home/SISTEMA_ELETTRICO/dispacciamento/dati_esercizio/dati_giornalieri/confronto.aspx; testo-readLines(indweb) k-grep(^(.)+dnn_ctr3072_DocumentTerna_grdDocuments_(.)+CategoryCell\(\\d\\d)/(\\d\\d)/201(\\d),testo) n-length(k) # Poichè le date sono in ordine decrescente, ordina in ordine crescente k-k[order(k,decreasing=TRUE)] for (i in 1:length(k) ) { data-gsub(^(.)+dnn_ctr3072_DocumentTerna_grdDocuments_(.)+CategoryCell\,,testo[k[1]]) data-paste(substr(data,7,10), substr(data,4,5), substr(data,1,2), sep=-) mysel-paste(select count(*) from richiesta where data=\,data,\;,sep=) dataesiste-as.integer(dbGetQuery(con,mysel)) if (dataesiste == 0) { rif-gsub(\Confronto Giornaliero(.)+,,testo[k[30]]) rif-gsub(^(.)+href=\,,rif) pag-paste(http://www.terna.it,rif,sep=;) pagina-readLines(pag) ………. ………. ………. Il giorno 18/set/2011, alle ore 18:25, Joshua Wiley ha scritto: On Sun, Sep 18, 2011 at 7:44 AM, Victor vdem...@gmail.com wrote: Unfortunately pdf2text doesn't seem to exist either in linux or mac osx. I think Jeff's main point was to search for software specific for your task (convert a pdf to text). Formatting will be lost so once you get your text files, I would look at regular expressions to try to find the right part of text to grab. Some general functions that seem like they might be relevant: ## for getting the text into R ?readLines ?scan ## for finding the part you need ?regexp ?grep Cheers, Josh Ciao Vittorio Il giorno 17/set/2011, alle ore 21:00, Jeff Newmiller ha scritto: Doesn't seen like an R task, but see pdf2text? (From pdftools, UNIX command line tools) --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Victor vdem...@gmail.com wrote: In an R script I need to extract some figures from many web pages in pdf format. As an example see http://www.terna.it/LinkClick.aspx?fileticket=TTQuOPUf%2fs0%3damp;tabid=435amp;mid=3072 from which I would like to extract the Totale: 1,025,823). Is there any solution? Ciao Vittorio R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R-Help
Hi, my name is Gastón. I just read a question, made by Walter Durka, about a nonparametric discriminant analysis. It wasn´t any answer, and I was wondering if at this moment there is one. I have the same problem as W. Durka. I´m trying to classify and to cross-validate samples of three tunicates species based on morphometric data and to identify the variables that best discriminate between species. Thanks for help. Kind regards! Gaston Alurralde -- *[ GASTÓN ]* * * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R-Help
Gaston: There are many ways to do this, but I think this is mostly a question about statistics, not about R. Once you have decided *what* you want to do, then you can search in R for tools to do it. So I would suggest you post your question on a statistics site, like http://stats.stackexchange.com/ . Better yet by far is to collaborate with a local statistician. Cheers, Bert On Sun, Sep 18, 2011 at 11:25 AM, Gastón mitocondriareve...@gmail.comwrote: Hi, my name is Gastón. I just read a question, made by Walter Durka, about a nonparametric discriminant analysis. It wasn´t any answer, and I was wondering if at this moment there is one. I have the same problem as W. Durka. I´m trying to classify and to cross-validate samples of three tunicates species based on morphometric data and to identify the variables that best discriminate between species. Thanks for help. Kind regards! Gaston Alurralde -- *[ GASTÓN ]* * * [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions. -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] troubles with a for loop
Why wouldn't? It does for me ;-) curve(sin(x), 0, 10, col = 4, lwd = 2, las = 1) curve(cos(x), 0, 10, add = TRUE) Best, Jorge On Sun, Sep 18, 2011 at 2:07 PM, R. Michael Weylandt wrote: Furthermore, if you want to add lines to a plot, I'd advise against the curve() function, rather use lines() to add lines (or points() for, well, points) on a plot. E.g., x - seq(0,10,by=0.025) y - sin(x) y2 - cos(x) plot(x,y,type=l,col=red4,lwd=3) lines(x,y2) curve() wouldn't work for this Michael On Sun, Sep 18, 2011 at 1:23 PM, Patrick Burns wrote: Sarah has told you how to get from where you are to where you want to be. However, it is easier to start somewhere else. The more R way to do what you are doing is to use a list to put the results of your regressions into. It is then very easy to use that list, and it is easier to keep track of. The two documents mentioned in my signature may help you get up and running in R. Since you are coming from Stata, you should also look at http://r4stats.com On 18/09/2011 17:05, Francesco Sarracino wrote: Dear all, I am a stata user and I am moving my first steps in R. I am dealing with a silly issue concerning looping over variables. I read previous posts on similar topics in the R help archive, but I did not find a solution. Here is my case: I run a simple bivariate linear regression saving the output in objects called: pd.memb.0, pd.memb.1, pd.memb.2, pd.memb.3 pd.memb.0- lm(E.fs.memb ~ M.fs.memb, data, subset = (tag2 == 1)) pd.memb.1- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb= quantile(M.fs.memb, .25) tag2 == 1)) pd.memb.2- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .25) M.fs.memb= quantile(M.fs.memb, .75) tag2 == 1)) pd.memb.3- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .75) tag2 == 1)) Subsequently, I wish to plot my data superimposing a different line for each regression model. Here I am trying to apply my loop. Looking at the info I found around, the following code sound to me as correct, but I am wrong. plot(M.fs.memb , E.fs.memb) for(i = 1:3){ curve(coef(pd.memb.i)[1] + coef(pd.memb.i)[2]*x, add = T, cex = 100, col = red) } The plot is plotted, but the curves are not printed and I get the following error message: Error in coef(pd.memb.i) : error in evaluating the argument 'object' in selecting a method for function 'coef' }Error: unexpected '}' in } What am I doing wrong? Thanks a lot for your help, f. [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-help 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 commented, minimal, self-contained, reproducible code. -- Patrick Burns pbu...@pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/**blog http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno') __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-help 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 commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Could R run Cox proportional hazard model with multiple failure time data
You sent that question to me individually as well as posting to the group. Kindly pick the most appropriate place and send to only that. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Could-R-run-Cox-proportional-hazard-model-with-multiple-failure-time-data-tp3821264p3822421.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] troubles with a for loop
Wow, thanks a lot for your quick replies and useful comments. Indeed, Sarah's advice does the job perfectly. I wish to thank you all also for your advices on how to shift from a Stata mindset to an R one (which is currently my main obstacle). Best, f. On 18 September 2011 20:07, R. Michael Weylandt michael.weyla...@gmail.comwrote: Furthermore, if you want to add lines to a plot, I'd advise against the curve() function, rather use lines() to add lines (or points() for, well, points) on a plot. E.g., x - seq(0,10,by=0.025) y - sin(x) y2 - cos(x) plot(x,y,type=l,col=red4,lwd=3) lines(x,y2) curve() wouldn't work for this Michael On Sun, Sep 18, 2011 at 1:23 PM, Patrick Burns pbu...@pburns.seanet.comwrote: Sarah has told you how to get from where you are to where you want to be. However, it is easier to start somewhere else. The more R way to do what you are doing is to use a list to put the results of your regressions into. It is then very easy to use that list, and it is easier to keep track of. The two documents mentioned in my signature may help you get up and running in R. Since you are coming from Stata, you should also look at http://r4stats.com On 18/09/2011 17:05, Francesco Sarracino wrote: Dear all, I am a stata user and I am moving my first steps in R. I am dealing with a silly issue concerning looping over variables. I read previous posts on similar topics in the R help archive, but I did not find a solution. Here is my case: I run a simple bivariate linear regression saving the output in objects called: pd.memb.0, pd.memb.1, pd.memb.2, pd.memb.3 pd.memb.0- lm(E.fs.memb ~ M.fs.memb, data, subset = (tag2 == 1)) pd.memb.1- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb= quantile(M.fs.memb, .25) tag2 == 1)) pd.memb.2- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .25) M.fs.memb= quantile(M.fs.memb, .75) tag2 == 1)) pd.memb.3- lm(E.fs.memb ~ M.fs.memb, data, subset = (M.fs.memb quantile(M.fs.memb, .75) tag2 == 1)) Subsequently, I wish to plot my data superimposing a different line for each regression model. Here I am trying to apply my loop. Looking at the info I found around, the following code sound to me as correct, but I am wrong. plot(M.fs.memb , E.fs.memb) for(i = 1:3){ curve(coef(pd.memb.i)[1] + coef(pd.memb.i)[2]*x, add = T, cex = 100, col = red) } The plot is plotted, but the curves are not printed and I get the following error message: Error in coef(pd.memb.i) : error in evaluating the argument 'object' in selecting a method for function 'coef' }Error: unexpected '}' in } What am I doing wrong? Thanks a lot for your help, f. [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Patrick Burns pbu...@pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/**blog http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno') __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Referring to an object by a variable containing its name: 6 failures
Thanks Josh Duncan! That was very clear and helpful. After going back and reviewing documentation for { and $ I am realizing that R the pattern in R documentation is simply to tell you the truth, and not to give much effort to distinguishing confusable choices. Once again, things that seemed crazy to me become perfectly sensible once understood. I think I need to read function documentation more the way one reads concept definitions in a math book. Josh, one question: Your reasons to avoid attach() seem cogent. However, Venables, Smith et al. say in “An Introduction to R” : A useful convention that allows you to work with many different problems comfortably together in the same working directory is gather together all variables for any well defined and separate problem in a data frame under a suitably informative name; when working with a problem attach the appropriate data frame at position 2, and use the working directory at level 1 for operational quantities and temporary variables; before leaving a problem, add any variables you wish to keep for future reference to the data frame using the $ form of assignment, and then detach(); finally remove all unwanted variables from the working directory I'm still at the point that I am doing things just because Authority says so, but unfortunately, everyone is Authority, relative to me. Still, I wonder if you have any thoughts about why such a venerable authority as Venables et al. would recomend a programming practice if that practice should always be avoided. For cognative dissonance form authority conflicts, that's up there with the Google R stylesheet saying to avoid using S4 classes. Again, my thanks. andrewH -- View this message in context: http://r.789695.n4.nabble.com/Referring-to-an-object-by-a-variable-containing-its-name-6-failures-tp3817129p3822436.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R-Help
On Sep 18, 2011, at 2:25 PM, Gastón wrote: Hi, my name is Gastón. I just read a question, made by Walter Durka, about a nonparametric discriminant analysis. It wasn´t any answer, and I was wondering if at this moment there is one. I have the same problem as W. Durka. I´m trying to classify and to cross-validate samples of three tunicates species based on morphometric data and to identify the variables that best discriminate between species. Thanks for help. http://cran.r-project.org/web/views/Cluster.html -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] graph bugs using R on MAC
This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] graph bugs using R on MAC
On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] graph bugs using R on MAC
Copy paste doesn't work. So I tried to Select and then copy paste, but it doesn't work either. Quoting Don McKenzie d...@u.washington.edu: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] graph bugs using R on MAC
Have you been shown how to save a graph as a JPEG or PNG? try this: png(myGraph.png) plot(your_data) dev.off() A png will appear in your working directory, which can be imported into the Word document. You can do the same with a JPEG see ?jpeg or ?png and ?dev.off HTH bonnieyuan wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://r.789695.n4.nabble.com/graph-bugs-using-R-on-MAC-tp3822460p3822480.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
On 18-Sep-11, at 12:59 PM, Duncan Murdoch wrote: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... Odd -- I was using OpenOffice when trying to duplicate the problem. Well NeoOffice, the mac twin. So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] graph bugs using R on MAC
Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? Bonnie Yuan. Quoting Duncan Murdoch murdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Add png image outside plot borders
I am trying to add a copyright disclaimer outside the plot borders of some images I have created. I can use mtext() to add the written portion, but I would like to have the Creative Commons license image (http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the text. I've found that I can plot a .png image inside the plot boundaries using rasterImage() but I can't figure out how to do it outside the boundaries. Any help would be great. If you know unicode or Adobe Symbol encoding for the CC logo, that might work too. ~Amelia McNamara Statistics PhD student, UCLA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Add png image outside plot borders
Hi Amelia, Can you give an example (using text where you want the CC is fine)? Two angles I would try would be A) changing the regions or related but more flexible (and hence complex) B) use grid of course if you're making these with, say, ggplot2, you're already in grid (but then mtext probably would not work, though I have not tried it offhand). Anyway, an example (code please, not just the picture), will clear up all these questions and we can offer a solution tailored to what you are doing. Cheers, Josh On Sun, Sep 18, 2011 at 1:18 PM, Amelia McNamara amelia.mcnam...@stat.ucla.edu wrote: I am trying to add a copyright disclaimer outside the plot borders of some images I have created. I can use mtext() to add the written portion, but I would like to have the Creative Commons license image (http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the text. I've found that I can plot a .png image inside the plot boundaries using rasterImage() but I can't figure out how to do it outside the boundaries. Any help would be great. If you know unicode or Adobe Symbol encoding for the CC logo, that might work too. ~Amelia McNamara Statistics PhD student, UCLA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
I think it's actually dev.copy2eps() or at least that one works. On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] graph bugs using R on MAC
On 11-09-18 4:53 PM, Don McKenzie wrote: I think it's actually dev.copy2eps() or at least that one works. Right, sorry. Duncan Murdoch On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Add png image outside plot borders
If you run this, you'll see that I have some text at the bottom, but the logo is within the plot borders. plot(c(1.1, 2.3, 4.6), c(2.0, 1.6, 3.2), ylab=, xlab=) mtext(X axis label, side=1, line=3) mtext(Copyright statement, side=1, line=4, adj=0, cex=0.7) library(png) z - readPNG(Cc.logo.circle.png) rasterImage(z, 1, 1.6, 1.2, 1.7) I've tried doing things like rasterImage(z, 1, 0.5, 1.2, 1) but nothing shows up. The documentation for rasterImage() says that the corner values have to be within the plot region. As I said before, I want the logo to be down on the level of my copyright text, outside the plot region. Thanks! On Sun, Sep 18, 2011 at 1:26 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Amelia, Can you give an example (using text where you want the CC is fine)? Two angles I would try would be A) changing the regions or related but more flexible (and hence complex) B) use grid of course if you're making these with, say, ggplot2, you're already in grid (but then mtext probably would not work, though I have not tried it offhand). Anyway, an example (code please, not just the picture), will clear up all these questions and we can offer a solution tailored to what you are doing. Cheers, Josh On Sun, Sep 18, 2011 at 1:18 PM, Amelia McNamara amelia.mcnam...@stat.ucla.edu wrote: I am trying to add a copyright disclaimer outside the plot borders of some images I have created. I can use mtext() to add the written portion, but I would like to have the Creative Commons license image (http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the text. I've found that I can plot a .png image inside the plot boundaries using rasterImage() but I can't figure out how to do it outside the boundaries. Any help would be great. If you know unicode or Adobe Symbol encoding for the CC logo, that might work too. ~Amelia McNamara Statistics PhD student, UCLA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] randomForest2Rules
Hi, I'm trying to extract the rules from every tree in the random forest model that I've created. I've used randomForest2Rules function from rattle package however I get an error Error in if (var.class == character | var.class == factor) { : argument is of length zero Sample code: library(rattle) library(randomForest) iris.10tree - randomForest(Species ~ ., data=iris, ntree=10) iris.10tree printRandomForests(iris.10tree) #this prints the rules as described in the vignette ruleset-randomForest2Rules(iris.10tree) # this does not work and gives the error I mentioned above. Rattle package: http://cran.r-project.org/web/packages/rattle/rattle.pdf Please can someone tell me where I'm going wrong. -- View this message in context: http://r.789695.n4.nabble.com/randomForest2Rules-tp3822530p3822530.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
Don and Duncan, That function works, up to the same point where I can save pdf into Word using the menu. But when I use Identify function together with plot function, the Quartz window has to be closed before I can go back the console to execute copy2eps function. But by then, I don't have an active device anymore. So it beats the purpose. Dan, I'm using Word 2004. Upgrading Word is an idea. I will definitely look into it, although I didn't think those who didn't have this problem necessarily had a higher version of Word. Bonnie Yuan Quoting Duncan Murdoch murdoch.dun...@gmail.com: On 11-09-18 4:53 PM, Don McKenzie wrote: I think it's actually dev.copy2eps() or at least that one works. Right, sorry. Duncan Murdoch On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] graph bugs using R on MAC
On Sep 18, 2011, at 2:15 PM, bby2...@columbia.edu wrote: Don and Duncan, That function works, up to the same point where I can save pdf into Word using the menu. But when I use Identify function together with plot function, the Quartz window has to be closed before I can go back the console to execute copy2eps function. ** This is indeed strange. Running R 2.13.0 on mac SnowLeopard, with quartz window manager plot(1,1) identify(1,1) warning: no point within 0.25 inches [1] 1 dev.copy2eps(file=test.eps) quartz 2 The eps file shows up in my working directory just as it should. There should be no need to close the quartz window, or even look at it for that matter. Can you show us your session info? But by then, I don't have an active device anymore. So it beats the purpose. Dan, I'm using Word 2004. Upgrading Word is an idea. I will definitely look into it, although I didn't think those who didn't have this problem necessarily had a higher version of Word. Bonnie Yuan Quoting Duncan Murdoch murdoch.dun...@gmail.com: On 11-09-18 4:53 PM, Don McKenzie wrote: I think it's actually dev.copy2eps() or at least that one works. Right, sorry. Duncan Murdoch On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu [[alternative HTML version deleted]]
Re: [R] graph bugs using R on MAC
Sorry -- you do have to highlight the quartz window to use identify(), but that shouldn't matter either. On Sep 18, 2011, at 2:41 PM, Don McKenzie wrote: On Sep 18, 2011, at 2:15 PM, bby2...@columbia.edu wrote: Don and Duncan, That function works, up to the same point where I can save pdf into Word using the menu. But when I use Identify function together with plot function, the Quartz window has to be closed before I can go back the console to execute copy2eps function. ** This is indeed strange. Running R 2.13.0 on mac SnowLeopard, with quartz window manager plot(1,1) identify(1,1) warning: no point within 0.25 inches [1] 1 dev.copy2eps(file=test.eps) quartz 2 The eps file shows up in my working directory just as it should. There should be no need to close the quartz window, or even look at it for that matter. Can you show us your session info? But by then, I don't have an active device anymore. So it beats the purpose. Dan, I'm using Word 2004. Upgrading Word is an idea. I will definitely look into it, although I didn't think those who didn't have this problem necessarily had a higher version of Word. Bonnie Yuan Quoting Duncan Murdoch murdoch.dun...@gmail.com: On 11-09-18 4:53 PM, Don McKenzie wrote: I think it's actually dev.copy2eps() or at least that one works. Right, sorry. Duncan Murdoch On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources,
Re: [R] Add png image outside plot borders
Amelia You can persuade rasterImage() (and other functions) to draw outside of the data region using xpd = NA or xpd = TRUE. See the help for the par function. D. On 9/18/11 1:59 PM, Amelia McNamara wrote: If you run this, you'll see that I have some text at the bottom, but the logo is within the plot borders. plot(c(1.1, 2.3, 4.6), c(2.0, 1.6, 3.2), ylab=, xlab=) mtext(X axis label, side=1, line=3) mtext(Copyright statement, side=1, line=4, adj=0, cex=0.7) library(png) z - readPNG(Cc.logo.circle.png) rasterImage(z, 1, 1.6, 1.2, 1.7) I've tried doing things like rasterImage(z, 1, 0.5, 1.2, 1) but nothing shows up. The documentation for rasterImage() says that the corner values have to be within the plot region. As I said before, I want the logo to be down on the level of my copyright text, outside the plot region. Thanks! On Sun, Sep 18, 2011 at 1:26 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Amelia, Can you give an example (using text where you want the CC is fine)? Two angles I would try would be A) changing the regions or related but more flexible (and hence complex) B) use grid of course if you're making these with, say, ggplot2, you're already in grid (but then mtext probably would not work, though I have not tried it offhand). Anyway, an example (code please, not just the picture), will clear up all these questions and we can offer a solution tailored to what you are doing. Cheers, Josh On Sun, Sep 18, 2011 at 1:18 PM, Amelia McNamara amelia.mcnam...@stat.ucla.edu wrote: I am trying to add a copyright disclaimer outside the plot borders of some images I have created. I can use mtext() to add the written portion, but I would like to have the Creative Commons license image (http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the text. I've found that I can plot a .png image inside the plot boundaries using rasterImage() but I can't figure out how to do it outside the boundaries. Any help would be great. If you know unicode or Adobe Symbol encoding for the CC logo, that might work too. ~Amelia McNamara Statistics PhD student, UCLA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] AIC
This isn't a question about R; more appropriate for stackexchange. Here is one string that might interest you: http://stats.stackexchange.com/questions/4997/can-aic-compare-across-different-types-of-model Tania Sav wrote: Hello, I'm using AIC() to choose a better model. I have 3 options: 1) y=ax+b 2) y=ax^2 +bx + c 3) y=a(1-exp(-x/b)) + c Is it ok to use AIC() for determine wich is the better equation to use for fit to my data? Thanks Tania Tania Sav wrote: Hello, I'm using AIC() to choose a better model. I have 3 options: 1) y=ax+b 2) y=ax^2 +bx + c 3) y=a(1-exp(-x/b)) + c Is it ok to use AIC() for determine wich is the better equation to use for fit to my data? Thanks Tania -- View this message in context: http://r.789695.n4.nabble.com/AIC-tp3820732p3822647.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Add png image outside plot borders
Hi, if your logo is in vector format you should probably try the grImport package; see its vignette for examples, also below, library(grImport) ## http://creativecommons.org/about/downloads/ PostScriptTrace(cc.logo.eps) cc - readPicture(cc.logo.eps.xml) logo - pictureGrob(cc[16:18], x=unit(1, npc), y=unit(0, npc), width=unit(2,cm), height=unit(2,cm), just= c(right, bottom), use.gc = FALSE, gp = gpar(fill = grey40, col = grey50)) plot(1:10, rnorm(10), panel.first = grid.draw(logo)) HTH, baptiste On 19 September 2011 08:18, Amelia McNamara amelia.mcnam...@stat.ucla.edu wrote: I am trying to add a copyright disclaimer outside the plot borders of some images I have created. I can use mtext() to add the written portion, but I would like to have the Creative Commons license image (http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the text. I've found that I can plot a .png image inside the plot boundaries using rasterImage() but I can't figure out how to do it outside the boundaries. Any help would be great. If you know unicode or Adobe Symbol encoding for the CC logo, that might work too. ~Amelia McNamara Statistics PhD student, UCLA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Add png image outside plot borders
Great, thanks Amelia. Here is what I would do: require(png) require(grid) ## select the PNG file z - readPNG(file.choose()) ## Function to draw your statement copyright.draw - function(label, image, x, y, size, ...) { lab - textGrob(label = label, x = unit(x, npc), y = unit(y, npc), just = c(left, centre), gp = gpar(...)) logo - rasterGrob(image = image, x = unit(x, npc) + unit(1, grobwidth, lab), y = unit(y, npc), width = unit(size, cm), height = unit(size, cm), just = c(left, centre), gp = gpar(...)) grid.draw(lab) grid.draw(logo) } plot(1:10, 1:10) copyright.draw(Copyright statement , z, .02, .04, .5, fontsize = 8) Seems reasonably aesthetically pleasing to me (don't forget the space after your copyright statement if you want there to be a space there before the CC logo). I kind like Baptiste's idea to use the SVG file directly, but you asked for PNG. Also, the function is not strictly necessary, what is nice about it is that it handles positioning the logo based on the text. You don't want to be in a position where you are trying to manually line the two up. You can pass additional arguments as you like to gpar (though note it will affect botht he text and raster grobs. Cheers, Josh On Sun, Sep 18, 2011 at 1:59 PM, Amelia McNamara amelia.mcnam...@stat.ucla.edu wrote: If you run this, you'll see that I have some text at the bottom, but the logo is within the plot borders. plot(c(1.1, 2.3, 4.6), c(2.0, 1.6, 3.2), ylab=, xlab=) mtext(X axis label, side=1, line=3) mtext(Copyright statement, side=1, line=4, adj=0, cex=0.7) library(png) z - readPNG(Cc.logo.circle.png) rasterImage(z, 1, 1.6, 1.2, 1.7) I've tried doing things like rasterImage(z, 1, 0.5, 1.2, 1) but nothing shows up. The documentation for rasterImage() says that the corner values have to be within the plot region. As I said before, I want the logo to be down on the level of my copyright text, outside the plot region. Thanks! On Sun, Sep 18, 2011 at 1:26 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Amelia, Can you give an example (using text where you want the CC is fine)? Two angles I would try would be A) changing the regions or related but more flexible (and hence complex) B) use grid of course if you're making these with, say, ggplot2, you're already in grid (but then mtext probably would not work, though I have not tried it offhand). Anyway, an example (code please, not just the picture), will clear up all these questions and we can offer a solution tailored to what you are doing. Cheers, Josh On Sun, Sep 18, 2011 at 1:18 PM, Amelia McNamara amelia.mcnam...@stat.ucla.edu wrote: I am trying to add a copyright disclaimer outside the plot borders of some images I have created. I can use mtext() to add the written portion, but I would like to have the Creative Commons license image (http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the text. I've found that I can plot a .png image inside the plot boundaries using rasterImage() but I can't figure out how to do it outside the boundaries. Any help would be great. If you know unicode or Adobe Symbol encoding for the CC logo, that might work too. ~Amelia McNamara Statistics PhD student, UCLA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] perm.test()
Hi! I am doing a two sample permutation test and trying to find confidence interval. perm.test() seems can do that but when the vector contains negative numbers it occurs an error. And for perm.test(x,y), elements in x can't be more than in y. I am wondering how I can fix these two problems? Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/perm-test-tp3822738p3822738.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
On 11-09-18 5:15 PM, bby2...@columbia.edu wrote: Don and Duncan, That function works, up to the same point where I can save pdf into Word using the menu. But when I use Identify function together with plot function, the Quartz window has to be closed before I can go back the console to execute copy2eps function. But by then, I don't have an active device anymore. So it beats the purpose. You stop the identify function by right-clicking in the graphics window. I have my one-button Mac set up to do this with a two-finger tap, you may have it set some other way. (I think Mac calls this a secondary tap.) After that dev.copy2eps should copy the identifiers too. Duncan Murdoch Dan, I'm using Word 2004. Upgrading Word is an idea. I will definitely look into it, although I didn't think those who didn't have this problem necessarily had a higher version of Word. Bonnie Yuan Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 4:53 PM, Don McKenzie wrote: I think it's actually dev.copy2eps() or at least that one works. Right, sorry. Duncan Murdoch On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Linear regression interaction terms
Hello I performed a linear regression, my equation is Y = âo+ â1A + â2B + â3AB. Is there a way to separate interaction terms, say â3AB and plot it against a certain variable? Thanks, Andrew [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] graph bugs using R on MAC
Cool! Don showed me another trick--use (n= ) in Identify. The active window will come back to console after the specified amount of clicks, you will be able to execute more commands in console. Thank you! Quoting Duncan Murdoch murdoch.dun...@gmail.com: On 11-09-18 5:15 PM, bby2...@columbia.edu wrote: Don and Duncan, That function works, up to the same point where I can save pdf into Word using the menu. But when I use Identify function together with plot function, the Quartz window has to be closed before I can go back the console to execute copy2eps function. But by then, I don't have an active device anymore. So it beats the purpose. You stop the identify function by right-clicking in the graphics window. I have my one-button Mac set up to do this with a two-finger tap, you may have it set some other way. (I think Mac calls this a secondary tap.) After that dev.copy2eps should copy the identifiers too. Duncan Murdoch Dan, I'm using Word 2004. Upgrading Word is an idea. I will definitely look into it, although I didn't think those who didn't have this problem necessarily had a higher version of Word. Bonnie Yuan Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 4:53 PM, Don McKenzie wrote: I think it's actually dev.copy2eps() or at least that one works. Right, sorry. Duncan Murdoch On 18-Sep-11, at 1:51 PM, Duncan Murdoch wrote: On 11-09-18 4:11 PM, bby2...@columbia.edu wrote: Yes, I'm positive I had the right window highlighted, and I have shown this problem to lots of people including tech staff, to get no answers. So I suspect it's probably a somewhat obscure problem. Duncan, thanks for the lead on the new group. I will follow up on that. What is the copy2eps? Is it to Excel? Do you get that option in R? copy2eps() is a function in R. Try ?copy2eps for details. Duncan Murdoch Bonnie Yuan. Quoting Duncan Murdochmurdoch.dun...@gmail.com: On 11-09-18 3:48 PM, Don McKenzie wrote: On 18-Sep-11, at 12:38 PM, bby2...@columbia.edu wrote: This is has been bugging me for a long time. Nobody around me seems to have this problem. I hope someone on the forum could help me. When I generate a R graph and want to bring the image into Word. I cannot copy and paste it like many of my classmates can do. The Select in Edit menu have all options grayed out. You want Copy, not Select. Then Paste into your word processor. That doesn't work for me with OpenOffice (I don't have Word). copy2eps(file=some.eps) does work, along with Insert | Picture | From file... So what I ended up doing is to save it as pdf file and bring it into Word. But if I use Identify in the Plot statement, there will be values labels on the graph when you click on the observation. For some reason, these labels don't show up in the pdf file. They did show up with copy2eps(). I didn't try copy2pdf(); my copy of OpenOffice doesn't recognize .pdf as a picture type. But Bonnie will probably get a better answer on the R-sig-mac list. Duncan Murdoch So the last resort I have is prinscreen, which always have irrelevant things showing. I've tried updating R/OS and all softwares on my MAC, but nothing seems to do anything. I have OX 10.6.8. Does this problem sound familiar to anyone? Thanks in advance! Bonnie Yuan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. When we look at the wings of the eagle To the left, closest to the heart, is the spirit To the right, far away from the heart, is the science No bird can ever lift off with wings that are not equal -- Greenland First Nations elder quoted in EOS Transactions Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. Don McKenzie, Research Ecologist Pacific WIldland Fire Sciences Lab US Forest Service Affiliate Professor School of Forest Resources, College of the Environment CSES Climate Impacts Group University of Washington phone: 206-732-7824 d...@uw.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] regression summary results pvalues and coefficients into a excel
Hi All, I have run many regression analyses (14000 +) and want to collect the coefficients and pvalues into an excel file. I can get the statements below to work up to step 4. I can printout the regressionresults (sample output below). So my hope is to run something like step 5 and 6 and put the pvalues (and then coefficients) into an excel file. Can anyone suggest what I am doing wrong or a better way :0 Thanks Don 1) sdata - read.table(gene.csv, row.names=1, sep=',') 2) headshape - c(0.575818, 0.573874, 0.525701, 0.548490, 0.685111, 0.592502, 0.566001, 0.563605, 0.637906, 0.578099, 0.588142, 0.383393, 0.561732, 0.456134, 0.430472, 0.603143, 0.514315, 0.53328, 0.482734, 0.637906) 3) morphtrait - headshape aof-function(x){m-data.frame(morphtrait,x); summary(lm(morphtrait~x, m))} 4) regressionresults -apply(sdata, 1, aof) 5) regpvalues - data.frame(lapply(regressionresults, function(x){x[Pr(|t|)][1:2,]})) 6) write.table(t(regpvalues), file = regression-resultsheadshape.txt, quote = F, sep ='\t') regressionresults $CUST_54_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23217 -0.08980 -0.04592 -0.00947 1.07688 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.5985797 0.0364510 16.421 2e-16 *** x 0.0005372 0.0011161 0.4810.632 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2379 on 76 degrees of freedom Multiple R-squared: 0.003039, Adjusted R-squared: -0.01008 F-statistic: 0.2316 on 1 and 76 DF, p-value: 0.6317 $CUST_13662_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23434 -0.09000 -0.05062 -0.01427 1.06208 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.626368 0.030173 20.759 2e-16 *** x -0.003815 0.003337 -1.1430.256 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2362 on 76 degrees of freedom Multiple R-squared: 0.01691,Adjusted R-squared: 0.003976 F-statistic: 1.307 on 1 and 76 DF, p-value: 0.2565 $CUST_8938_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23424 -0.09051 -0.04721 -0.01216 1.07195 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.6056038 0.0368423 16.438 2e-16 *** x 0.0004091 0.0021406 0.1910.849 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2382 on 76 degrees of freedom Multiple R-squared: 0.0004803, Adjusted R-squared: -0.01267 F-statistic: 0.03652 on 1 and 76 DF, p-value: 0.849 $CUST_5773_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23587 -0.09139 -0.04895 -0.01037 1.07437 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.598110 0.038504 15.534 2e-16 *** x 0.001818 0.004070 0.4470.656 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2379 on 76 degrees of freedom Multiple R-squared: 0.002619, Adjusted R-squared: -0.0105 F-statistic: 0.1996 on 1 and 76 DF, p-value: 0.6563 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] regression summary results pvalues and coefficients into a excel
On Sep 18, 2011, at 9:36 PM, Donald Price wrote: Hi All, I have run many regression analyses (14000 +) and want to collect the coefficients and pvalues into an excel file. I can get the statements below to work up to step 4. I can printout the regressionresults (sample output below). This sounds pretty suspicious. Is this plan well thought out from a statistical viewpoint? So my hope is to run something like step 5 and 6 and put the pvalues (and then coefficients) into an excel file. Can anyone suggest what I am doing wrong or a better way :0 Where did you copy this code from? Thanks Don 1) sdata - read.table(gene.csv, row.names=1, sep=',') 2) headshape - c(0.575818, 0.573874, 0.525701, 0.548490, 0.685111, 0.592502, 0.566001, 0.563605, 0.637906, 0.578099, 0.588142, 0.383393, 0.561732, 0.456134, 0.430472, 0.603143, 0.514315, 0.53328, 0.482734, 0.637906) 3) morphtrait - headshape aof-function(x){m- data.frame(morphtrait,x); summary(lm(morphtrait~x, m))} 4) regressionresults -apply(sdata, 1, aof) Have you looked at str(regressionresults[[1]])? It does not look to be something that can be immediately accessed as though it were a matrix. Perhaps after you extract the coefficients element. 5) regpvalues - data.frame(lapply(regressionresults, function(x){x[Pr(|t|)][1:2,]})) I would have guessed: regpvalues - data.frame(lapply(regressionresults, function(x){ x[[coefficients]][1:2, Pr(|t|)] } The coefficient values are the rows, and the Pr(|t|)'s are the columns. 6) write.table( t(regpvalues), file = regression- resultsheadshape.txt, quote = F, sep ='\t') I doubt that t(.) will succeed. I'm not aware that t has a list method regressionresults $CUST_54_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23217 -0.08980 -0.04592 -0.00947 1.07688 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.5985797 0.0364510 16.421 2e-16 *** x 0.0005372 0.0011161 0.4810.632 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2379 on 76 degrees of freedom Multiple R-squared: 0.003039, Adjusted R-squared: -0.01008 F-statistic: 0.2316 on 1 and 76 DF, p-value: 0.6317 $CUST_13662_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23434 -0.09000 -0.05062 -0.01427 1.06208 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.626368 0.030173 20.759 2e-16 *** x -0.003815 0.003337 -1.1430.256 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2362 on 76 degrees of freedom Multiple R-squared: 0.01691,Adjusted R-squared: 0.003976 F-statistic: 1.307 on 1 and 76 DF, p-value: 0.2565 $CUST_8938_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23424 -0.09051 -0.04721 -0.01216 1.07195 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.6056038 0.0368423 16.438 2e-16 *** x 0.0004091 0.0021406 0.1910.849 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2382 on 76 degrees of freedom Multiple R-squared: 0.0004803, Adjusted R-squared: -0.01267 F-statistic: 0.03652 on 1 and 76 DF, p-value: 0.849 $CUST_5773_PI410671829 Call: lm(formula = morphtrait ~ x, data = m) Residuals: Min 1Q Median 3Q Max -0.23587 -0.09139 -0.04895 -0.01037 1.07437 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.598110 0.038504 15.534 2e-16 *** x 0.001818 0.004070 0.4470.656 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2379 on 76 degrees of freedom Multiple R-squared: 0.002619, Adjusted R-squared: -0.0105 F-statistic: 0.1996 on 1 and 76 DF, p-value: 0.6563 David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.