Re: [R] Problem with data type recognition and conversion
Hi On 31 Oct 2006 at 22:42, tom soyer wrote: Date sent: Tue, 31 Oct 2006 22:42:40 -0600 From: tom soyer [EMAIL PROTECTED] To: r-help r-help@stat.math.ethz.ch Subject:[R] Problem with data type recognition and conversion Hi, I have a CSV file with two columns; the first column is date, second column is numbers. I used read.csv() to load the file into the variable temp. Somehow, R could not recognize my numbers as double. Instead, it thinks these numbers are integer even though they all have decimal points (isn't that strange?). The problem I ran into is that if I tried to convert the numbers to double using as.double, R doesn't give me the original value; e.g. 9.92 becomes 805 (see below). temp[1,2] [1] 9.92 812 Levels: . 10.00 10.01 10.02 10.03 10.04 10.05 10.06 10.07 10.08 10.09 10.10 10.11 10.12 ... 9.99 typeof(temp[1,2]) [1] integer as.double(temp[1,2]) [1] 805 Levels always tell you it is a factor. Your csv file has an extra decimal point or something odd that forces R to convert second column to factor. You can transfer factor variable to numeric one by as.numeric(as.character(temp[,2])) however I recommend you to go through your csv file (if it is not too big) and find the problematic item. If I leave the numbers as integer, then I can't do arithmetic operations on them. Does anyone know what's going on? see ?factor HTH Petr Thanks, Tom [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 make a data file
Hi I use clipboard for transfering data from Excel. In Excel select the part you want to copy to R Press Ctrl-C In R write test - read.delim(clipboard) or read.table(clipboard) to transfer your data to test data frame. However if you will not go through some introduction manual (what I already recommended) and do not know how to manipulate objects in R, you will quickly be completely lost. To use R efficiently you need to accept that it has its own language, terminology and its own way how to do things. R is not Excel (Thanks goodness :-) HTH Petr On 1 Nov 2006 at 11:42, amna khan wrote: Date sent: Wed, 1 Nov 2006 11:42:05 +0500 From: amna khan [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Subject:Re: [R] how to make a data file Sir i have been poor for saving data in form of a datafile. please guid me in simple words to make a data file after importing it from excel. Thank you On 10/31/06, Petr Pikal [EMAIL PROTECTED] wrote: Hi well probably the best approach for you is to read some introductory documents. I would recommend this sequence R-intro R-lang R-data Posting guide or you can try to go through some documents from CRAN, in many of them you can find introductory chapters. And leas but not last when starting with R I found usefull Paul Johnson's Rtips (StatsRUs). At least for more concise help you need to provide R version, OS, and what exactly you did and how you failed - as recommended in posting guide ;-) HTH Petr On 31 Oct 2006 at 11:31, amna khan wrote: Date sent: Tue, 31 Oct 2006 11:31:08 +0500 From: amna khan [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject:[R] how to make a data file Sir after importing data from excel to R, I am not understanding how to make this data file. So that I can use it in extRemeToolkit and other packages. Thank you -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with data type recognition and conversion
Your 'numbers' are in fact a factor: note what it says about 'levels', and that one level is '.'. So very likely there was a non-number ('.') in that column of your input file. Please study 'An Introduction to R' and familiarize yourself with factors. typeof() is useful for basic types, but not for classed objects such as factors. On Tue, 31 Oct 2006, tom soyer wrote: Hi, I have a CSV file with two columns; the first column is date, second column is numbers. I used read.csv() to load the file into the variable temp. Somehow, R could not recognize my numbers as double. Instead, it thinks these numbers are integer even though they all have decimal points (isn't that strange?). The problem I ran into is that if I tried to convert the numbers to double using as.double, R doesn't give me the original value; e.g. 9.92 becomes 805 (see below). temp[1,2] [1] 9.92 812 Levels: . 10.00 10.01 10.02 10.03 10.04 10.05 10.06 10.07 10.08 10.09 10.10 10.11 10.12 ... 9.99 typeof(temp[1,2]) [1] integer as.double(temp[1,2]) [1] 805 If I leave the numbers as integer, then I can't do arithmetic operations on them. Does anyone know what's going on? Thanks, Tom [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Hessian matrix
?deriv can do so algebraically for some functions. There are various packages which can do so via finite differences, e.g. fdHess() in nlme and hessian() in numDeriv. On Wed, 1 Nov 2006, Arun Kumar Saha wrote: Dear all R users, Is there any way to calculate hessian matrix of a given function at any given point? Regards [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Please do: no HTML mail as requested. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Sued Tuerkei.
Sehr geehrte Damen und Herren, Als SI GROUP Für diesen Winter haben wir Ihnen ein preislich unschlagbares Angebot an die türkische Riviera-BELEK Halb Pansion 5 Sterne Hotels anzubieten. Ab Zuerich-Basel-Stuttgart-Muenchen. INCLUSIV FLUG Hin und Zurück und 8-tägige Ferien an der Türkischen Riviera-Antalya-5 Sterne Halb Pansion(Frühstück und Abendessen) TERMINE UND PREISE- 23.12. bis 30.12.2006 Euro 295 30.12.2006 bis 06.01.2007 Euro 395 06.01. bis 13.01.2007 Euro 295 13.01. bis 20.01.2007 Euro 295 20.01. bis 27.01.2007 Euro 295 27.01. bis 03.02.2007 Euro 295 03.02. bis 10.02.2007 Euro 295 10.02. bis 17.02.2007 Euro 295 17.02. bis 24.02.2007 Euro 295 24.02. bis 03.03.2007 Euro 295 03.03. bis 10.03.2007 Euro 295 10.03. bis 17.03.2007 Euro 295 17.03. bis 24.03.2007 Euro 295 24.03. bis 31.03.2007 Euro 295 31.03. bis 07.04.2007 Euro 295 07.04. bis 14.04.2007 Euro 295 14.04. bis 21.04.2007 Euro 295 21.04. bis 28.04.2007 Euro 395 28.04. bis 05.05.2007 Euro 390 Inklusivleistungen: 6 Übernachtungen im 5 - Sterne - Hotel im Doppelzimmer. 1 Übernachtung in einem Thermalhotel in Pamukkale. 7 x Halbpension. Begrüßungscocktail. 1 eintägiger Ausflug nach Antalya mit Bootsfahrt. Alle Eintritte während der Reise. Klimatisierte Busse für 2 Ausflüge. Reiseleitung. Mit Herzlichen Grüssen. SI GROUP Dear Ladies and Gentlemen! The SI GROUP offer you a special autumn and winter travel program Turkey accommodation at 5 Star Hotel at the Turkish Riviera-Belek Flight destination: From: Zuerich-Basel-Stuttgart-Muenchen. SI GROUP Services: Flights to Turkey and back, half board (breakfast dinner) accommodation 8 days vacation in a 5 Star Hotel at the Turkish Riviera. Terms and conditions: 23.12. bis 30.12.2006 Euro 295 30.12.2006 bis 06.01.2007 Euro 395 06.01. bis 13.01.2007 Euro 295 13.01. bis 20.01.2007 Euro 295 20.01. bis 27.01.2007 Euro 295 27.01. bis 03.02.2007 Euro 295 03.02. bis 10.02.2007 Euro 295 10.02. bis 17.02.2007 Euro 295 17.02. bis 24.02.2007 Euro 295 24.02. bis 03.03.2007 Euro 295 03.03. bis 10.03.2007 Euro 295 10.03. bis 17.03.2007 Euro 295 17.03. bis 24.03.2007 Euro 295 24.03. bis 31.03.2007 Euro 295 31.03. bis 07.04.2007 Euro 295 07.04. bis 14.04.2007 Euro 295 14.04. bis 21.04.2007 Euro 295 21.04. bis 28.04.2007 Euro 395 28.04. bis 05.05.2007 Euro 390 SI Group Services 6 x Overnight at a 5 Star Hotel basis double bed room 1 x Overnight at Pamukkale 7 x Half board Welcome Cocktail 1 x Daily trip to Antalya with a boat cursing all Entree fees Air condition busses for the 2 Trips Travel guide from SI GROUP Feel free to contact us and we will send you more details about our SI GROUP Travel program. With kind regards SI GROUP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] [ggplot] some questions
Hello everyone! Sorry, for asking all the time, but I still have some questions which I just can not find in the docs: - Suppose I have a factor with quite a lot of levels. How do I split this factor not only along x or y axis, but rather split about both axis. I'm looking for the lattice layout-equivalent. - If I split my data into levels and plot my measurement for every factor. How can I then add a line to every seperate panel with a different slope and a different intercept? Thanks a lot in advance. Greetings, Sebastian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how can i fix the color for different image plot?
Hi, i defined the colors as follow for image function in R, mycola=c(#00FF00,#0DF200,#1BE400,#28D700,#36C900,#43BC00,#51AE00,#5EA100,#6B9400,#798600,#867900,#946B00,#A15E00,#AE5100,#BC4300,#C93600,#D72800,#E41B00,#F20D00,#FF) So when i use this color set to plot different data matrix which have different max and min value, the same color in different figure represents different value. for example ,i have two data matrix,one with min= -2,max=3.5;the second with min= -3,max=2.5;And i want to fix -3 to be the most blue(#00FF00),3 the most red(#FF),what can i do ? That is vales less than -3 will be plotted as -3, so for vales greater than 3. Any suggestion? Thanks in advance. Jiantao Shi [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] did my searching but still couldn't find anything for bayesian dlm
On Tue, 2006-10-31 at 19:12 -0500, Leeds, Mark (IED) wrote: I familarized myelf with kalmanlike and structts which are approaches for building and estimating ( and forecasting ) state space models ( or the equivalent arima models ). back in 2003, gavin simpson wrote an email describing the west and harrison apprach to estimate state space models and asked if anything was out there for using that approach. the goals of this approach are the same as kalman like and structts but priors are put on the variances and a bayesian approach is used to estimate the next state. in this manner, , all numerical optimization is avoided ( but obviously the results are different also so it's not necessarily a better approach. just different ). i'm dealing with minute by minute data so , for me, it's essential to avoid computing likelihoods over and over. is it possible, that , since gavin's email, the west and harrison approach has been built in one of the many packages out there. i looked really hard but i couldn't find it. my guess is that the answer is no. thanks for any input. Not sure how far the Bayesian bit has advanced, but DLMs are now becoming part of R in add-on packages sspir and dlm, thanks to a number of people, Claus Dethlefsen and Søren Lundbye-Christensen (sspir), and Giovanni Petris (dlm). IIRC, I saw some of Giovanni's materials from his website that contains information about doing Bayesian analysis with his dlm package, but I don't have the link on my home PC to confirm this. Whether these will be suitable for your use, I don't know. All the best, G mark This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received via ! e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT [w] http://www.freshwaters.org.uk/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with data type recognition and conversion
tom soyer wrote: Hi, I have a CSV file with two columns; the first column is date, second column is numbers. I used read.csv() to load the file into the variable temp. Somehow, R could not recognize my numbers as double. Instead, it thinks these numbers are integer even though they all have decimal points (isn't that strange?). The problem I ran into is that if I tried to convert the numbers to double using as.double, R doesn't give me the original value; e.g. 9.92 becomes 805 (see below). The data seem to have been read as a factor, probably due to the wrong delimiter being supplied or assumed. Make sure that the delimiter in the file is the one specified on the read.* function. Another thing that might mess up the input is quote characters. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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)
put the constrained predictor in the model offset ('offset' argument in 'lm'). i.e.: set.seed(10) X - matrix(rnorm(20), 10, 2) y - X %*% c(1,2) + rnorm(10) coef(lm(y ~ X[,2], offset=X[,1])) (Intercept) X[, 2] -0.8009112 1.6968198 coef(lm(I(y-X[,1]) ~ X[,2])) (Intercept) X[, 2] -0.8009112 1.6968198 Antonio. 2006/11/1, John Gauss [EMAIL PROTECTED]: Dear R users, Please excuse my inexperience. I am trying to contrain the coefficients of my linear regression to equal one when using the -lm(...) command. I've searched help(glm) help(model.offset) etc. but I am unable to figure out where to put this constraint. Your help would be greatly apprciated. Thanks. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Problem with data type recognition and conversion
Hi, The plot function not produces graphics in linux. The msg: Error in X11(): it was not possible to find no source X11 Verifity if the way of sources is correct. Any ideas? Thanks, Ricardo __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Constructing a loop for a Matrix
Dear R users, I have a Coxian Phase type Generator Matrix (Continuous time Markov chain) that I am trying to estimate the parameters via a Maximum Likelihood Estimation (MLE). However this markov chain can be from 2 by 2 to 6 by 6. Given initial set of parameters (theta), and the size of the matrix say n = 3 (3 * 3 matrix), I want to construct a for loop (or if there is something more sophisticated) that can return combination of matrices from my initial parameters. Here is an example: #This set of code cannot be compiled in R - It is for illustrative purposes# if (n = 3){ # 3 by 3 matrix theta=c(lambda1, lambda2, mu2, mu3) # my set of parameters From this set of parameters, I would like the following matrices: M = [-lambda1-mu1, lambda1, 0 0,-lambda2, lambda2 0, 0, -mu3] and M = [-lambda1, lambda1, 0 0, -lambda2-mu2, lambda2 0, 0, -mu3] } if (n = 4){ #4 by 4 matrix theta=c(lambda1, lambda2, lambda3, mu2, mu3) M = [-lambda1-mu1, lambda1, 0, 0 0,-lambda2, lambda2, 0 0, 0, -lambda3, lambda3] 0, 0,0, -mu3] and M = [-lambda1, lambda1, 0, 0 0, -lambda2-mu2, lambda2, 0 0, 0, -lambda3, lambda3] 0, 0,0, -mu3] and M = [-lambda1, lambda1, 0, 0 0, -lambda2, lambda2, 0 0, 0, -lambda3-mu2, lambda3] 0, 0,0, -mu3] } As the number of parameters increase, the combination of matrices will also increase. Is there a way of constructing such a loop, giving initial set of parameters, that can list SPECIFIC combination of matrices which can be incoorporated in to MLE. Thank you all Eren Demir __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] spatstat symbol referencing error
Sparc Solaris 8 SunStudio 11 compilers R-2.3.1 spatstat 1.10-1 R-2.3.1 and spatstat were installed using SunStudio11 compilers on a Sparc Solaris 8 machine. No errors were reported in the compilations, however, when I try to load spatstat I get an error: library(spatstat) Loading required package: mgcv This is mgcv 1.3-20 Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/software/R-2.3.1/lib/R/library/spatstat/libs/spatstat.so': ld.so.1: R: fatal: relocation error: file /software/R-2.3.1/lib/R/library/spatstat/libs/spatstat.so: symbol __1cG__CrunKpure_error6F_v_: referenced symbol not found Error in library(spatstat) : .First.lib failed for 'spatstat' I think the symbol is defined in the Sunstudio lib libCrun.so (/software/sunstudio11/SUNWspro/lib/libCrun.so) but this library does not appear in the list of libraries output by ldd ran against spatstat.so. My LD_LIBRARY_PATH includes /software/sunstudio11/SUNWspro/lib Any ideas, or help, or pointers to package install troubleshooting resources much appreciated, David David Stone Systems Database Administrator Macaulay Institute Craigiebuckler Aberdeen AB15 8QH +44 (0)1224 498200 www.macaulay.ac.uk -- Please note that the views expressed in this e-mail are those of the sender and do not necessarily represent the views of the Macaulay Institute. This email and any attachments are confidential and are intended solely for the use of the recipient(s) to whom they are addressed. If you are not the intended recipient, you should not read, copy, disclose or rely on any information contained in this e-mail, and we would ask you to contact the sender immediately and delete the email from your system. Thank you. Macaulay Institute and Associated Companies, Macaulay Drive, Craigiebuckler, Aberdeen, AB15 8QH. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] getMethod(s) and var.test
Hi Jeff, Dimitris, Thanks for the help! Is there some characteristic in the environment description returned by the command var.test which I could have recognized which method to use for retrieving the code? To put it differently, can I distinguish from that description between the functions that can be retrieved by getMethods() and these that need different treatment? Regards Benjamin -Ursprüngliche Nachricht- Von: Jeff Miller [mailto:[EMAIL PROTECTED] Gesendet: 31 October 2006 16:39 An: 'Benjamin Otto'; 'R-Help' Betreff: RE: [R] getMethod(s) and var.test I have found that you need this to see the stats package code getAnywhere(var.test.default) Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Otto Sent: Tuesday, October 31, 2006 10:15 AM To: R-Help Subject: [R] getMethod(s) and var.test Hi, How do I retrieve the var.test() function code? I had a similar problem once before with another function but getMethods() solved the problem then. Now I tried several combinations for var.test() without success. Regards benjamin -- Benjamin Otto Universitaetsklinikum Eppendorf Hamburg Institut fuer Klinische Chemie Martinistrasse 52 20246 Hamburg [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] write to clipboard under Linux
Prof Brian Ripley: Linux does not have a clipboard but an X11 session has primary and secondary selections. ?file says [...] so RTFM applied. Indeed it did here. Many thanks for the externsive answer despite the lucid help entry already being there! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with data type recognition and conversion
Thanks Jim, Brian, and Petr. I found a non-number, ., in my CSV file that prevented R from reading the data correctly. Once I got rid of it, R works fine. Thanks! On 11/1/06, Jim Lemon [EMAIL PROTECTED] wrote: tom soyer wrote: Hi, I have a CSV file with two columns; the first column is date, second column is numbers. I used read.csv() to load the file into the variable temp. Somehow, R could not recognize my numbers as double. Instead, it thinks these numbers are integer even though they all have decimal points (isn't that strange?). The problem I ran into is that if I tried to convert the numbers to double using as.double, R doesn't give me the original value; e.g. 9.92 becomes 805 (see below). The data seem to have been read as a factor, probably due to the wrong delimiter being supplied or assumed. Make sure that the delimiter in the file is the one specified on the read.* function. Another thing that might mess up the input is quote characters. Jim [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Optimization and garch
Good day, Here I was trying to write a code for Garch(1,1) . As garch problem is more or less an optimization problem I also tried to get the algorithm for nlminb function. What I saw that if use this function 'nlminb I can easyly get the estimate of parameters. But any other function is not working. I tried to write my own code for optimization using Quasi-Newton Methods etc but although it is working for ordinary non-linear function, it fails in garch case. Therefore I am trying to get a step by step documentation for nlminb function. I already gone though its help page got a look on http://netlib.bell-labs.com/cm/cs/cstr/153.pdf. But it did not solve my problem. In this regards, can anyone give me any step-by-step approach or theory behind the calculation that 'nlminb uses? Any help will be highly appreciable. Thanks and regards, __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] extract values from a vector
Hello, I'm looking for a solution for the following problem: I have two vectors V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) now, I would like to know for each element in V1 if it's equal to one of the elements in V2 I could do: which(V1 == V2[1] | V1 == V2[2]) but what if I don't know the length of V2 and it's content??? Thank you in advance! Antje __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extract values from a vector
Antje wrote: Hello, I'm looking for a solution for the following problem: I have two vectors V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) now, I would like to know for each element in V1 if it's equal to one of the elements in V2 I could do: which(V1 == V2[1] | V1 == V2[2]) but what if I don't know the length of V2 and it's content??? V1 %in% V2 [1] FALSE FALSE TRUE TRUE FALSE or is.element(V1, V2) [1] FALSE FALSE TRUE TRUE FALSE ?is.element Thank you in advance! Antje __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extract values from a vector
Antje [EMAIL PROTECTED] writes: Hello, I'm looking for a solution for the following problem: I have two vectors V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) now, I would like to know for each element in V1 if it's equal to one of the elements in V2 I could do: which(V1 == V2[1] | V1 == V2[2]) but what if I don't know the length of V2 and it's content??? %in% Thank you in advance! Antje __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extract values from a vector
You could do this V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) intersect(V1,V2) [1] milk bread setdiff(V1,V2) [1] apple honey butter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Antje Sent: Wednesday, November 01, 2006 8:50 AM To: R-help@stat.math.ethz.ch Subject: [R] extract values from a vector Hello, I'm looking for a solution for the following problem: I have two vectors V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) now, I would like to know for each element in V1 if it's equal to one of the elements in V2 I could do: which(V1 == V2[1] | V1 == V2[2]) but what if I don't know the length of V2 and it's content??? Thank you in advance! Antje __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] graphics not find source
Ricardo Arias Brito ricardo_ariasbrito at yahoo.com.br writes: Hi, The plot function not produces graphics in linux. The msg: Error in X11(): it was not possible to find no source X11 Verifity if the way of sources is correct. Any ideas? Thanks, Ricardo This is too vague for us to help you; I would also be extremely surprised if these are the exact text of the error messages! Please: * start R with the --vanilla option * tell us _exactly_ which commands you ran (cutting and pasting would be a good idea) * tell us exactly what error message you go (ditto on cutting and pasting) * type version and cut and paste the results * tell us what distribution and version of Linux you're using You might get some help after that. Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] did my searching but still couldn't find anything for bayesian dlm
thanks gavin : i'll check those out. On Wed, 1 Nov 2006, Gavin Simpson wrote: On Tue, 2006-10-31 at 19:12 -0500, Leeds, Mark (IED) wrote: I familarized myelf with kalmanlike and structts which are approaches for building and estimating ( and forecasting ) state space models ( or the equivalent arima models ). back in 2003, gavin simpson wrote an email describing the west and harrison apprach to estimate state space models and asked if anything was out there for using that approach. the goals of this approach are the same as kalman like and structts but priors are put on the variances and a bayesian approach is used to estimate the next state. in this manner, , all numerical optimization is avoided ( but obviously the results are different also so it's not necessarily a better approach. just different ). i'm dealing with minute by minute data so , for me, it's essential to avoid computing likelihoods over and over. is it possible, that , since gavin's email, the west and harrison approach has been built in one of the many packages out there. i looked really hard but i couldn't find it. my guess is that the answer is no. thanks for any input. Not sure how far the Bayesian bit has advanced, but DLMs are now becoming part of R in add-on packages sspir and dlm, thanks to a number of people, Claus Dethlefsen and Søren Lundbye-Christensen (sspir), and Giovanni Petris (dlm). IIRC, I saw some of Giovanni's materials from his website that contains information about doing Bayesian analysis with his dlm package, but I don't have the link on my home PC to confirm this. Whether these will be suitable for your use, I don't know. All the best, G mark This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received v ia ! e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Hessian matrix
The function hessian in the numDeriv package can be useful. It is based on Richardson extrapolation, and although it involves more computational effort (depending on the order of the extrapolation), it will provide highly accurate values. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: Wednesday, November 01, 2006 3:13 AM To: Arun Kumar Saha Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Hessian matrix ?deriv can do so algebraically for some functions. There are various packages which can do so via finite differences, e.g. fdHess() in nlme and hessian() in numDeriv. On Wed, 1 Nov 2006, Arun Kumar Saha wrote: Dear all R users, Is there any way to calculate hessian matrix of a given function at any given point? Regards [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Please do: no HTML mail as requested. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] cluster analysis using Dmax
Dear All, a long time ago I ran a cluster analysis where the dissimilarity matrix used consisted of Dmax (or Kolmogorov-Smirnov distance) values. In other words the maximum difference between two cumulative proportion curves. This all worked very well indeed. The matrix was calculated using Dbase III+ and took a day and a half and the clustering was done using MV-ARCH, with the resultant dendrogram converted from HP Plotter language to PostScript manually. As you might guess, I'd like to be able to do this more efficiently in R. I have looked through the various help files and found that some of the clustering routines will take a dissimilarity matrix as input (yay!). My questions (as a very novice R user) are: a) how would one go about calculating the matrix of Dmax/KS distance values? b) of the many clustering packages (I'll be doing a simple average link hierarchical clustering) is there one where I can ask: If I 'cut' the dendrogram at the 0.x dissimilarity level, which items are in which clusters? (As my dataset has over 200 items this is non-trivial to work out manually). Many thanks indeed for your help. Kris Lockyear. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] cluster analysis using Dmax
Dear Kris, a) how would one go about calculating the matrix of Dmax/KS distance values? Hmm, I'd implement this directly by comparing the curves on a dense sequence of equidistant points over a given value range (hope you know a suitable one) and looking for the maximum difference... b) of the many clustering packages (I'll be doing a simple average link hierarchical clustering) is there one where I can ask: If I 'cut' the dendrogram at the 0.x dissimilarity level, which items are in which clusters? (As my dataset has over 200 items this is non-trivial to work out manually). ?cutree Best, Christian Many thanks indeed for your help. Kris Lockyear. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** --- *** Christian Hennig University College London, Department of Statistical Science Gower St., London WC1E 6BT, phone +44 207 679 1698 [EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
i need a strange algorithm that i can easily do in a loop but need o do without looping. suppose i have a vector of length y filled with zeros and a number x. then, i want a new vector which is (1,..x,1..x,1.x,1.y mod x ) so if y was of length 17 and x was 3, the resultant vector should be (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) so basically , the algorithm should repeat seq(1,x) as many times as needed to fill y but then , if the last one doesn;'t fit perfectly, it should stop whenever it hits the end of y ? rep(seq(1:x,length(y)/x) will work when there is a perfect fit but it can't handle the non fit cases. it just cuts off the non integer part of length(y)/x and then fills the vector do that the resultant vector is less than the length of y. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] [ggplot] some questions
- Suppose I have a factor with quite a lot of levels. How do I split this factor not only along x or y axis, but rather split about both axis. I'm looking for the lattice layout-equivalent. You can't (yet). You can work around it by splitting the factor into two parts yourself. - If I split my data into levels and plot my measurement for every factor. How can I then add a line to every seperate panel with a different slope and a different intercept? qplot(wt, mpg, data=mtcars, type=c(point,smooth), method=lm) Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
Try: rep(1:3, length = 17) or as.numeric(gl(3, 1, 17)) or y - 1:17 replace(y, TRUE, 1:3) # ignore warning On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: i need a strange algorithm that i can easily do in a loop but need o do without looping. suppose i have a vector of length y filled with zeros and a number x. then, i want a new vector which is (1,..x,1..x,1.x,1.y mod x ) so if y was of length 17 and x was 3, the resultant vector should be (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) so basically , the algorithm should repeat seq(1,x) as many times as needed to fill y but then , if the last one doesn;'t fit perfectly, it should stop whenever it hits the end of y ? rep(seq(1:x,length(y)/x) will work when there is a perfect fit but it can't handle the non fit cases. it just cuts off the non integer part of length(y)/x and then fills the vector do that the resultant vector is less than the length of y. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
probably you want to use the 'length' argument of rep(), e.g., rep(1:3, length = 17) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, November 01, 2006 3:36 PM Subject: [R] strange algorithm needed i need a strange algorithm that i can easily do in a loop but need o do without looping. suppose i have a vector of length y filled with zeros and a number x. then, i want a new vector which is (1,..x,1..x,1.x,1.y mod x ) so if y was of length 17 and x was 3, the resultant vector should be (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) so basically , the algorithm should repeat seq(1,x) as many times as needed to fill y but then , if the last one doesn;'t fit perfectly, it should stop whenever it hits the end of y ? rep(seq(1:x,length(y)/x) will work when there is a perfect fit but it can't handle the non fit cases. it just cuts off the non integer part of length(y)/x and then fills the vector do that the resultant vector is less than the length of y. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
On Wed, 2006-11-01 at 09:36 -0500, [EMAIL PROTECTED] wrote: i need a strange algorithm that i can easily do in a loop but need o do without looping. suppose i have a vector of length y filled with zeros and a number x. then, i want a new vector which is (1,..x,1..x,1.x,1.y mod x ) so if y was of length 17 and x was 3, the resultant vector should be (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) so basically , the algorithm should repeat seq(1,x) as many times as needed to fill y but then , if the last one doesn;'t fit perfectly, it should stop whenever it hits the end of y ? rep(seq(1:x,length(y)/x) will work when there is a perfect fit but it can't handle the non fit cases. it just cuts off the non integer part of length(y)/x and then fills the vector do that the resultant vector is less than the length of y. ?rep, in particular the length.out argument. Using this, your desired output is easily achieved: Y - rep(0, 17) X - 3 Y - rep(1:X, length.out = length(Y)) Y [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 yours - c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) all.equal(yours, Y) [1] TRUE HTH G thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT [w] http://www.freshwaters.org.uk/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] installing rgl package on linux suse 10.1
Dear R wizards, In windows I get really cool graphs with the rgl package. However on linux, it seems that I can't install one of my favourite packages. I get a error message on X11, but all X11 packages are installed on my linux desktop. Who can help me out here? Thanks! Steven Gorlé install.packages() * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/lib/R/library/rgl' The downloaded packages are in /tmp/RtmpUAg2Xh/downloaded_packages Warning message: installation of package 'rgl' had non-zero exit status in: install.packages() __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
thanks to all for your replies. very neat. On Wed, 1 Nov 2006, Gabor Grothendieck wrote: Try: rep(1:3, length = 17) or as.numeric(gl(3, 1, 17)) or y - 1:17 replace(y, TRUE, 1:3) # ignore warning On 11/1/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: i need a strange algorithm that i can easily do in a loop but need o do without looping. suppose i have a vector of length y filled with zeros and a number x. then, i want a new vector which is (1,..x,1..x,1.x,1.y mod x ) so if y was of length 17 and x was 3, the resultant vector should be (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) so basically , the algorithm should repeat seq(1,x) as many times as needed to fill y but then , if the last one doesn;'t fit perfectly, it should stop whenever it hits the end of y ? rep(seq(1:x,length(y)/x) will work when there is a perfect fit but it can't handle the non fit cases. it just cuts off the non integer part of length(y)/x and then fills the vector do that the resultant vector is less than the length of y. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
[EMAIL PROTECTED] wrote: i need a strange algorithm that i can easily do in a loop but need o do without looping. suppose i have a vector of length y filled with zeros and a number x. then, i want a new vector which is (1,..x,1..x,1.x,1.y mod x ) so if y was of length 17 and x was 3, the resultant vector should be (1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2) so basically , the algorithm should repeat seq(1,x) as many times as needed to fill y but then , if the last one doesn;'t fit perfectly, it should stop whenever it hits the end of y ? rep(seq(1:x,length(y)/x) will work when there is a perfect fit but it can't handle the non fit cases. it just cuts off the non integer part of length(y)/x and then fills the vector do that the resultant vector is less than the length of y. rep(seq(1:x),length(y)/x+1)[1:length(y)] -- --- Jeff NewmillerThe . . Go Live... DCN:[EMAIL PROTECTED]Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extract values from a vector
Am 1 Nov 2006 um 14:49 hat Antje geschrieben: Date sent: Wed, 01 Nov 2006 14:49:43 +0100 From: Antje [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject:[R] extract values from a vector Hello, I'm looking for a solution for the following problem: I have two vectors V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) now, I would like to know for each element in V1 if it's equal to one of the elements in V2 I could do: which(V1 == V2[1] | V1 == V2[2]) but what if I don't know the length of V2 and it's content??? V1%in%V2 [1] FALSE FALSE TRUE TRUE FALSE Is this what you are looking for? HTH, Bernd __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Measuring the effects of history on event probabilities
This is probably very simple but my brain has frozen over. (I'm trying to warm it with coffee) I have observations of around 22000 individuals over 13 successive years: they were either 'interviewed' at time t or 'not interviewed'. What's the most appropriate function/approach to use to find out the extent to which individuals' event outcomes are temporally correlated? Thanks, Jon Minton [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 rgl package on linux suse 10.1
2006/11/1, Steven Gorlé [EMAIL PROTECTED]: Dear R wizards, In windows I get really cool graphs with the rgl package. However on linux, it seems that I can't install one of my favourite packages. I get a error message on X11, but all X11 packages are installed on my linux desktop. Who can help me out here? Thanks! Steven Gorlé install.packages() * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/lib/R/library/rgl' The downloaded packages are in /tmp/RtmpUAg2Xh/downloaded_packages Warning message: installation of package 'rgl' had non-zero exit status in: install.packages() __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hello, make sure the following packages are installed on suse (YAST): xorg-x11-libs Check this tutorial http://www.hellmund.dk/RSUSEGUI.html. Ro. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] splitting very long character string
Hello, I've a very long character array (500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string. The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this: ... 12345 564376 5674 6356656 5666 ... I've to read about a hundred of these files and was wondering whether there's a more efficient way to turn this string into an array of numerics. Any ideas? thanks a lot for your help and kind regards, Arne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] splitting very long character string
Hi Arne If you are reading in from files and they are just one number per line it would be more efficient to use scan directly. ?scan For example: filen-C:/temp/tt.txt i-scan(filen) Read 5 items i [1] 12345 5643765674 63566565666 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 01 November 2006 15:47 To: r-help@stat.math.ethz.ch Subject: [R] splitting very long character string Hello, I've a very long character array (500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string. The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this: ... 12345 564376 5674 6356656 5666 ... I've to read about a hundred of these files and was wondering whether there's a more efficient way to turn this string into an array of numerics. Any ideas? thanks a lot for your help and kind regards, Arne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] splitting very long character string
On Wed, 2006-11-01 at 16:47 +0100, [EMAIL PROTECTED] wrote: Hello, I've a very long character array (500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string. The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this: ... 12345 564376 5674 6356656 5666 ... I've to read about a hundred of these files and was wondering whether there's a more efficient way to turn this string into an array of numerics. Any ideas? thanks a lot for your help and kind regards, Arne Vec - sample(c(0:9, \n), 50, replace = TRUE) str(Vec) chr [1:50] 7 0 9 6 5 3 1 9 ... table(Vec) Vec \n 0 1 2 3 4 5 6 7 8 9 45432 45723 45641 45526 45460 45284 45378 45392 45374 45314 45476 sink(Vec.txt) cat(Vec) sink() First 10 lines of Vec.txt: 7 0 9 6 5 3 1 9 8 1 8 3 4 2 1 2 2 3 7 7 6 8 3 4 7 4 9 2 1 9 8 7 2 0 9 4 3 9 3 5 2 2 5 8 0 5 4 5 6 1 5 8 7 4 1 2 8 3 2 6 4 9 4 1 6 8 5 0 8 8 8 5 3 0 5 3 5 4 8 5 4 3 9 5 3 6 5 8 9 7 6 9 5 8 2 4 6 5 system.time(Vec.Split - scan(Vec.txt, sep = \n)) Read 41276 items [1] 0.180 0.004 0.186 0.000 0.000 str(Vec.Split) num [1:41276] 7.10e+13 1.22e+02 3.78e+08 9.22e+10 9.35e+44 ... sprintf(%.0f, Vec.Split[1:10]) [1] 70965319818342 [2] 122 [3] 377683474 [4] 92198720943 [5] 935225805456158720742405574866620654670577664 [6] 9 [7] 536589769 [8] 58 [9] 246 [10] 5 Does that help? Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] OT: data from Harvey's book
Goodmorning, and sorry for the off-topic question. Does anybody know if the data sets used in Harvey's book Forecasting, structural time series models and the Kalman filter are available online? Thanks in advance, Giovanni -- __ [ ] [ Giovanni Petris [EMAIL PROTECTED] ] [ Associate Professor ] [ Department of Mathematical Sciences ] [ University of Arkansas - Fayetteville, AR 72701 ] [ Ph: (479) 575-6324, 575-8630 (fax) ] [ http://definetti.uark.edu/~gpetris/ ] [__] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] coefficient constraints
Hi, Isn't this a complex way to calculate: mean(y-x1-x2) Yours, Kees On Wednesday 01 November 2006 02:13, John Fox wrote: Dear John, You can subtract the variables in question from the left-hand-side of the model [e.g., lm(y - x1 - x2 ~ 1)], or use the offset argument to lm [e.g., lm(y ~ 1, offset=x1 + x2)], or use offset() in the model formula [e.g., lm(y ~ offset(x1 + x2)]. All of these options are equivalent. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Gauss Sent: Tuesday, October 31, 2006 7:28 PM To: r-help@stat.math.ethz.ch Subject: [R] coefficient constraints Hi, Thank you for your help. I'm trying to constrain the coefficients on a linear regression model, -lm(...), to all equal one, except for the intercept. I've searched help(glm), help(model.fit), etc. but I can not find where to add the constraint. Your help would be greatly appreciated. Thanks. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 run R code without R enviorment at Windows?
Hello. I have a problem with R code running. Since I need to run my R code at a Windows Server rountinely. But I can not install R language on that windows machine. Is there anyway to package R code into standalone executables, which does not need the administrator to install R on that machine? Any advice is appreciated! Thanks a lot for your help, Victor [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] splitting very long character string
On Wed, 1 Nov 2006, [EMAIL PROTECTED] wrote: Hello, I've a very long character array (500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string. Can't you use fixed=TRUE since you do not have a regular expression? Nevertheless, if you are going to be creating about 60k character strings, the overhead in creating the strings will be very considerable. If you just want the numbers, using an anonymous file() connection to write out the string and then using scan() might well be a lot more efficient. The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this: ^^^ 'package' or your own C code accessing libxml? ... 12345 564376 5674 6356656 5666 ... I've to read about a hundred of these files and was wondering whether there's a more efficient way to turn this string into an array of numerics. Any ideas? thanks a lot for your help and kind regards, Arne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Missing Variables? Singularities?
Hello, I am running into trouble with an ANCOVA model I am attempting to develop. The model includes 2 categorical variables (BHCODE and MHCODE), 2 continuous variables (LOGWGT,LOG1980), and an interaction term (BHCODE:MHCODE). There are seven levels of the BHCODE (ForestG, ForestO, Generalist, Grassland, Scrub, Urban, Wetland) and three levels of MHCODE (Neo, Res, Short). The model is written as follows: lm7 - lm(LOGIT1980~BHCODE+MHCODE+LOGWGT+LOG1980+BHCODE:MHCODE,data = data80) When I attempt to use the summary(lm) function, I receive the following output. Two terms are missing from all of my analyses, ForestG (from the BHCODE variable) and Neo (from the MHCODE variable). They are not constant and change throughout the data set. In addition, the singularity warning does not seem to relate to these missing levels but to the NA findings below (BHCODEGeneralist:MHCODERes and BHCODEScrub:MHCODERes). I know that ForestG is represented by the (Intercept) term, but it is not found again in any interaction terms and Neo is just plain gone. Any thoughts?? Thanks! Coefficients: (2 not defined because of singularities) Estimate Std. Error t value Pr(|t|) (Intercept) -0.196230.14485 -1.355 0.1795 BHCODEForestO-0.447540.18855 -2.374 0.0201 * BHCODEGeneralist -0.062990.17215 -0.366 0.7154 BHCODEGrassland -0.475540.25435 -1.870 0.0653 . BHCODEScrub -0.055770.21577 -0.258 0.7967 BHCODEUrban -0.352410.18748 -1.880 0.0639 . BHCODEWetland-0.044880.14080 -0.319 0.7508 MHCODERes 0.378790.17125 2.212 0.0299 * MHCODEShort -0.235820.16185 -1.457 0.1492 LOGWGT0.192120.09511 2.020 0.0469 * LOG1980 0.774770.06480 11.957 2e-16 *** BHCODEForestO:MHCODERes 0.268180.44155 0.607 0.5454 BHCODEGeneralist:MHCODERes NA NA NA NA BHCODEGrassland:MHCODERes-0.993720.47383 -2.097 0.0393 * BHCODEScrub:MHCODERes NA NA NA NA BHCODEUrban:MHCODERes-0.733410.31685 -2.315 0.0233 * BHCODEWetland:MHCODERes -0.792030.40175 -1.971 0.0523 . BHCODEForestO:MHCODEShort 0.530820.30627 1.733 0.0871 . BHCODEGeneralist:MHCODEShort 0.488210.27064 1.804 0.0752 . BHCODEGrassland:MHCODEShort 0.380840.31552 1.207 0.2311 BHCODEScrub:MHCODEShort 0.252020.31288 0.805 0.4230 BHCODEUrban:MHCODEShort 0.447030.27947 1.600 0.1138 BHCODEWetland:MHCODEShort 0.241100.23742 1.016 0.3130 -- Benjamin Zuckerberg Doctoral Candidate State University of New York College of Environmental Science and Forestry Illick 244A, 1 Forestry Drive Syracuse, New York 13210 Tele: (315) 470-6985 E-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 run R code without R enviorment at Windows?
Wang, Luyong (SCR US) wrote: Hello. I have a problem with R code running. Since I need to run my R code at a Windows Server rountinely. But I can not install R language on that windows machine. Why not? You can install into a private directory. Is there anyway to package R code into standalone executables, which does not need the administrator to install R on that machine? No. Uwe Ligges Any advice is appreciated! Thanks a lot for your help, Victor [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extract values from a vector
Bernd Weiss schrieb: Am 1 Nov 2006 um 14:49 hat Antje geschrieben: Date sent:Wed, 01 Nov 2006 14:49:43 +0100 From: Antje [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject: [R] extract values from a vector Hello, I'm looking for a solution for the following problem: I have two vectors V1 - c(apple,honey,milk,bread,butter) V2 - c(bread,milk) now, I would like to know for each element in V1 if it's equal to one of the elements in V2 I could do: which(V1 == V2[1] | V1 == V2[2]) but what if I don't know the length of V2 and it's content??? V1%in%V2 [1] FALSE FALSE TRUE TRUE FALSE Is this what you are looking for? HTH, Bernd Thank you very much, that's what I need (I'm sorry for asking so stupid questions) Antje __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] xyplot: Plotting two variables, one as points - the other as line. Can that be done without explicitly using panel functions
Hi! Consider d - data.frame(x=1:10,y=5+1:10, yf=rnorm(10,5+1:10)) x yyf 1 1 6 5.268621 2 2 7 8.623896 3 3 8 8.114830 4 4 9 10.125955 5 5 10 9.977261 ... I plot y and yf against x with xyplot(y+yf~x,data=d,col=c('red','green'),pch=c(a,b)) BUT - I would like that the plot of y against x is with type='l' and the plot of yf against x is with type='p'. 1) Can this be done easily (i.e. without panel functions)? (Doing xyplot(y+yf~x,data=d,type=c(l,p),col=c('red','green'),pch=c(a,b)) is not the way ahead) 2) How to do it with panel functions? Thanks in advance Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Figuring out the right formula
Hello, This question is bugging me because of my ignorance on the subject. I can't even figure out what to read to understand it. I am trying to start an lme or nlme analysis of some data but I can't figure out the right formula to use. The data has the following structure: 1) A measurement , say y was made at 5 different angles (A) on few days (d) on the ith subject on location x (two possibilities). Both locations were measured on all subjects but not all angles or all days were measured. 2) Everything is in a table. I tried creating groupedData using a variety of formulas and played with the trellis plots to investigate whether my formula seem to be entered right, so I tried: y ~ A/d | i/x y ~ A | i/x/d y ~ A*d | i/x etc. My problem is I can't figure out the proper way to say y depends on both A and d and is grouped by subject (i) and location (x). Any help with this particular formula and any pointers to a tutorial/text on this type of formulas would be greatly appreciated. Regards. Turgut __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 make a data file
Hi, Within Excel, I save the file as a .csv file and then read it into R using read.csv. This will generate a data frame object which can then be fed to the extRemes Toolkit. Alternatively you could master the R-ODBC package to load an excel file directly, but I find that rather complicated :D Regards, Ahraz -Original Message- From: Petr Pikal [mailto:[EMAIL PROTECTED] Sent: 01 November 2006 08:09 To: amna khan Cc: r-help@stat.math.ethz.ch Subject: Re: [R] how to make a data file Hi I use clipboard for transfering data from Excel. In Excel select the part you want to copy to R Press Ctrl-C In R write test - read.delim(clipboard) or read.table(clipboard) to transfer your data to test data frame. However if you will not go through some introduction manual (what I already recommended) and do not know how to manipulate objects in R, you will quickly be completely lost. To use R efficiently you need to accept that it has its own language, terminology and its own way how to do things. R is not Excel (Thanks goodness :-) HTH Petr On 1 Nov 2006 at 11:42, amna khan wrote: Date sent: Wed, 1 Nov 2006 11:42:05 +0500 From: amna khan [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Subject:Re: [R] how to make a data file Sir i have been poor for saving data in form of a datafile. please guid me in simple words to make a data file after importing it from excel. Thank you On 10/31/06, Petr Pikal [EMAIL PROTECTED] wrote: Hi well probably the best approach for you is to read some introductory documents. I would recommend this sequence R-intro R-lang R-data Posting guide or you can try to go through some documents from CRAN, in many of them you can find introductory chapters. And leas but not last when starting with R I found usefull Paul Johnson's Rtips (StatsRUs). At least for more concise help you need to provide R version, OS, and what exactly you did and how you failed - as recommended in posting guide ;-) HTH Petr On 31 Oct 2006 at 11:31, amna khan wrote: Date sent: Tue, 31 Oct 2006 11:31:08 +0500 From: amna khan [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject:[R] how to make a data file Sir after importing data from excel to R, I am not understanding how to make this data file. So that I can use it in extRemeToolkit and other packages. Thank you -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Fitting mean and covariance of Multivariate normal with censored data
Hello, I have been googling for 2 days and I cannot find the answer in previous posts. I have a set of d-dimensional data elements (d=11 .. 14), each data point can be censored at different values both Lower-limit and upper limit. N = 2000 sets of vectors of D=11 data points per vector. Each of the N*D points can have different upper and lower limits. I simply want to fit a Multivariate distribution to the data and get the mean and covariance matrix of the sample. The closest post I saw mentionned the function survreg in the survival5 package, but I can't figure out how To use it for a non-regression model. Thanks, Hugues [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Optimization and garch
Optimizing GARCH likelihoods is notoriously difficult. I suspect that you will find 'nlminb' to be less than perfect, though it is relatively good. In particular you are likely to see different behavior depending on whether or not the data are in percent. A reference is Winker and Maringer (2006) The convergence of optimization based estimators: Theory and application to a GARCH-model. Available online. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) stat stat wrote: Good day, Here I was trying to write a code for Garch(1,1) . As garch problem is more or less an optimization problem I also tried to get the algorithm for nlminb function. What I saw that if use this function 'nlminb I can easyly get the estimate of parameters. But any other function is not working. I tried to write my own code for optimization using Quasi-Newton Methods etc but although it is working for ordinary non-linear function, it fails in garch case. Therefore I am trying to get a step by step documentation for nlminb function. I already gone though its help page got a look on http://netlib.bell-labs.com/cm/cs/cstr/153.pdf. But it did not solve my problem. In this regards, can anyone give me any step-by-step approach or theory behind the calculation that 'nlminb uses? Any help will be highly appreciable. Thanks and regards, __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] xyplot: Plotting two variables, one as points - the other as line. Can that be done without explicitly using panel functions
If the x values are unique, as in this example, then xyplot.zoo can do it without a panel function (or perhaps more accurately the default panel function in xyplot.zoo can do it). Note that a zoo object is a vector or matrix with a time index attached to it. You don't really have to be familiar with zoo manipulations for this but there is zoo vignette if you want. library(lattice) libary(zoo) set.seed(1) d - data.frame(x=1:10,y=5+1:10, yf=rnorm(10,5+1:10)) z - with(d, zoo(cbind(y, yf), x)) # create zoo object, x is time xyplot(z, col = 2:3, type = c(l, p), pch = b, screen = 1) On 11/1/06, Søren Højsgaard [EMAIL PROTECTED] wrote: Hi! Consider d - data.frame(x=1:10,y=5+1:10, yf=rnorm(10,5+1:10)) x yyf 1 1 6 5.268621 2 2 7 8.623896 3 3 8 8.114830 4 4 9 10.125955 5 5 10 9.977261 ... I plot y and yf against x with xyplot(y+yf~x,data=d,col=c('red','green'),pch=c(a,b)) BUT - I would like that the plot of y against x is with type='l' and the plot of yf against x is with type='p'. 1) Can this be done easily (i.e. without panel functions)? (Doing xyplot(y+yf~x,data=d,type=c(l,p),col=c('red','green'),pch=c(a,b)) is not the way ahead) 2) How to do it with panel functions? Thanks in advance Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] xyplot: Plotting two variables, one as points - the other as line. Can that be done without explicitly using panel functions
On 11/1/06, Søren Højsgaard [EMAIL PROTECTED] wrote: Hi! Consider d - data.frame(x=1:10,y=5+1:10, yf=rnorm(10,5+1:10)) x yyf 1 1 6 5.268621 2 2 7 8.623896 3 3 8 8.114830 4 4 9 10.125955 5 5 10 9.977261 ... I plot y and yf against x with xyplot(y+yf~x,data=d,col=c('red','green'),pch=c(a,b)) BUT - I would like that the plot of y against x is with type='l' and the plot of yf against x is with type='p'. 1) Can this be done easily (i.e. without panel functions)? (Doing xyplot(y+yf~x,data=d,type=c(l,p),col=c('red','green'),pch=c(a,b)) is not the way ahead) xyplot(y+yf~x,data=d,type=c(l,p),col=c('red','green'), pch=c(a,b), distribute.type = TRUE) 2) How to do it with panel functions? See ?panel.superpose -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] matrix manipulation with a for loop
Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]=5) (F.zoo[,86]= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,86]*100 But to do this for each column (189) is pretty hard, so I want to write a function in order to perform this automatically, such I have the percent value corresponding to a specific column. I' tried these two formulas but I can't get it. I think the problem is how to set the initial values for the loop: Formula1: nnn-function(x){for (i in F.zoo[,i]){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Formula 2: H-t(matrix(1,189)) nnn-function(x){for (i in col(H){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Thanks, Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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)
Does anyone know if it's possible to pull out the Spike-In control average intensities (BioB, BioC etc..) from a batch of un-normalised CEL files using R? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] ncp in dt
i just wanted to know if the non centraility parameter as it is referred to in the dt test is what i would think of as mu zero if i was doing a test of a hypothesis that the mean was equal to mu zero and the variance was unknown. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] ncp in dt
i meant dt function in my email below. my aopolgies. On Wed, 1 Nov 2006 [EMAIL PROTECTED] wrote: i just wanted to know if the non centraility parameter as it is referred to in the dt test is what i would think of as mu zero if i was doing a test of a hypothesis that the mean was equal to mu zero and the variance was unknown. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix manipulation with a for loop
Try this where m is the matrix: 100 * colMeans(m 5 m 9, na.rm = TRUE) On 11/1/06, antonio rodriguez [EMAIL PROTECTED] wrote: Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]=5) (F.zoo[,86]= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,86]*100 But to do this for each column (189) is pretty hard, so I want to write a function in order to perform this automatically, such I have the percent value corresponding to a specific column. I' tried these two formulas but I can't get it. I think the problem is how to set the initial values for the loop: Formula1: nnn-function(x){for (i in F.zoo[,i]){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Formula 2: H-t(matrix(1,189)) nnn-function(x){for (i in col(H){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Thanks, Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix manipulation with a for loop
Phil Spector escribió: Antonio - When you're operating on each column of a matrix, you really should consider the apply() function, which was written for the task. Also, it's usually easier to count things in R by taking the sum of a logical expression, rather than the length of a subsetted vector. Here's code that will solve your problem: apply(F.zoo,1,function(x)sum(x =5 x = 9)/sum(!is.na(x))*100) Dear Phil, The problem is that the columns have some missing values (NA's) so the result for: apply(F.zoo,2,function(x)sum(x =5 x = 9)/sum(!is.na(x))*100) # yields: X.1 X.2 X.3 X.4 X.5 X.6 X.7 X.8 X.9 X.10 X.11 X.12 X.13 NANANANANANANANANANANA NANA X.14 X.15 X.16 X.17 X.18 X.19 X.20 X.21 X.22 X.23 X.24 X.25 X.26 NANANANANANANANANANANA NANA So it is supposed that using na.rm=T should do the task, but if I write: apply(F.zoo,2,function(x)sum(F.zoo =5 F.zoo = 9)/sum(!is.na(F.zoo))*100,na.rm=T) I get: Erro en FUN(newX[, i], ...) : unused argument(s) (na.rm = TRUE) Antonio - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley [EMAIL PROTECTED] On Wed, 1 Nov 2006, antonio rodriguez wrote: Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]=5) (F.zoo[,86]= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,86]*100 But to do this for each column (189) is pretty hard, so I want to write a function in order to perform this automatically, such I have the percent value corresponding to a specific column. I' tried these two formulas but I can't get it. I think the problem is how to set the initial values for the loop: Formula1: nnn-function(x){for (i in F.zoo[,i]){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Formula 2: H-t(matrix(1,189)) nnn-function(x){for (i in col(H){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Thanks, Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 rgl package on linux suse 10.1
On Wed, 2006-11-01 at 15:52 +0100, Steven Gorlé wrote: Dear R wizards, In windows I get really cool graphs with the rgl package. However on linux, it seems that I can't install one of my favourite packages. I get a error message on X11, but all X11 packages are installed on my linux desktop. Who can help me out here? Guessing that you don't have the development headers for X. I've never used SUSE, but on my Fedora system the relevant package is: xorg-x11-devel I think suse uses the Xorg flavour of X so there is a chance the package will be similarly named. If so, install it (or the correct package) and try again. At a terminal, typing rpm -qa | grep x11 might help show you if the basic package is xorg-x11 for which you'd need the devel package mentioned above, or point you in the direction of the correct package to install HTH G Thanks! Steven Gorlé install.packages() * Installing *source* package 'rgl' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package 'rgl' ** Removing '/usr/lib/R/library/rgl' The downloaded packages are in /tmp/RtmpUAg2Xh/downloaded_packages Warning message: installation of package 'rgl' had non-zero exit status in: install.packages() __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT [w] http://www.freshwaters.org.uk/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix manipulation with a for loop
Gabor Grothendieck escribió: Try this where m is the matrix: 100 * colMeans(m 5 m 9, na.rm = TRUE) Dear Gabor, Just perfect! Thanks a lot, Antonio On 11/1/06, antonio rodriguez [EMAIL PROTECTED] wrote: Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]=5) (F.zoo[,86]= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,86]*100 But to do this for each column (189) is pretty hard, so I want to write a function in order to perform this automatically, such I have the percent value corresponding to a specific column. I' tried these two formulas but I can't get it. I think the problem is how to set the initial values for the loop: Formula1: nnn-function(x){for (i in F.zoo[,i]){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Formula 2: H-t(matrix(1,189)) nnn-function(x){for (i in col(H){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Thanks, Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] building RMySQL under Mac OS X
Ricardo, I notice you have posted two questions about this subject, I have not seen a reply. I have asked the Mac special interest group for help, so it may well be worth you looking here (https://stat.ethz.ch/mailman/listinfo/r- sig-mac) over the next few days for answers to this problem. Paul On 28 Oct 2006, at 16:13, Your EPEC ICT Team - Ricardo Rodríguez wrote: Hi, Please, is out there anybody using RMySQL under Mac OS X? I'm trying to build it without much success. How must I add/locate mysql.h and lmysqlclient library? Thanks for your help, Ricardo -- Ricardo Rodríguez Your EPEC ICT Team P. B. Pynsent, Research Teaching Centre, Royal Orthopaedic Hospital, Northfield, Birmingham, B31 2AP, U. K. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] matrix manipulation with a for loop
Phil Spector escribió: Antonio - You need the na.rm in the first invocation of sum -- is.na() will never return a missing value: apply(F.zoo,2,function(x)sum(x =5 x = 9,na.rm=TRUE)/sum(!is.na(x))*100) - Phil Dear Phil, I understand now. Many thanks!! Best regards, Antonio On Wed, 1 Nov 2006, antonio rodriguez wrote: Phil Spector escribió: Antonio - When you're operating on each column of a matrix, you really should consider the apply() function, which was written for the task. Also, it's usually easier to count things in R by taking the sum of a logical expression, rather than the length of a subsetted vector. Here's code that will solve your problem: apply(F.zoo,1,function(x)sum(x =5 x = 9)/sum(!is.na(x))*100) Dear Phil, The problem is that the columns have some missing values (NA's) so the result for: apply(F.zoo,2,function(x)sum(x =5 x = 9)/sum(!is.na(x))*100) # yields: X.1 X.2 X.3 X.4 X.5 X.6 X.7 X.8 X.9 X.10 X.11 X.12 X.13 NANANANANANANANANANANA NANA X.14 X.15 X.16 X.17 X.18 X.19 X.20 X.21 X.22 X.23 X.24 X.25 X.26 NANANANANANANANANANANA NANA So it is supposed that using na.rm=T should do the task, but if I write: apply(F.zoo,2,function(x)sum(F.zoo =5 F.zoo = 9)/sum(!is.na(F.zoo))*100,na.rm=T) I get: Erro en FUN(newX[, i], ...) : unused argument(s) (na.rm = TRUE) Antonio - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley [EMAIL PROTECTED] On Wed, 1 Nov 2006, antonio rodriguez wrote: Hi, Having a matrix F.zoo (6575,189) with NA's in some columns I'm trying to extract from each column the percent of days within an specific range, so I've wrote this procedure: length(subset(F.zoo[,86],(F.zoo[,86]=5) (F.zoo[,86]= 9)))/(length(F.zoo[,86])-length(subset(F.zoo[,86],is.na(F.zoo[,86]*100 But to do this for each column (189) is pretty hard, so I want to write a function in order to perform this automatically, such I have the percent value corresponding to a specific column. I' tried these two formulas but I can't get it. I think the problem is how to set the initial values for the loop: Formula1: nnn-function(x){for (i in F.zoo[,i]){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Formula 2: H-t(matrix(1,189)) nnn-function(x){for (i in col(H){ print(length(subset(F.zoo[,i],(F.zoo[,i]=5) (F.zoo[,i]= 9)))/(length(F.zoo[,i])-length(subset(F.zoo[,i],is.na(F.zoo[,i]*100) } } Thanks, Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] read.fwf and header
How about using a connection and reading the header separate from the data, like this: tmp1 - file('c:/temp/tmp.dat') open(tmp1) my.names - scan(tmp1, nlines=1, what='') new.data-read.fwf(file=tmp1, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19), header=FALSE) names(new.data) - my.names close(tmp1) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gregor Gorjanc Sent: Monday, October 30, 2006 3:33 PM To: Daniel Nordlund Cc: r-help@stat.math.ethz.ch Subject: Re: [R] read.fwf and header Daniel Nordlund wrote: Gregor, According to the help for read.fwf, sep needs to be set to a value that occurs only in the header record. I changed the spaces to commas in the header record of your example and used the following syntax and was able to read the file just fine. new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19), header=TRUE, sep=',') Hope this is helpful, Dan Thanks Dan! But I have to modfy file first. Not that much of work but still. Regards, Gregor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] graphics not find source
Hi, The plot function not produces graphics in linux. The msg: Error in X11(): it was not possible to find no source X11 Verifity if the way of sources is correct. Any ideas? Thanks, Ricardo ___ Registre seu aparelho agora! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] graphics not find source
Ricardo Arias Brito [EMAIL PROTECTED] writes: Hi, The plot function not produces graphics in linux. The msg: Error in X11(): it was not possible to find no source X11 Verifity if the way of sources is correct. Any ideas? Hmm, maybe you shouldn't have tried to translate the message back to English I believe there is a similar message that has to do with _fonts_. If so, then the problem could be related to the font path or to locale issues. What happens if you do LC_ALL=C R ? It could be useful to know more about your system than linux. Which distribution and which version? Compiled yourself or installed from binaries? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Missing data analysis in R
Analysis of Incomplete Multivariate Data is the name you were thinking of. I thought it was pretty good and has some S examples if i remember correctly On 10/31/06, Leeds, Mark (IED) [EMAIL PROTECTED] wrote: there is a green book by joe shafer ( I forget the name but it's probsably on amazon ). I also Can't say it's in the same format as faraday's book but I think it's fairly popular for multiple Imputation techniques etc. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Inman, Brant A. M.D. Sent: Tuesday, October 31, 2006 12:18 PM To: r-help@stat.math.ethz.ch Subject: [R] Missing data analysis in R I am looking for a book that discusses the theory of multiple imputation (and other methods of dealing with missing data) and, just as importantly, how to implement these methods in R or S-Plus. Ideally, the book would have a structure similar to Faraway (Regression), PinheiroBates (Mixed Effects) and Wood (GAMs) and would be very modern (i.e. published within the last couple of years). Any ideas? If such a book does not exist, one of the experts on this help list should write it! (I will gladly buy the first copy.) Brant Inman Mayo Clinic [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] gamm(): degrees of freedom of the fit
I wonder whether any of you know of an efficient way to calculate the approximate degrees of freedom of a gamm() fit. Calculating the smoother/projection matrix S: y - \hat y and then its trace by sum(eigen(S))$values is what I've been doing so far- but I was hoping there might be a more efficient way than doing the spectral decomposition of an NxN-matrix. The degrees of freedom associated with the linear and smooth parts can be read from the gam-part of the fitted gamm()-model, but not the degrees of freedom associated with the random effects. For lmer()-models, there is hatTrace() but I know of nothing of the sort for lme()-Objects. Maybe somebody has some code or ideas to share? -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] gamm(): degrees of freedom of the fit
On Wed, 1 Nov 2006, Fabian Scheipl wrote: Calculating the smoother/projection matrix S: y - \hat y and then its trace by sum(eigen(S))$values is what I've been doing so far- but I was hoping there might be a more efficient way than doing the spectral decomposition of an NxN-matrix. Well, there are more efficient ways to compute the trace of a matrix than spectral decomposition. The trace is just the sum of the diagonal elements: sum(diag(S)) -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] read.fwf and header
Greg Snow wrote: How about using a connection and reading the header separate from the data, like this: tmp1 - file('c:/temp/tmp.dat') open(tmp1) my.names - scan(tmp1, nlines=1, what='') new.data-read.fwf(file=tmp1, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19), header=FALSE) names(new.data) - my.names close(tmp1) Yes, also possible as has been shown in previous posts. -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Confidence intervals for Brier score
I am using the ipred library to calculate the censored Brier score for a Cox proportional hazards model. I would like to know if anyone has developed a method of calculating confidence intervals for the various forms of the Brier score that are used in the analysis of survival/censored data. If so, are these implemented in S? Thank you Brant Inman [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] ncp in dt
dt calculates the density function from the student's t distribution. If you want to perform a standard t-test you may want to look at the t.test() function included in the stats package. Cheers, Francisco From: [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: Re: [R] ncp in dt Date: Wed, 1 Nov 2006 13:09:50 -0500 (EST) i meant dt function in my email below. my aopolgies. On Wed, 1 Nov 2006 [EMAIL PROTECTED] wrote: i just wanted to know if the non centraility parameter as it is referred to in the dt test is what i would think of as mu zero if i was doing a test of a hypothesis that the mean was equal to mu zero and the variance was unknown. thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. _ Stay in touch with old friends and meet new ones with Windows Live Spaces __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] repeating symbols and colors
Heres an easy one. Well, easy for those more clever than I am. I am plotting several groups and use symbols 15:25, pch - 15:25 Sometimes, however, I need more than those and would like to have them recycled automatically so that pch[12] = pch[1]. Perhaps I can use %% or kludge up a multi-line, multi-if solution, but hope that a kind helper can suggest something more elegant. I am also using RColorBrewer and like Set1 but that has only 9 colors. I don't want infinitesimal color gradations and would prefer to re-use those colors if I can find a way to recycle them too. Since the number of available colors and available symbols differ, the color/symbol combinations will be unique for the recycled usage. Thanks for your counsel. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] ncp in dt
[EMAIL PROTECTED] writes: i meant dt function in my email below. my aopolgies. On Wed, 1 Nov 2006 [EMAIL PROTECTED] wrote: i just wanted to know if the non centraility parameter as it is referred to in the dt test is what i would think of as mu zero if i was doing a test of a hypothesis that the mean was equal to mu zero and the variance was unknown. thanks. The other way around: If testing that mu is zero, when it is really mu_zero and the sd is one. (The noncentral t is roughly centered around the ncp.) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Calling an arbitrarily named data frame + variable
If I want to pass a data frame variable name and a specific component name of the data frame to a function, and I want the function to operate on this (e.g. Data frame = data1 and the component in question is component1, so I want the function to operate on data1$component1), how do I pass and call this info? This would be for an arbitrarily named data frame and component name, e.g. The function should also be able to handle it if I pass data2 and component2, e.g. function1 - function(dataframename,componentname) {} ... function1(data2,component2) --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research Center MS 242-4 Moffett Field, CA 94035-1000 Office: 650-604-5896 Cell: 415-794-5043 AIM: jgrn307 MSN: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Matrix dimnames
R version : 2.4.0 O/S: Windows XP SP2 :-( How does one assign names to the columns of a matrix so that the columns can be accesses using the '$' operator? It seem that x$c1 below should return column 1. x = matrix(1:4,2) dimnames(x) = list(c(r1, r2), c(c1, c2)) x c1 c2 r1 1 3 r2 2 4 x$c1 NULL x$c2 NULL Daniel Gatti UNC-CH __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] strange algorithm needed
1+(0:16 %% 3) is a purely arithmetic solution Dimitris Rizopoulos wrote: probably you want to use the 'length' argument of rep(), e.g., rep(1:3, length = 17) I hope it helps. Best, Dimitris -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] problem with chooseCRANmirror()
I get this error when using chooseCRANmirror(). chooseCRANmirror() Error in open.connection(file, r) : unable to open connection In addition: Warning message: unable to connect to 'cran.r-project.org' on port 80. The TclTk window comes up and I can scroll and select a mirror, but it doesn't appear that I can connect properly. I am using RedHat Enterprise. I also can't connect to download the akima package install.packages(akima) --- Please select a CRAN mirror for use in this session --- Error in open.connection(file, r) : unable to open connection In addition: Warning message: unable to connect to 'cran.r-project.org' on port 80. Loading Tcl/Tk interface ... done Warning: unable to access index for repository http://www.biometrics.mtu.edu/CRAN/src/contrib Warning in download.packages(pkgs, destdir = tmpd, available = available, : no package 'akima' at the repositories I appreciate any direction that I can be given... Perry __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 went away from top emacs window :-(
I've recently updated to R 2.4 and have noticed that when I type ?help.on.something in ESS from within emacs, the old text help doesn't show up in the other (other being the horizontally split windows) window. Instead the windows chm help file pops up. Is there any way to get R to revert back to the old simple text based help in the top window help? I couldn't find anything on the ESS archives about this behavoir so I thought I post a message here rather than revert back to an older version of R for the time being... Thanks, Jeff. --- Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon 97339-1421 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Position of a specific letter in a character string
Dear useR, x is a character string In R: x- '32159_3' Which function could enable me to determine the position of underscore in x? In here, the underscore is on the 6th digit of x. --- Yours Sincerely Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Position of a specific letter in a character string
here's one way x - 1234_5 regexpr(_,x) [1] 5 attr(,match.length) [1] 1 so regexpr(_,x)[1] [1] 5 there's probably an easier way, but this works. tim On 11/2/06, Am Stat [EMAIL PROTECTED] wrote: Dear useR, x is a character string In R: x- '32159_3' Which function could enable me to determine the position of underscore in x? In here, the underscore is on the 6th digit of x. --- Yours Sincerely Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Tim Calkins 0406 753 997 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Position of a specific letter in a character string
Cool, thanks a lot! It works great! Best, Leon - Original Message - From: Tim Calkins To: Am Stat ; Sent: Wednesday, November 01, 2006 6:55 PM Subject: Re: [R] Position of a specific letter in a character string here's one way x - 1234_5 regexpr(_,x) [1] 5 attr(,match.length) [1] 1 so regexpr(_,x)[1] [1] 5 there's probably an easier way, but this works. tim On 11/2/06, Am Stat [EMAIL PROTECTED] wrote: Dear useR, x is a character string In R: x- '32159_3' Which function could enable me to determine the position of underscore in x? In here, the underscore is on the 6th digit of x. --- Yours Sincerely Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Tim Calkins 0406 753 997 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] axis labels title not visible
Dear all, I recently upgraded to R-2.4.0 and have had some difficulties with axis labels. When I create a plot on the X11 display, the labels (including the title) are not visible. However, if I execute the exact same command on the pdf display, the labels are printed. I've tried explicitly setting axes=TRUE, but the result is the same. I have also tried downgrading to 2.3.1 and that didn't help. This has to be something really obvious that I can't see for some reason. Any ideas? FYI, I am running this on Ubuntu 6.10 (Edgy Eft). Thanks! -Jay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Matrix dimnames
Daniel Gatti wrote: How does one assign names to the columns of a matrix so that the columns can be accesses using the '$' operator? It seem that x$c1 below should return column 1. x = matrix(1:4,2) dimnames(x) = list(c(r1, r2), c(c1, c2)) x c1 c2 r1 1 3 r2 2 4 x$c1 NULL x$c2 NULL Is this useful?-- x[,c1] r1 r2 1 2 I have only seen $ used with lists. A data frame is a kind of list, but a matrix isn't. From the R Reference Manual: The form [of indexing] using $ applies to recursive objects such as lists and pairlists. HTH Mike Prager Southeast Fisheries Science Center, NOAA Beaufort, North Carolina USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] read.fwf and header
[Martin Maechler] In my (and probably R-core's) view, read.fwf() should only have to be used for ``legacy data files'' (those times when people used *no* separators in order to save disk space), since nowadays, such data files should automatically have correct separators. In my day-to-day experience, the main virtue for fixed width format files is basic, humble legibility, much more than disk space savings. The FWF files I see have delimiters between fields, but also embedded space within fields, or at end of fields, without extraneous quotes. XML markup, CSVs, quoted fields, etc. are devices meant for helping machines much more than for helping humans. They significantly decrease legibility. Humans not only know better, they decipher fixed width format easily enough for not really needing hairier devices in general. FWF files may be archaic, they are not obsolescent. They will resist the fashion of the day for complexity, and survive in the long run. -- François Pinard http://pinard.progiciels-bpi.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Saving a function
Matt, patopatasfrias wrote: Hey, I'm a real novice... how do I go about saving a function that I created eg. If I created this function: Fun-function(x1,X2) {..}, how can I store it so that the next time I use R I can load it and not have to type it out again If you search the list archives, you may find a solution to this that I posted several months ago. It involves moving one's own functions to a dedicated directory, saving them in an R workspace in that directory, and then loading that workspace in the .Rprofile file. My method is a LOT simpler than making an R package but it is more complex than saving the functions with dput or otherwise in a file to be reloaded. Its advantage is that (like making a package) it makes the functions available to you even when you open R in a different directory. HTH Mike Prager Southeast Fisheries Science Center, NOAA Beaufort, North Carolina USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Res: graphics not find source
In ubuntu 6,06 the R normally run, but latter to install the a vesion 6,10 plot this not appearing. computer with problem: /usr/share/X11/fonts$ ls misc Type1 X11R7 In computer OK: /usr/share/X11/fonts$ls 100dpi(*) 75dpi encodings fonts.cache-1 misc Type1 - Mensagem original De: Peter Dalgaard [EMAIL PROTECTED] Para: Ricardo Arias Brito [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Enviadas: Quarta-feira, 1 de Novembro de 2006 18:29:14 Assunto: Re: [R] graphics not find source Ricardo Arias Brito [EMAIL PROTECTED] writes: Hi, The plot function not produces graphics in linux. The msg: Error in X11(): it was not possible to find no source X11 Verifity if the way of sources is correct. Any ideas? Hmm, maybe you shouldn't have tried to translate the message back to English I believe there is a similar message that has to do with _fonts_. If so, then the problem could be related to the font path or to locale issues. What happens if you do LC_ALL=C R ? It could be useful to know more about your system than linux. Which distribution and which version? Compiled yourself or installed from binaries? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ___ Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas ! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling an arbitrarily named data frame + variable
Try this: f - function(DF, vnam) { if (is.character(DF)) DF - get(DF) head(DF[[vnam]]) } f(iris, Species) f(iris, Species) On 11/1/06, Jonathan Greenberg [EMAIL PROTECTED] wrote: If I want to pass a data frame variable name and a specific component name of the data frame to a function, and I want the function to operate on this (e.g. Data frame = data1 and the component in question is component1, so I want the function to operate on data1$component1), how do I pass and call this info? This would be for an arbitrarily named data frame and component name, e.g. The function should also be able to handle it if I pass data2 and component2, e.g. function1 - function(dataframename,componentname) {} ... function1(data2,component2) --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research Center MS 242-4 Moffett Field, CA 94035-1000 Office: 650-604-5896 Cell: 415-794-5043 AIM: jgrn307 MSN: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Individual Based Model and/or Cellular automata
Hi R-gurus, Is there someone working with Individual-Based-Models (IBM) or Agent-Based-Models (ABM) with our withour Cellular Automata (CA) in R? I´m looking for develop some ecological applications, Kind regards, Miltinho Brazil - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] poly() question
Besides the primary citation, Kennedy, W. J. Jr and Gentle, J. E. (1980) Statistical Computing Marcel Dekker. (which is $300 and my library doesn't have it), is there any other documentation on how to take a poly() object and predict by hand new data? E.g. What do those coefficients actually mean (The orthogonal polynomial is summarized by the coefficients, which can be used to evaluate it via the three-term recursion...)? We created a GLM model with a poly() term and I'm trying to apply this model in another program (grass gis via mapcalc) without requiring the direct link with R if at all possible. We'd like to avoid making a lookup table if at all possible. Thanks! --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research Center MS 242-4 Moffett Field, CA 94035-1000 Office: 650-604-5896 Cell: 415-794-5043 AIM: jgrn307 MSN: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help went away from top emacs window :-(
This is a change in the default in the Windows version of R in 2.4.0. It is not an ESS issue. To change it back, type options(chmhelp=FALSE) Duncan, I think this change in Help default should be added to the Windows FAQ. Rich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Compare linear regressios for significant differences of the slopes
Hi I have (8 measures * 96 groups) = 768 datasets for which I did linear regressions using lm(). Now I want to compare the slopes for each of the 8 measures in each of the 96 groups. As I understand , I can not use anova(lm1, ..., lm8) as the lm1 ... lm8 are based on different datasets. I also read in previous discussions in this list, that I can see if the slope +- stddev(slope) overlap, but this seems a long process for the huge number of comparisons. Therefore my question: is there a way to compare the slopes of lm() which are based on different datasets and what is the easiest way to do it for this large number of datasets? Thanks in advance for your help, Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] subsetting, aggregating and zoo
Dear Gabor, The solution below was very useful for me, but I have, I hope, one last question about extracting some specific data. How to count , from below, the number of times a date is repeated, that is: starts [1] 1988-01-13 1988-01-13 1988-01-16 1988-01-20 1988-01-20 [6] 1988-01-20 1988-01-25 1988-01-25 1988-01-25 1988-01-25 dput(starts[1:10], control = all) structure(c(6586, 6586, 6589, 6593, 6593, 6593, 6598, 6598, 6598, 6598), class = Date) So I need to know how many times, for example, 1988-01-03 is repeated (in this case, 2 times) Can't find what function to use. Best regards, Antonio Gabor Grothendieck escribió: Sorry, the line starting idx - should have time(z) in place of z. That is, year - as.Date(c( 1988-01-13, 1988-01-14, 1988-01-16, 1988-01-20, 1988-01-21, 1988-01-22, 1988-01-25, 1988-01-26, 1988-01-27, 1988-01-28)) x - c( 7.973946, 9.933518, 7.978227, 7.512960, 6.641862, 5.667780, 5.721358, 6.863729, 9.60, 9.049846) z - zoo(x, year) idx - cumsum(c(1, diff(time(z)) != 1)) starts - time(z)[match(idx, idx)] ends - time(z)[cumsum(table(idx))[idx]] aggregate(z, starts, mean) By the way, dput(v, control = all) will output variable v in a form easily pastable by someone else into their session. On 10/29/06, antonio rodriguez [EMAIL PROTECTED] wrote: Gabor Grothendieck escribió: Try this: # test data x - c(1:4, 6:8, 10:14) z - zoo(x, as.Date(x)) # idx is 1 for first run, 2 for second run, etc. idx - cumsum(c(1, diff(z) != 1)) # starts replaces each time with the start time of that run # ends is similar but for ends starts - time(z)[match(idx, idx)] ends - time(z)[cumsum(table(idx))[idx]] # average over each run using the time of the end of run for the result # replace ends with starts if that is preferred aggregate(z, ends, mean) Yes it's OK in your example, but when I try to do it with my data I don't get the same figure. is.zoo(z) [1]TRUE atributes(z) $index [1] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 .. [3861] 2005-12-20 2005-12-23 2005-12-24 2005-12-25 2005-12-26 [3866] 2005-12-27 2005-12-30 $class [1] zoo z[1:10] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 1988-01-22 1988-01-25 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 1988-01-26 1988-01-27 1988-01-28 6.863729 9.60 9.049846 If I follow your instructions, idx - cumsum(c(1, diff(z) != 1)) starts - time(z)[match(idx, idx)] ends - time(z)[cumsum(table(idx))[idx]] s1 - aggregate(z, starts, mean) s1[1:10] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 1988-01-22 1988-01-25 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 1988-01-26 1988-01-27 1988-01-28 6.863729 9.60 9.049846 s2 - aggregate(z, starts, mean) s2[1:10] 1988-01-13 1988-01-14 1988-01-16 1988-01-20 1988-01-21 1988-01-22 1988-01-25 7.973946 9.933518 7.978227 7.512960 6.641862 5.667780 5.721358 1988-01-26 1988-01-27 1988-01-28 6.863729 9.60 9.049846 Always the same. Don't know why (there are not NA's in the series) Antonio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.