[R] lrm-function: Interpretation and error message
I have a set of data that is not normally distributed and for which I need to build a model. So, I tried the lrm function from the design-package. The first run went well, and I got the following results: Wald Statistics Response: RVCL2PROC.mott Factor Chi-Square d.f. P TTV.mott (Factor+Higher Order Factors) 69.01 4.0001 All Interactions12.13 30.0069 BEHANDLING (Factor+Higher Order Factors)14.94 60.0208 All Interactions12.13 30.0069 TTV.mott * BEHANDLING (Factor+Higher Order Factors) 12.13 3 0.0069 TOTAL69.76 7.0001 Now, how is it to be interpreted? Does it mean that the p-value for the interaction (TTV.mott*BEHANDLING) is 0.0069? And what does the TOTAL p-value signify? Then, I ran exactly the same script on another dataset and got the following error message: singular information matrix in lrm.fit (rank= 0 ). Offending variable(s): Error in est[z$pivot[nvi:(irank + 1)] - kint] : only 0's may be mixed with negative subscripts Does anyone know? I suspect that the first question is probably rather easy for you clever guys but I'm a statistics noob so... looking forward to your help. Martin Kellner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Structure of SEM
Hello, how does exactly the function looks like that estimates the parameters in SEM? What methods are used? Thank you, Luba [[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] Importing time series
I have a time series dataset, saved in a csv file. However date-formatting is : 7/2/1982 7/6/1982 7/7/1982 7/8/1982 7/13/1982 7/14/1982 However if I use following zoo-code, it is not reading data: read.zoo(file=F:/data.csv, format=%m/%d/%y, header=F) Error is Error in read.zoo(file =F:/data.csv, format = %m/%d/%y, : index contains NAs Here I have the mandate to keep date formating in abovementioned way. Can anyone please tell me what to do here? Regards, -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24713580.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] dumping data objects
WQM == William Q Meeker wqmee...@iastate.edu on Tue, 28 Jul 2009 14:58:26 -0500 writes: WQM While .deparseOpts(control=S_compatible) dump(foo) WQM did not work as I had expected, WQM dump(foo,control=S_compatible) WQM did work OK. yes, of course (at least in hindsight). Note that it's for a reason that .deparseOpts starts with a . : This is decades old style suggesting typically not to be messed with by the user and indeed is only used to produce the correct binary code used by the C internal dump() code, .deparseOpts(control=S_compatible) [1] 128 as you had demonstrated in your first message. Can you propose an amendment to the help page for dump(), source at https://svn.r-project.org/R/trunk/src/library/base/man/dump.Rd which helps the user more clearly? Martin Maechler, ETH Zurich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] quetions about dimensions
interting , when I modified bj2=bjerrdata$tyerr[bjyearnum[2]:bjyearnum[3]] the length of bj2 is correct . It seems that can not put a fomula in the dimension description . 2009/7/29 Jie TANG totang...@gmail.com hi ,everyone, I have a script shown as below: bj2=bjerrdata$tyerr[bjyearnum[2]+1:bjyearnum[3]] length(bj2) [1] 448 while b=bjyearnum[3] a=bjyearnum[2]+1 bj1=bjerrdata$tyerr[a:b] length(bj1) [1] 169 it is different with bj2 and bj1 . and the array bjyearnum is [1]0 279 448 633 1021 1365 1813 2237 2839 3314 3798 4157 12 why bj1 is 169 while bj2 is 448 ? how to let bj2 is also array with the length 169 ? thank you . -- TANG Jie Email: totang...@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China -- TANG Jie Email: totang...@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China [[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] partially sorting?
x - + matrix(c(1239,10,10,10,10,1234,10,10,10,10,1500,11,11,11,11,1001,11,11,11,11, + + 1009,11,11,11,11,1344,12,12,12,12,1349,12,12,12,12,1458,13,13,13,13),8,5,byrow + = T) x[order(x[,1]),] [,1] [,2] [,3] [,4] [,5] [1,] 1001 11 11 11 11 [2,] 1009 11 11 11 11 [3,] 1234 10 10 10 10 [4,] 1239 10 10 10 10 [5,] 1344 12 12 12 12 [6,] 1349 12 12 12 12 [7,] 1458 13 13 13 13 [8,] 1500 11 11 11 11 see ?order regards, nik -- Andreas Dominik Cullmann Forstliche Versuchs- und Forschungsanstalt Wonnhalde 4 79100 Freiburg Tel. +49 761 4018 204 Email: dominik.cullm...@forst.bwl.de mailto:dominik.cullm...@forst.bwl.de Homepage: www.fva-bw.de http://www.fva-bw.de -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von ashley2000 Gesendet: Mittwoch, 29. Juli 2009 03:44 An: r-help@r-project.org Betreff: [R] partially sorting? Dear all, x - matrix(c(1239,10,10,10,10,1234,10,10,10,10,1500,11,11,11,11,10 01,11,11,11,11, 1009,11,11,11,11,1344,12,12,12,12,1349,12,12,12,12,1458,13,13, 13,13),8,5,byrow = T) x [,1] [,2] [,3] [,4] [,5] [1,] 1239 10 10 10 10 [2,] 1234 10 10 10 10 [3,] 1500 11 11 11 11 [4,] 1001 11 11 11 11 [5,] 1009 11 11 11 11 [6,] 1344 12 12 12 12 [7,] 1349 12 12 12 12 [8,] 1458 13 13 13 13 I tried to sort by 1st column, but stayed the other columns as they were. I mean [,1] [,2] [,3] [,4] [,5] [2,] 1234 10 10 10 10 [1,] 1239 10 10 10 10 -- [4,] 1001 11 11 11 11 [5,] 1009 11 11 11 11 [3,] 1500 11 11 11 11 -- [6,] 1344 12 12 12 12 [7,] 1349 12 12 12 12 -- [8,] 1458 13 13 13 13 any suggestions? thanks ashley -- View this message in context: http://www.nabble.com/partially-sorting--tp24710996p24710996.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] Summarising Data for Forrest Plots
Are n.FD and n.RD the number of people who received the full/reduced dose and surv.FD and surv.RD the number of people that survived? And are the people who received the full dose different from the people who received the reduced dose? And what exactly is it that you want to plot in the forest plot? From the way you have arranged the table, it seems as if you want some kind of effect size measure that contrasts the survival rate of the full versus reduced dose in the various subgroups. Is that correct? And are you just trying to figure out how to draw the forest plot once you have the data in the table form as shown in your post or are you also trying to figure out how to create that table to begin with? -- Wolfgang Viechtbauer Department of Methodology and Statistics University of Maastricht, The Netherlands http://www.wvbauer.com/ Original Message From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Polwart Calum (County Durham and Darlington NHS Foundation Trust) Sent: Tuesday, July 28, 2009 20:28 To: r-help@r-project.org Subject: [R] Summarising Data for Forrest Plots I tried to post this a few times last week and it seems to have got stuck somehow so I'm trying from a different email in the hope that works. If somehow this has appeared on the list 20 tiems and I never saw any of them I apologize ;-) I'm basically an R-newbie. But I am VERY computer literate. But this has me stumped... All the examples for using the rmeta package to create a forest plot or simillar seem to use the catheter data: Name n.trt n.ctrl col.trt col.ctrl inf.trt inf.ctrl 1 Ciresi 124127 15 21 13 14 2 George44 35 10 25 13 3 Hannan68 60 22 22 57 4 Heard 151157 60 82 56 ... As I see it thats a summary of data from several published trials. What I want to do is do a forrest (forest) plot for subgroups within my single dataset as a test of heterogeniety. I have a dataset who received either full dose(FD) or reduced dose(RD) treatment, and a number of characteristics about those subjects: age, sex, renal function, weight, toxicity. And I have survival data (censored). they are in standard columnar data. Is there an *easy* way to transform them into something like this: SubGroupn.FDn.RDsurv.FD surv.RD 1 Age 65 2 Age = 65 3 Male ... 9 Grade 0-2 Tox 10 Grade 3/4 Tox Which rmeta will then let me use to create a forest plot from? This is a reasonably standard approach in biomedical studies these days so it seems odd that I can't find any How-To that tells me how to short cut it. Otherwise I have to manually calculate each of the parameters :-( Which is a real pain as we are awaiting more mature data which would need the same process re-run. Thanks in advance C This message may contain confidential information. If yo...{{dropped:21}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Importing time series
On Wed, 29 Jul 2009, Bogaso wrote: I have a time series dataset, saved in a csv file. However date-formatting is : 7/2/1982 7/6/1982 7/7/1982 7/8/1982 7/13/1982 7/14/1982 However if I use following zoo-code, it is not reading data: read.zoo(file=F:/data.csv, format=%m/%d/%y, header=F) Your example is not reproducible, so it's hard to tell but I guess that you need %Y instead of %y. The following example works for me. Z data - textConnection(7/2/1982 1 7/6/1982 2 7/7/1982 3 7/8/1982 4 7/13/1982 5 7/14/1982 6 ) z - read.zoo(data, format = %m/%d/%Y, header = FALSE) Error is Error in read.zoo(file =F:/data.csv, format = %m/%d/%y, : index contains NAs Here I have the mandate to keep date formating in abovementioned way. Can anyone please tell me what to do here? Regards, -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24713580.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] Importing time series
The format for the year should be %Y, not %y; however, without a reproducible example (see last line to every message on R help) we can't be sure that that is the whole story. On Wed, Jul 29, 2009 at 3:00 AM, Bogasobogaso.christo...@gmail.com wrote: I have a time series dataset, saved in a csv file. However date-formatting is : 7/2/1982 7/6/1982 7/7/1982 7/8/1982 7/13/1982 7/14/1982 However if I use following zoo-code, it is not reading data: read.zoo(file=F:/data.csv, format=%m/%d/%y, header=F) Error is Error in read.zoo(file =F:/data.csv, format = %m/%d/%y, : index contains NAs Here I have the mandate to keep date formating in abovementioned way. Can anyone please tell me what to do here? Regards, -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24713580.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] Installing lme4 package in Windows Vista
Dear Angela, lme() is a part of the nlme package. The lme4 package has the function lmer() which is the equivalent of lme() from nlme. Both function differ in their capabilities. Briefly: lmer() can (easly) do crossed random effects and GLMM, lme() can handle variance and correlation structures. HTH, Thierry PS Don't for get that you need to load a package before using it! Just installing it is not sufficient. library(lme4) ?lmer library(nlme) ?lme ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Angela Radulescu Verzonden: woensdag 29 juli 2009 1:48 Aan: r-help@r-project.org Onderwerp: [R] Installing lme4 package in Windows Vista Hi all, I have a problem with package installing in Windows, on my PC machine. The end goal is to be able to use the lme() function. Here's what I did so far: install.packages(lme4) Warning in install.packages(lme4) : argument 'lib' is missing: using 'C:\Users\Angela\Documents/R/win-library/2.9' --- Please select a CRAN mirror for use in this session --- trying URL 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.9/lme4_0.999375-31.z ip' Content type 'application/zip' length 1140865 bytes (1.1 Mb) opened URL downloaded 1.1 Mb package 'lme4' successfully unpacked and MD5 sums checked The downloaded packages are in C:\Users\Angela\AppData\Local\Temp\Rtmp1t8vjT\downloaded_packages updating HTML package descriptions Warning message: In file.create(f.tg) : cannot create file 'C:\PROGRA~1\R\R-29~1.1/doc/html/packages.html', reason 'Permission denied' I had to change permissions on some of the library folder before this. Still, after installation, R cannot find the lme function of interest. lme Error: object 'lme' not found Does anyone know why this is happening, and what the solution to the problem is? Many thanks, Angela -- View this message in context: http://www.nabble.com/Installing-lme4-package-in-Windows-Vista-tp2470993 2p24709932.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. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Importing time series
Thanks for reply. However still problem is there. Here I am giving some parts of the data : ss - 7/2/1982312.7212.0618.397471390.4 + 7/6/1982311208.4518.227521392.2 + 7/7/1982306.7206.4118.327381385 + 7/8/1982313.5207.1918.567221392.6 + 7/13/1982352.5205.7918.857301485.7 + 7/14/1982352.7206.2718.757211494.9 + 7/15/1982350.2207.1218.717121491.6 + 7/20/1982347.7205.3218.626611508.8 + 7/21/1982366.5204.6618.776541575.6 + 7/26/1982352.2208.418.526541554.9 + 7/27/1982351.2212.1718.516591523.6 + 7/28/1982347213.9618.226541499.3 + 7/30/1982342.9215.8318.066581467.9 + 8/3/1982349.2216.3718.147281536.6 + ss1 - textConnection(ss) read.zoo(ss1, format = %m/%d/%Y, header = FALSE) Error in read.zoo(ss1, format = %m/%d/%Y, header = FALSE) : index contains NAs Any other suggestion? Gabor Grothendieck wrote: The format for the year should be %Y, not %y; however, without a reproducible example (see last line to every message on R help) we can't be sure that that is the whole story. On Wed, Jul 29, 2009 at 3:00 AM, Bogasobogaso.christo...@gmail.com wrote: I have a time series dataset, saved in a csv file. However date-formatting is : 7/2/1982 7/6/1982 7/7/1982 7/8/1982 7/13/1982 7/14/1982 However if I use following zoo-code, it is not reading data: read.zoo(file=F:/data.csv, format=%m/%d/%y, header=F) Error is Error in read.zoo(file =F:/data.csv, format = %m/%d/%y, : index contains NAs Here I have the mandate to keep date formating in abovementioned way. Can anyone please tell me what to do here? Regards, -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24713580.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. -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24714603.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] Adding picture to graph?
Hi while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer -- Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch University, South Africa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie in R: Reading .txt files and storing the 'numbers' in a vector
Hello everybody, I'm a newbie in R and just went through an introduction class recently. Here's my problem. I have 2 text files (.txt) with plain numbers ('doubles' for those who know c++) ordered into 2 columns as below: coordinate1 value1 coordinate2 value2 coordinate3 value3 ... ... coordinateN valueN I would like to write a small programme in which i would: 1. take all values of file 1 and store them in a vector 2. substract to those all values of file 2 (one by one) and store the result in a new vector 3. Create a sliding window of chosen size and calculate the mathematical average and store these averages in a new vector 4. Plot the different graphes with a bar plot So I wrote a c++ script that does the first parts and writes the averages in a output.txt file (which I have up and running). Unfortunately, I seem to fail in reading these as numbers and putting them into a vector (in the R environment). I can read the file , but this is what I get: z=scan(file = /Users/NCCRGENETICS/Desktop/testRnumbers.txt, what = double) Read 19 items z [1] {\\rtf1\\ansi\\ansicpg1252\\cocoartf949\\cocoasubrtf430 [2] {\\fonttbl\\f0\\fswiss\\fcharset0 [3] Helvetica;} [4] {\\colortbl;\\red255\\green255\\blue255;} [5] \\paperw11900\\paperh16840\\margl1440\\margr1440\\vieww9000\ \viewh8400\\viewkind0 [6] \\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\ \tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\ql\\qnatural\\pardirnatural [7] \\f0\\fs24 [8] \\cf0 [9] 13\\ // This is where my file should start reading the numbers I see in the window when I open it with textedit [10] 27\\ [11] 39\\ [12] 48\\ [13] 34\\ [14] 17\\ [15] 23\\ [16] 45\\ [17] 23\\ [18] 4\\ [19] } Thanks so much to any of you who could provoid a little help... I'm getting nuts. Patrick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie in R: Reading .txt files and storing the 'numbers' in avector
Have a look at ?read.table HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Patrick Schorderet Verzonden: woensdag 29 juli 2009 10:29 Aan: r-help@r-project.org Onderwerp: [R] Newbie in R: Reading .txt files and storing the 'numbers' in avector Hello everybody, I'm a newbie in R and just went through an introduction class recently. Here's my problem. I have 2 text files (.txt) with plain numbers ('doubles' for those who know c++) ordered into 2 columns as below: coordinate1 value1 coordinate2 value2 coordinate3 value3 ... ... coordinateN valueN I would like to write a small programme in which i would: 1. take all values of file 1 and store them in a vector 2. substract to those all values of file 2 (one by one) and store the result in a new vector 3. Create a sliding window of chosen size and calculate the mathematical average and store these averages in a new vector 4. Plot the different graphes with a bar plot So I wrote a c++ script that does the first parts and writes the averages in a output.txt file (which I have up and running). Unfortunately, I seem to fail in reading these as numbers and putting them into a vector (in the R environment). I can read the file , but this is what I get: z=scan(file = /Users/NCCRGENETICS/Desktop/testRnumbers.txt, what = double) Read 19 items z [1] {\\rtf1\\ansi\\ansicpg1252\\cocoartf949\\cocoasubrtf430 [2] {\\fonttbl\\f0\\fswiss\\fcharset0 [3] Helvetica;} [4] {\\colortbl;\\red255\\green255\\blue255;} [5] \\paperw11900\\paperh16840\\margl1440\\margr1440\\vieww9000\ \viewh8400\\viewkind0 [6] \\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\ \tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\ql\\qnatural\\pardirnatural [7] \\f0\\fs24 [8] \\cf0 [9] 13\\// This is where my file should start reading the numbers I see in the window when I open it with textedit [10] 27\\ [11] 39\\ [12] 48\\ [13] 34\\ [14] 17\\ [15] 23\\ [16] 45\\ [17] 23\\ [18] 4\\ [19] } Thanks so much to any of you who could provoid a little help... I'm getting nuts. Patrick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Importing time series
There are no delimiters between your fields! read.table and friends require such delimiters. As the input is ambiguous we have assumed the field widths shown in the read.fwf statement and you can modify it appropriately to use the correct field widths. Also, evidently your data has errors in it with decimals points likely missing on the 6th and the 28th of July. ss - 7/2/1982312.7212.0618.397471390.4 7/6/1982311208.4518.227521392.2 7/7/1982306.7206.4118.327381385 7/8/1982313.5207.1918.567221392.6 7/13/1982352.5205.7918.857301485.7 7/14/1982352.7206.2718.757211494.9 7/15/1982350.2207.1218.717121491.6 7/20/1982347.7205.3218.626611508.8 7/21/1982366.5204.6618.776541575.6 7/26/1982352.2208.418.526541554.9 7/27/1982351.2212.1718.516591523.6 7/28/1982347213.9618.226541499.3 7/30/1982342.9215.8318.066581467.9 8/3/1982349.2216.3718.147281536.6 DF1 - read.table(textConnection(ss), sep = /, as.is = TRUE) DF2 - read.fwf(textConnection(DF1$V3), c(4, 5, 5, 5, 5)) library(zoo) z - zoo(as.matrix(DF2[-1]), as.Date(paste(DF2$V1, DF1$V1, DF1$V2, sep = -))) This gives the following: z V2 V3 V4 V5 1982-07-02 312.7 212.000 618.300 97471390.4 1982-07-06 31120.0 8.451 8.227 521392.2 1982-07-07 306.7 206.400 118.300 27381385.0 1982-07-08 313.5 207.100 918.500 67221392.6 1982-07-13 352.5 205.700 918.800 57301485.7 1982-07-14 352.7 206.200 718.700 57211494.9 1982-07-15 350.2 207.100 218.700 17121491.6 1982-07-20 347.7 205.300 218.600 26611508.8 1982-07-21 366.5 204.600 618.700 76541575.6 1982-07-26 352.2 208.400 18.520 6541554.9 1982-07-27 351.2 212.100 718.500 16591523.6 1982-07-28 34721.0 3.961 8.226 541499.3 1982-07-30 342.9 215.800 318.000 66581467.9 1982-08-03 349.2 216.300 718.100 47281536.6 On Wed, Jul 29, 2009 at 4:22 AM, Bogasobogaso.christo...@gmail.com wrote: Thanks for reply. However still problem is there. Here I am giving some parts of the data : ss - 7/2/1982312.7212.0618.397471390.4 + 7/6/1982311208.4518.227521392.2 + 7/7/1982306.7206.4118.327381385 + 7/8/1982313.5207.1918.567221392.6 + 7/13/1982352.5205.7918.857301485.7 + 7/14/1982352.7206.2718.757211494.9 + 7/15/1982350.2207.1218.717121491.6 + 7/20/1982347.7205.3218.626611508.8 + 7/21/1982366.5204.6618.776541575.6 + 7/26/1982352.2208.418.526541554.9 + 7/27/1982351.2212.1718.516591523.6 + 7/28/1982347213.9618.226541499.3 + 7/30/1982342.9215.8318.066581467.9 + 8/3/1982349.2216.3718.147281536.6 + ss1 - textConnection(ss) read.zoo(ss1, format = %m/%d/%Y, header = FALSE) Error in read.zoo(ss1, format = %m/%d/%Y, header = FALSE) : index contains NAs Any other suggestion? Gabor Grothendieck wrote: The format for the year should be %Y, not %y; however, without a reproducible example (see last line to every message on R help) we can't be sure that that is the whole story. On Wed, Jul 29, 2009 at 3:00 AM, Bogasobogaso.christo...@gmail.com wrote: I have a time series dataset, saved in a csv file. However date-formatting is : 7/2/1982 7/6/1982 7/7/1982 7/8/1982 7/13/1982 7/14/1982 However if I use following zoo-code, it is not reading data: read.zoo(file=F:/data.csv, format=%m/%d/%y, header=F) Error is Error in read.zoo(file =F:/data.csv, format = %m/%d/%y, : index contains NAs Here I have the mandate to keep date formating in abovementioned way. Can anyone please tell me what to do here? Regards, -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24713580.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. -- View this message in context: http://www.nabble.com/Importing-time-series-tp24713580p24714603.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] Adding picture to graph?
See: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:translucency On Wed, Jul 29, 2009 at 4:27 AM, Rainer M Krugr.m.k...@gmail.com wrote: Hi while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer -- Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch University, South Africa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] quetions about dimensions
Try this: bj2=bjerrdata$tyerr[ (bjyearnum[2]+1):bjyearnum[3] ] I think it's more like what you meant to do. I believe what you wrote actually did: bjyearnum[2]+(1:bjyearnum[3]) So the problem was with arithmetic priorities, in my opinion (: having a higher priority than +). Check this: (1+2):4 [1] 3 4 1+2:4 [1] 3 4 5 Xavier - Mail Original - De: Jie TANG totang...@gmail.com À: r-help@r-project.org Envoyé: Mercredi 29 Juillet 2009 09h30:51 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: [R] quetions about dimensions hi ,everyone, I have a script shown as below: bj2=bjerrdata$tyerr[bjyearnum[2]+1:bjyearnum[3]] length(bj2) [1] 448 while b=bjyearnum[3] a=bjyearnum[2]+1 bj1=bjerrdata$tyerr[a:b] length(bj1) [1] 169 it is different with bj2 and bj1 . and the array bjyearnum is [1]0 279 448 633 1021 1365 1813 2237 2839 3314 3798 4157 12 why bj1 is 169 while bj2 is 448 ? how to let bj2 is also array with the length 169 ? thank you . -- TANG Jie Email: totang...@gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] A hiccup when using anova on gam() fits.
RT == Rolf Turner r.tur...@auckland.ac.nz on Wed, 29 Jul 2009 11:57:20 +1200 writes: RT I stumbled across a mild glitch when trying to compare the RT result of gam() fitting with the result of lm() fitting. RT The following code demonstrates the problem: RT library(gam) hmm, you should state -- optimally even in the subject of your message -- that you are *not* using the modern and well-developed gam() function from *recommended* package 'mgcv' but rather gam() from 'gam' package .. which was a sensationally good thing -- as (!#?) Fortran code -- originally in it's time in the 1980s, and soon with an S interface, (then 'S-PLUS' now 'S+') RT x - rep(1:10,10) RT set.seed(42) RT y - rnorm(100) RT fit1 - lm(y~x) RT fit2 - gam(y~lo(x)) in mgcv: fit2 - gam(y ~ s(x)) {or one of the many possible 'gam(y ~ s(x, ))' } RT fit3 - lm(y~factor(x)) RT print(anova(fit1,fit2)) # No worries. RT print(anova(fit1,fit3)) # Likewise. RT print(anova(fit2,fit3)) # Throws an error. ## not with mgcv .. ## but also there, you rather want fit3. - gam(y ~ factor(x))# NB: gam(), not lm(), even though we fit linear! anova(fit2,fit3.) # ... as you want it ## or maybe anova(fit2,fit3., test = F) RT print(anova(fit3,fit2)) # ``Works'' but gives negative degrees of RT freedom and sum of squares. ##MM: ditto for mgcv What is bad about these negative numbers? After all they are *differences* of df's and RSS's and correctly *are* negative .. but then, I know you know that ... ## NOTE: The last one goes anova() - anova.lm() - anova.lmlist() ## and then happens to work with a gam() fit... ## For that reason, even here, anova(fit3. , fit2) # note the . ## is to be preferred in my view -- Martin Maechler, ETH Zurich -- RT Is this evidence of a ``bug''? Or am I being terribly young and RT naive to RT expect anova() to work at all in such circumstances? RT The error thrown is: RT Error in anova.glmlist(list(object, ...), test = test) : RT (list) object cannot be coerced to type 'double' RT cheers, RT Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Showing time progression on (triangle) plots
Hi, I have made some nice triangle plots showing the projected airborne, landborne and oceanborne fraction of anthropogenic emitted carbon dioxide at 10 year intervals for the next century. Currently all ten points on my plot are identical so I can't distinguish between them. I would like to be able to track the trend as the century progresses. How can I show the time progression on the plot (I was thinking a gradual colour, character type or character size change)? Thanks for the help Jim The code I have used for the plot uses 'plotrix' (thanks to the Bristol mirror): Fractions -matrix(c(LF10,AF10,OF10), ncol=3) colnames(Fractions, do.NULL = TRUE, prefix=col) colnames(Fractions) - c(Landborne fraction, Airborne fraction, Oceanborne fraction) library(plotrix) triax.plot(x=Fractions,main=Where do anthropogenic emissions reside?,at=seq(0.1,0.9,by=0.1),axis.labels=NULL, tick.labels=NULL,col.axis=black,cex.axis=1,cex.ticks=1,align.labels=TRUE,show.grid=TRUE,col.grid=gray,lty.grid=par(lty),cc.axes=FALSE,show.legend=FALSE,label.points=FALSE,point.labels=NULL,col.symbols=2,pch=par(pch),no.add=TRUE) -- JS Walker jw2...@bristol.ac.uk __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R Packages and Permanent Datasets creation
Our Query: Actually while opening R console and R commander we see some packages like car and datasets. In these packages we have default datasets. For example: Women and Prestige so on. Now we created a Sales dataset importing either from excel, xml or text file. Now we are trying to store that dataset permanently in any one of the packages mentioned above (car or datasets). I am able to create them temporarily untill that pirticular session. But once we close the session and try to log into R Console and R Commander. We are not able to find the earlier created datasets Sales in the packages (Car and Datasets). Kindly suggest how to create permanent datasets in packages and also suggest how to create our own packages. If possible please send us the code it will be very helpful for us. -- View this message in context: http://www.nabble.com/R-Packages-and-Permanent-Datasets-creation-tp24713045p24713045.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] SystemFit
Ferdogan wrote: Hi, I have two products which are substitudes. I try to fix a system as below to mydata. Demand1 = A1 -B1*Price1 + C1*Price2 Demand2 = A2 +B2*Price1 - C2*Price2 I would expect C1 B2 to be symmetric, If they are truly substitude. How can I enforce this symmetry when creating a system of equations via SystemFit ? -- View this message in context: http://www.nabble.com/SystemFit-tp24588252p24713807.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] Adding picture to graph?
I had to do this recently, and I finally gave up trying to do it with R alone. Instead, I used the LaTeX overpic package. For the result, see Figure 1 in http://journal.sjdm.org/9417/jdm9417.pdf or (screenshot of it) in http://journal.sjdm.org/9417/jdm9417.html and the .tex file http://journal.sjdm.org/9417/jdm9417.tex and the R file that drew the plots http://journal.sjdm.org/9417/figs.R The pictures are tiny in this case. I do think it is possible to define your own symbols. Maybe someone else can say how. Jon On 07/29/09 10:27, Rainer M Krug wrote: Hi while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer -- Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch University, South Africa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron Editor: Judgment and Decision Making (http://journal.sjdm.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] How to do poisson distribution test like this?
On 29-Jul-09 03:28:24, glen_b wrote: Corrected links (the originals somehow aquired an extra space, sorry) Paper: http://www.plantphysiol.org/cgi/content/full/148/3/1189 Table I: http://www.plantphysiol.org/cgi/content/full/148/3/1189/TBL1 I think I've cracked it (using the informationm in Table 1). What they seem to have done is: 1: Sum the oberved numbers N[i] of F-Box Genes: total = N 2: Sum the lengths L[i] of the chromosomes: total = L 3: Calculate expected number Exp[i] for chromosome i as Exp[i] = N*L[i]/L 4: Use the Poisson distribution as: ppois(N[i],Exp[i])if N[i] Exp[i] 1-ppois(N[i],Exp[i] if N[i] Exp[i] (equality does not occur) I have implemented this in R, using the Table 1 data, as follows. The variables Exp0 and P0 are the values of Exp and P from the Table; the variables Exp1 and P1 are as calculated according to the above. Len - c(32.16,23.44,17.45,15.08,17.04,17.68,11.90, 15.43,12.41,19.21,13.17,13.03,11.50,13.68, 10.19,12.82,5.44,12.44,10.23) Obs - c(36,25,13,10,19,19,12,15,12,15,17,13,13,13,12,9,2,12,2) Exp0 - c(30,22,17,14,16,17,11,15,12,18,13,12,11,13,10,12,5,12,10) P0 - c(0.137,0.235,0.235,0.159,0.196,0.242,0.340, 0.391,0.395,0.273,0.082,0.353,0.207,0.421, 0.176,0.231,0.112,0.398,0.004) N - sum(Obs) ; L - sum(Len) Exp1 - N*Len/L Low - (Obs Exp1) P1 - Low*ppois(Obs,Exp1) + (1-Low)*(1-ppois(Obs,Exp1)) cbind(Len,Obs,Exp0,Exp1,P0,P1) Len Obs Exp0 Exp1 P0 P1 # [1,] 32.16 3630 30.429265 0.137 0.136529344 # [2,] 23.44 2522 22.178544 0.235 0.234714001 # [3,] 17.45 1317 16.510904 0.235 0.234942347 # [4,] 15.08 1014 14.268449 0.159 0.158563376 # [5,] 17.04 1916 16.122969 0.196 0.196445135 # [6,] 17.68 1917 16.728526 0.242 0.241956811 # [7,] 11.90 1211 11.259585 0.340 0.340015730 # [8,] 15.43 1515 14.599613 0.391 0.390970369 # [9,] 12.41 1212 11.742139 0.395 0.394571188 # [10,] 19.21 1518 18.176187 0.273 0.273013405 # [11,] 13.17 1713 12.461238 0.082 0.082372362 # [12,] 13.03 1312 12.328772 0.353 0.353596077 # [13,] 11.50 1311 10.881112 0.207 0.207821286 # [14,] 13.68 1313 12.943792 0.421 0.420776167 # [15,] 10.19 1210 9.641611 0.176 0.175748117 # [16,] 12.82 912 12.130074 0.231 0.231213063 # [17,] 5.44 2 5 5.147239 0.112 0.112786229 # [18,] 12.44 1212 11.770524 0.398 0.397809438 # [19,] 10.23 210 9.679458 0.004 0.003598524 There is now agreement between P0 (from the article) and P1 (as calculated above) -- subject to the rounded third decimal place of P0 being 1 out in a few cases ([12], [13], [17]). The puzzle clearly qrose in the first place becaue the authors reported their Expected Numbers as integers, not fractions! Well, well, well! Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 29-Jul-09 Time: 11:59:11 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Adding picture to graph?
Hi Rainer, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. Yes. Look at package pixmap and, especially, at the examples sub s.logo() in package ade4. Regards, Mark. Rainer M Krug-6 wrote: Hi while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer -- Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch University, South Africa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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://www.nabble.com/Adding-picture-to-graph--tp24714724p24716913.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] Add a line in a Pairs2 and mark the axis length
Hi, I have finally installed TeachingDemos trough zip file and installed on lbrary. One new question: I want to draw a line (like abline) on diagonal or the result of running a ols. How can I do it. On the other hand, I want to mark the length on each sub plot y axis. It is possible? My function is sca-function(){ z2-read.table(Ase.txt,header=T) z3-read.table(Ase2.txt,header=T) pairs2(z2,z3) } Ase.txt cointains 3653 4617 4177 3907 3975 3651 3031 2912 3018 Ase2.txt contains ant g t 219390 8740 17220 301510 8530 17550 316970 8640 17650 364220 9360 21420 387390 9960 23410 430180 11040 25820 499930 12240 27620 595010 13800 31670 661870 14760 37170 2009/7/28, Petr PIKAL petr.pi...@precheza.cz: r-help-boun...@r-project.org napsal dne 28.07.2009 15:39:03: Have you installed it first? First: install.packages(TeachingDemos) Or if you have problems with correct setting through corporate network rules (like myself) you can download a zip (for Windows) version and unzip it to library subdirectory. Then: library(TeachingDemos) shall be executed without problem Regards Petr --- On Tue, 7/28/09, Jose Narillos de Santos narillosdesan...@gmail.com wrote: From: Jose Narillos de Santos narillosdesan...@gmail.com Subject: Re: [R] pairs plot To: Petr PIKAL petr.pi...@precheza.cz, r-help@r-project.org, greg.s...@imail.org Received: Tuesday, July 28, 2009, 8:24 AM Hi, I tried to load typing library(TeachingDemos) But the message can´t find package TeachingDemos) occurs. I use versión R 2.9 on windows. Can you please guide me? Sorry¡¡¡ 2009/7/28, Petr PIKAL petr.pi...@precheza.cz: Hi r-help-boun...@r-project.org napsal dne 28.07.2009 09:55:11: Hi Greg I saw, read, the TeachingDemos you suggesttef but when run pairs2 function on my R module says Can´t find function pairs2 How can I load the module or function pairs2? Did you do library(TeachingDemos)? Regards Petr Thanks in advance for your help. You are the best. 2009/7/27, Greg Snow greg.s...@imail.org: Look at the pairs2 function in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Jose Narillos de Santos Sent: Monday, July 27, 2009 9:02 AM To: r-help@r-project.org Subject: [R] pairs plot Hi all, I want to plot trough pairs() plot a matrix with 4 columns. I want to make a trhee plot in a graph. Plotting pairs colum 2,3,4 on y axis and 1 on X axis. You mean (a plot with three graphs) ommitting the first pair with itself. And only the pairs with colum 1 with the other not all pairs. I. e. this matrix 4177 289390 8740 17220 3907 301510 8530 17550 3975 316970 8640 17650 3651 364220 9360 21420 3031 387390 9960 23410 2912 430180 11040 25820 3018 499930 12240 27620 2685 595010 13800 31670 2884 661870 14760 37170 Thanks in advance. [[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- 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] -Inline Attachment Follows- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com.
[R] Subtract matrices within arrays along indices
I have the following array: 3 dimensional object, one dimension being year. Object is 3*3*3 library(plyr, reshape) a1-rep(c(2007,2008,2009),9) a2-c(rep(a,9),rep(b,9),rep(c,9)) a3-c(rep(c(rep(1,3),rep(2,3),rep(3,3)),3)) a4 - rnorm(27) A-data.frame(cbind(comp=a2,val=a3, year=a1, a4)) A1-melt(A, id=c(year, comp, val)) A2-cast(A1, comp~val~year) I would now like to look for changes from one year to the other, i.e. for(i in levels(A$year)) A2[,,i]-A2[,,i-1] and put that into A3. Which should work except for the first one, i.e. giving me a 3*3*2 object A3. The more abstract formulation would possibly be cellwise operation within adjacent matrices of the array. I have however searched the forum for the key words and there is not much. Any help even in form of a reference would be appreciated. -- View this message in context: http://www.nabble.com/Subtract-matrices-within-arrays-along-indices-tp24717178p24717178.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] Similar package like SEM
Hello, is there a similar package like SEM. In fact, I am looking for a package where I as input several given vector variables which are part of an autoregressive model. Then I would like to obtan parameters for so called latent variables. Thank you, Luba [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to do poisson distribution test like this?
Follow-up: On 29-Jul-09 03:28:24, glen_b wrote: Corrected links (the originals somehow aquired an extra space, sorry) Paper: http://www.plantphysiol.org/cgi/content/full/148/3/1189 Table I: http://www.plantphysiol.org/cgi/content/full/148/3/1189/TBL1 -- I have now scanned though the Paper, and find the explanation of their calculation of Expected Length (which agrees with the method I described in my previous email) in a somewhat garbled description on page 1198 (page 10/12 of the PDF file): The expected gene number lambda_i on chromosome i would be a sample from a Poisson distribution lambda_i = m*L_i/Sum L_i where m is the total number of genes detected within the assembled sequences and L_i is the length of chromosome i. I agree with your earlier comment, Glen, that the paper would have benefited from more careful scrutiny by referees/editor! Best wishes, Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 29-Jul-09 Time: 12:43:26 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Adding picture to graph?
several options are listed here: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images baptiste Rainer M Krug schrieb: Hi while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] lrm-function: Interpretation and error message
Martin Kellner wrote: I have a set of data that is not normally distributed and for which I need to build a model. So, I tried the lrm function from the design-package. The first run went well, and I got the following results: Wald Statistics Response: RVCL2PROC.mott Factor Chi-Square d.f. P TTV.mott (Factor+Higher Order Factors) 69.01 4.0001 All Interactions12.13 30.0069 BEHANDLING (Factor+Higher Order Factors)14.94 60.0208 All Interactions12.13 30.0069 TTV.mott * BEHANDLING (Factor+Higher Order Factors) 12.13 3 0.0069 TOTAL69.76 7.0001 Now, how is it to be interpreted? Does it mean that the p-value for the interaction (TTV.mott*BEHANDLING) is 0.0069? And what does the TOTAL p-value signify? To understand all that, first make sure you understand all the parameters in the model - as printed when you print the fit object. Then get print.anova.Design to annotate the output to display exactly which parameters are being tested in each line: a - anova(fit) print(a, which='subscripts') # or 'names' or 'dots' Then, I ran exactly the same script on another dataset and got the following error message: singular information matrix in lrm.fit (rank= 0 ). Offending variable(s): Error in est[z$pivot[nvi:(irank + 1)] - kint] : only 0's may be mixed with negative subscripts Please follow the posting guide and submit a small example that reproduces this problem. Frank Does anyone know? I suspect that the first question is probably rather easy for you clever guys but I'm a statistics noob so... looking forward to your help. Martin Kellner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] regexpr virtue
Hi all I have got something like that (actually those are column names) [51] X19.2.300b...80 X19.2.400v...80 X19.2.400b...80 X19.2.300v...90 X19.2.300b...90 [56] X19.2.400v...90 X19.2..400b..90 X19.2.300v...100 X19.2.300b...100 X19.2.400v...100 in character vector. I would like to get last n figures from this character vector but my regexpr unerstanding is inferior and I did not succeed. Please, is there anybody who can extract those n digits from end of each character string? If there were only 2 digits I could use substr but there can be one, two or three digits. I tried several variations of gsub(0:9$, \\1 ,names(foto)[10]) but either got whole string or an error. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] (no subject)
HiI am contacting you regarding a problem with downloading R. I cannot seen to manage because my computer language is in Norwegian. DO you know if there is R that can deal with Norwegian letters? Øistein Harsem _ Show them the way! Add maps and directions to your party invites. [[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] Transporting data in different R windows
Hi, I am working with multiple R-windows opened and would like to transport some variables from one to another. Is there any direct way to do this without saving them in hard-disk? Thanks -- View this message in context: http://www.nabble.com/Transporting-data-in-different-R-windows-tp24719077p24719077.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] regexpr virtue
Here are a couple of possibilities: sub(.*\\., , s) library(gsubfn) strapply(s, [0-9]*$, simplify = c) On Wed, Jul 29, 2009 at 9:10 AM, Petr PIKALpetr.pi...@precheza.cz wrote: Hi all I have got something like that (actually those are column names) [51] X19.2.300b...80 X19.2.400v...80 X19.2.400b...80 X19.2.300v...90 X19.2.300b...90 [56] X19.2.400v...90 X19.2..400b..90 X19.2.300v...100 X19.2.300b...100 X19.2.400v...100 in character vector. I would like to get last n figures from this character vector but my regexpr unerstanding is inferior and I did not succeed. Please, is there anybody who can extract those n digits from end of each character string? If there were only 2 digits I could use substr but there can be one, two or three digits. I tried several variations of gsub(0:9$, \\1 ,names(foto)[10]) but either got whole string or an error. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] regexpr virtue
Thanks If somebody does not come with more elaborated solution I will adapt yours. After strsplit I can get not only 3 but several chunks. If the last chunk is every time the one I need then sapply(strsplit(names(foto),\\...), length) [1] 2 6 6 6 6 5 5 6 5 3 3 3 3 3 3 3 3 3 3 4 3 3 4 4 3 3 3 3 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 3 3 3 3 3 3 3 4 3 3 3 3 3 3 4 4 3 4 3 3 gives me number of chunks which I can use for selection. Best regards Jorge Ivan Velez jorgeivanve...@gmail.com napsal dne 29.07.2009 15:18:33: Dear Petr, How about this strsplit()ing them up? x [1] X19.2.400v...80 strsplit(x,\\...)[[1]][3] [1] 80 HTH, Jorge On Wed, Jul 29, 2009 at 9:10 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi all I have got something like that (actually those are column names) [51] X19.2.300b...80 X19.2.400v...80 X19.2.400b...80 X19.2.300v...90 X19.2.300b...90 [56] X19.2.400v...90 X19.2..400b..90 X19.2.300v...100 X19.2.300b...100 X19.2.400v...100 in character vector. I would like to get last n figures from this character vector but my regexpr unerstanding is inferior and I did not succeed. Please, is there anybody who can extract those n digits from end of each character string? If there were only 2 digits I could use substr but there can be one, two or three digits. I tried several variations of gsub(0:9$, \\1 ,names(foto)[10]) but either got whole string or an error. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Subtract matrices within arrays along indices
Hi Christian, Christian Langkamp wrote: I have the following array: 3 dimensional object, one dimension being year. Object is 3*3*3 library(plyr, reshape) # reshape won't be loaded that way, use separate library() Christian Langkamp wrote: a1-rep(c(2007,2008,2009),9) a2-c(rep(a,9),rep(b,9),rep(c,9)) a3-c(rep(c(rep(1,3),rep(2,3),rep(3,3)),3)) a4 - rnorm(27) A-data.frame(cbind(comp=a2,val=a3, year=a1, a4)) # here, a4 have been switched to factor. # you can use str(A) #to check that #so use nlevels(), A$a4 - as.numeric(a4) Christian Langkamp wrote: A1-melt(A, id=c(year, comp, val)) A2-cast(A1, comp~val~year) I would now like to look for changes from one year to the other, i.e. for(i in levels(A$year)) A2[,,i]-A2[,,i-1] and put that into A3. # levels will return characters, but you can't substract 1 from it # so use nlevels instead, A3 -array(dim=dim(A2)) for(i in 2:nlevels(A$year)) A3[,,i]-A2[,,i]-A2[,,i-1] Hope this help, Etienne Christian Langkamp wrote: Which should work except for the first one, i.e. giving me a 3*3*2 object A3. The more abstract formulation would possibly be cellwise operation within adjacent matrices of the array. I have however searched the forum for the key words and there is not much. Any help even in form of a reference would be appreciated. -- View this message in context: http://www.nabble.com/Subtract-matrices-within-arrays-along-indices-tp24717178p24719544.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] regexpr virtue
Thank you Gabor Grothendieck ggrothendi...@gmail.com napsal dne 29.07.2009 15:20:40: Here are a couple of possibilities: sub(.*\\., , s) This seems to be the target. Can you be so kind and translate for me what it really does? .* matches several dots? \\. what is this? I thought sub finds a match and replaces replacement in a string. But from this solution it seems that the command replaces all characters in a string with empty string and leave only value after three or two dots? Am I right? Best regards Petr library(gsubfn) strapply(s, [0-9]*$, simplify = c) On Wed, Jul 29, 2009 at 9:10 AM, Petr PIKALpetr.pi...@precheza.cz wrote: Hi all I have got something like that (actually those are column names) [51] X19.2.300b...80 X19.2.400v...80 X19.2.400b...80 X19.2.300v...90 X19.2.300b...90 [56] X19.2.400v...90 X19.2..400b..90 X19.2.300v...100 X19.2.300b...100 X19.2.400v...100 in character vector. I would like to get last n figures from this character vector but my regexpr unerstanding is inferior and I did not succeed. Please, is there anybody who can extract those n digits from end of each character string? If there were only 2 digits I could use substr but there can be one, two or three digits. I tried several variations of gsub(0:9$, \\1 ,names(foto)[10]) but either got whole string or an error. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Drawing lines in margins
Hi all, Quick question: What function can I use to draw a line in the margin of a plot? segments() and lines() both stop at the margin. In case the answer depends on exactly what I'm trying to do, see below. I'm using R v. 2.8.1 on Windows XP. Cheers, Alan I'm trying to make a horizontal barplot with a column of numbers on the right side. I'd like to put a line between the column header and the numbers. The following reconstructs the idea - just copy and paste it in: aa - 1:10 plot.mtx2-cbind(aa,aa+1) colnames(plot.mtx2)-c(Male,Female) lci2- cbind(aa-1,aa) uci2- cbind(aa+1,aa+2) par(mar=c(5,6,4,5)) cols - c(grey79,grey41) bplot2-barplot(t(plot.mtx2),beside=TRUE,xlab=Malaria death rates per 100,000, names.arg=paste(state,aa,sep=),legend.text=F,las=1,xlim=c(0,13), horiz=T, col=cols, main=Malaria death rates by state and sex) legend(8,6,legend=c(Female,Male),fill=cols[order(2:1)]) segments(y0=bplot2, y1=bplot2, x0=t(lci2), x1=t(uci2)) mtext(10*(aa+1),side=4,line=4,at=seq(3,3*length(aa),by=3)-0.35,padj=0.5,adj=1,las=1,cex=0.85) mtext(10*aa,side=4,line=4,at=seq(2,3*length(aa)-1,by=3)-0.65,padj=0.5,adj=1,las=1,cex=0.85) mtext(Estimated,side=4,line=3,at=3*length(aa)+2.75,padj=0.5,adj=0.5,las=1,cex=0.85) mtext(Deaths,side=4,line=3,at=3*length(aa)+1.25,padj=0.5,adj=0.5,las=1,cex=0.85) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Adding picture to graph?
I'm not sure if you can consider grid graphics. If so, then Murrell has some nice worked examples in: http://www.stat.auckland.ac.nz/~paul/Talks/gddg.pdf On Jul 29, 2009, at 4:27 AM, Rainer M Krug wrote: while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer -- Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch University, South Africa David Winsemius, MD Heritage Laboratories 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] R Packages and Permanent Datasets creation
On Tue, 2009-07-28 at 23:13 -0700, rajclinasia wrote: Our Query: Actually while opening R console and R commander we see some packages like car and datasets. In these packages we have default datasets. For example: Women and Prestige so on. Now we created a Sales dataset importing either from excel, xml or text file. Now we are trying to store that dataset permanently in any one of the packages mentioned above (car or datasets). I am able to create them temporarily untill that pirticular session. But once we close the session and try to log into R Console and R Commander. We are not able to find the earlier created datasets Sales in the packages (Car and Datasets). Kindly suggest how to create permanent datasets in packages and also suggest how to create our own packages. If possible please send us the code it will be very helpful for us. You *can't* do this (well, not easily, without compiling your own version of R or the car package). I don't know how the R Commander package works but I'm fairly certain it isn't restricted to datasets that come in packages. Lets take RCmdr our of the equation for a moment. You have an object 'Sales' in your R session. To save this as an R object for reuse in later sessions, just do save(Sales, file = my_Sales_obj.rda) Next session, before you start RCmdr, do load(file = my_Sales_obj.rda) That will make it available for use. The filenames I use can be whatever you want and should include the full path to where you want it saving if not in the current working directory. G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] (no subject)
On Wed, Jul 29, 2009 at 03:12:02PM +0200, Øistein Harsem wrote: HiI am contacting you regarding a problem with downloading R. I cannot seen to manage because my computer language is in Norwegian. DO you know if there is R that can deal with Norwegian letters? I have never seen a download to fail because of locales. Or do you mean you have trouble with using non-ASCII characters in a sucessfully downloaded/installed R? My installation of R seems to have no issues with the non-Ascii chars I have used so far (R 2.9.1, LINUX, utf8 locale). In any case, you need to be a bit more specific about the problem you have: What version of R, what OS, what exaclty are you trying to do and what happens when you try? cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 Packages and Permanent Datasets creation
On Tue, Jul 28, 2009 at 11:13:11PM -0700, rajclinasia wrote: Actually while opening R console and R commander we see some packages like car and datasets. In these packages we have default datasets. For example: Women and Prestige so on. Now we created a Sales dataset importing either from excel, xml or text file. Now we are trying to store that dataset permanently in any one of the packages mentioned above (car or datasets). I am able to create them temporarily untill that pirticular session. But once we close the session and try to log into R Console and R Commander. We are not able to find the earlier created datasets Sales in the packages (Car and Datasets). Kindly suggest how to create permanent datasets in packages and also suggest how to create our own packages. A similar question has been asked very recently by someone else - are you guys related in any way? (e.g. takeing the same class or something). Gavin already pointed out that adding to other peoples packages can (should) not be done - at least not cleanly. He has also pointed out save and load so your problem is probably solved. On the other hand, there could be more to your question, so I'd like to ask WHY you would like to add your own dataset to an exisiting package. Are you simply interested in having you data available in the next session or do you have something else in mind (e.g. distributing the data to others). cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Drawing lines in margins
Look at the xpd option in ?par. If you set par(xpd=TRUE) you should be able to add a segment for what you want. But please let me know if someone gives you a better way to do this. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alan Cohen Sent: Wednesday, July 29, 2009 10:22 AM To: r-help@r-project.org Subject: [R] Drawing lines in margins Hi all, Quick question: What function can I use to draw a line in the margin of a plot? segments() and lines() both stop at the margin. In case the answer depends on exactly what I'm trying to do, see below. I'm using R v. 2.8.1 on Windows XP. Cheers, Alan I'm trying to make a horizontal barplot with a column of numbers on the right side. I'd like to put a line between the column header and the numbers. The following reconstructs the idea - just copy and paste it in: aa - 1:10 plot.mtx2-cbind(aa,aa+1) colnames(plot.mtx2)-c(Male,Female) lci2- cbind(aa-1,aa) uci2- cbind(aa+1,aa+2) par(mar=c(5,6,4,5)) cols - c(grey79,grey41) bplot2-barplot(t(plot.mtx2),beside=TRUE,xlab=Malaria death rates per 100,000, names.arg=paste(state,aa,sep=),legend.text=F,las=1,xlim=c(0,13), horiz=T, col=cols, main=Malaria death rates by state and sex) legend(8,6,legend=c(Female,Male),fill=cols[order(2:1)]) segments(y0=bplot2, y1=bplot2, x0=t(lci2), x1=t(uci2)) mtext(10*(aa+1),side=4,line=4,at=seq(3,3*length(aa),by=3)-0.35,padj=0.5, adj=1,las=1,cex=0.85) mtext(10*aa,side=4,line=4,at=seq(2,3*length(aa)-1,by=3)-0.65,padj=0.5,ad j=1,las=1,cex=0.85) mtext(Estimated,side=4,line=3,at=3*length(aa)+2.75,padj=0.5,adj=0.5,la s=1,cex=0.85) mtext(Deaths,side=4,line=3,at=3*length(aa)+1.25,padj=0.5,adj=0.5,las=1 ,cex=0.85) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S. News World Report (2008). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] predict
I have found a regression model, and i would like to predict value in different points. I have tried to use predict function but it doesn't work. I have used predict function like this: newdata-seq(from=0.1, to=0.32,by=0.02) data-predict(fm,newdata) where fm is a regression model. The predict function return me that: Error in eval(predvars, data, env) : numeric argument 'envir' doesn't have unitary length where is the error? -- View this message in context: http://www.nabble.com/predict-tp24719362p24719362.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] Package norm has been removed. What to use for Maximum Likelihood Missing Data Imputation?
Hello, I also used the norm-package for data with missing values. Are there no possibilities to fix it (its not under GPL?), or is here anyone able to get the negotiation for the maintainership for this package? Another question: I have read, taht mice would be an alternative instead of using norm. Is it also possible to the EM-Algorithm for imputation of missing values in multivariate normal data? Or are there better possibilities? (Besides:the package mvnmle is not possible for me, because my data matrix is too big...) I would be pleased to get anwers from you! Katharina Klein Uwe Ligges-3 wrote: Achim Zeileis wrote: On Fri, 17 Jul 2009, Daniel Abbott wrote: Hello, I apologize if an answer to my questions is available, or if I submitted this question incorrectly. I have read the mailing lists, as well as the R Project and CRAN homepages. However, I may have missed something. I noticed the package 'norm' has been removed. Its page http://cran.r-project.org/web/packages/norm/index.html now reads: Package ?norm? was removed from the CRAN repository. Formerly available versions can be obtained from the archive. My questions are: 1. Why was norm removed? I used the package and found it to be very useful. Is there a serious error in the package or another problem? What do you consider to be a serious error? Typical reasons for removing a package from the active CRAN repository are that the package does not pass CRAN checks and/or that the package maintainer is irresponsive. (norm, specifically, hadn't been updated since 2002.) This is serious enough to make all automatic CRAN features such as daily package checks and building of binary packages too cumbersome. But if you do not consider this to be serious, you can keep on using norm, it is still in CRAN's package archives. Or, even better, you could adopt it, fix it, and release a new version to CRAN (although it is not quite clear to me whether the norm's license allows this). Oh yes, indeed. Please ignore my former message, I haven't looked at the license carefully enough. And since the license is rather special (not GPL'ed as I assumed in my message), you cannot take over maintainership without negotiation with the former maintainer, I fear. Best, Uwe Ligges (Note that CRAN runs no checks whether the methods implemented are reasonable or well-suited for the problem they are trying to address etc.) 2. If norm should no longer be removed, what is another good package for ML (maximum likelihood) missing data imputation? I have seen several recommendations online, but I wonder which one is currently the reigning champ. The Multivariate and the SocialSciences task views have sections about missing data http://CRAN.R-project.org/view=Multivariate http://CRAN.R-project.org/view=SocialSciences Additionally, I can recall that there is the Amelia II package: http://CRAN.R-project.org/package=Amelia and potentially others. hth, Z Thank you very much. I appreciate your time! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Package-norm-has-been-removed.-What-to-use-for-Maximum-Likelihood-Missing-Data-Imputation--tp24531976p24718866.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] predict
Newdata needs to be a dataframe with the same variable names as the explanatory variables in your models. Model - lm(y ~ x, data = dataset) Newdata - data.frame(x = seq(from=0.1, to=0.32,by=0.02)) Newdata$y - predict(Model, newdata = Newdata) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens serbring Verzonden: woensdag 29 juli 2009 15:31 Aan: r-help@r-project.org Onderwerp: [R] predict I have found a regression model, and i would like to predict value in different points. I have tried to use predict function but it doesn't work. I have used predict function like this: newdata-seq(from=0.1, to=0.32,by=0.02) data-predict(fm,newdata) where fm is a regression model. The predict function return me that: Error in eval(predvars, data, env) : numeric argument 'envir' doesn't have unitary length where is the error? -- View this message in context: http://www.nabble.com/predict-tp24719362p24719362.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. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] predict
You need to create the variable names in newdata (which is generally a dataframe) that match those used in constructing fm. Surely there must be a worked example that illustrates this on the help page? On Jul 29, 2009, at 9:30 AM, serbring wrote: I have found a regression model, and i would like to predict value in different points. I have tried to use predict function but it doesn't work. I have used predict function like this: newdata-seq(from=0.1, to=0.32,by=0.02) data-predict(fm,newdata) where fm is a regression model. The predict function return me that: Error in eval(predvars, data, env) : numeric argument 'envir' doesn't have unitary length where is the error? Hard to tell what other errors at work might be at work since no reproducible example (and not even the original code to construct fm) was offered. Please re-read the Posting Guide. David Winsemius, MD Heritage Laboratories 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] visualizzazione colonne
ciao, ho aperto un file in R di classe data frame di 15000 righe e 29 colonne. Nella console però sono visualizzate solo la prima e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina [[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] Package with function for plots with embedded hyperlinks?
Some years ago, if I recall correctly, I learned of a package that included a function that would write a plot to a file so that one could associate hyperlinks with elements of the plot, such as points. Then, when the plot was displayed in a browser, one could click on (for example) a point, and jump to wherever the hypelink pointed. I don't remember then name of the package or function, and haven't been able to find it after some searching. Does anyone know the name, or have a suggestion to help track it down? Thanks -Don -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] (senza oggetto)
Ciao, ho aperto con R un file di classe data frame con 15000 righe e 29 colonne. Nella console però sono visualizzate solo la prime e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina [[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] n-way table of aggregate statistics
Hi, I'm doing my first steps in R. I wonder how can I create an n-way table of aggregate statistics, something like what aggregate.table does, but with an unlimited number of grouping factors. Thanks, Yoav Kessler __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Package with function for plots with embedded hyperlinks?
Never mind, just after I sent this I finally did the right search. It is RSVGTipsDevice -Don At 8:30 AM -0700 7/29/09, Don MacQueen wrote: Some years ago, if I recall correctly, I learned of a package that included a function that would write a plot to a file so that one could associate hyperlinks with elements of the plot, such as points. Then, when the plot was displayed in a browser, one could click on (for example) a point, and jump to wherever the hypelink pointed. I don't remember then name of the package or function, and haven't been able to find it after some searching. Does anyone know the name, or have a suggestion to help track it down? Thanks -Don -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] (senza oggetto)
Um Antwort von der R Mailinglite zu bekommen, verwenden Sie bitte eine aussagekräftige Betreff-Zeile und formulieren Sie Ihre Anfrage in *Englisch* - nachdem Sie den posting guide gelesen haben. MfG, Uwe Ligges sabrina.michie...@alice.it wrote: Ciao, ho aperto con R un file di classe data frame con 15000 righe e 29 colonne. Nella console però sono visualizzate solo la prime e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make my plots bigger and reduce white space around panels?
It still was not attached, but you can reduce the white space by reducing the margins using par(mar=c(...)). If you do par(mar=c(0,0,0,0)), then there will be no space between the plots, using values larger than 0 will give space. But beware, you need to either suppress the plotting of axis labels/ticks or make them smaller and closer to the axes, or you will end up with the axis label for one plot inside of another. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Mark Na Sent: Tuesday, July 28, 2009 4:53 PM To: r-help@r-project.org Subject: Re: [R] Make my plots bigger and reduce white space around panels? The plot is attached this time... On Tue, Jul 28, 2009 at 4:47 PM, Mark Na mtb...@gmail.com wrote: Hi, I have made a plot with panels (attached) using R code (below) and I'd like to increase the size of each panel and decrease the white space, especially the white space between: 1. rows of panels 2. the top panel and its title (which contains info on r2 and N) 3. each panel and its x label. I've dug around in the plot help files but can't seem to find how to do this. Any help much appreciated, thanks! Mark Na #ELEPHANT SPECIES RICHNESS par(mfrow=c(3,4),oma=c(0,0,2,0)) models-list(data$SR.elephant.obs~data$AREA, log(data$SR.elephant.obs+1,10)~log(data$AREA,10), data$SR.elephant.obs~log(data$AREA,10), log(data$SR.elephant.obs+1,10)~data$AREA) for (i in 1:length(models)){ #SCATTERPLOT model-lm(models[[i]]) plot(models[[i]],ylab=Elephant SR); abline(model);title(main=paste(r2=,round(summary(model)$r.squared,dig its=3),, N=,dim(data)[1])) } for (i in 1:length(models)){#RESIDUALS VS FITTED VALUES PLOT model-lm(models[[i]]) plot.lm(model,which=1,sub.caption=NA) } for (i in 1:length(models)){#Q-Q PLOT model-lm(models[[i]]) plot.lm(model,which=2,sub.caption=NA) } title(main=ELEPHANT SPECIES RICHNESS,outer=TRUE); savePlot(SR_elephant.emf,type=emf); dev.off() -- Mark Na University of Saskatchewan Saskatoon, Canada __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] regexpr virtue
dot means any character and * repeats it for as many times as possible so it replaces eveything (.*) up to the last dot (\\.) with nothing. On Wed, Jul 29, 2009 at 9:43 AM, Petr PIKALpetr.pi...@precheza.cz wrote: Thank you Gabor Grothendieck ggrothendi...@gmail.com napsal dne 29.07.2009 15:20:40: Here are a couple of possibilities: sub(.*\\., , s) This seems to be the target. Can you be so kind and translate for me what it really does? .* matches several dots? \\. what is this? I thought sub finds a match and replaces replacement in a string. But from this solution it seems that the command replaces all characters in a string with empty string and leave only value after three or two dots? Am I right? Best regards Petr library(gsubfn) strapply(s, [0-9]*$, simplify = c) On Wed, Jul 29, 2009 at 9:10 AM, Petr PIKALpetr.pi...@precheza.cz wrote: Hi all I have got something like that (actually those are column names) [51] X19.2.300b...80 X19.2.400v...80 X19.2.400b...80 X19.2.300v...90 X19.2.300b...90 [56] X19.2.400v...90 X19.2..400b..90 X19.2.300v...100 X19.2.300b...100 X19.2.400v...100 in character vector. I would like to get last n figures from this character vector but my regexpr unerstanding is inferior and I did not succeed. Please, is there anybody who can extract those n digits from end of each character string? If there were only 2 digits I could use substr but there can be one, two or three digits. I tried several variations of gsub(0:9$, \\1 ,names(foto)[10]) but either got whole string or an error. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] dot plot with several points for 2 categories
Hi Michael, Steve, and 1Rnwb, I'm very impressed by the quick replies on the mailer. Thanks a lot for your suggestions. They worked very well. In general, I have to say that I'm a bit disappointed that in R, like in Excel, one basically needs to hack to get a dot blot with categories by adding an artificial x value. I was hoping this common type of diagram could be generated using a standard function like dotplot or dotchart. Best, j Michael Knudsen-2 wrote: On Fri, Jul 17, 2009 at 7:17 PM, jaregisuck...@mpi-cbg.de wrote: I'm trying to wean myself off the very limited capabilities of Excel and Oo. Currently, I am trying to make a plot showing several values for 2 categories in a dot blot (see http://www.nabble.com/file/p24538360/Picture%2B1.png Picture+1.png except that the x axis should contain the category not a number, which was the only way to coax Excel into displaying a plot like this). Let y1 be a vector containing the values in the first category, and let y2 contain those of the second. The you could do like this: x1 = rep(1,times=length(y1)) x2 = rep(2,times=length(y2)) plot(c(x1,x2),c(y1,y2),xaxt=n) axis(side=1,at=c(1,2),labels=c(label1,label2)) It looks like a hack, but it should work. -- Michael Knudsen micknud...@gmail.com http://lifeofknudsen.blogspot.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. -- View this message in context: http://www.nabble.com/dot-plot-with-several-points-for-2-categories-tp24538360p24722548.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 a line in a Pairs2 and mark the axis length
I am not sure what you mean by mark the length on each sub plot y axis, but here is an example of the other parts (and if you know how to mark the length on a single regular plot, then just add that code to the panel function): pairs2( iris[,1], iris[,2:4], panel=function(x,y,...) { points(x,y,...) abline(0,1, col='blue') abline(lm(y~x), col='green') } ) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Jose Narillos de Santos [mailto:narillosdesan...@gmail.com] Sent: Wednesday, July 29, 2009 5:10 AM To: petr.pi...@precheza.cz; Greg Snow; r-help@r-project.org Subject: Add a line in a Pairs2 and mark the axis length Hi, I have finally installed TeachingDemos trough zip file and installed on lbrary. One new question: I want to draw a line (like abline) on diagonal or the result of running a ols. How can I do it. On the other hand, I want to mark the length on each sub plot y axis. It is possible? My function is sca-function(){ z2-read.table(Ase.txt,header=T) z3-read.table(Ase2.txt,header=T) pairs2(z2,z3) } Ase.txt cointains 3653 4617 4177 3907 3975 3651 3031 2912 3018 Ase2.txt contains ant g t 219390 8740 17220 301510 8530 17550 316970 8640 17650 364220 9360 21420 387390 9960 23410 430180 11040 25820 499930 12240 27620 595010 13800 31670 661870 14760 37170 2009/7/28, Petr PIKAL petr.pi...@precheza.czmailto:petr.pi...@precheza.cz: r-help-boun...@r-project.orgmailto:r-help-boun...@r-project.org napsal dne 28.07.2009 15:39:03: Have you installed it first? First: install.packages(TeachingDemos) Or if you have problems with correct setting through corporate network rules (like myself) you can download a zip (for Windows) version and unzip it to library subdirectory. Then: library(TeachingDemos) shall be executed without problem Regards Petr --- On Tue, 7/28/09, Jose Narillos de Santos narillosdesan...@gmail.commailto:narillosdesan...@gmail.com wrote: From: Jose Narillos de Santos narillosdesan...@gmail.commailto:narillosdesan...@gmail.com Subject: Re: [R] pairs plot To: Petr PIKAL petr.pi...@precheza.czmailto:petr.pi...@precheza.cz, r-help@r-project.orgmailto:r-help@r-project.org, greg.s...@imail.orgmailto:greg.s...@imail.org Received: Tuesday, July 28, 2009, 8:24 AM Hi, I tried to load typing library(TeachingDemos) But the message can´t find package TeachingDemos) occurs. I use versión R 2.9 on windows. Can you please guide me? Sorry¡¡¡ 2009/7/28, Petr PIKAL petr.pi...@precheza.czmailto:petr.pi...@precheza.cz: Hi r-help-boun...@r-project.orgmailto:r-help-boun...@r-project.org napsal dne 28.07.2009 09:55:11: Hi Greg I saw, read, the TeachingDemos you suggesttef but when run pairs2 function on my R module says Can´t find function pairs2 How can I load the module or function pairs2? Did you do library(TeachingDemos)? Regards Petr Thanks in advance for your help. You are the best. 2009/7/27, Greg Snow greg.s...@imail.orgmailto:greg.s...@imail.org: Look at the pairs2 function in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.orgmailto:greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.orgmailto:r-help-boun...@r-project.org [mailto:r-help-boun...@r-mailto:r-help-boun...@r- project.orghttp://project.org/] On Behalf Of Jose Narillos de Santos Sent: Monday, July 27, 2009 9:02 AM To: r-help@r-project.orgmailto:r-help@r-project.org Subject: [R] pairs plot Hi all, I want to plot trough pairs() plot a matrix with 4 columns. I want to make a trhee plot in a graph. Plotting pairs colum 2,3,4 on y axis and 1 on X axis. You mean (a plot with three graphs) ommitting the first pair with itself. And only the pairs with colum 1 with the other not all pairs. I. e. this matrix 4177 289390 8740 17220 3907 301510 8530 17550 3975 316970 8640 17650 3651 364220 9360 21420 3031 387390 9960 23410 2912 430180 11040 25820 3018 499930 12240 27620 2685 595010 13800 31670 2884 661870 14760 37170 Thanks in advance. [[alternative HTML version deleted]] __ R-help@r-project.orgmailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-http://www.r-project.org/posting- guide.html and provide commented,
[R] vector
Hi , i have a vector A=(a1,a2,a3,a4) and i want to create another vector B=(a1,a1,a2,a2,a3,a3,a4,a4) !!! i know that it is simple but i begin with R so i nned your help!! thank you for your help !!! [[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] visualizing columns
hi, i've opened a file with R which data are data.frame. It has 15000 rows and 29 columns. On the console i only can see the first and the last columns and the last 8000 rows. Is it possible to visualize the entire data set? Thanks Sabrina Da: sabrina.michie...@alice.it Inviato: mer 29/07/2009 17.37 A: R-help@r-project.org Oggetto: Ciao, ho aperto con R un file di classe data frame con 15000 righe e 29 colonne. Nella console però sono visualizzate solo la prime e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] vector
rep(A, each=2) On Thu, Jul 30, 2009 at 12:15 AM, Inchallah Yarabinchallahya...@yahoo.fr wrote: Hi , i have a vector A=(a1,a2,a3,a4) and i want to create another vector B=(a1,a1,a2,a2,a3,a3,a4,a4) !!! i know that it is simple but i begin with R so i nned your help!! thank you for your help !!! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Adding picture to graph?
In addition to the other responses, you may want to look at the subplot function in the TeachingDemos package for a way to place the image at a location within the plot (the other answers so far use the image as a full background), see the last example on the help page for a way to use the R logo as a plotting symbol. If you want to define your own symbols for plotting, look at the my.symbols function in the TeachingDemos package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Rainer M Krug Sent: Wednesday, July 29, 2009 2:27 AM To: r-h...@stat.math.ethz.ch Subject: [R] Adding picture to graph? Hi while teaching R, the question came up if it would be possible to add a picture (saved on the HDD) to a graph (generated by plot()), which we could not answer. It might easily kill a clean graph, but: is there a way of doing this, even one should not do it? On a similar line of thought: is it possibe to define own symbols so that they can be used in the plot function with pch=? Rainer -- Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch University, South Africa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Drawing lines in margins
In addition to Benjamin's response (which is the best way that I know of), you may also want to look at the grconvertX and grconvertY functions for ways to find the coordinates in the margins to plot at. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Nutter, Benjamin Sent: Wednesday, July 29, 2009 8:56 AM To: Alan Cohen Cc: r-help@r-project.org Subject: Re: [R] Drawing lines in margins Look at the xpd option in ?par. If you set par(xpd=TRUE) you should be able to add a segment for what you want. But please let me know if someone gives you a better way to do this. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Alan Cohen Sent: Wednesday, July 29, 2009 10:22 AM To: r-help@r-project.org Subject: [R] Drawing lines in margins Hi all, Quick question: What function can I use to draw a line in the margin of a plot? segments() and lines() both stop at the margin. In case the answer depends on exactly what I'm trying to do, see below. I'm using R v. 2.8.1 on Windows XP. Cheers, Alan I'm trying to make a horizontal barplot with a column of numbers on the right side. I'd like to put a line between the column header and the numbers. The following reconstructs the idea - just copy and paste it in: aa - 1:10 plot.mtx2-cbind(aa,aa+1) colnames(plot.mtx2)-c(Male,Female) lci2- cbind(aa-1,aa) uci2- cbind(aa+1,aa+2) par(mar=c(5,6,4,5)) cols - c(grey79,grey41) bplot2-barplot(t(plot.mtx2),beside=TRUE,xlab=Malaria death rates per 100,000, names.arg=paste(state,aa,sep=),legend.text=F,las=1,xlim=c(0,13), horiz=T, col=cols, main=Malaria death rates by state and sex) legend(8,6,legend=c(Female,Male),fill=cols[order(2:1)]) segments(y0=bplot2, y1=bplot2, x0=t(lci2), x1=t(uci2)) mtext(10*(aa+1),side=4,line=4,at=seq(3,3*length(aa),by=3)- 0.35,padj=0.5, adj=1,las=1,cex=0.85) mtext(10*aa,side=4,line=4,at=seq(2,3*length(aa)-1,by=3)- 0.65,padj=0.5,ad j=1,las=1,cex=0.85) mtext(Estimated,side=4,line=3,at=3*length(aa)+2.75,padj=0.5,adj=0.5,l a s=1,cex=0.85) mtext(Deaths,side=4,line=3,at=3*length(aa)+1.25,padj=0.5,adj=0.5,las= 1 ,cex=0.85) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S. News World Report (2008). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] dot plot with several points for 2 categories
Hi, On Jul 29, 2009, at 12:11 PM, jaregi wrote: Hi Michael, Steve, and 1Rnwb, I'm very impressed by the quick replies on the mailer. Thanks a lot for your suggestions. They worked very well. In general, I have to say that I'm a bit disappointed that in R, like in Excel, one basically needs to hack to get a dot blot with categories by adding an artificial x value. I was hoping this common type of diagram could be generated using a standard function like dotplot or dotchart. Is it really that disappointing? I've never used excel for anything serious, so I don't know what life is like there, but in R you can make your own functions in order to encapsulate functionality you find useful. So, for instance, let's take the code I used before and wrap it up a bit nicer: dotplot - function(..., labels=NULL, cols=NULL, main=My Awesome Dotplot) { stuff - list(...) lower - min(sapply(stuff, min)) upper - max(sapply(stuff, max)) if (is.null(cols)) { cols - rainbow(length(stuff)) } plot(jitter(rep(1, length(stuff[[1]]))), stuff[[1]], ylim=c(lower,upper), xlim=c(0.5,length(stuff)+0.5), xlab=NULL, xaxt='n', col=cols[1], main=main) if (length(stuff) 1) { for (i in 2:length(stuff)) { points(jitter(rep(i, length(stuff[[i]]))), stuff[[i]], col=cols[i]) } } if (is.null(labels)) { labels - paste(Group, seq(stuff)) } axis(1, seq(stuff), labels=labels) } Copy that function up there and either (i) paste it into your R workspace, or (ii) save it to a file and source('/path/to/dotplot.R'). Now look at the difference between these two: dotplot(rnorm(20,10,2), rnorm(20,15,1), rnorm(10,15,0.1)) dotplot(rnorm(20,10,2), rnorm(20,15,1), rnorm(10,15,0.1), cols=c('red','green','blue'), labels=c('A', 'B', 'C'), main=Custom Colors) See ?plot ?title ?par to tweak the plotting functionality as you wish. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] visualizing columns
Try the View function (note capitol V), does that do what you want? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of sabrina.michie...@alice.it Sent: Wednesday, July 29, 2009 10:18 AM To: R-help@r-project.org Subject: [R] visualizing columns hi, i've opened a file with R which data are data.frame. It has 15000 rows and 29 columns. On the console i only can see the first and the last columns and the last 8000 rows. Is it possible to visualize the entire data set? Thanks Sabrina Da: sabrina.michie...@alice.it Inviato: mer 29/07/2009 17.37 A: R-help@r-project.org Oggetto: Ciao, ho aperto con R un file di classe data frame con 15000 righe e 29 colonne. Nella console però sono visualizzate solo la prime e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina [[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] Summarising Data for Forrest Plots
Are n.FD and n.RD the number of people who received the full/reduced dose Yes - but I don't have the data structured like that YET - thats what I want to get to because thats what forest plot seems to be wanting. and surv.FD and surv.RD the number of people that survived? Mmm... was more thinking of something like median survival? ALthough the brain hasn't kicked into gear yet tonight and it might actually be mean to be a hazard ratio? And are the people who received the full dose different from the people who received the reduced dose? Yes And what exactly is it that you want to plot in the forest plot? Subgroups - see below From the way you have arranged the table, it seems as if you want some kind of effect size measure that contrasts the survival rate of the full versus reduced dose in the various subgroups. Is that correct? Yip that sounds right And are you just trying to figure out how to draw the forest plot once you have the data in the table form as shown in your post or are you also trying to figure out how to create that table to begin with? I *think* I can draw the plot once I have the data structured right. But at the moment my data is structured like this: PatientID FullDose Survival Censored Age Sex Normal Renal Func Grade of Toxicity 001 Y125 N 75 F Y 1 002 N55 Y 55 M N 4 003 N65 Y78 F Y 2 I want to eventually get to a forest plot that looks a bit like this: Age: 65|-#---|| = 65 |-#| | | Sex:| M|-#--|---| F |---#-| | | Renal Fucn: | Normal |---#-| Abnormal |---#-| | Grade of Toxicity: | 0-1 | |---#---| 2 |-#--|| 3-4 |--#| | | Overall: | Which I believe I can achieve using the metaplot or forrest plot functions, replacing the studies with the relevant sub groups. But my challenge has been converting the patient data above down to list subgroups. Other than by running a survival analysis individually on an individual subgroup recording the results and building up a table. Calum This message may contain confidential information. If yo...{{dropped:21}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] - counting factor occurrences within a group: tapply()
Dear List, I'm an [R] novice starting analysis of an ecological dataset containing the basal areas of different tree species in a number of research plots. Example data follow: Trees-data.frame(SppID=as.factor(c(rep('QUEELL',2), rep('QUEALB',3), 'CORAME', 'ACENEG', 'TILAME')), BA=c(907.9, 1104.4, 113.0, 143.1, 452.3, 638.7, 791.7, 804.3), PlotID=as.factor(c('BU3F10', rep('BU3F11',2), rep('BU3F12',5 Trees SppID BA PlotID 1 QUEELL 907.9 BU3F10 2 QUEELL 1104.4 BU3F11 3 QUEALB 113.0 BU3F11 4 QUEALB 143.1 BU3F12 5 QUEALB 452.3 BU3F12 6 CORAME 638.7 BU3F12 7 ACENEG 791.7 BU3F12 8 TILAME 804.3 BU3F12 Fields are (in order): Tree Species Code, Basal Area, and Plot Code. I've been successful in computing summary statistics by species or plot groups using tapply(): tapply(BA, PlotID, sum) BU3F10 BU3F11 BU3F12 907.91217.42830.1 *My Question* I'd like to perform a similar function that tells me how many species are in each plot, I thought this would be possible using something like: tapply(SppID, PlotID, nlevels) BU3F10 BU3F11 BU3F12 5 55 however, this outputs the total number of levels for the factor SppID rather than the number of species in each plot category which would look like: BU3F10 BU3F11 BU3F12 124 I understand, from reading the archive, that this occurs because R does not subset factor levels, but I'm wondering if there's a simple way around this. Thanks for your help, Ian Chidister Environment and Resources The Nelson Institute for Environmental Studies University of Wisconsin-Madison, USA [[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] Summarising Data for Forrest Plots
What I want to do is do a forrest (forest) plot for subgroups within my single dataset as a test of heterogeniety. I have a dataset who received either full dose(FD) or reduced dose(RD) treatment, and a number of characteristics about those subjects: age, sex, renal function, weight, toxicity. And I have survival data (censored). they are in standard columnar data. Is there an *easy* way to transform them into something like this: SubGroupn.FDn.RDsurv.FD surv.RD 1 Age 65 2 Age = 65 3 Male ... 9 Grade 0-2 Tox 10 Grade 3/4 Tox Hi Calum, Have you tried subsetting the dataset like this: meta.DSL(...,data=mydataset[mydataset$age = 65,],...) Jim Hi Jim, I'm not sure that I understand! But my understanding was that meta.DSL wants 4 bits of information number treated (Full Dose in my case), Number in control (reduced dose in my case), Number of events in the twoi groups... which is what I was trying to describe above - although possibly not very well.. Then it will do the work for me. My challenge is taking a load of data in columns and getting it summarised by the subgroups so that it takes Age 65 and counts how many had full dose, howmany had reduced dose and populates the field then does the same for Age 65 etc etc... (I may be back with questions about the survival value - but even knowing how to get it to summarise like I describe would be a start. I guess its a bit like a pivot table in excel? But perhaps its something to do with the mydataset[mydataset$age =65,] bit? That seems to give me a data table with only the 65 and unders which makes sense. But then how do I get it to populate a table with the numbers in the two groups? This message may contain confidential information. If yo...{{dropped:21}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] (senza oggetto)
Caro Sabrina, Take a look at ?options, especially the max.print parameter. Ciao, Jorge 2009/7/29 sabrina.michie...@alice.it Ciao, ho aperto con R un file di classe data frame con 15000 righe e 29 colonne. Nella console perÅ sono visualizzate solo la prime e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : vector thank you it works
I'm very impressed by the quick replies on the mailer. Thanks a lot for your suggestions. They worked very well. De : Linlin Yan yanlinli...@gmail.com Cc : r-help@r-project.org Envoyé le : Mercredi, 29 Juillet 2009, 18h26mn 32s Objet : Re: [R] vector rep(A, each=2) On Thu, Jul 30, 2009 at 12:15 AM, Inchallah Hi , i have a vector A=(a1,a2,a3,a4) and i want to create another vector B[[elided Yahoo spam]] [[elided Yahoo spam]] [[elided Yahoo spam]] [[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] - counting factor occurrences within a group: tapply()
This is probably what you want; you need to count the number of unique instances: tapply(Trees$SppID, Trees$PlotID, function(x) length(unique(x))) BU3F10 BU3F11 BU3F12 1 2 4 On Wed, Jul 29, 2009 at 12:57 PM, Ian Chidisterian.chidis...@gmail.com wrote: Dear List, I'm an [R] novice starting analysis of an ecological dataset containing the basal areas of different tree species in a number of research plots. Example data follow: Trees-data.frame(SppID=as.factor(c(rep('QUEELL',2), rep('QUEALB',3), 'CORAME', 'ACENEG', 'TILAME')), BA=c(907.9, 1104.4, 113.0, 143.1, 452.3, 638.7, 791.7, 804.3), PlotID=as.factor(c('BU3F10', rep('BU3F11',2), rep('BU3F12',5 Trees SppID BA PlotID 1 QUEELL 907.9 BU3F10 2 QUEELL 1104.4 BU3F11 3 QUEALB 113.0 BU3F11 4 QUEALB 143.1 BU3F12 5 QUEALB 452.3 BU3F12 6 CORAME 638.7 BU3F12 7 ACENEG 791.7 BU3F12 8 TILAME 804.3 BU3F12 Fields are (in order): Tree Species Code, Basal Area, and Plot Code. I've been successful in computing summary statistics by species or plot groups using tapply(): tapply(BA, PlotID, sum) BU3F10 BU3F11 BU3F12 907.9 1217.4 2830.1 *My Question* I'd like to perform a similar function that tells me how many species are in each plot, I thought this would be possible using something like: tapply(SppID, PlotID, nlevels) BU3F10 BU3F11 BU3F12 5 5 5 however, this outputs the total number of levels for the factor SppID rather than the number of species in each plot category which would look like: BU3F10 BU3F11 BU3F12 1 2 4 I understand, from reading the archive, that this occurs because R does not subset factor levels, but I'm wondering if there's a simple way around this. Thanks for your help, Ian Chidister Environment and Resources The Nelson Institute for Environmental Studies University of Wisconsin-Madison, USA [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] - counting factor occurrences within a group: tapply()
does length instead of nlevels do what you want to do? with(Trees,tapply(SppID,PlotID,unique)) daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Ian Chidister Gesendet: Wednesday, July 29, 2009 12:57 PM An: r-help@r-project.org Betreff: [R] - counting factor occurrences within a group: tapply() Dear List, I'm an [R] novice starting analysis of an ecological dataset containing the basal areas of different tree species in a number of research plots. Example data follow: Trees-data.frame(SppID=as.factor(c(rep('QUEELL',2), rep('QUEALB',3), 'CORAME', 'ACENEG', 'TILAME')), BA=c(907.9, 1104.4, 113.0, 143.1, 452.3, 638.7, 791.7, 804.3), PlotID=as.factor(c('BU3F10', rep('BU3F11',2), rep('BU3F12',5 Trees SppID BA PlotID 1 QUEELL 907.9 BU3F10 2 QUEELL 1104.4 BU3F11 3 QUEALB 113.0 BU3F11 4 QUEALB 143.1 BU3F12 5 QUEALB 452.3 BU3F12 6 CORAME 638.7 BU3F12 7 ACENEG 791.7 BU3F12 8 TILAME 804.3 BU3F12 Fields are (in order): Tree Species Code, Basal Area, and Plot Code. I've been successful in computing summary statistics by species or plot groups using tapply(): tapply(BA, PlotID, sum) BU3F10 BU3F11 BU3F12 907.91217.42830.1 *My Question* I'd like to perform a similar function that tells me how many species are in each plot, I thought this would be possible using something like: tapply(SppID, PlotID, nlevels) BU3F10 BU3F11 BU3F12 5 55 however, this outputs the total number of levels for the factor SppID rather than the number of species in each plot category which would look like: BU3F10 BU3F11 BU3F12 124 I understand, from reading the archive, that this occurs because R does not subset factor levels, but I'm wondering if there's a simple way around this. Thanks for your help, Ian Chidister Environment and Resources The Nelson Institute for Environmental Studies University of Wisconsin-Madison, USA [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] side-by-side Barplot newbie question
Hi, I am new to R and I hope someone can help me with my problem. I am trying to draw a side by side barplot. There is a main experiment and there are many sub experiments within the main experiment. I would like to draw a bar plot showing the number of sub_experiments done for each main_exp. For instance if the Main_Exp is 6, I would like to group the sub exp's for the main_exp and show that there were two sub_exp's done an ELISA and a FCM and that the ELISA was done once and the FCM was done twice. Similarly for Main_Exp 7 I would like to show that for there were ELISA,FCM,qPCR,Telometry done and that they had a count of 3,3,2,5 respectively. This is what my dataset looks like: Task Datatype Count 1ELISA 2 6ELISA 1 6 FCM 2 7 ELISA 3 7 FCM 3 7 Telometry2 7 qPCR 5 The code that I have is table(comparisons_new) barplot(as.matrix(comparisons_new$Sub_Exp_Count),xlab=Main_Exp_Name, ylab=Sub_Exp_Count,ylim=c(0,10),names.arg=(comparisons_new$Main_Exp_Name),beside=TRUE,legend=rownames(compariso ns_new$Sub_Exp_Name),col=rainbow(5)) [[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] Side by Side Barplot Newbie Question
Hi, Many apologies for sending this twice. I accidentally hit the send button before I finished writing my mail. I am new to R and I hope someone can help me with my problem. I am trying to draw a side by side barplot. There is a main experiment and there are many sub experiments within the main experiment. I would like to draw a bar plot showing the number and type of sub_experiments done for each main_exp. For instance if the Main_Exp is 6, I would like to group the sub exp's for the main_exp and show that there were two sub_exp's done an ELISA and a FCM and that the ELISA was done once and the FCM was done twice. Similarly for Main_Exp 7 I would like to show that for there were ELISA,FCM,qPCR,Telometry done and that they had a count of 3,3,2,5 respectively. This is what my dataset looks like: Main_Exp_Name Sub_Exp_Name Sub_Exp_Count 1ELISA 2 6ELISA 1 6 FCM 2 7 ELISA 3 7 FCM 3 7 Telometry2 7 qPCR 5 The code that I have is table(comparisons_new) barplot(as.matrix(comparisons_new$Sub_Exp_Count),xlab=Main_Exp_Name, ylab=Sub_Exp_Count,ylim=c(0,10),names.arg=(comparisons_new$Main_Exp_Name),beside=TRUE,legend=rownames(comparisons_new$Sub_Exp_Name),col=rainbow(5)) With this code, I am able to draw the barplot, but am having issues: I am not able to group them together. That is for each Main_Exp I am not able to group the Sub_Exp's under it. It all shows up as one continuous barplot without any spaces in between the Main_Exp's. Also, I would like to be able to use the same colour for a particular sub_Exp_Name no matter in which ever Main_Exp it may show up. But, this is not working for me. Please help, Brinda [[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] Determine the dimension-names of an element in an array in R
Hey, i have forgotten to generalize the code so Correl-Correl[1:4,,,] must be Correl-Correl[1:length(c),,,] it's because the comparison levels. I think you don't want the correlation betweeen A1, B1, D1 and A2, C1, D1 , but between A1, B1, D1 and A1, C1, D1 or between A1, B1, D1 and A1, C2, D1. So the 1:length(c) writes only the correlation between the B and C out of the whole correlation array. That's also why the sequence in the second apply function is changed. Regards Christian. Poersching schrieb: Hey, I think I have a solution for your problem: Correl-apply(DataArray_1,1:3, function(d1) apply(DataArray_2,c(2,1,3), function(d) cor(d1,d)) ) Correl-Correl[1:4,,,] dimnames(Correl)[[1]]-c Correl-aperm(Correl,c(2,3,1,4)) This one should work. :-) Best Regards, Christian Sauvik De schrieb: Hi there, Thanks again for your reply. I know for-loop is always a solution to my problem and I had already coded using for-loop. But the number of levels for each dimension is large enough in actual problem and hence it was time-consuming. So, I was just wondering if there are any other alternative way-outs to solving my problem. That's why I tried with apply functions (sapply)assuming that this might work out faster even fractionally as compared to for-loop. Cheers, Sauvik On Mon, Jul 27, 2009 at 12:28 AM, Poersching poerschin...@web.de mailto:poerschin...@web.de wrote: Sauvik De schrieb: Hi: Lots of thanks for your valuable time! But I am not sure how you would like to use the function in this situation. As I had mentioned that the first element of my output array should be like: cor(DataArray_1[dimnames(Correl)[[1]][1],dimnames(Correl)[[2]][1],dimnames(Correl)[[4]][1],],DataArray_2[dimnames(Correl)[[1]][1],dimnames(Correl)[[3]][1],dimnames(Correl)[[4]][1],],use=pairwise.complete.obs) in my below code. and the output array of correlation I wish to get using sapply as follows: Correl = sapply(Correl,function(d) cor(DataArray_1[...],DataArray_2[...], use=pairwise.complete.obs)) So it would be of great help if you could kindly specify how to utilise your function findIndex in ... Apologies for all this! Thanks Regards, Sauvik Hey, sorry, I haven't understood your problem last time, but now this solution should solve your problem, so I hope. :-) It's only a for to loop, but an apply function may work too. I will think about this, but for now... ;-) la-length(a) lb-length(b) lc-length(c) ld-length(d) for (ia in 1:la) { for (ib in 1:lb) { for (ic in 1:lc) { for (id in 1:ld) { Correl[ia,ib,ic,id]-cor( DataArray_1[dimnames(Correl)[[1]][ia], dimnames(Correl)[[2]][ib], dimnames(Correl)[[4]][id],] , DataArray_2[dimnames(Correl)[[1]][ia], dimnames(Correl)[[3]][ic], dimnames(Correl)[[4]][id],] , use=pairwise.complete.obs) } } } } ## with function findIndex you can find the dimensions with ## i.e. cor values greater 0.5 or smaller -0.5, like: findIndex(Correl,Correl[Correl0.5]) findIndex(Correl,Correl[Correl(-0.5)]) I have changed the code of the function findIndex in line which contents: el[j]-which(is.element(data,element[j])) Rigards, Christian On Sun, Jul 26, 2009 at 3:54 PM, Poerschingpoerschin...@web.de mailto:poerschin...@web.de wrote: Sauvik De schrieb: Hi Gabor: Many thanks for your prompt reply! The code is fine. But I need it in more general form as I had mentioned that I need to input any 0 to find its dimension-names. Actually, I was using sapply to calculate correlation and this idea was required in the middle of correlation calculation. I am providing the way I tried my calculation. a= c(A1,A2,A3,A4,A5) b= c(B1,B2,B3) c= c(C1,C2,C3,C4) d= c(D1,D2) e= c(E1,E2,E3,E4,E5,E6,E7,E8) DataArray_1 = array(c(rnorm(240)),dim=c(length(a),length(b), length(d),length(e)),dimnames=list(a,b,d,e)) DataArray_2 = array(c(rnorm(320)), dim=c(length(a),length(c), length(d),length(e)),dimnames=list(a,c,d,e)) #Defining an empty array which will contain the correlation values (output array) Correl = array(NA, dim=c(length(a),length(b), length(c),length(d)),dimnames=list(a,b,c,d)) #Calculating Correlation between attributes b c over values of e Correl = sapply(Correl,function(d) cor(DataArray_1[...],DataArray_2[...], use=pairwise.complete.obs)) This is where I get stuck. In the above, d is acting as an element in the Correl array. Hence I need
Re: [R] - counting factor occurrences within a group: tapply()
Hi All- Thanks for your quick responses. I was looking for unique instances, so Jim's and Daniel's suggestions got the job done. Using length alone didn't discriminate between multiple occurrences of the same species and multiple species. I do have one followup question- my full data set (not the example data) has a number of NAs in the SppID column, and [r] is currently counting the NAs as species occurrences. Using Jim's code, I tried: tapply(SppID, PlotID, function(Trees, na.rm=T) length(unique(Trees, na.rm=T))) and alternately: tapply(SppID, PlotID, function(Trees) length(unique(Trees)), na.rm=T) which doesn't seem to convince [r] to ignore the NAs. What am I doing wrong? Thanks, Ian [[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] - counting factor occurrences within a group: tapply()
One way is to exclude the NAs from consideration by creating a new object without NAs in that column: newTrees - Trees[!is.na(Trees$SppID),] tapply(newTrees$SppID, newTrees$PlotID, function(x) length(unique(x))) On Wed, Jul 29, 2009 at 2:13 PM, Ian Chidisterian.chidis...@gmail.com wrote: Hi All- Thanks for your quick responses. I was looking for unique instances, so Jim's and Daniel's suggestions got the job done. Using length alone didn't discriminate between multiple occurrences of the same species and multiple species. I do have one followup question- my full data set (not the example data) has a number of NAs in the SppID column, and [r] is currently counting the NAs as species occurrences. Using Jim's code, I tried: tapply(SppID, PlotID, function(Trees, na.rm=T) length(unique(Trees, na.rm=T))) and alternately: tapply(SppID, PlotID, function(Trees) length(unique(Trees)), na.rm=T) which doesn't seem to convince [r] to ignore the NAs. What am I doing wrong? Thanks, Ian [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] - counting factor occurrences within a group: tapply()
Or even easier: tapply(Trees$SppID, Trees$PlotID, function(x) length(unique(na.omit(x On Wed, Jul 29, 2009 at 2:13 PM, Ian Chidisterian.chidis...@gmail.com wrote: Hi All- Thanks for your quick responses. I was looking for unique instances, so Jim's and Daniel's suggestions got the job done. Using length alone didn't discriminate between multiple occurrences of the same species and multiple species. I do have one followup question- my full data set (not the example data) has a number of NAs in the SppID column, and [r] is currently counting the NAs as species occurrences. Using Jim's code, I tried: tapply(SppID, PlotID, function(Trees, na.rm=T) length(unique(Trees, na.rm=T))) and alternately: tapply(SppID, PlotID, function(Trees) length(unique(Trees)), na.rm=T) which doesn't seem to convince [r] to ignore the NAs. What am I doing wrong? Thanks, Ian [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] - counting factor occurrences within a group: tapply()
Jim- That did the trick- thanks so much for taking the time to help me out. Sincerely, Ian Chidister On Wed, Jul 29, 2009 at 11:57 AM, Ian Chidister ian.chidis...@gmail.comwrote: Dear List, I'm an [R] novice starting analysis of an ecological dataset containing the basal areas of different tree species in a number of research plots. Example data follow: Trees-data.frame(SppID=as.factor(c(rep('QUEELL',2), rep('QUEALB',3), 'CORAME', 'ACENEG', 'TILAME')), BA=c(907.9, 1104.4, 113.0, 143.1, 452.3, 638.7, 791.7, 804.3), PlotID=as.factor(c('BU3F10', rep('BU3F11',2), rep('BU3F12',5 Trees SppID BA PlotID 1 QUEELL 907.9 BU3F10 2 QUEELL 1104.4 BU3F11 3 QUEALB 113.0 BU3F11 4 QUEALB 143.1 BU3F12 5 QUEALB 452.3 BU3F12 6 CORAME 638.7 BU3F12 7 ACENEG 791.7 BU3F12 8 TILAME 804.3 BU3F12 Fields are (in order): Tree Species Code, Basal Area, and Plot Code. I've been successful in computing summary statistics by species or plot groups using tapply(): tapply(BA, PlotID, sum) BU3F10 BU3F11 BU3F12 907.91217.42830.1 *My Question* I'd like to perform a similar function that tells me how many species are in each plot, I thought this would be possible using something like: tapply(SppID, PlotID, nlevels) BU3F10 BU3F11 BU3F12 5 55 however, this outputs the total number of levels for the factor SppID rather than the number of species in each plot category which would look like: BU3F10 BU3F11 BU3F12 124 I understand, from reading the archive, that this occurs because R does not subset factor levels, but I'm wondering if there's a simple way around this. Thanks for your help, Ian Chidister Environment and Resources The Nelson Institute for Environmental Studies University of Wisconsin-Madison, USA [[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] Systematic resampling (in sequential Monte Carlo)
Dear all, Here is a little coding problem. It falls in the category of how can I do this efficiently? rather than how can I do this? (I know how to do it inefficiently). So, if you want to take the challenge, keep reading, otherwise just skip to the next post - I won't be offended by that ;-) I am coding a particle filter and I want to use systematic resampling to regenerate particles. Basically, what this means is the following. 1. Start with a vector of labels, x, say, of length N and a vector of probabilities, w, say - w[i] is the probability attached to x[i]. 2. Draw N equally spaced random number in (0,1) as u = (1 : N + runif(1)) / N. 3. Define a new sample of labels, y, say, by inverting the cdf defined by the probabilities w. That is, set y[i] = x[k] if cumsum(w)[k-1] = u[i] cumsum(w)[k], i=1, ..., N. The following is a piece of R code that implements the procedure. ### Systematic resampling set.seed(2) x - LETTERS[1 : 6] # labels w - rexp(6) w - w / sum(w) # probabilities W - c(0, cumsum(w)) # cdf u - (1 : 6 + runif(1)) / 6 indNew - sapply(seq_along(u), + function(i) (sum(W[i] = u u W[i + 1]))) (y - rep(x, indNew)) [1] A B D D F ## graphically... plot(stepfun(seq_along(u), W), xaxt = n) axis(1, at = seq_along(u), x) abline(h = u, lty = dotted) The question is the following. I believe the way I compute newInd is of order N^2. Is there a smart way of doing it which is of order N? (I know there is one, I just cannot find it...) Thanks in advance, Giovanni __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Watching tune parameters for SVM?
Hi, I'm switch over from RapidMiner to R. (The learning curve is steep, but there is so much more I can do with R and it runs much faster overall.) In RapidMiner, I can tune a parameter of my svm in a nice cross validation loop. The process will print out the progress as it goes. So for a 5x cross tuning for the value of C with auc as my performance measure, I see XVCAUC 11.5 21.48 31.51 41.52 12.52 22.54 32.53 42.52 13.6 23.61 33.6 43.59 etc... RapidMiner then takes the average for each value of C and reports back the best one. RapidMiner will even graph the progress with C on the X axis and AUC on the Y axis so I can see how the process is doing. (This is nice when training a large range of C so I can tell if it is worth stopping the process early. I can even train 2 or more variables at a time in a big grid of combination is 5x cross validation for each combo. i.e. 10 values for C and 10 values for gamma gives 100 combinations with 5x cross validation for each for a total of 500 executions. Is there anyway to do something similar to this in R. I've come across the tune function, but don't entirely understand all the options. Additionally, I don't see how to output the progress as it goes. (also, setting number of XV, averaging of scores, etc.) Does anybody have any ideas? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to compute other columns without a column for sample name
Data has the first row for variable name and the first column for sample name. I want to take Log for all data, but how to compute without the first column for sample name. log.raw_data=log(raw_data,base=2) Error in Math.data.frame(list(sample_id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, : non-numeric variable in data frame: sample_id Thank you in advance, Jin -- View this message in context: http://www.nabble.com/how-to-compute-other-columns-without-a-column-for-sample-name-tp24723210p24723210.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] Side by Side Barplot newbie question
Hi, Many apologies for sending this twice. I accidentally hit the send button before I finished writing my mail. I am new to R and I hope someone can help me with my problem. I am trying to draw a side by side barplot. There is a main experiment and there are many sub experiments within the main experiment. I would like to draw a bar plot showing the number and type of sub_experiments done for each main_exp. For instance if the Main_Exp is 6, I would like to group the sub exp's for the main_exp and show that there were two sub_exp's done an ELISA and a FCM and that the ELISA was done once and the FCM was done twice. Similarly for Main_Exp 7 I would like to show that for there were ELISA,FCM,qPCR,Telometry done and that they had a count of 3,3,2,5 respectively. This is what my dataset looks like: Main_Exp_Name Sub_Exp_Name Sub_Exp_Count 1ELISA 2 6ELISA 1 6 FCM 2 7 ELISA 3 7 FCM 3 7 Telometry2 7 qPCR 5 The code that I have is table(comparisons_new) barplot(as.matrix(comparisons_new$Sub_Exp_Count),xlab=Main_Exp_Name, ylab=Sub_Exp_Count,ylim=c(0,10),names.arg=(comparisons_new$Main_Exp_Na me),beside=TRUE,legend=rownames(comparisons_new$Sub_Exp_Name),col=rainbo w(5)) With this code, I am able to draw the barplot, but am having issues: I am not able to group them together. That is for each Main_Exp I am not able to group the Sub_Exp's under it. It all shows up as one continuous barplot without any spaces in between the Main_Exp's. Also, I would like to be able to use the same colour for a particular sub_Exp_Name no matter in which ever Main_Exp it may show up. But, this is not working for me. Please help, Brinda [[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] standard error of median in MASS library
Hello all, I wonder which function in MASS library is calculating the standard error of median? thank you very much in advance, Lisa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] regexpr virtue
Petr, Here is a different approach. It, in effect, works from the end of the string backwards, rather than from the beginning of the string forwards. substring(x, regexpr([0-9]+$, x)) The regular expression [0-9]+$ finds a string of 1 or more (+) digits ([0-9]) followed by the end of the line ($). The regexpr() function returns the position in the string x where that regular expression begins. Feed that to substring() and you get the desired result. Both substring() and regexpr() work on vectors of strings. Best regards, Chuck Taylor TIBCO Spotfire Seattle -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Petr PIKAL Sent: Wednesday, July 29, 2009 6:10 AM To: r-h...@stat.math.ethz.ch Subject: [R] regexpr virtue Hi all I have got something like that (actually those are column names) [51] X19.2.300b...80 X19.2.400v...80 X19.2.400b...80 X19.2.300v...90 X19.2.300b...90 [56] X19.2.400v...90 X19.2..400b..90 X19.2.300v...100 X19.2.300b...100 X19.2.400v...100 in character vector. I would like to get last n figures from this character vector but my regexpr unerstanding is inferior and I did not succeed. Please, is there anybody who can extract those n digits from end of each character string? If there were only 2 digits I could use substr but there can be one, two or three digits. ... Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing lme4 package in Windows Vista
Thanks everyone! It works now :) Cheers, a. ONKELINX, Thierry wrote: Dear Angela, lme() is a part of the nlme package. The lme4 package has the function lmer() which is the equivalent of lme() from nlme. Both function differ in their capabilities. Briefly: lmer() can (easly) do crossed random effects and GLMM, lme() can handle variance and correlation structures. HTH, Thierry PS Don't for get that you need to load a package before using it! Just installing it is not sufficient. library(lme4) ?lmer library(nlme) ?lme ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Angela Radulescu Verzonden: woensdag 29 juli 2009 1:48 Aan: r-help@r-project.org Onderwerp: [R] Installing lme4 package in Windows Vista Hi all, I have a problem with package installing in Windows, on my PC machine. The end goal is to be able to use the lme() function. Here's what I did so far: install.packages(lme4) Warning in install.packages(lme4) : argument 'lib' is missing: using 'C:\Users\Angela\Documents/R/win-library/2.9' --- Please select a CRAN mirror for use in this session --- trying URL 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.9/lme4_0.999375-31.z ip' Content type 'application/zip' length 1140865 bytes (1.1 Mb) opened URL downloaded 1.1 Mb package 'lme4' successfully unpacked and MD5 sums checked The downloaded packages are in C:\Users\Angela\AppData\Local\Temp\Rtmp1t8vjT\downloaded_packages updating HTML package descriptions Warning message: In file.create(f.tg) : cannot create file 'C:\PROGRA~1\R\R-29~1.1/doc/html/packages.html', reason 'Permission denied' I had to change permissions on some of the library folder before this. Still, after installation, R cannot find the lme function of interest. lme Error: object 'lme' not found Does anyone know why this is happening, and what the solution to the problem is? Many thanks, Angela -- View this message in context: http://www.nabble.com/Installing-lme4-package-in-Windows-Vista-tp2470993 2p24709932.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. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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://www.nabble.com/Installing-lme4-package-in-Windows-Vista-tp24709932p24723919.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] Standard error of Median in MASS library
Dear All, I wonder which function in MASS library calculates and output the standard error of median. Thank you in advance for your help Lisa Wang Biostatistics, Princess Margaret hospital, toronto, On __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to skip a numeric column for averaging other columns?
Hi, On Jul 29, 2009, at 3:02 PM, sandsky wrote: Data has the first row for variable name and the first column for sample name. I want to take Log for all data, but how to compute without the first column for sample name. That is, column 1: sample ID column 2-10: data I think one thing you could/should do in your case is to set your rownames to your (I assume) unique sample ID's: rownames(raw_data) - raw_data[,1] Then just nuke that first column: raw_data - raw_data[,-1] But even if you don't do that: I want to find an average on each column (2-10) apply(raw_data,2,mean) Error in Math.data.frame(list(sample_id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, : non-numeric variable in data frame: sample_id You can just run your function over all of the columns *except* the first: apply(raw_data[,-1], 2, mean) But in this specific case, you can use the specialized colMeans function: colMeans(raw_data[,-1]) -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to skip a numeric column for averaging other columns?
log.raw.data - log(raw.data[,2:10]) I think but I don't understand the Data has the first row for variable name comment --- On Wed, 7/29/09, sandsky realst...@hotmail.com wrote: From: sandsky realst...@hotmail.com Subject: [R] how to skip a numeric column for averaging other columns? To: r-help@r-project.org Received: Wednesday, July 29, 2009, 3:01 PM Data has the first row for variable name and the first column for sample name. I want to take Log for all data, but how to compute without the first column for sample name. That is, column 1: sample ID column 2-10: data I want to find an average on each column (2-10) log.raw_data=log(raw_data,base=2) Error in Math.data.frame(list(sample_id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, : non-numeric variable in data frame: sample_id Thank you in advance, Jin -- View this message in context: http://www.nabble.com/how-to-skip-a-numeric-column-for-averaging-other-columns--tp24723210p24723210.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. __ Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what yo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Transporting data in different R windows
In the useR 2009 conference there was a lecture on how to use bigmemory to create and object (a matrix I guess) - and then be able to access it from two R sessions. Consider searching for that :) Tal On Wed, Jul 29, 2009 at 4:15 PM, Bogaso bogaso.christo...@gmail.com wrote: Hi, I am working with multiple R-windows opened and would like to transport some variables from one to another. Is there any direct way to do this without saving them in hard-disk? Thanks -- View this message in context: http://www.nabble.com/Transporting-data-in-different-R-windows-tp24719077p24719077.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. -- -- My contact information: Tal Galili Phone number: 972-50-3373767 FaceBook: Tal Galili My Blogs: http://www.r-statistics.com/ http://www.talgalili.com http://www.biostatistics.co.il [[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] Side by Side Barplot Newbie Question
Hi Brindha Does this answer your question: http://onertipaday.blogspot.com/2007/05/make-many-barplot-into-one-plot.html ? Cheers, Tal On Wed, Jul 29, 2009 at 8:48 PM, Brindha Selvaraj brindharh...@gmail.comwrote: Hi, Many apologies for sending this twice. I accidentally hit the send button before I finished writing my mail. I am new to R and I hope someone can help me with my problem. I am trying to draw a side by side barplot. There is a main experiment and there are many sub experiments within the main experiment. I would like to draw a bar plot showing the number and type of sub_experiments done for each main_exp. For instance if the Main_Exp is 6, I would like to group the sub exp's for the main_exp and show that there were two sub_exp's done an ELISA and a FCM and that the ELISA was done once and the FCM was done twice. Similarly for Main_Exp 7 I would like to show that for there were ELISA,FCM,qPCR,Telometry done and that they had a count of 3,3,2,5 respectively. This is what my dataset looks like: Main_Exp_Name Sub_Exp_Name Sub_Exp_Count 1ELISA 2 6ELISA 1 6 FCM 2 7 ELISA 3 7 FCM 3 7 Telometry2 7 qPCR 5 The code that I have is table(comparisons_new) barplot(as.matrix(comparisons_new$Sub_Exp_Count),xlab=Main_Exp_Name, ylab=Sub_Exp_Count,ylim=c(0,10),names.arg=(comparisons_new$Main_Exp_Name),beside=TRUE,legend=rownames(comparisons_new$Sub_Exp_Name),col=rainbow(5)) With this code, I am able to draw the barplot, but am having issues: I am not able to group them together. That is for each Main_Exp I am not able to group the Sub_Exp's under it. It all shows up as one continuous barplot without any spaces in between the Main_Exp's. Also, I would like to be able to use the same colour for a particular sub_Exp_Name no matter in which ever Main_Exp it may show up. But, this is not working for me. Please help, Brinda [[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. -- -- My contact information: Tal Galili Phone number: 972-50-3373767 FaceBook: Tal Galili My Blogs: http://www.r-statistics.com/ http://www.talgalili.com http://www.biostatistics.co.il [[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] Standard error of Median in MASS library
Well the MASS package is support for a book, the details for most of functions in the package are detailed in the book, so if you really want to know, either look at the code, or read the book. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Lisa Wang Sent: Wednesday, July 29, 2009 12:05 PM To: r-help@r-project.org Subject: [R] Standard error of Median in MASS library Dear All, I wonder which function in MASS library calculates and output the standard error of median. Thank you in advance for your help Lisa Wang Biostatistics, Princess Margaret hospital, toronto, On __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Superscripts and rounding
library(RODBC) library(HYDAT) You will need to install HYDAT (the zip file) from http://www.geog.ubc.ca/~rdmoore/Rcode.htm Below is my current code - which works. The [[]] is the way i am accessing the columns from the data frame. thanks again for all your help # load HYDAT data par(mfrow=c(3,1)) path - 'c:\\HYDAT' wsc.id - '11AB075' stn - ReadHydatFile(path, wsc.id) #if data in CDROM image # stn - ReadHydatDatabase (path, wsc.id) #if data in database # subset daily flow record for plotting purposes dates - c(as.Date('1927-01-01'), as.Date('1960-12-31')) decade - subset(stn[['flow']][['daily']], date = dates[1] date = dates[2]) # identify days flagged as backwater ('B') or estimated ('E') # daily.flags is a vector of color names used to apply to points daily.flags - rep('NA', nrow(decade)) daily.flags[which(decade[['flag']] == 'A')] - 'goldenrod' daily.flags[which(decade[['flag']] == 'E')] - 'red' daily.flags[which(decade[['flag']] == 'B')] - 'blue' # subset daily flow record for plotting purposes dates - c(as.Date('1970-01-01'), as.Date('2008-12-31')) decade - subset(stn[['flow']][['daily']], date = dates[1] date = dates[2]) # identify days flagged as backwater ('B') or estimated ('E') # daily.flags is a vector of color names used to apply to points daily.flags - rep('NA', nrow(decade)) daily.flags[which(decade[['flag']] == 'A')] - 'goldenrod' daily.flags[which(decade[['flag']] == 'E')] - 'red' daily.flags[which(decade[['flag']] == 'B')] - 'blue' # last plot entire series with subtitle as a light gray line plot ( decade[['date']], decade[['value']], type = 'l', col = 'lightsteelblue4', ylab = 'Discharge [cms]', main = sprintf('%s [%s]', stn[['metadata']][['name']], stn[['metadata']][['id']]), sub = sprintf('Seasonal station with natural streamflow - Lat: %s Lon: %s Gross Area %s\km\UB2 - Effective Area %s\km\UB2', stn[['metadata']][['latitude']], stn[['metadata']][['longitude']],stn[['metadata']][['grossarea']], stn[['metadata']][['effectivearea']], cex.sub = 1, font.sub = 3, col.sub = black )) # overlay the points where the daily value has been flagged. # Note the daily.flags array contains NAs for days when not flagged, so these will not show up as # points in the plot. lines ( decade[['date']], decade[['value']], type = 'p', cex = 0.1, pch = 20, col = daily.flags ) # slap a legend on the plot... legend ( x = 'topright', legend = c('Partial', 'Estimated', 'Backwater', 'Not flagged (A, E or B)'), lty = c(0,0,0,1), pch = c(20,20,20,NA), col = c('goldenrod','red','blue','lightsteelblue4'), cex = 0.75 ) -- View this message in context: http://www.nabble.com/Superscripts-and-rounding-tp24682319p24726439.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] Package with function for plots with embedded hyperlinks?
Don't leave us hanging! What is it? --- On Wed, 7/29/09, Don MacQueen m...@llnl.gov wrote: From: Don MacQueen m...@llnl.gov Subject: Re: [R] Package with function for plots with embedded hyperlinks? To: r-help@r-project.org Received: Wednesday, July 29, 2009, 11:43 AM Never mind, just after I sent this I finally did the right search. It is RSVGTipsDevice -Don At 8:30 AM -0700 7/29/09, Don MacQueen wrote: Some years ago, if I recall correctly, I learned of a package that included a function that would write a plot to a file so that one could associate hyperlinks with elements of the plot, such as points. Then, when the plot was displayed in a browser, one could click on (for example) a point, and jump to wherever the hypelink pointed. I don't remember then name of the package or function, and haven't been able to find it after some searching. Does anyone know the name, or have a suggestion to help track it down? Thanks -Don -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 programming class - Boston USA area - or online
Hello - I am just beginning to look into R Programming and have written some basic R code. Do you know of anyone in the Boston-USA area that might be offering any courses on R Programming? Or possibly a course online? Many thanks Mike Boucher Michael Boucher | Quantitative Analyst - Portfolio Manager | Fidelity Strategic Advisers | 82 Devonshire Street Boston MA V5D | 617-563-2691 -- FIDELITY CONFIDENTIAL INFORMATION This e-mail, and any attachments hereto, are intended fo...{{dropped:17}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Transporting data in different R windows
On Wed, 29-Jul-2009 at 06:15AM -0700, Bogaso wrote: | | Hi, | | I am working with multiple R-windows opened and would like to | transport some variables from one to another. Is there any direct | way to do this without saving them in hard-disk? With so little information given, I can't tell whether you know the difference between a window and a directory. If you tell us what's different about your windows we might be in a position to know what you're trying to do, -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie in R: Reading .txt files and storing the 'numbers' in a vector
On Wed, 29-Jul-2009 at 10:29AM +0200, Patrick Schorderet wrote: Hello everybody, I'm a newbie in R and just went through an introduction class recently. Did you get the distinction between a vector and a dataframe? Here's my problem. I have 2 text files (.txt) with plain numbers ('doubles' for those who know c++) ordered into 2 columns as below: coordinate1 value1 coordinate2 value2 coordinate3 value3 ... ... coordinateN valueN I would like to write a small programme in which i would: 1. take all values of file 1 and store them in a vector I'm fairly certain you need a dataframe, hence the recommendation to look at read.table. 2. substract to those all values of file 2 (one by one) and store the result in a new vector 3. Create a sliding window of chosen size and calculate the mathematical average and store these averages in a new vector 4. Plot the different graphes with a bar plot Those will follow simply once you have the first part working. HTH -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] xtable formatting: RED for negative numbers?
Ken-JP wrote: Is there a way to modify this code to generate RED numbers inside xtable for negative results in x.ts? This post would probably have been better for R-help. Anyway, you can do it easily by modifying print.xtable.R in the xtable package. If it is easier, make a copy of that file, modify it, load the xtable package, then source your modified version. Basically change line 227 from result[i] - gsub(-,$-$,result[i],fixed=TRUE) to result[i] - gsub(-,\\color{red}$-$,result[i],fixed=TRUE) and then your code chunk becomes: sample,echo=F,results=tex= library(xtable) x.ts - ts(rnorm(100), start = c(1954, 7), frequency = 12) x.table - xtable( x.ts, digits = 1 ) print( x.table, floating = FALSE, math.style.negative = TRUE) @ Here is the patch: http://www.nabble.com/file/p24727150/print.xtable.R.diff print.xtable.R.diff Here is the output I got: http://www.nabble.com/file/p24727150/xtable-red.pdf xtable-red.pdf - Cameron P.S. You must use the color package in latex. -- View this message in context: http://www.nabble.com/xtable-formatting%3A-RED-for-negative-numbers--tp24712208p24727150.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] Object equality for S4 objects
To test two environments for object equality (Lisp EQ), I can use 'identity': e1 - environment(local(function()x)) e2 - environment(local(function()x)) identical(e1,e2) # compares object identity [1] FALSE identical(as.list(e1),as.list(e2))# compares values as name-value mapping [1] TRUE# (is there a better way to do this?) What is the corresponding function for testing whether two S4 objects are the same object? It appears that 'identity' for S4 objects compares the *value*, not the *object identity*: setClass(simple,representation(a=logical)) [1] simple s1 - new(simple); s2 - new(simple) identical(s1,s1) [1] TRUE # not surprising identical(s1,s2) [1] TRUE # ? not comparing object identity s...@a - TRUE s...@a - TRUE identical(s1,s2) [1] TRUE s...@a - TRUE s...@a - FALSE identical(s1,s2) [1] FALSE Thanks, -s __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Which CRAN mirror is the fastest ?
Hi dear R help group. I was wondering how can I find out which CRAN mirror would be the fastest for me (I leave in Israel and therefore don't have a CRAN mirror for our country to go to by default) Thanks, Tal -- -- My contact information: Tal Galili Phone number: 972-50-3373767 FaceBook: Tal Galili My Blogs: http://www.r-statistics.com/ http://www.talgalili.com http://www.biostatistics.co.il [[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] Side by Side Barplot Newbie Question
I think your data is set up incorrectly. With your data below as xx try this. # Dotcharts are often better than barplots so you might want to # try this library(reshape) mm - melt(xx, id=c(1:2)); mm bb - as.matrix(cast(mm, tt ~ task, sum)) barplot(bb, beside=TRUE, col=rainbow(4)) legend(topleft, legend=row.names(bb), text.col=rainbow(4)) # Dotcharts are often better than barplots so you might want to # try this in place of a barplot. dotchart(bb, col=rainbow(4)) = --- On Wed, 7/29/09, Brindha Selvaraj brindharh...@gmail.com wrote: From: Brindha Selvaraj brindharh...@gmail.com Subject: [R] Side by Side Barplot Newbie Question To: r-help@r-project.org Received: Wednesday, July 29, 2009, 1:48 PM Hi, Many apologies for sending this twice. I accidentally hit the send button before I finished writing my mail. I am new to R and I hope someone can help me with my problem. I am trying to draw a side by side barplot. There is a main experiment and there are many sub experiments within the main experiment. I would like to draw a bar plot showing the number and type of sub_experiments done for each main_exp. For instance if the Main_Exp is 6, I would like to group the sub exp's for the main_exp and show that there were two sub_exp's done an ELISA and a FCM and that the ELISA was done once and the FCM was done twice. Similarly for Main_Exp 7 I would like to show that for there were ELISA,FCM,qPCR,Telometry done and that they had a count of 3,3,2,5 respectively. This is what my dataset looks like: Main_Exp_Name Sub_Exp_Name Sub_Exp_Count 1 ELISA 2 6 ELISA 1 6 FCM 2 7 ELISA 3 7 FCM 3 7 Telometry 2 7 qPCR 5 The code that I have is table(comparisons_new) barplot(as.matrix(comparisons_new$Sub_Exp_Count),xlab=Main_Exp_Name, ylab=Sub_Exp_Count,ylim=c(0,10),names.arg=(comparisons_new$Main_Exp_Name),beside=TRUE,legend=rownames(comparisons_new$Sub_Exp_Name),col=rainbow(5)) With this code, I am able to draw the barplot, but am having issues: I am not able to group them together. That is for each Main_Exp I am not able to group the Sub_Exp's under it. It all shows up as one continuous barplot without any spaces in between the Main_Exp's. Also, I would like to be able to use the same colour for a particular sub_Exp_Name no matter in which ever Main_Exp it may show up. But, this is not working for me. Please help, Brinda [[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. __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.