Re: [R] Using dll with Visual Studio Compiler
On Tue, 12 Jun 2007, Ian McCarthy wrote: Hi, I have created a dll in Fortran and used the Visual Studio 2005 Compiler. I've read that certain problems can arise based on the Since Visual Studio does not create Fortran, that's a bit vague. And let us assume you are on Win32, but you failed to say. compiler used and that these problems can sometimes cause R not to be able to access everything appropriately, but I've not found how to fix any of these problems. Specifically, after using dyn.load, I know the dll has been loaded because it is listed in getLoadedDLLs(), but when I try is.loaded(subroutine name), it returns FALSE. I saw that this was mentioned in the manual, but it too offers little help for a solution. 'The manual'? If you mean an R manual, it offers a lot more details than you are giving us to go on. Try using VS or pedump to see what is exported from your DLL under what names. (pedump is in the R tools kit as well as elsewhere.) Any advice would be greatly appreciated. Cheers, Ian McCarthy Department of Economics Indiana University 100 S. Woodlawn Bloomington, IN 47405-7104 http://mypage.iu.edu/~imccarthhttp://mypage.iu.edu/~imccarth [EMAIL PROTECTED]mailto:[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. -- 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] passing (or obtaining) index or element name of list to FUN in lapply()
Hello everyone, I wonder if there is a way to pass the index or name of a list to a user-specified function in lapply(). For instance, my desired effect is something like the output of L - list(jack=4098,sape=4139) lapply(seq(along=L),function(i,x) if(i==1) jack else sape,x=L) [[1]] [1] jack [[2]] [1] sape lapply(seq(along=L),function(i,x) if(names(x)[i]==jack) 1 else 2,x=L) [[1]] [1] 1 [[2]] [1] 2 But by passing L as the first argument of lapply(). I thought there was a tangentially-related post on this mailing list in the past but I don't recall that it was ever addressed directly (and I can't seem to find it now). The examples above are perfectly good alternatives especially if I wrap each of the lines in names-() to return lists with appropriate names assigned, but it feels like I am essentially writing a FOR-LOOP - though I was surprised to find that speed-wise, it doesn't seem to make much of a difference (unless I have not selected a rigorous test): N - 1 y - runif(N) ## looping through elements of y system.time(lapply(y, +function(x) { + set.seed(222) + mean(rnorm(1e4,x,1)) +})) [1] 21.00 0.17 21.29NANA ## looping through indices system.time(lapply(1:N, +function(x,y) { + set.seed(222) + mean(rnorm(1e4,y[x],1)) + },y=y)) [1] 21.09 0.14 21.26NANA In Python, there are methods for Lists and Dictionaries called enumerate(), and iteritems(), respectively. Example applications: ## a list L = ['a','b','c'] [x for x in enumerate(L)] ## returns index of list along with the list element [(0, 'a'), (1, 'b'), (2, 'c')] ## a dictionary D = {'jack': 4098, 'sape': 4139} [x for x in D.iteritems()] ## returns element key (name) along with element contents [('sape', 4139), ('jack', 4098)] And this is something of the effect I was looking for... Thanks to all, Stephen __ 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] PCA for Binary data
On Tue, 12 Jun 2007, Spencer Graves wrote: The problem with applying prcomp to binary data is that it's not clear what problem you are solving. The standard principal components and factor analysis models assume that the observations are linear combinations of unobserved common factors (shared variability), normally distributed, plus normal noise, independent between observations and variables. Those assumptions are clearly violated for binary data. RSiteSearch(PCA for binary data) produced references to 'ade4' and 'FactoMineR'. Have you considered these? I have not used them, but FactoMineR included functions for 'Multiple Factor Analysis for Mixed [quantitative and qualitative] Data' AFAIK, that is not using 'factor analysis' in the same sense as e.g. factanal(). Continuous underlying variables with binary manifest variables is part of latent variable analysis. Package 'ltm' covers a variety of such models. But to begin to give advice we would need to know the scientific problem for which Ranga Chandra Gudivada is looking for a tool. Simon Blomberg mentioned ordination, but that is only one of several classes of uses of PCA (which finds a linear subspace that both has maximal variance within and is least-squares fitting to the data). Hope this helps. Spencer Graves Josh Gilbert wrote: I don't understand, what's wrong with using prcomp in this situation? On Sunday 10 June 2007 12:50 pm, Ranga Chandra Gudivada wrote: Hi, I was wondering whether there is any package implementing Principal Component Analysis for Binary data Thanks chandra - [[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. -- 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] Viewing a data object
Hi Horace, I have also thought that it may be useful but I don't know of any Object Explorer available for R. However, (you may alread know this but) (1) you can view your list of objects in R with objects(), (2) view objects in a spreadsheet-like table (if they are matrices or data frames) with invisible(edit(objectName)) [which isn't easy on the fingers]. fix(objectName) is also a shorter option but it has the side effect of possibly changing your object when you close the viewing data. For instance, this can happen if you mistakenly type something into a cell; it can also change your column classes when you don't - for example: options(stringsAsFactors=TRUE) x - data.frame(letters[1:5],1:5) sapply(x,class) letters.1.5. X1.5 factorinteger fix(x) # no user-changes made sapply(x,class) letters.1.5. X1.5 factornumeric (3) I believe Deepayan Sarkar contributed the tab-completion capability at the command line. So unless you have a lot of objects beginning with 'AuroraStoch...' you should be able to type a few letters and let the auto-completion handle the rest. Best regards, ST --- Horace Tso [EMAIL PROTECTED] wrote: Dear list, First apologize that this is trivial and just betrays my slothfulness at the keyboard. I'm sick of having to type a long name just to get a glimpse of something. For example, if my data frame is named 'AuroraStochasticRunsJune1.df and I want to see what the middle looks like, I have to type AuroraStochasticRunsJune1.df[ 400:500, ] And often I'm not even sure rows 400 to 500 are what I want to see. I might have to type the same line many times. Is there sort of a R-equivalence of the Object Explorer, like in Splus, where I could mouse-click an object in a list and a window pops up? Short of that, is there any trick of saving a couple of keystrokes here and there? Thanks for tolerating this kind of annoying questions. H. __ 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. Sucker-punch spam with award-winning protection. __ 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] if statement
Hi all, I have a rather naive question. I have the height of 100 individuals in a table and I want to assign the tallest 30% as Case=1 and the bottom 30% as Case=0. How do I do that? thanks. jiong The email message (and any attachments) is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message (and any attachments). Thank You. [[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] Panel data
Dear all R users, I have a small doubt about panel data analysis. My basic understanding on Panel data is a type of data that is collected over time and subjects. Vector Autoregressive Model (VAR) model used on this type of data. Therefore can I say that, one of statistical tools used for analysis of panel data is VAR model? If you clarify my doubt I will be very grateful. Thanks and regards, Megh Looking for earth-friendly autos? Browse Top Cars by Green Rating at Yahoo! Autos' Green Center. [[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] Trouble making JRI.jar with Ubuntu and Java6
Hi, Forum newb here, looking for some help. Have been trying to install an R-Java interface to make R calls from Java. JRI's configure script runs fine, but when it comes to make, I get the error: too few arguments to function 'R_ParseVector' Java runs fine. R runs fine. But I can't get this .jar file created. grumble Any help would be appreciated immensely, Taivo Ubuntu FeistyFawn, java-6-sun-1.6.0.00, R 2.5 p.s. Here's the screen output: make -C src JRI.jar make[1]: Entering directory `/home/taivo/coop_summer2007/r/JRI/src' gcc -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include/linux -fPIC -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include -I/usr/share/R/include Rengine.c: In function ‘Java_org_rosuda_JRI_Rengine_rniParse’: Rengine.c:92: error: too few arguments to function ‘R_ParseVector’ make[1]: *** [Rengine.o] Error 1 make[1]: Leaving directory `/home/taivo/coop_summer2007/r/JRI/src' make: *** [src/JRI.jar] Error 2 -- View this message in context: http://www.nabble.com/Trouble-making-JRI.jar-with-Ubuntu-and-Java6-tf3909057.html#a11083776 Sent from the R help mailing list archive at Nabble.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] PCA for Binary data
Dear Prof Brian Ripley, Would you also recommend some packages for non-binary data to do variable and feature selection? Thanks a lot! Alex On 6/12/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Tue, 12 Jun 2007, Spencer Graves wrote: The problem with applying prcomp to binary data is that it's not clear what problem you are solving. The standard principal components and factor analysis models assume that the observations are linear combinations of unobserved common factors (shared variability), normally distributed, plus normal noise, independent between observations and variables. Those assumptions are clearly violated for binary data. RSiteSearch(PCA for binary data) produced references to 'ade4' and 'FactoMineR'. Have you considered these? I have not used them, but FactoMineR included functions for 'Multiple Factor Analysis for Mixed [quantitative and qualitative] Data' AFAIK, that is not using 'factor analysis' in the same sense as e.g. factanal(). Continuous underlying variables with binary manifest variables is part of latent variable analysis. Package 'ltm' covers a variety of such models. But to begin to give advice we would need to know the scientific problem for which Ranga Chandra Gudivada is looking for a tool. Simon Blomberg mentioned ordination, but that is only one of several classes of uses of PCA (which finds a linear subspace that both has maximal variance within and is least-squares fitting to the data). Hope this helps. Spencer Graves Josh Gilbert wrote: I don't understand, what's wrong with using prcomp in this situation? On Sunday 10 June 2007 12:50 pm, Ranga Chandra Gudivada wrote: Hi, I was wondering whether there is any package implementing Principal Component Analysis for Binary data Thanks chandra - [[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. -- 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. [[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] if statement
My solutions are usually too baroque, but does this do what you want? x - rnorm(100) quants - quantile(x, c(.3, .7)) Case - rep(2, length(x)) # 2 lies in the middle of the distribution Case[x = quants[1]] - 0 Case[x = quants[2]] - 1 Case Cheers, Simon. On Mon, 2007-06-11 at 15:14 -0700, Jiong Zhang, PhD wrote: Hi all, I have a rather naive question. I have the height of 100 individuals in a table and I want to assign the tallest 30% as Case=1 and the bottom 30% as Case=0. How do I do that? thanks. jiong The email message (and any attachments) is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message (and any attachments). Thank You. [[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. -- Simon Blomberg, BSc (Hons), PhD, MAppStat. Lecturer and Consultant Statistician Faculty of Biological and Chemical Sciences The University of Queensland St. Lucia Queensland 4072 Australia Room 320, Goddard Building (8) T: +61 7 3365 2506 email: S.Blomberg1_at_uq.edu.au The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ 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] Confusion with sapply
Hi, I have some confusion in applying a function over a column. Here's my function. I just need to shift non-March month-ends to March month-ends. Initially I tried seq.dates, but one cannot give a negative increment (decrement) here. return(as.Date(seq.dates(format(xdate,%m/%d/%Y),by=months,len=4)[4]) ) Hence this simple function: mydate - as.Date(2006-01-01) # Function to shift non-March company-reporting dates to March. Set2March - function(xdate){ + # Combines non-March months into March months: + # Dec2006 - Mar2007 + # Mar2006 - Mar2006 + # Jun2006 - Mar2006 + # Sep2006 - Mar2006 + # VERY Specific code. + Month - format(xdate,%m) + wDate - month.day.year(julian(xdate)) + if (Month==12){ + wDate$year - wDate$year + 1 + wDate$month - 3 + }else + if (Month==06){ + wDate$month - 3 + }else + if (Month==09){ + wDate$month - 3 + wDate$day - wDate$day + 1 + }else warning (No Changes made to the month, since month is not one of (6,9,12)) + cDate - chron(paste(wDate$month,wDate$day,wDate$year,sep=/)) + return(as.Date(as.yearmon(as.Date(cDate,%m/%d/%y)),frac=1)) + } Set2March(as.Date(2006-06-30)) [1] 2006-03-31 Set2March(mydate) [1] 2006-01-31 Warning message: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(mydate) Works well when I use it on a single date. Then I try it on a vector: dc - seq(as.Date(2006-01-01),len=10, by=month) dc [1] 2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 [9] 2006-09-01 2006-10-01 sapply(as.vector(dc),Set2March) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : unimplemented type 'character' in 'asLogical' What am I missing here? Shouldn't the function work with the sapply working on each entry? TIA and best, -Tir __ 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] if statement
Simon Blomberg s.blomberg1 at uq.edu.au writes: My solutions are usually too baroque, but does this do what you want? x - rnorm(100) quants - quantile(x, c(.3, .7)) Case - rep(2, length(x)) # 2 lies in the middle of the distribution Case[x = quants[1]] - 0 Case[x = quants[2]] - 1 Case On Mon, 2007-06-11 at 15:14 -0700, Jiong Zhang, PhD wrote: Hi all, I have a rather naive question. I have the height of 100 individuals in a table and I want to assign the tallest 30% as Case=1 and the bottom 30% as Case=0. How do I do that? Or, how about, x - rnorm(100) Case - cut(x, quantile(x, c(0, 0.3, 0.7, 1)), c(0, 2, 1), TRUE) ken -- Ken Knoblauch Inserm U846 Institut Cellule Souche et Cerveau Département Neurosciences Intégratives 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.pizzerialesgemeaux.com/u846/ __ 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] passing (or obtaining) index or element name of list to FUN in lapply()
On Tue, 12 Jun 2007, Stephen Tucker wrote: Hello everyone, I wonder if there is a way to pass the index or name of a list to a user-specified function in lapply(). For instance, my desired effect is something like the output of L - list(jack=4098,sape=4139) lapply(seq(along=L),function(i,x) if(i==1) jack else sape,x=L) [[1]] [1] jack [[2]] [1] sape as.list(names(L)) lapply(seq(along=L),function(i,x) if(names(x)[i]==jack) 1 else 2,x=L) [[1]] [1] 1 [[2]] [1] 2 as.list(seq_along(L)) lapply() can be faster than a for-loop, but usually not by much: its main advantage is clarity of code. I think we need a real-life example to see what you are trying to do. But by passing L as the first argument of lapply(). I thought there was a tangentially-related post on this mailing list in the past but I don't recall that it was ever addressed directly (and I can't seem to find it now). The examples above are perfectly good alternatives especially if I wrap each of the lines in names-() to return lists with appropriate names assigned, but Try something like L[] - lapply(seq_along(L),function(i,x) if(i==1) jack else sape,x=L) it feels like I am essentially writing a FOR-LOOP - though I was surprised to find that speed-wise, it doesn't seem to make much of a difference (unless I have not selected a rigorous test): N - 1 y - runif(N) ## looping through elements of y system.time(lapply(y, +function(x) { + set.seed(222) + mean(rnorm(1e4,x,1)) +})) [1] 21.00 0.17 21.29NANA ## looping through indices system.time(lapply(1:N, +function(x,y) { + set.seed(222) + mean(rnorm(1e4,y[x],1)) + },y=y)) [1] 21.09 0.14 21.26NANA In Python, there are methods for Lists and Dictionaries called enumerate(), and iteritems(), respectively. Example applications: ## a list L = ['a','b','c'] [x for x in enumerate(L)] ## returns index of list along with the list element [(0, 'a'), (1, 'b'), (2, 'c')] ## a dictionary D = {'jack': 4098, 'sape': 4139} [x for x in D.iteritems()] ## returns element key (name) along with element contents [('sape', 4139), ('jack', 4098)] And this is something of the effect I was looking for... Thanks to all, Stephen __ 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] extractor rows from a matrix
hi! i have a little problem: my data's matrix has 1093 rows and 3 columns. i'd like to extract each rows.. something like this: ht= my matrix Dt=(???)=a vector with t=1,2...1093 what can i do? thank you! Vincenzo -- View this message in context: http://www.nabble.com/extractor-rows-from-a-matrix-tf3913088.html#a11094459 Sent from the R help mailing list archive at Nabble.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.
[R] export to a dat file that SAS can read
Hello i have a data frame in R that some SAS users need to use in their programs, and they want it in a dat file, is that possible? and which functions to use for that? my data frame is like this: out13[1:100,] faridniveau1 niveau3 p1p3 antal1 210007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 3 910076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 3 10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 6 13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 19 16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 4 17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 2 18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 6 22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 16 28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 4 29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 4 36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 4 42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 5 Thanks Rina [[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] export to a dat file that SAS can read
Rina Miehs wrote: Hello i have a data frame in R that some SAS users need to use in their programs, and they want it in a dat file, is that possible? What is a dat file? and which functions to use for that? I *guess* write.table() will do the trick, given dat is what I guess it is... Uwe Ligges my data frame is like this: out13[1:100,] faridniveau1 niveau3 p1p3 antal1 210007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 3 910076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 3 10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 6 13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 19 16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 4 17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 2 18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 6 22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 16 28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 4 29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 4 36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 4 42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 5 Thanks Rina [[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] export to a dat file that SAS can read
One solution: Use 'write.csv' (or write.csv2) in R to output a csv file. Then import it in SAS (by default, it imports into the work library; then you need to copy into another libray to have the SAS file). Christophe On 6/13/07, Rina Miehs [EMAIL PROTECTED] wrote: Hello i have a data frame in R that some SAS users need to use in their programs, and they want it in a dat file, is that possible? and which functions to use for that? my data frame is like this: out13[1:100,] faridniveau1 niveau3 p1p3 antal1 210007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 3 910076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 3 10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 6 13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 19 16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 4 17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 2 18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 6 22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 16 28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 4 29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 4 36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 4 42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 5 Thanks Rina [[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. -- Christophe Pallier (http://www.pallier.org) [[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] extractor rows from a matrix
billycorg wrote: hi! i have a little problem: my data's matrix has 1093 rows and 3 columns. i'd like to extract each rows.. something like this: ht= my matrix Dt=(???)=a vector with t=1,2...1093 A vector with t=1,2, ..., 1093 and 3 columns is the matrix itself, isn't it? If you want to extract a row from a matrix and you do not know how: Please read the posting guide before posting and do what it says! Particularly: Please read An Introduction to R! Uwe Ligges what can i do? thank you! Vincenzo __ 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] Design library installation problem
Ian Watson wrote: Dear Listers I have tried to install Frank Harrell's two libaries: Hmisc and Design. I found that Hmisc was listed in the list of packages from the Install Packages command on the Packages menu, but Design was not. I installed Hmisc from this list, and when I issued the library(Hmisc) command, it loaded into memory correctly. I then copied the Design 1.1-1.zip file from the http://lib.stat.cmu.edu/S/Harrell/library/r/ site and used the Install Packages from Local Zip file command. I received no error messages and a visual inspection of the R\library directory shows Design has been installed. However, when I issued the library(Design) command I get the following error message: Error in library(Design) : 'Design' is not a valid package -- installed 2.0.0? I also notice, from a visual inspection of the R\library\Design\R directory that there is only one file: design. In other directories, eg. R\library\Hmisc\R there are usually 3 files: Hmisc Hmisc.rdx Hmisc.rdb I am new to R, and a bit lost. I have read the R-admin.pdf documentation on packages but am still unsure how to proceed from here. I would appreciate any advice, and any answers to the following questions: 1) is there a reason why Design is not listed in the Install Packages list as Hmisc is? Yes. The current version does not pass the checks under Windows. Please convince the maintainer to fix the package, and a binary will be made available shortly. 2) have I done the correct thing by way of manual installation of Design? Not quite: If you want to install a binary package, it must fit to your OS *and* to your version of R. The file you used is for an ancient version of R (given its date!). 3) is the absence of 2 other Design files (rdx, rdb) the reason for my failed installation? More or less, see 2. 4) what should I try now? See 1 or install Design from sources. Attention: it will probably still fail its checks. CCing to maintainer and author of Design, since the becomes a frequently asked questions (and nobody checks the mailing list archive before posting, obviously). Uwe Ligges I am using R.2.5.0 on Windows XP. Kind regards Ian __ 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] Cause of error message in cov function?
Matthew Keller wrote: Hi all, I have written a script in R that simulates genetically informative data - it is posted on my website and available to the public. This is my first time to write a script for use by others and am learning that it isn't as easy as it seems. To the issue. My script runs fine on my machine and on a server I have access to, but a user has written me saying that it crashes the first time the function cov is called up. Below is her error message followed by the version of R she's using. Can anyone help me out here? I can't recreate her error message. Does anyone know what this might have to do with? Is it a version issue (she's using R 2.1)? I'd appreciate any help!! It may be a version issue, but hard to say since we do not know what effects.cur() is, not do we have any data to reproduce this. Uwe Ligges Matt ERROR MESSAGE: cov.varcomp - cov(t(effects.cur[c(A,AA,D,F,S,E,AGE,AGE.by.A),]*beta2)) there is an argument mssing. error message: Error in mean((a - mean(a)) * (b - mean(b))) : argument b is missing, with no default SPECIFICS OF HER MACHINE: memory.size() [1] 10985480 R.Version() $platform [1] i386-pc-mingw32 $arch [1] i386 $os [1] mingw32 $system [1] i386, mingw32 $status [1] $major [1] 2 $minor [1] 1.0 $year [1] 2005 $month [1] 04 $day [1] 18 $language [1] R .Platform $OS.type [1] windows $file.sep [1] / $dynlib.ext [1] .dll $GUI [1] Rgui $endian [1] little $pkgType [1] win.binary __ 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 Windows-like .INI files into R data structure?
One more question, inspired by this one, just to increase my R skill level. Earl F. Glynn wrote: I need to process some datasets where the configuration information was stored in .INI-like files, i.e., text files with sections like this: [Section1] var1=value1 var2=value2 [Section2] A=value3 B=value4 var1=value1, A=value3 is almost pure R code. Is it possible to use this feature to solve the problem? That is, something like eval(as.expression(A=value3)) and assign (store) the result in lst$Section2 environment. lst is a newly created list, containing the contents of the file being processed. -- View this message in context: http://www.nabble.com/Read-Windows-like-.INI-files-into-R-data-structure--tf3908740.html#a11094865 Sent from the R help mailing list archive at Nabble.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] Trouble making JRI.jar with Ubuntu and Java6
You have a version mismatch. You haven't told us your version of JRI, but it is not recent enough for R 2.5.0. Also, you told us you are using java-6-sun-1.6.0.00, but the commands you show indicate otherwise. On Tue, 12 Jun 2007, taivo wrote: Hi, Forum newb here, looking for some help. Have been trying to install an R-Java interface to make R calls from Java. JRI's configure script runs fine, but when it comes to make, I get the error: too few arguments to function 'R_ParseVector' Java runs fine. R runs fine. But I can't get this .jar file created. grumble Any help would be appreciated immensely, Taivo Ubuntu FeistyFawn, java-6-sun-1.6.0.00, R 2.5 p.s. Here's the screen output: make -C src JRI.jar make[1]: Entering directory `/home/taivo/coop_summer2007/r/JRI/src' gcc -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include/linux -fPIC -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include -I/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include -I/usr/share/R/include Rengine.c: In function ÿÿJava_org_rosuda_JRI_Rengine_rniParseÿÿ: Rengine.c:92: error: too few arguments to function ÿÿR_ParseVectorÿÿ make[1]: *** [Rengine.o] Error 1 make[1]: Leaving directory `/home/taivo/coop_summer2007/r/JRI/src' make: *** [src/JRI.jar] Error 2 -- 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] Fitted value
I would like to fit a Pareto Distribution and I am using the following codes. I thought the fitted (fit1) should be the fitted value for the data, is it correct? As the result of the fitted turns out to be a single value for all. fit=vglm(ycf1 ~ 1, pareto1(location=alpha), trace=TRUE, crit=c) coef(fit, matrix=TRUE) summary(fit) fitted(fit) Could anybody give me some advice? -- View this message in context: http://www.nabble.com/Fitted-value-tf3913388.html#a11095344 Sent from the R help mailing list archive at Nabble.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] Confusion with sapply
Patnaik, Tirthankar wrote: Hi, I have some confusion in applying a function over a column. Here's my function. I just need to shift non-March month-ends to March month-ends. Initially I tried seq.dates, but one cannot give a negative increment (decrement) here. return(as.Date(seq.dates(format(xdate,%m/%d/%Y),by=months,len=4)[4]) ) Hence this simple function: mydate - as.Date(2006-01-01) # Function to shift non-March company-reporting dates to March. Set2March - function(xdate){ + # Combines non-March months into March months: + # Dec2006 - Mar2007 + # Mar2006 - Mar2006 + # Jun2006 - Mar2006 + # Sep2006 - Mar2006 + # VERY Specific code. + Month - format(xdate,%m) + wDate - month.day.year(julian(xdate)) + if (Month==12){ + wDate$year - wDate$year + 1 + wDate$month - 3 + }else + if (Month==06){ + wDate$month - 3 + }else + if (Month==09){ + wDate$month - 3 + wDate$day - wDate$day + 1 + }else warning (No Changes made to the month, since month is not one of (6,9,12)) + cDate - chron(paste(wDate$month,wDate$day,wDate$year,sep=/)) + return(as.Date(as.yearmon(as.Date(cDate,%m/%d/%y)),frac=1)) + } Set2March(as.Date(2006-06-30)) [1] 2006-03-31 Set2March(mydate) [1] 2006-01-31 Warning message: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(mydate) Works well when I use it on a single date. Then I try it on a vector: dc - seq(as.Date(2006-01-01),len=10, by=month) dc [1] 2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 [9] 2006-09-01 2006-10-01 sapply(as.vector(dc),Set2March) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : unimplemented type 'character' in 'asLogical' What am I missing here? Shouldn't the function work with the sapply working on each entry? 1. Your code is not reproducible. Which packages are required? chron? But then, I still do not have as.yearmon()! 2. Why do you use as.vector() in the sapply call? I doubt it can work that way, because as.vector strips the attributes! Uwe Ligges TIA and best, -Tir __ 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] Awk and Vilno
On 13-Jun-07 01:24:41, Robert Wilkins wrote: In clinical trial data preparation and many other data situations, the statistical programmer needs to merge and re-merge multiple input files countless times. A syntax for merging files that is clear and concise is very important for the statistical programmer's productivity. Here is how Vilno does it: inlist dataset1 dataset2 dataset3 ; joinby variable1 variable2 where ( var3=var4 ) ; [...] Thanks to Robert for this more explicit illustration of what Vilno does. Its potential usefulness is clear. I broadly agree with the comments that have been made about the various approaches (with/without awk/sed/R etc). Is there any URL that leads to a fuller explicit exposition of Vilno? As I said previously, a web-search on vilno leads to very little that is relevant. What I did find didn't amount to much. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 13-Jun-07 Time: 10:00:12 -- XFMail -- __ 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] Linux equivalent to windows menus and script window
JGR is pretty close to the windows R-GUI (with the menus) but even better since it is system independent and e.g. has syntax highlightning in the editor. You could have a look at the screenshots at http://rosuda.org/JGR/index.htm What you need is a Java 5 SDK installed at the system and probably R has to be reconfigured to find java. Stefan John, on Tuesday 12 June 2007 23:53:07 you wrote: JS Stefan, JS Am I correct that neither option will provide the menu options provided under windows, i.e. the MISC, PACKANGE, or WINDOWS menus? JS Thanks, JS John __ 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] Confusion with sapply
On 6/13/07, Patnaik, Tirthankar [EMAIL PROTECTED] wrote: Hi, I have some confusion in applying a function over a column. Here's my function. I just need to shift non-March month-ends to March month-ends. Initially I tried seq.dates, but one cannot give a negative increment (decrement) here. return(as.Date(seq.dates(format(xdate,%m/%d/%Y),by=months,len=4)[4]) ) Hence this simple function: mydate - as.Date(2006-01-01) # Function to shift non-March company-reporting dates to March. Set2March - function(xdate){ + # Combines non-March months into March months: + # Dec2006 - Mar2007 + # Mar2006 - Mar2006 + # Jun2006 - Mar2006 + # Sep2006 - Mar2006 + # VERY Specific code. + Month - format(xdate,%m) + wDate - month.day.year(julian(xdate)) + if (Month==12){ + wDate$year - wDate$year + 1 + wDate$month - 3 + }else + if (Month==06){ + wDate$month - 3 + }else + if (Month==09){ + wDate$month - 3 + wDate$day - wDate$day + 1 + }else warning (No Changes made to the month, since month is not one of (6,9,12)) + cDate - chron(paste(wDate$month,wDate$day,wDate$year,sep=/)) + return(as.Date(as.yearmon(as.Date(cDate,%m/%d/%y)),frac=1)) + } Set2March(as.Date(2006-06-30)) [1] 2006-03-31 Set2March(mydate) [1] 2006-01-31 Warning message: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(mydate) Works well when I use it on a single date. Then I try it on a vector: dc - seq(as.Date(2006-01-01),len=10, by=month) dc [1] 2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 [9] 2006-09-01 2006-10-01 sapply(as.vector(dc),Set2March) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : unimplemented type 'character' in 'asLogical' What am I missing here? Shouldn't the function work with the sapply working on each entry? You can considerable simplify your code with some helper functions: month - function(x) as.POSIXlt(x)$mon + 1 month- - function(x, value) { ISOdatetime(year(x) + (value - 1) %/% 12, (value - 1) %% 12 + 1 , mday(x), hour(x), minute(x), second(x), tz(x)) } year - function(x) as.POSIXlt(x)$year + 1900 year- - function(x, value) { ISOdatetime(value, month(x), mday(x), hour(x), minute(x), second(x), tz(x)) } marchise - function(x) { if (month(x) == 12) year(x) - year(x) if (month(x) %in% c(6, 9, 12)) month(x) - 3 x } dc - seq(as.Date(2006-01-01),len=10, by=month) marchise(dc[[1]]) However, that doesn't work with sapply because the date class seems to get stripped off - I'm not completely why, but perhaps because the date class is a property of the entire vector not the individual values: sapply(marchise, dc) 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.
[R] Subscription
I would like to subscribe and get free software for statistical analysis. Lucy ___ now. __ 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 Windows-like .INI files into R data structure?
var1=value1, A=value3 is almost pure R code. Is it possible to use this feature to solve the problem? Along the same lines: you may write a short script that converts the ini file into R code that can be sourced. From your example, you can generate the following R code: Section1 - list() Section1['var1'] - value1 Section1['var2'] - value2 Section2 - list() Section2['A'] - value3 Section2['B'] - value4 with the following awk script (using awk -F'=' -f conv.awk example.ini example.R) ### conv.awk $1 ~ /\[/ { gsub(/[\[\]]/,); # remove the brackets listname = $1; print $1 - list(); next } { print listname [' $1 '] - $2 } (I know, it looks cryptic... so I am shooting myself in the foot after claiming that awk scripts are typically quite readable ;-) -- Christophe Pallier (http://www.pallier.org) [[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] Read Windows-like .INI files into R data structure?
Christophe Pallier wrote: var1=value1, A=value3 is almost pure R code. Is it possible to use this feature to solve the problem? Along the same lines: you may write a short script that converts the ini file into R code that can be sourced. From your example, you can generate the following R code: Section1 - list() Section1['var1'] - value1 Section1['var2'] - value2 Section2 - list() Section2['A'] - value3 Section2['B'] - value4 with the following awk script (using awk -F'=' -f conv.awk example.ini example.R) ### conv.awk $1 ~ /\[/ { gsub(/[\[\]]/,); # remove the brackets listname = $1; print $1 - list(); next } { print listname [' $1 '] - $2 } (I know, it looks cryptic... so I am shooting myself in the foot after claiming that awk scripts are typically quite readable ;-) Christophe Pallier (http://www.pallier.org) It's sufficiently readable, but using something besides R is not sporty. ;) -- View this message in context: http://www.nabble.com/Read-Windows-like-.INI-files-into-R-data-structure--tf3908740.html#a11095800 Sent from the R help mailing list archive at Nabble.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.
[R] equivalent of windialog on unix??
I have on a script something like this toto = winDialog(yesno, Do you want to install the package) if (toto==YES){ but it dont work on unix because of the winDialog i think.. how can i do to change this for unix please? best regards vincent [[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] Read Windows-like .INI files into R data structure?
Vladimir Eremeev wrote: Christophe Pallier wrote: var1=value1, A=value3 is almost pure R code. Is it possible to use this feature to solve the problem? Along the same lines: you may write a short script that converts the ini file into R code that can be sourced. From your example, you can generate the following R code: Section1 - list() Section1['var1'] - value1 Section1['var2'] - value2 Section2 - list() Section2['A'] - value3 Section2['B'] - value4 with the following awk script (using awk -F'=' -f conv.awk example.ini example.R) ### conv.awk $1 ~ /\[/ { gsub(/[\[\]]/,); # remove the brackets listname = $1; print $1 - list(); next } { print listname [' $1 '] - $2 } (I know, it looks cryptic... so I am shooting myself in the foot after claiming that awk scripts are typically quite readable ;-) Christophe Pallier (http://www.pallier.org) It's sufficiently readable, but using something besides R is not sporty. ;) OK, I try to be sporty, at least that is what my family doctor asks me to do all the time ;-) Certainly there is much space for improvements... X - readLines(file) value1 - 1 value2 - 2 value3 - 3 value4 - 4 sections - grep(^\\[.*\\]$, X) starts - sections + 1 ends - c(sections[-1] - 1, length(X)) L - vector(mode=list, length=length(sections)) names(L) - gsub(\\[|\\], , X[sections]) for(i in seq(along = sections)){ env - new.env() eval(parse(text=X[seq(starts[i], ends[i])]), env = env) L[[i]] - as.list(env) } __ 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] update packages with R on Vista: error
Dear all, I figured out that the best solution for me is to install R in the /User/me/Documents/R/ directory instead of the program files directory since I am the only user on my notebook and R has then full write access and I do not need to change any environment variables... Thanks for the answers,- Stefan Original Message Subject: [R] update packages with R on Vista: error From: Stefan Grosse [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Date: 07.06.2007 12:00 Dear R-list, I have encountered the following error message trying to update R packages: update.packages(ask='graphics') Warning in install.packages(update[instlib == l, Package], l, contriburl = contriburl, : 'lib' is not writable Error in install.packages(update[instlib == l, Package], l, contriburl = contriburl, : unable to install packages I remember did not have the problem on the last update where R installed the files then in the Documents/R folder on my user account. Any ideas how to handle this? I made the directories completely writable so I do not know where the problem is now (especially since update worked before...) Stefan PS: Tinn-R 1.19.2.3 + R 2.5.0 on Vista Business __ 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] Problems with Vista, R 2.5.0 and function save
Hi Maja, if you are working on your own computer an alternative could be to install R in your user directory: c:\Users\your_loginname_\R or c:\Users\your_loginname_\Documents\R I also had a problem with the writing permissions when I tried updating R packages. Btw. when I work with files I set the path directly (since I have several different paths) so this is also a work around ( save(x,y,file=c:/Users/Maja/Documents/masterfile.Rda) just note that the windows backslash has been replaced). Stefan Original Message Subject: Re:[R] Problems with Vista, R 2.5.0 and function save From: Prof Brian Ripley [EMAIL PROTECTED] To: Maja Schröter [EMAIL PROTECTED] Date: 12.06.2007 13:48 So you are running R somewhere in your file system where you do not have permission to write. Did you create a shortcut with a working directory set as the rw-FAQ advised you to? On Tue, 12 Jun 2007, Maja Schröter wrote: Hi everyone, I want to make use of the save function but it did not work. I'm using vista and R 2.5.0, winzip is installed too. Here's the code (from example ?save): x - runif(20) y - list(a = 1, b = TRUE, c = oops) save(x, y, file = xy.Rdata) Fehler in gzfile(file, wb) : kann Verbindung nicht öffnen Zusätzlich: Warning message: kann komprimierte Datei 'xy.Rdata' nicht öffnen Thank you so much for your help. Background: I want to crate a variable masterfile that I can start with data(masterfile) or attach(masterfile). I.g. Town-c(London,Miami,Rio,Lansing) Pollution-c(34,32,50,17) masterfile-data.frame(Town,Pollution) save(masterfile,file=masterfile.Rda) Kindly regards, Maja Schröter __ 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. No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.15/847 - Release Date: 12.06.2007 21:42 __ 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] Linux equivalent to windows menus and script window
Note: The screenshots at http://rosuda.org/JGR/ don't show the menu bar because they're taken on a mac. But the menu items do exist. On Jun 13, 2007, at 11:02 AM, Stefan Grosse wrote: JGR is pretty close to the windows R-GUI (with the menus) but even better since it is system independent and e.g. has syntax highlightning in the editor. You could have a look at the screenshots at http://rosuda.org/JGR/ index.htm What you need is a Java 5 SDK installed at the system and probably R has to be reconfigured to find java. Stefan John, on Tuesday 12 June 2007 23:53:07 you wrote: JS Stefan, JS Am I correct that neither option will provide the menu options provided under windows, i.e. the MISC, PACKANGE, or WINDOWS menus? JS Thanks, JS John __ 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] equivalent of windialog on unix??
?readline On Wed, 13 Jun 2007, BaKaLeGuM wrote: I have on a script something like this toto = winDialog(yesno, Do you want to install the package) if (toto==YES){ but it dont work on unix because of the winDialog i think.. how can i do to change this for unix please? best regards vincent [[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] export to a dat file that SAS can read
At 09:05 13/06/2007, Rina Miehs wrote: Hello i have a data frame in R that some SAS users need to use in their programs, and they want it in a dat file, is that possible? and which functions to use for that? Does library(foreign) ?write.foreign get you any further forward? my data frame is like this: out13[1:100,] faridniveau1 niveau3 p1p3 antal1 210007995 0.0184891394 4.211306e-10 5.106471e-02 2.594580e-02 3 910076495 0.0140812953 3.858757e-10 1.065804e-01 3.743271e-02 3 10 10081892 0.0241760590 7.429612e-10 1.628295e-02 3.021538e-04 6 13 10101395 0.0319517576 3.257375e-10 2.365204e-03 6.633232e-02 19 16 10104692 0.0114040787 3.661169e-10 1.566721e-01 4.550663e-02 4 17 10113592 0.0167586526 4.229634e-10 6.922003e-02 2.543987e-02 2 18 10113697 0.0259205504 2.888646e-10 1.096366e-02 9.118995e-02 6 22 10121697 -0.0135341273 -5.507914e-10 1.157417e-01 5.501947e-03 16 28 10146495 0.0093514076 3.493487e-10 2.041883e-01 5.340801e-02 4 29 10150497 0.0091611504 3.455925e-10 2.089893e-01 5.531904e-02 4 36 10171895 0.0089116669 2.956742e-10 2.153844e-01 8.614259e-02 4 42 10198295 0.0078515166 3.147140e-10 2.437943e-01 7.314111e-02 5 Thanks Rina [[alternative HTML version deleted]] Michael Dewey http://www.aghmed.fsnet.co.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 GRASS-R packages
Hi, I tried to install R packages required for the GRASS-R interface by using the following command (copied from http://www.geog.uni-hannover.de/grass/statsgrass/grass6_r_install.html): /install.packages (c(sp, spgrass6,rgdal,maptools), dependencies =TRUE)/ rgdal package was installed successfully; There were problems to find 'sp' and 'maptools' packages. The error message was /: dependencies 'sp' and 'maptools' are not available/. I tried to download the packages from three different mirrors with the same result ( http://cran.fr.r-project.org/ , http://cran.mirroring.de/, http://probability.ca/cran/ ) http://probability.ca/cran/ I then failed to download 'spgrass6' since it required to download first sp can anybody tell me what mistake I did and how (where?) I can get these packages Thank you very much by advance http://probability.ca/cran/ -- Philippe Lagacherie Ingénieur de Recherche HDR Animateur équipe Organisation Spatiale et Fonctionnement des Paysages Cultivés INRA LISAH Montpellier Tel +33 (0)4 99 61 25 78. fax +33 (0)4 67 63 26 14 [EMAIL PROTECTED] Attention changement d'adresse email [[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] installing Rgraphviz under fedora 5
Dear list, I have a lot of troubles installing Rgraphviz. I installed graphviz 2.13 from graphviz-2.13.20061222.0540.tar I installed the library Rgraphviz getBioC(Rgraphviz) Running biocinstall version 2.0.8 with R version 2.5.0 Your version of R requires version 2.0 of Bioconductor. trying URL ' http://bioconductor.org/packages/2.0/bioc/src/contrib/Rgraphviz_1.14.0.tar.gz ' Content type 'application/x-gzip' length 1522949 bytes etc etc but when I do: library(Rgraphviz) library(Rgraphviz) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/home/jke/mazu/SOFTWARE_INST/R-2.5.0 /library/Rgraphviz/libs/Rgraphviz.so': libgvc.so.3: cannot open shared object file: No such file or directory Error : .onLoad failed in 'loadNamespace' for 'Rgraphviz' Error: package/namespace load failed for 'Rgraphviz' The path to Rgraphviz.so is correct ! Can someone help with this? this is the session info regards Marco sessioninfo() Error: could not find function sessioninfo sessionInfo() R version 2.5.0 (2007-04-23) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] tools stats graphics grDevices datasets utils [7] methods base other attached packages: geneplotter latticeannotate Biobase graph 1.14.00.15-41.14.11.14.01.14.2 [[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] Fitted Value Pareto Distribution
I would like to fit a Pareto Distribution and I am using the following codes. I thought the fitted (fit1) should be the fitted value for the data, is it correct? As the result of the fitted turns out to be a single value for all. fit=vglm(ycf1 ~ 1, pareto1(location=alpha), trace=TRUE, crit=c) fitted(fit) The result is fitted(fit) [,1] [1,] 0.07752694 [2,] 0.07752694 [3,] 0.07752694 [4,] 0.07752694 [5,] 0.07752694 [6,] 0.07752694 [7,] 0.07752694 [8,] 0.07752694 [9,] 0.07752694 [10,] 0.07752694 [11,] 0.07752694 [12,] 0.07752694 [13,] 0.07752694 Could anybody give me some advice? -- View this message in context: http://www.nabble.com/Fitted-Value-Pareto-Distribution-tf3914151.html#a11097749 Sent from the R help mailing list archive at Nabble.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] Viewing a data object
I believe JGR has an object browser. See the screenshots at the bottom of http://rosuda.org/JGR/. Andy From: Stephen Tucker Hi Horace, I have also thought that it may be useful but I don't know of any Object Explorer available for R. However, (you may alread know this but) (1) you can view your list of objects in R with objects(), (2) view objects in a spreadsheet-like table (if they are matrices or data frames) with invisible(edit(objectName)) [which isn't easy on the fingers]. fix(objectName) is also a shorter option but it has the side effect of possibly changing your object when you close the viewing data. For instance, this can happen if you mistakenly type something into a cell; it can also change your column classes when you don't - for example: options(stringsAsFactors=TRUE) x - data.frame(letters[1:5],1:5) sapply(x,class) letters.1.5. X1.5 factorinteger fix(x) # no user-changes made sapply(x,class) letters.1.5. X1.5 factornumeric (3) I believe Deepayan Sarkar contributed the tab-completion capability at the command line. So unless you have a lot of objects beginning with 'AuroraStoch...' you should be able to type a few letters and let the auto-completion handle the rest. Best regards, ST --- Horace Tso [EMAIL PROTECTED] wrote: Dear list, First apologize that this is trivial and just betrays my slothfulness at the keyboard. I'm sick of having to type a long name just to get a glimpse of something. For example, if my data frame is named 'AuroraStochasticRunsJune1.df and I want to see what the middle looks like, I have to type AuroraStochasticRunsJune1.df[ 400:500, ] And often I'm not even sure rows 400 to 500 are what I want to see. I might have to type the same line many times. Is there sort of a R-equivalence of the Object Explorer, like in Splus, where I could mouse-click an object in a list and a window pops up? Short of that, is there any trick of saving a couple of keystrokes here and there? Thanks for tolerating this kind of annoying questions. H. __ 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. __ __ Sucker-punch spam with award-winning protection. __ 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. -- Notice: This e-mail message, together with any attachments,...{{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.
Re: [R] specify constraints in maximum likelihood
adschai at optonline.net writes: Hi,I know only mle function but it seems that in mle one can only specify the bound of the unknowns forming the likelihood function. But I would like to specify something like, a = 2b or a = 2b where 'a' and 'b' could be my parameters in the likelihood function. Any help would be really appreciated. Thank you!- adschai Something like a=2b (equality constraints with a simple form) should be easy, just reparameterize your function. e.g. if you have minuslogl equal to f(a,b,c) then define a new function f2 - function(a,c) { b - a/2 f(a,b,c) } For a=2b reparameterize in terms of d=a-2b : f2 - function(a,c,d) { b - (a-d)/2 f(a,b,c) } and impose the constraint (e.g. with L-BFGS-B) of d=0. Actually, the second one (linear inequality constraints) can also be done with constrOptim. More complex (nonlinear) constraints have to be done with Lagrange multipliers or penalty terms ( http://www.zoo.ufl.edu/bolker/emdbook/chap7A.pdf has some general description, at a very basic level ) __ 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] Design library installation problem
I cannot find the posting but I believe Brian Ripley posted something here a day or so ago that said that Design had not passed some of the 2.5.0 tests. --- Ian Watson [EMAIL PROTECTED] wrote: Dear Listers I have tried to install Frank Harrell's two libaries: Hmisc and Design. I found that Hmisc was listed in the list of packages from the Install Packages command on the Packages menu, but Design was not. I installed Hmisc from this list, and when I issued the library(Hmisc) command, it loaded into memory correctly. I then copied the Design 1.1-1.zip file from the http://lib.stat.cmu.edu/S/Harrell/library/r/ site and used the Install Packages from Local Zip file command. I received no error messages and a visual inspection of the R\library directory shows Design has been installed. However, when I issued the library(Design) command I get the following error message: Error in library(Design) : 'Design' is not a valid package -- installed 2.0.0? I also notice, from a visual inspection of the R\library\Design\R directory that there is only one file: design. In other directories, eg. R\library\Hmisc\R there are usually 3 files: Hmisc Hmisc.rdx Hmisc.rdb I am new to R, and a bit lost. I have read the R-admin.pdf documentation on packages but am still unsure how to proceed from here. I would appreciate any advice, and any answers to the following questions: 1) is there a reason why Design is not listed in the Install Packages list as Hmisc is? 2) have I done the correct thing by way of manual installation of Design? 3) is the absence of 2 other Design files (rdx, rdb) the reason for my failed installation? 4) what should I try now? I am using R.2.5.0 on Windows XP. Kind regards Ian __ 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] Design library installation problem
Uwe Ligges wrote: Ian Watson wrote: Dear Listers I have tried to install Frank Harrell's two libaries: Hmisc and Design. I found that Hmisc was listed in the list of packages from the Install Packages command on the Packages menu, but Design was not. I installed Hmisc from this list, and when I issued the library(Hmisc) command, it loaded into memory correctly. I then copied the Design 1.1-1.zip file from the http://lib.stat.cmu.edu/S/Harrell/library/r/ site and used the Install Packages from Local Zip file command. I received no error messages and a visual inspection of the R\library directory shows Design has been installed. However, when I issued the library(Design) command I get the following error message: Error in library(Design) : 'Design' is not a valid package -- installed 2.0.0? I also notice, from a visual inspection of the R\library\Design\R directory that there is only one file: design. In other directories, eg. R\library\Hmisc\R there are usually 3 files: Hmisc Hmisc.rdx Hmisc.rdb I am new to R, and a bit lost. I have read the R-admin.pdf documentation on packages but am still unsure how to proceed from here. I would appreciate any advice, and any answers to the following questions: 1) is there a reason why Design is not listed in the Install Packages list as Hmisc is? Yes. The current version does not pass the checks under Windows. Please convince the maintainer to fix the package, and a binary will be made available shortly. Please note that this would be a lot easier if we did not get a segfault when running R CMD CHECK --- a segfault that does not happen with the example code is run outside of CMD CHECK. Charles Thomas Dupont is working hard on this. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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 Rgraphviz under fedora 5
The problem is that libgvc.so.3 is not in your dynamic library search path. That's true by default for FC5, it is in /usr/lib64/graphviz on a x86_64 FC5 box. The proper solution is to fix the FC5 graphviz installation to tell ld.so about the location. A simpler way is to add /usr/lib64/graphviz to the LD_LIBRARY_PATH: on our servers we have edited R_HOME/etc/ldpaths to do so, so we have : ${R_LD_LIBRARY_PATH=${R_HOME}/lib:/usr/local/lib64:/opt/export/lib64:/usr/lib6 4/graphviz} If you don't have permissions to do this, set it in your personal LD_LIBRARY_PATH. BTW, asking questions about installing Bioconductor is best done on their mailing list, not R-help. On Wed, 13 Jun 2007, marco.R.help marco.R.help wrote: Dear list, I have a lot of troubles installing Rgraphviz. I installed graphviz 2.13 from graphviz-2.13.20061222.0540.tar I installed the library Rgraphviz getBioC(Rgraphviz) Running biocinstall version 2.0.8 with R version 2.5.0 Your version of R requires version 2.0 of Bioconductor. trying URL ' http://bioconductor.org/packages/2.0/bioc/src/contrib/Rgraphviz_1.14.0.tar.gz ' Content type 'application/x-gzip' length 1522949 bytes etc etc but when I do: library(Rgraphviz) library(Rgraphviz) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/home/jke/mazu/SOFTWARE_INST/R-2.5.0 /library/Rgraphviz/libs/Rgraphviz.so': libgvc.so.3: cannot open shared object file: No such file or directory Error : .onLoad failed in 'loadNamespace' for 'Rgraphviz' Error: package/namespace load failed for 'Rgraphviz' The path to Rgraphviz.so is correct ! Can someone help with this? this is the session info regards Marco sessioninfo() Error: could not find function sessioninfo sessionInfo() R version 2.5.0 (2007-04-23) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] tools stats graphics grDevices datasets utils [7] methods base other attached packages: geneplotter latticeannotate Biobase graph 1.14.00.15-41.14.11.14.01.14.2 [[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] installing Rgraphviz under fedora 5
On 6/13/07, marco.R.help marco.R.help [EMAIL PROTECTED] wrote: Dear list, I have a lot of troubles installing Rgraphviz. I installed graphviz 2.13 from graphviz-2.13.20061222.0540.tar I installed the library Rgraphviz getBioC(Rgraphviz) Running biocinstall version 2.0.8 with R version 2.5.0 Your version of R requires version 2.0 of Bioconductor. trying URL ' http://bioconductor.org/packages/2.0/bioc/src/contrib/Rgraphviz_1.14.0.tar.gz ' Content type 'application/x-gzip' length 1522949 bytes etc etc but when I do: library(Rgraphviz) library(Rgraphviz) Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/home/jke/mazu/SOFTWARE_INST/R- 2.5.0 /library/Rgraphviz/libs/Rgraphviz.so': libgvc.so.3: cannot open shared object file: No such file or directory Error : .onLoad failed in 'loadNamespace' for 'Rgraphviz' Error: package/namespace load failed for 'Rgraphviz' The path to Rgraphviz.so is correct ! But it's libgvc.so.3 that's missing. Make sure your LD_LIBRARY_PATH environment variable points to the directory containing it. Can someone help with this? this is the session info regards Marco sessioninfo() Error: could not find function sessioninfo sessionInfo() R version 2.5.0 (2007-04-23) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] tools stats graphics grDevices datasets utils [7] methods base other attached packages: geneplotter latticeannotate Biobase graph 1.14.00.15-41.14.11.14.01.14.2 [[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. [[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] if statement
See ?quantcut in the gtools package. On 6/11/07, Jiong Zhang, PhD [EMAIL PROTECTED] wrote: Hi all, I have a rather naive question. I have the height of 100 individuals in a table and I want to assign the tallest 30% as Case=1 and the bottom 30% as Case=0. How do I do that? thanks. jiong The email message (and any attachments) is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message (and any attachments). Thank You. [[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] Confusion with sapply
Try this. It takes a Date class date and in the first line month.day.year converts unclass(x) to chron. In the last line of the function we convert back to Date class. Its already vectorized so sapply is unneeded: library(chron) f - function(x) with(month.day.year(unclass(x)), { month - ifelse(month == 6 | month == 9, 3, month) year - ifelse(month == 12, year + 1, year) as.Date(paste(year, month, day, sep = -)) }) Running the last line gives: # test f(seq(Sys.Date(), length = 12, by = month)) [1] 2007-03-13 2007-07-13 2007-08-13 2007-03-13 2007-10-13 [6] 2007-11-13 2008-12-13 2008-01-13 2008-02-13 2008-03-13 [11] 2008-04-13 2008-05-13 On 6/13/07, Patnaik, Tirthankar [EMAIL PROTECTED] wrote: Hi, I have some confusion in applying a function over a column. Here's my function. I just need to shift non-March month-ends to March month-ends. Initially I tried seq.dates, but one cannot give a negative increment (decrement) here. return(as.Date(seq.dates(format(xdate,%m/%d/%Y),by=months,len=4)[4]) ) Hence this simple function: mydate - as.Date(2006-01-01) # Function to shift non-March company-reporting dates to March. Set2March - function(xdate){ + # Combines non-March months into March months: + # Dec2006 - Mar2007 + # Mar2006 - Mar2006 + # Jun2006 - Mar2006 + # Sep2006 - Mar2006 + # VERY Specific code. + Month - format(xdate,%m) + wDate - month.day.year(julian(xdate)) + if (Month==12){ + wDate$year - wDate$year + 1 + wDate$month - 3 + }else + if (Month==06){ + wDate$month - 3 + }else + if (Month==09){ + wDate$month - 3 + wDate$day - wDate$day + 1 + }else warning (No Changes made to the month, since month is not one of (6,9,12)) + cDate - chron(paste(wDate$month,wDate$day,wDate$year,sep=/)) + return(as.Date(as.yearmon(as.Date(cDate,%m/%d/%y)),frac=1)) + } Set2March(as.Date(2006-06-30)) [1] 2006-03-31 Set2March(mydate) [1] 2006-01-31 Warning message: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(mydate) Works well when I use it on a single date. Then I try it on a vector: dc - seq(as.Date(2006-01-01),len=10, by=month) dc [1] 2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 [9] 2006-09-01 2006-10-01 sapply(as.vector(dc),Set2March) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : unimplemented type 'character' in 'asLogical' What am I missing here? Shouldn't the function work with the sapply working on each entry? TIA and best, -Tir __ 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] equivalent of windialog on unix??
this is the answer :) toto - tkmessageBox(title = Rcmdr, message = Do you want to install Rcmdr?, icon = question, type = yesno) if (as.character(toto)==yes){ it work on windows and unix (and i think mac) 2007/6/13, Prof Brian Ripley [EMAIL PROTECTED]: ?readline On Wed, 13 Jun 2007, BaKaLeGuM wrote: I have on a script something like this toto = winDialog(yesno, Do you want to install the package) if (toto==YES){ but it dont work on unix because of the winDialog i think.. how can i do to change this for unix please? best regards vincent [[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 -- _ baka [EMAIL PROTECTED] photo du moment: http://linuxfr.org/images/dessins/concours_antidrm/protection_des_livres/protection_des_livres_small.png --- [[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] Differences of correlations testing in R
Good morning everybody, I need to compare intercorrelations between variables. My data were collected from 4 samples (with various number of subject) containing 4 variables scores. Some of my hypothesis are about the strength of relations (the sign doesn't matter) between variables across samples. I have such correlation matrix: A B ab C ac bc D ad bd cd A B C D my hypothesis are: |ad||ac| |ad||ab| |ad||bd| |ad||cd| |bc||ac| |bc||cd| |bc||ab| |bc||bd| ac,bd 0 ab,bc,cd,ad 0 I would like to make above comparisons across the samples I'm only interested in whether the pattern is replicated in all samples not in the differences between them. Is it possible to do it in R? (I'm newbie) Any help would be greatly appreciated. Rafal Bartczuk Institute of Psychology Catholic University of Lublin __ 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] Confusion with sapply
Hi, Many thanks for this Hadley, and Uwe, the packages I used were chron, and zoo. Later I'm also using Hadley's reshape. I was able to run the code for a vector thus: dc - seq(as.Date(2006-01-01),len=10,by=month) dc [1] 2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 [9] 2006-09-01 2006-10-01 as.Date(sapply(dc,function(x)Set2March(as.Date(x [1] 2006-01-31 2006-02-28 2006-03-31 2006-04-30 2006-05-31 2006-03-31 2006-07-31 2006-08-31 [9] 2006-03-31 2006-10-31 Warning messages: 1: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 2: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 3: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 4: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 5: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 6: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 7: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) 8: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(as.Date(x)) Basically I ran as.Date on the vector elements (Why?, since the elements are dates anyway?), and then afterwards use as.Date again on the returned vector. Got the answer, but it would be great if I could understand exactly how. TIA and Best, -Tir -Original Message- From: hadley wickham [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 2:35 PM To: Patnaik, Tirthankar [GWM-CIR] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Confusion with sapply On 6/13/07, Patnaik, Tirthankar [EMAIL PROTECTED] wrote: Hi, I have some confusion in applying a function over a column. Here's my function. I just need to shift non-March month-ends to March month-ends. Initially I tried seq.dates, but one cannot give a negative increment (decrement) here. return(as.Date(seq.dates(format(xdate,%m/%d/%Y),by=months,len=4)[4 ]) ) Hence this simple function: mydate - as.Date(2006-01-01) # Function to shift non-March company-reporting dates to March. Set2March - function(xdate){ + # Combines non-March months into March months: + # Dec2006 - Mar2007 + # Mar2006 - Mar2006 + # Jun2006 - Mar2006 + # Sep2006 - Mar2006 + # VERY Specific code. + Month - format(xdate,%m) + wDate - month.day.year(julian(xdate)) + if (Month==12){ + wDate$year - wDate$year + 1 + wDate$month - 3 + }else + if (Month==06){ + wDate$month - 3 + }else + if (Month==09){ + wDate$month - 3 + wDate$day - wDate$day + 1 + }else warning (No Changes made to the month, since month is not one of (6,9,12)) + cDate - chron(paste(wDate$month,wDate$day,wDate$year,sep=/)) + return(as.Date(as.yearmon(as.Date(cDate,%m/%d/%y)),frac=1)) + } Set2March(as.Date(2006-06-30)) [1] 2006-03-31 Set2March(mydate) [1] 2006-01-31 Warning message: No Changes made to the month, since month is not one of (6,9,12) in: Set2March(mydate) Works well when I use it on a single date. Then I try it on a vector: dc - seq(as.Date(2006-01-01),len=10, by=month) dc [1] 2006-01-01 2006-02-01 2006-03-01 2006-04-01 2006-05-01 2006-06-01 2006-07-01 2006-08-01 [9] 2006-09-01 2006-10-01 sapply(as.vector(dc),Set2March) Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3, : unimplemented type 'character' in 'asLogical' What am I missing here? Shouldn't the function work with the sapply working on each entry? You can considerable simplify your code with some helper functions: month - function(x) as.POSIXlt(x)$mon + 1 month- - function(x, value) { ISOdatetime(year(x) + (value - 1) %/% 12, (value - 1) %% 12 + 1 , mday(x), hour(x), minute(x), second(x), tz(x)) } year - function(x) as.POSIXlt(x)$year + 1900 year- - function(x, value) { ISOdatetime(value, month(x), mday(x), hour(x), minute(x), second(x), tz(x)) } marchise - function(x) { if (month(x) == 12) year(x) - year(x) if (month(x) %in% c(6, 9, 12)) month(x) - 3 x } dc - seq(as.Date(2006-01-01),len=10, by=month) marchise(dc[[1]]) However, that doesn't work with sapply because the date class seems to get stripped off - I'm not completely why, but perhaps because the date class is a property of the entire vector not the individual values: sapply(marchise, dc) 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,
Re: [R] installing GRASS-R packages
On Wed, 13 Jun 2007, Philippe LAGACHERIE wrote: Hi, I tried to install R packages required for the GRASS-R interface by using the following command (copied from http://www.geog.uni-hannover.de/grass/statsgrass/grass6_r_install.html): /install.packages (c(sp, spgrass6,rgdal,maptools), dependencies =TRUE)/ rgdal package was installed successfully; There were problems to find 'sp' and 'maptools' packages. The error message was /: dependencies 'sp' and 'maptools' are not available/. I tried to download the packages from three different mirrors with the same result ( http://cran.fr.r-project.org/ , http://cran.mirroring.de/, http://probability.ca/cran/ ) http://probability.ca/cran/ I then failed to download 'spgrass6' since it required to download first sp can anybody tell me what mistake I did and how (where?) I can get these packages The note in the OSGeo Journal: http://www.osgeo.org/files/journal/final_pdfs/OSGeo_vol1_GRASS-R.pdf is more recent, although the note you accessed is accurate, and says just: install.packages(spgrass6, dependencies = TRUE) should be enough, because all the packages are on CRAN, and current sp and maptools are on at least http://cran.fr.r-project.org. Topics like this are best raised on the R-sig-geo list, or perhaps on the GRASS STATGRASS list. It is also good practice to say what platform you are on (OS, R version, etc.) as reported by sessionInfo(). Thank you very much by advance http://probability.ca/cran/ -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 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.
[R] How to install RMySQL package in R 2.5 in Windows OS?
Dear R-users, It seems that install.packages( ) doesn't work to RMySQL package. Would anybody have the experience of that? Thanks _ Dr.Ruixin ZHU Shanghai Center for Bioinformation Technology [EMAIL PROTECTED] [EMAIL PROTECTED] 86-21-13040647832 [[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] export to a dat file that SAS can read
On Wed, 13 Jun 2007, Uwe Ligges wrote: Rina Miehs wrote: Hello i have a data frame in R that some SAS users need to use in their programs, and they want it in a dat file, is that possible? What is a dat file? and which functions to use for that? I *guess* write.table() will do the trick, given dat is what I guess it is... Another approach (that preserves factor levels if you have them) is to use write.foreign in the 'foreign' package. This writes a text file for the data and also writes SAS code to read the file. -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.
[R] Obtaining the cross validation coefficient of determination
Hello - I am currently working through some MLR models and wanted to perform cross validation to assess the model's prediction error. As a Minitab user prior to discovering R, I was able to view the PRESS statistic and the resultant cross validation R^2. Is there a canned function already present that does this or should I go ahead and just right a user defined function? Along the same lines, is there an easy way to extract the Sum of Squares column from an ANOVA analysis in order to compute the total sum of squares? Thanks in advance. Matt Pietrzykowski [[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] R Book Advice Needed
Roland: Thanks for your reply. I have sort of pay my dues with statistics and doing the hard math reading of Proofs. Years ago reading lots of books on Multi-variate Methods such As Principal Components, Cluster Analysis, Discriminant Analysis, Multi Dimensional Scaling(MDS), Optimization both LP and QP and more. At this point, want to jump in avoiding all the Mathematical proofs and just apply R and the packages for what I want to do. So as example, How to set-up a dataset (timeseries of returns), formatted so I can do A cluster Analysis and nicely format a dendrogram. I am hoping the right books can show me, not concerned about which distance measure and cluster method (i.e. Ward's, Single Linkage etc) Done this and know based on type of data what works best. Just some simple books to jump start me right into practically applying R. Thanks for your response. Regards, Neil -Original Message- From: Roland Rau [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 10:14 AM To: Gottlieb, Neil Cc: R-help@stat.math.ethz.ch Subject: Re: [R] R Book Advice Needed Hi, [EMAIL PROTECTED] wrote: I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical Analyses Using R - Brian S. Everitt 6-Introductory Statistics with R - Peter Dalgaard 7-Using R for Introductory Statistics - John Verzani 8-Data Analysis and Graphics Using R - John Maindonald; 9-Linear Models with R (Texts in Statistical Science) - Julian J. Faraway 10-Analysis of Financial Time Series (Wiley Series in Probability and Statistics)2nd edition - Ruey S. Tsay as one other message says, it depends a lot on your ideas what you want to do with R. And, I'd like to add, how familiar you are with statistics. One book I am missing in your list is Venables / Ripley: Modern Applied Statistics with S. I can highly recommend it. If you are going to buy yourself only one book, then I would say: buy Venables/Ripley Best, Roland This information is being sent at the recipient's request or...{{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.
Re: [R] R is not a validated software package..
I've been on vacation and so come late to this interesting discussion. Let me add two minor points. 1. I have run into a lot of statements that x is required when dealing with pharma, and in particular wrt NDAs (new drug application). Almost all were false. But I also understand a bit of where they are coming from. An NDA costs millions, with the required trials, and is a huge submission in terms of the sheer amount of paper. If a company's last NDA was successful, there is a lot of draw to make the next one as much like it as possible, down to the font size and the margins. So I agree with Frank that SAS is validated is a false requirement, yet remain somewhat sympathetic to the person who said it. 2. We have been audited once on a portion of an analysis. The official said, more or less, show us how you got that answer while pointing at a part of the report. That particular analysis happened to be done in SAS, but what was important was our ability to quickly find the relevant code, not the package. 3. If the other party is stubborn about SAS vs S, I have one example I like to argue with. The S survival code has an extensive test suite, including a set of small examples where I have worked out the correct results by hand. Many of these latter are documented in the appendix of the Therneau and Grambsch book. The SAS phreg procedure does not pass all the tests. (Cox model + Efron approx for ties + deviance residuals for one. The size of the error is numerically insignificant, a 1/n vs 1/(n-1) type of thing: but it leads to slightly different robust standard errors). __ 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] ievent.wait
Does locator(type='l') (or type ='b') Work for you? -Original Message- From: ryestone [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Sent: 6/8/07 10:19 AM Subject: [R] ievent.wait I am working on a plot and would be like to click on a few points and then have a line connect them. Could anyone help me with this or advise me in a direction that would suit this. I know I would be using ievent.wait in iplot but not sure about this. thank you. -- View this message in context: http://www.nabble.com/ievent.wait-tf3891095.html#a11030568 Sent from the R help mailing list archive at Nabble.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. __ 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] R Book Advice Needed
Hi, [EMAIL PROTECTED] wrote: I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical Analyses Using R - Brian S. Everitt 6-Introductory Statistics with R - Peter Dalgaard 7-Using R for Introductory Statistics - John Verzani 8-Data Analysis and Graphics Using R - John Maindonald; 9-Linear Models with R (Texts in Statistical Science) - Julian J. Faraway 10-Analysis of Financial Time Series (Wiley Series in Probability and Statistics)2nd edition - Ruey S. Tsay as one other message says, it depends a lot on your ideas what you want to do with R. And, I'd like to add, how familiar you are with statistics. One book I am missing in your list is Venables / Ripley: Modern Applied Statistics with S. I can highly recommend it. If you are going to buy yourself only one book, then I would say: buy Venables/Ripley Best, Roland __ 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] barplot and map overlay
Look at the subplot function in the TeachingDemos package. -Original Message- From: Héctor Villalobos [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Sent: 6/11/07 5:48 PM Subject: [R] barplot and map overlay Hi, I wonder if it is possible with the graphics package to overlay one or several plots (barplots, for example) over a map. Data for the map is in a data frame with the latitude and longitude coordinates, and then: plot(map$long, map$lat, type =l) produces the map. I want to put each barplot in specific locations on the map, namely at the center of statistical squares. I´ve seen an example in Paul Murrell´s R Graphics book that seems appropriate (grid package), but a bit complicated. Thanks a lot for any advice. Héctor -- Héctor Villalobos [EMAIL PROTECTED] CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, MÉXICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 2425 Fax. (+52 612) 122 53 22 [[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 Rgraphviz under fedora 5
marco.R.help marco.R.help [EMAIL PROTECTED] writes: Dear list, I have a lot of troubles installing Rgraphviz. I installed graphviz 2.13 from graphviz-2.13.20061222.0540.tar I installed the library Rgraphviz I'm pretty sure that you will have problems with graphviz 2.13 and that you will need to use graphviz 2.12. + seth -- Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center http://bioconductor.org __ 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] R Book Advice Needed
Thanks Alain. Guess bite the bullet with limited budget buy bunch From Amazon and see what reads best and return the rest!. One ends up collecting so many books (most of bought 5 books on Bayesian analysis years ago), still like browsing shelfs! Regards, Neil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alain Reymond Sent: Tuesday, June 12, 2007 6:23 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] R Book Advice Needed [EMAIL PROTECTED] a écrit : I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical Analyses Using R - Brian S. Everitt 6-Introductory Statistics with R - Peter Dalgaard 7-Using R for Introductory Statistics - John Verzani 8-Data Analysis and Graphics Using R - John Maindonald; 9-Linear Models with R (Texts in Statistical Science) - Julian J. Faraway 10-Analysis of Financial Time Series (Wiley Series in Probability and Statistics)2nd edition - Ruey S. Tsay Thanks. Neil Gottlieb Neil, I am also new to R and I just bought the book of Peter Dalgaard (n°6). I find it very practical. It covers a large panel of principal statistical techniques that you can use directly. I thinkk it is a good start for a R beginner. At least, it is good for me! Don't forget the many resources on the R website. Regards. -- Alain Reymond CEIA Bd Saint-Michel 119 1040 Bruxelles Tel: +32 2 736 04 58 Fax: +32 2 736 58 02 [EMAIL PROTECTED] PGPId : 0xEFB06E2E __ 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 information is being sent at the recipient's request or...{{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.
Re: [R] Fitted Value Pareto Distribution
livia wrote: I would like to fit a Pareto Distribution and I am using the following codes. I thought the fitted (fit1) should be the fitted value for the data, is it correct? As the result of the fitted turns out to be a single value for all. fit=vglm(ycf1 ~ 1, pareto1(location=alpha), trace=TRUE, crit=c) fitted(fit) The result is fitted(fit) [,1] [1,] 0.07752694 [2,] 0.07752694 [3,] 0.07752694 [4,] 0.07752694 [5,] 0.07752694 [6,] 0.07752694 [7,] 0.07752694 [8,] 0.07752694 [9,] 0.07752694 [10,] 0.07752694 [11,] 0.07752694 [12,] 0.07752694 [13,] 0.07752694 Could anybody give me some advice? Your model only includes an intercept, so the fitted value is supposed to be the same for all units (there is nothing in your model that allows the fitted value to vary across units). markus -- Markus Jantti Abo Akademi University [EMAIL PROTECTED] http://www.iki.fi/~mjantti __ 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] R Book Advice Needed
Cody: Think you might have asked the question for me Neil. I do time series analysis of return data in finance. I will be creating a factor model based on PCA Or Single Value Decomposition to get Eigenvectors Of the correlation matrix (tends to work better for finance data Than covariance). From there will be doing style analysis, some optimization, Regime switching, co-intregration testing and some Statistical Process Control charting such as CUSUM. Ultimately, what I learned over the years with statistics, visualization is critical for my end-users. The don't care what cluster method I use, be it Hierarchical or Rosseau' newer methods such as Fanny, which I find more robust. In end I need practical stuff: as a programmer on Data types, data structures and even how to format and read in Data. So that's basically stuff I will be doing. Neil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 6:36 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] R Book Advice Needed Alain, Can you tell us what you plan to use R for? Regards, -Cody [EMAIL PROTECTED] a écrit : I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical Analyses Using R - Brian S. Everitt 6-Introductory Statistics with R - Peter Dalgaard 7-Using R for Introductory Statistics - John Verzani 8-Data Analysis and Graphics Using R - John Maindonald; 9-Linear Models with R (Texts in Statistical Science) - Julian J. Faraway 10-Analysis of Financial Time Series (Wiley Series in Probability and Statistics)2nd edition - Ruey S. Tsay Thanks. Neil Gottlieb Cody Hamilton, PhD Edwards Lifesciences [[alternative HTML version deleted]] This information is being sent at the recipient's request or...{{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.
Re: [R] R Book Advice Needed
Hi Neil, [EMAIL PROTECTED] wrote: At this point, want to jump in avoiding all the Mathematical proofs and just apply R and the packages for what I want to do. I'd still recommend Venables/Ripley: Modern Applied Statistics with S (or often abbrev. MASS, which is also name of the package which supports this book and is part of any standard distribution of R). Have a look at the table of contents. It is possible via amazon.com (and I guess also for a series of other books on your list). I think using MASS together with the included manuals (especially An Introduction to R) is probably the best way to get you started. Best, Roland __ 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] equivalent of windialog on unix??
On Wed, 13 Jun 2007, BaKaLeGuM wrote: this is the answer :) toto - tkmessageBox(title = Rcmdr, message = Do you want to install Rcmdr?, icon = question, type = yesno) if (as.character(toto)==yes){ it work on windows and unix (and i think mac) Only if you have tcl/tk installed and an X11 server accessible. E.g. it does not work on a remote machine in general. 2007/6/13, Prof Brian Ripley [EMAIL PROTECTED]: ?readline On Wed, 13 Jun 2007, BaKaLeGuM wrote: I have on a script something like this toto = winDialog(yesno, Do you want to install the package) if (toto==YES){ but it dont work on unix because of the winDialog i think.. how can i do to change this for unix please? best regards vincent [[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 -- 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] R Book Advice Needed
Roland Rau wrote: Hi, [EMAIL PROTECTED] wrote: I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical Analyses Using R - Brian S. Everitt 6-Introductory Statistics with R - Peter Dalgaard 7-Using R for Introductory Statistics - John Verzani 8-Data Analysis and Graphics Using R - John Maindonald; 9-Linear Models with R (Texts in Statistical Science) - Julian J. Faraway 10-Analysis of Financial Time Series (Wiley Series in Probability and Statistics)2nd edition - Ruey S. Tsay as one other message says, it depends a lot on your ideas what you want to do with R. And, I'd like to add, how familiar you are with statistics. One book I am missing in your list is Venables / Ripley: Modern Applied Statistics with S. I can highly recommend it. If you are going to buy yourself only one book, then I would say: buy Venables/Ripley And given the programming background, also check out the other VR book, S Programming. (This is about R too). -- 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] Awk and Vilno
Hey, What we should really compare is the four situations: R alone R + awk R + vilno R + awk + vilno and maybe R + SAS Data step and see what scripts are more elegant (read 'short and understandable') what do you guys think of creating a R-wiki page for syntax comparisons among the various options to enhance R use? I already have two sugestions: 1) syntax examples for using R and other tools to manipulate and analyze large datasets (with a concise description of the datasets); 2) syntax examples for using R and other tools (or R alone) to clean and prepare datasets (simple and very small datasets, for didatic purposes). I think this could be interesting for R users and to promote other software tools, since it seems there is a lot of R users that use other tools also. Besides that, questions on those two above subjects are prevalent at this list. Thus a wiki page seems to be the right place to discuss and teach this to other users. What do you think? Rogerio __ 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] R Book Advice Needed
Thanks Roland, fortunately I dug up MASS by Venables/Ripley buried under all my econometric and statistic books. Will be reading it today and order a few of the R books for additional support. Thanks for your suggestions... Regards, Neil -Original Message- From: Roland Rau [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 10:40 AM To: Gottlieb, Neil Cc: R-help@stat.math.ethz.ch Subject: Re: [R] R Book Advice Needed Hi Neil, [EMAIL PROTECTED] wrote: At this point, want to jump in avoiding all the Mathematical proofs and just apply R and the packages for what I want to do. I'd still recommend Venables/Ripley: Modern Applied Statistics with S (or often abbrev. MASS, which is also name of the package which supports this book and is part of any standard distribution of R). Have a look at the table of contents. It is possible via amazon.com (and I guess also for a series of other books on your list). I think using MASS together with the included manuals (especially An Introduction to R) is probably the best way to get you started. Best, Roland This information is being sent at the recipient's request or...{{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.
Re: [R] ievent.wait
Hi, Greg, type = 'b' won't work according to ?locator. Try type = 'o'. HTH,x --sundar Greg Snow said the following on 6/13/2007 7:27 AM: Does locator(type='l') (or type ='b') Work for you? -Original Message- From: ryestone [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Sent: 6/8/07 10:19 AM Subject: [R] ievent.wait I am working on a plot and would be like to click on a few points and then have a line connect them. Could anyone help me with this or advise me in a direction that would suit this. I know I would be using ievent.wait in iplot but not sure about this. thank you. __ 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 install RMySQL package in R 2.5 in Windows OS?
On Wed, 13 Jun 2007, Ruixin ZHU wrote: Dear R-users, It seems that install.packages( ) doesn't work to RMySQL package. Under Windows, yes. You need the MySQL client libraries for your version of MySQL (or something very close to the same version), so the only safe way is to install from the sources. The latter is not hard and there are instructions in the package. Would anybody have the experience of that? Thanks _ Dr.Ruixin ZHU Shanghai Center for Bioinformation Technology [EMAIL PROTECTED] [EMAIL PROTECTED] 86-21-13040647832 [[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] pretty report
I think my initial intention is to write multiple worksheets for multiple data frames. write.csv or write.table cannot do that. On 6/12/07, Robert A LaBudde [EMAIL PROTECTED] wrote: At 09:13 PM 6/12/2007, Don wrote: At 5:01 PM -0400 6/12/07, Weiwei Shi wrote: Dear Listers: I have a couple of data frames to report and each corresponds to different condtions, e.g. conditions=c(10, 15, 20, 25). In this examples, four data frames need to be exported in a pretty report. I knew Perl has some module for exporting data to Excel and after googling, I found R does not. I use write.table(), name the file with .xls as the suffix, then outside R I double-click on it and it opens in Excel. Granted, it's a text file, and Excel is opening a text file, but none the less, I snip Note that files with a .csv extension are also associated with Excel and can opened with a double-click. Comma-separated-value files also can be unambiguously loaded by Excel without parsing. Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: [EMAIL PROTECTED] Least Cost Formulations, Ltd.URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239Fax: 757-467-2947 Vere scire est per causas scire __ 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. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ 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] Fitted Value Pareto Distribution
livia wrote: I would like to fit a Pareto Distribution and I am using the following codes. I thought the fitted (fit1) should be the fitted value for the data, is it correct? As the result of the fitted turns out to be a single value for all. fit=vglm(ycf1 ~ 1, pareto1(location=alpha), trace=TRUE, crit=c) fitted(fit) The result is fitted(fit) [,1] [1,] 0.07752694 [2,] 0.07752694 [3,] 0.07752694 [4,] 0.07752694 [5,] 0.07752694 [6,] 0.07752694 [7,] 0.07752694 [8,] 0.07752694 [9,] 0.07752694 [10,] 0.07752694 [11,] 0.07752694 [12,] 0.07752694 [13,] 0.07752694 Could anybody give me some advice? I don't have whatever package function 'vglm' comes from (did you follow the instructions in the last two lines of your post?), but you can fit a GPD and get fitted values for it by some such approach as this: library(POT) threshold - 0 # probably para - fitgpd(ycf1, threshold, method=pwmu)$param ycf1.fit - qgpd( ppoints(ycf1, a=0.44), threshold, para[1], para[2]) Note that the above code contains my own preferences for fitting method and plotting positions: yours may differ. J. R. M. Hosking __ 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] R Book Advice Needed
There are some online sources that you might find useful. You could get started on those while you decide what books to get: - CRAN contributed documentation http://cran.r-project.org/other-docs.html - S Poetry http://www.burns-stat.com/pages/spoetry.html - Zoonekynd book http://zoonek2.free.fr/UNIX/48_R/all.html - R manuals http://cran.r-project.org/manuals.html - R News http://cran.r-project.org/doc/Rnews/ - various packages have vignettes which are PDF documents that discuss the package, often at length. vignette() # shows vignettes for installed packages - there was a vignette browser posted to r-devel recently http://tolstoy.newcastle.edu.au/R/e2/devel/07/06/3498.html On 6/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical Analyses Using R - Brian S. Everitt 6-Introductory Statistics with R - Peter Dalgaard 7-Using R for Introductory Statistics - John Verzani 8-Data Analysis and Graphics Using R - John Maindonald; 9-Linear Models with R (Texts in Statistical Science) - Julian J. Faraway 10-Analysis of Financial Time Series (Wiley Series in Probability and Statistics)2nd edition - Ruey S. Tsay Thanks. Neil Gottlieb __ 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] VGAM Pareto
livia yn19832 at msn.com writes: I would like to fit a Pareto Distribution and I am using the following codes fit=vglm(ycf1 ~ 1, pareto1(location=alpha), trace=TRUE, crit=c) fitted(fit) But the fitted values turn out to be the same for each observation. I guess the problem is with ycf1 ~ 1, Are you trying to fit the distribution to set of a values, or are you trying to fit a model with a Pareto error distribution (in which case you would be fitting the distribution to the observations within each group separately, or fitting the distribution with parameters changing as a function of covariates, depending on your mixture of factor and numeric predictors)? If the former, then there aren't any fitted values to be gotten. Perhaps if you say a little more about the problem you're trying to solve you will get more useful help. Also see http://tolstoy.newcastle.edu.au/R/e2/help/06/09/0133.html and the answers to it. __ 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] R Book Advice Needed
Pat: I have done PCA to extract eigenvectors on return series for equities. Rotation does help and does make factors more understandable, have had success doing this. You are right, when doing pure statistical factors, one tends to find first factor which explains most of the variance is the Market Beta. Our scree score showed 20 factors explains most of the variance in equity returns. If you sort on the factor loadings, the other first few factors tend to things such as interest rates,Energy prices, currency exposure. After that it gets a little more complicated what the factors are but they tend to be sector specific. That's the major complaint about pure statistical factor analysis... Interpretation but can get reasonable idea by sorting factor cores. As for missing values, a lot of work has been done there with sampling such as EM and Maximum Likehood. I will check out your R code. Hopefully it will get included Eventually in the Portfolio package. Being new to R, will need to figure out how to source the code to R! Regards, Neil -Original Message- From: Patrick Burns [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 12:56 PM To: Gottlieb, Neil Subject: Re: [R] R Book Advice Needed Neil, 'factor.model.stat' is a part of POP, which is an R package (that runs under S-PLUS as well). We've made 'factor.model.stat' public domain so you don't have to have POP in order to use it. The version of 'factor.model.stat' in the Public Domain area is not in a package. You can just 'source' the code. I just checked and 'factor.model.stat' is not in the 'portfolio' package -- I'm not sure why they haven't included it. The statistical factors are already orthogonal. Rotation is only aimed at trying to make them more interpretable. I'm not very optimistic about that, other than the first factor represents the market. But if you do have success, I'd be interested in hearing of it. A caveat to the paragraph above is that orthogonality assumes no missing values. Having no missing values is not a very common occurrence though (at least for a lot of us). Most of the code in 'factor.model.stat' is handling missing values. I haven't had call for rotations, but I'd be extremely surprised if there weren't a bunch somewhere in R. The 'RSiteSearch' function should be your friend for this. Pat [EMAIL PROTECTED] wrote: Thank Patrick. Is factor.model.stat part of r packages? Also want to rotate the factors so they are orthogonal. Do you have varimax or promax rotation functio? Neil -Original Message- From: Patrick Burns [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 11:28 AM To: Gottlieb, Neil Subject: Re: [R] R Book Advice Needed Most or all of the work for your factor model should be done in 'factor.model.stat' from the Public Domain page of the Burns Statistics website. It is also in the 'portfolio' package, I believe. 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) [EMAIL PROTECTED] wrote: Cody: Think you might have asked the question for me Neil. I do time series analysis of return data in finance. I will be creating a factor model based on PCA Or Single Value Decomposition to get Eigenvectors Of the correlation matrix (tends to work better for finance data Than covariance). From there will be doing style analysis, some optimization, Regime switching, co-intregration testing and some Statistical Process Control charting such as CUSUM. Ultimately, what I learned over the years with statistics, visualization is critical for my end-users. The don't care what cluster method I use, be it Hierarchical or Rosseau' newer methods such as Fanny, which I find more robust. In end I need practical stuff: as a programmer on Data types, data structures and even how to format and read in Data. So that's basically stuff I will be doing. Neil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 6:36 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] R Book Advice Needed Alain, Can you tell us what you plan to use R for? Regards, -Cody [EMAIL PROTECTED] a écrit : I am new to using R and would appreciate some advice on which books to start with to get up to speed on using R. My Background: 1-C# programmer. 2-Programmed directly using IMSL (Now Visual Numerics). 3- Used in past SPSS and Statistica. I put together a list but would like to pick the best of and avoid redundancy. Any suggestions on these books would be helpful (i.e. too much overlap, porly written etc?) Books: 1-Analysis of Integrated and Co-integrated Time Series with R (Use R) - Bernhard Pfaff 2-An Introduction to R - W. N. Venables 3-Statistics: An Introduction using R - Michael J. Crawley 4-R Graphics (Computer Science and Data Analysis) - Paul Murrell 5-A Handbook of Statistical
Re: [R] Viewing a data object
Stephen and Christophe, I'm aware of fix and edit and the few issues with fix. Thus my reluctance to use them. Emacs may be the way to go, but from what I heard here it has a steep learning curve. The autocompletion feature in 2.5.1 is great. Andy Liaw points me to JGR which I'm just about to jump in. I was hoping something like the head/tail function with a little more flexibility may also be useful to a lot of folks here. vw = function( , location, nlines=10 ) { #'...' gives the string fragments that identify an object # location : 0.5 = middle, 0.25 = the first quartile, etc # nlines : the number of lines to show } vw(Auro, 0.5) returns the middle part of the first data frame it finds with name string starting with Auro. This function should be easy to write with all thse regular expression functions. Well, I'll save it for my Christmas wish list. H. Stephen Tucker [EMAIL PROTECTED] 6/12/2007 11:25 PM Hi Horace, I have also thought that it may be useful but I don't know of any Object Explorer available for R. However, (you may alread know this but) (1) you can view your list of objects in R with objects(), (2) view objects in a spreadsheet-like table (if they are matrices or data frames) with invisible(edit(objectName)) [which isn't easy on the fingers]. fix(objectName) is also a shorter option but it has the side effect of possibly changing your object when you close the viewing data. For instance, this can happen if you mistakenly type something into a cell; it can also change your column classes when you don't - for example: options(stringsAsFactors=TRUE) x - data.frame(letters[1:5],1:5) sapply(x,class) letters.1.5. X1.5 factorinteger fix(x) # no user-changes made sapply(x,class) letters.1.5. X1.5 factornumeric (3) I believe Deepayan Sarkar contributed the tab-completion capability at the command line. So unless you have a lot of objects beginning with 'AuroraStoch...' you should be able to type a few letters and let the auto-completion handle the rest. Best regards, ST --- Horace Tso [EMAIL PROTECTED] wrote: Dear list, First apologize that this is trivial and just betrays my slothfulness at the keyboard. I'm sick of having to type a long name just to get a glimpse of something. For example, if my data frame is named 'AuroraStochasticRunsJune1.df and I want to see what the middle looks like, I have to type AuroraStochasticRunsJune1.df[ 400:500, ] And often I'm not even sure rows 400 to 500 are what I want to see. I might have to type the same line many times. Is there sort of a R-equivalence of the Object Explorer, like in Splus, where I could mouse-click an object in a list and a window pops up? Short of that, is there any trick of saving a couple of keystrokes here and there? Thanks for tolerating this kind of annoying questions. H. __ 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. Sucker-punch spam with award-winning protection. __ 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] passing (or obtaining) index or element name of list to FUN in lapply()
Hi Professor Ripley, Thanks for the response. I apologize, my examples were not too real (though your solutions are indeed clever)... I was trying to ask more generally whether the element name or index of 'listObj' could be obtained by the user-function 'myfunction' when used in lapply(X=listObj,FUN=myfunction); below I illustrate two cases in which I have come across this desire: (1) In 'Example 1' I essentially take the list element and do some transformations (optionally some number-crunching), and then plot it with the element name of the list for the title. (2) In 'Example 2' I want to read in data from the list element and write the contents to a file; writing a header line only when operating on the first element of the list. ## data specification data1 - var1 var2 -0.44 0.17 1.03 0.93 0.85 0.39 data2 - var1 var2 -0.16 0.97 0.93 0.23 0.80 0.42 L - list(data1=data1,data2=data2) ##=== Example 1 (want element name) === ## function definition plottingfunc - function(i,x) { plot(read.table(textConnection(x[[i]]),header=TRUE),main=names(x)[i]) } ## function application par(mfrow=c(2,1)) lapply(seq(along=L),plottingfunc,x=L) ##=== Example 2 (want element index) === ## function definition readwritefunc - function(i,x,fout) { data - read.table(textConnection(x[[i]]),header=TRUE) if(i==1) cat(paste(colnames(data),collapse=,),\n,file=fout) write.table(data,file=fout,sep=,,col=FALSE, row=FALSE,quote=FALSE,append=TRUE) } ## function application fout - file(out.dat,open=w) lapply(seq(along=L),readwritefunc,x=L,fout=fout) close(fout) Since the above code works, I suppose this is more of a question of aesthetics since I thought the spirit of lapply() was to operate on the elements of a list and not its indices - I thought perhaps there is a way to get the index number and element name from within the user-function. Also, I recall a lesson on 'loop avoidance' from an earlier version of MASS; this was in the days of S-PLUS dominance and perhaps less applicable now to R as you mentioned... But old habits die hard; my amygdala still invokes a fear response at the thought of a loop... (and as of recently, I have been infatuated with the notion of adhering, albeit loosely, to the 'functional programming' paradigm which makes me doubly fearful of loops) Thanks and best regards, Stephen --- Prof Brian Ripley [EMAIL PROTECTED] wrote: On Tue, 12 Jun 2007, Stephen Tucker wrote: Hello everyone, I wonder if there is a way to pass the index or name of a list to a user-specified function in lapply(). For instance, my desired effect is something like the output of L - list(jack=4098,sape=4139) lapply(seq(along=L),function(i,x) if(i==1) jack else sape,x=L) [[1]] [1] jack [[2]] [1] sape as.list(names(L)) lapply(seq(along=L),function(i,x) if(names(x)[i]==jack) 1 else 2,x=L) [[1]] [1] 1 [[2]] [1] 2 as.list(seq_along(L)) lapply() can be faster than a for-loop, but usually not by much: its main advantage is clarity of code. I think we need a real-life example to see what you are trying to do. But by passing L as the first argument of lapply(). I thought there was a tangentially-related post on this mailing list in the past but I don't recall that it was ever addressed directly (and I can't seem to find it now). The examples above are perfectly good alternatives especially if I wrap each of the lines in names-() to return lists with appropriate names assigned, but Try something like L[] - lapply(seq_along(L),function(i,x) if(i==1) jack else sape,x=L) it feels like I am essentially writing a FOR-LOOP - though I was surprised to find that speed-wise, it doesn't seem to make much of a difference (unless I have not selected a rigorous test): N - 1 y - runif(N) ## looping through elements of y system.time(lapply(y, +function(x) { + set.seed(222) + mean(rnorm(1e4,x,1)) +})) [1] 21.00 0.17 21.29NANA ## looping through indices system.time(lapply(1:N, +function(x,y) { + set.seed(222) + mean(rnorm(1e4,y[x],1)) + },y=y)) [1] 21.09 0.14 21.26NANA In Python, there are methods for Lists and Dictionaries called enumerate(), and iteritems(), respectively. Example applications: ## a list L = ['a','b','c'] [x for x in enumerate(L)] ## returns index of list along with the list element [(0, 'a'), (1, 'b'), (2, 'c')] ## a dictionary D = {'jack': 4098, 'sape': 4139} [x for x in D.iteritems()] ## returns element key (name) along with element contents [('sape', 4139), ('jack', 4098)] And this is something of the effect I was looking for... Thanks to all, Stephen __ R-help@stat.math.ethz.ch mailing list
Re: [R] barplot and map overlay
Thank you Greg, It works! On 13 Jun 2007 at 8:27, Greg Snow wrote: Look at the subplot function in the TeachingDemos package. -Original Message- From: Héctor Villalobos [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Sent: 6/11/07 5:48 PM Subject: [R] barplot and map overlay Hi, I wonder if it is possible with the graphics package to overlay one or several plots (barplots, for example) over a map. Data for the map is in a data frame with the latitude and longitude coordinates, and then: plot(map$long, map$lat, type =l) produces the map. I want to put each barplot in specific locations on the map, namely at the center of statistical squares. I´ve seen an example in Paul Murrell´s R Graphics book that seems appropriate (grid package), but a bit complicated. Thanks a lot for any advice. Héctor -- Héctor Villalobos [EMAIL PROTECTED] CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, MÉXICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 2425 Fax. (+52 612) 122 53 22 __ 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] ievent.wait
With locator( ) does it only work in a regular R plot or can I use it with iPlot? I am having difficulty getting it to be used with Iplots, it just calls up a new screen when the function is called. Stone. Sundar Dorai-Raj wrote: Hi, Greg, type = 'b' won't work according to ?locator. Try type = 'o'. HTH,x --sundar Greg Snow said the following on 6/13/2007 7:27 AM: Does locator(type='l') (or type ='b') Work for you? -Original Message- From: ryestone [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch Sent: 6/8/07 10:19 AM Subject: [R] ievent.wait I am working on a plot and would be like to click on a few points and then have a line connect them. Could anyone help me with this or advise me in a direction that would suit this. I know I would be using ievent.wait in iplot but not sure about this. thank you. __ 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. -- View this message in context: http://www.nabble.com/ievent.wait-tf3891095.html#a11105384 Sent from the R help mailing list archive at Nabble.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] Subscription
--- Lucy Namu [EMAIL PROTECTED] wrote: I would like to subscribe and get free software for statistical analysis. Lucy It looks like you are subscribed. To download R http://www.r-project.org/. Some other sources of free software http://www.epidata.dk/ http://gsociology.icaap.org/methods/soft.html http://freestatistics.altervista.org/stat.php http://www.psychnet-uk.com/experimental_design/software_packages.htm http://data.fas.harvard.edu/micah_altman/socsci.shtml __ 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] extractor rows from a matrix
ex1 - ht[,1]and so on? Have a look at Chapter 5 in the Introduction to R --- billycorg [EMAIL PROTECTED] wrote: hi! i have a little problem: my data's matrix has 1093 rows and 3 columns. i'd like to extract each rows.. something like this: ht= my matrix Dt=(???)=a vector with t=1,2...1093 what can i do? thank you! Vincenzo -- View this message in context: http://www.nabble.com/extractor-rows-from-a-matrix-tf3913088.html#a11094459 Sent from the R help mailing list archive at Nabble.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. __ 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] Removing Inf and Inf values from a fata frame
Hi, I have a csv file with empty values, when I apply the different functions (mean, std, etc.) I create a new data frame, the empty values generate Inf and -Inf values. How can I remove those Inf and -Inf values from the new data frame? I already specified na.rm in the mean and std functions, but the values are still there. Thank you, Judith __ 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] Removing Inf and Inf values from a fata frame
Hi, try with df[!is.infinite(your_column_in_d.f.),] -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 Ohttp://maps.google.com/maps?f=qhl=enq=Curitiba,+Brazillayer=ie=UTF8z=18ll=-25.448315,-49.276916spn=0.002054,0.005407t=kom=1 On 13/06/07, Judith Flores [EMAIL PROTECTED] wrote: Hi, I have a csv file with empty values, when I apply the different functions (mean, std, etc.) I create a new data frame, the empty values generate Inf and -Inf values. How can I remove those Inf and -Inf values from the new data frame? I already specified na.rm in the mean and std functions, but the values are still there. Thank you, Judith __ 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.
Re: [R] Read Windows-like .INI files into R data structure?
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... .Ini files are, for lack of a better description, ancient. In this case a device is creating the INI files as part of an experiment, so the file format cannot be changed (at least easily). I've looked at XML files from time to time and I'm amazed more don't complain how bloated, if not wasteful, they are. I've seen XML files that were megabytes long when they held kilobytes worth of data. INI files may be ancient, but they can be efficient and effective compared with XML. In some cases, newer may not really be better (but newer may have the momentum behind it). Gabor Grothendieck [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... In thinking about this a bit more here is an even shorter solution where Lines.raw is as before: # Lines - readLines(myfile.ini) Lines - readLines(textConnection(Lines.raw)) Lines2 - chartr([], ==, Lines) DF - read.table(textConnection(Lines2), as.is = TRUE, sep = =, fill = TRUE) L - DF$V1 == subset(transform(DF, V3 = V2[which(L)[cumsum(L)]])[1:3], V1 != ) Thanks for your helpful suggestions, Gabor. Perhaps your zoo option is more elegant, but I try to use as few packages as possible, so this option seemed the best for me. Since in my problem the structure of the INI sections is almost static and always present, I extended your example to create an in-memory list of everything in the INI file with this function: # Prototype of how to read INI files to process olfactometer data # efg, 13 June 2007 # Thanks to Gabor Grothendieck for helpful suggestions in the R-Help # mailing list on how to parse the INI file. Parse.INI - function(INI.filename) { connection - file(INI.filename) Lines - readLines(connection) close(connection) Lines - chartr([], ==, Lines) # change section headers connection - textConnection(Lines) d - read.table(connection, as.is = TRUE, sep = =, fill = TRUE) close(connection) L - d$V1 == # location of section breaks d - subset(transform(d, V3 = V2[which(L)[cumsum(L)]])[1:3], V1 != ) ToParse - paste(INI.list$, d$V3, $, d$V1, - ', d$V2, ', sep=) INI.list - list() eval(parse(text=ToParse)) return(INI.list) } Here's an example of using the above function (I'll put the sample input file below): INI1 - Parse.INI(sample.ini) # Explore INI contents summary(INI1) INI1$SystemSetup$OlfactometerCode INI1$DefaultLevels unlist(INI1$DefaultLevels) INI1$Map INI1$Map$port1 as.integer( unlist( strsplit(INI1$Map$port1, ,) ) ) = = = = = Sample output: INI1 - Parse.INI(sample.ini) # Explore INI contents summary(INI1) Length Class Mode SystemSetup 1 -none- list Files 8 -none- list DefaultLevels 4 -none- list OdorNames 2 -none- list Map 3 -none- list INI1$SystemSetup$OlfactometerCode [1] 3 INI1$DefaultLevels $FC00 [1] 50 $FC01 [1] 100 $FC02 [1] 50 $FC10 [1] 50 unlist(INI1$DefaultLevels) FC00 FC01 FC02 FC10 50 100 50 50 INI1$Map $port0 [1] 0,0,0,0,0,0,0,0,0,0,0,0 $port1 [1] 0,0,0,0,0,0,0,0,0,0,0,0 $port2 [1] 0,0,0,0,0,0,0,0,0,0,0,0 INI1$Map$port1 [1] 0,0,0,0,0,0,0,0,0,0,0,0 as.integer( unlist( strsplit(INI1$Map$port1, ,) ) ) [1] 0 0 0 0 0 0 0 0 0 0 0 0 = = = = = Sample input file, sample.ini: [SystemSetup] OlfactometerCode=3 [Files] prelog0=Part0.txt date0=2:06:27.461 PM 6/9/2007 note0=group1-1 name0=group1 prelog1=Part1.txt date1=2:09:16.809 PM 6/9/2007 note1=group1-1 name1=group1-1 [DefaultLevels] FC00=50 FC01=100 FC02=50 FC10=50 [OdorNames] port0=None port1=None [Map] port0=0,0,0,0,0,0,0,0,0,0,0,0 port1=0,0,0,0,0,0,0,0,0,0,0,0 port2=0,0,0,0,0,0,0,0,0,0,0,0 = = = = = Thanks again, Gabor! efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ 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] Removing Inf and Inf values from a fata frame
?is.finite for removing the Infs *from the dataframe*, this does not aviod creating them by mean() or std(). Petr Judith Flores napsal(a): Hi, I have a csv file with empty values, when I apply the different functions (mean, std, etc.) I create a new data frame, the empty values generate Inf and -Inf values. How can I remove those Inf and -Inf values from the new data frame? I already specified na.rm in the mean and std functions, but the values are still there. Thank you, Judith __ 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 Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic __ 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] lme() doesn't converge on IGF example
Running the Chapter 4 examples in Pinheiro Bates' Mixed-Effects Models in S and S-PLUS (2000), I get a message that the default optimizer doesn't converge, but using optim for the optimizer results in convergence: library(nlme) fm1IGF.lis - lmList(IGF) fm1IGF.lme - lme(fm1IGF.lis) Error in lme.formula(fixed = conc ~ age, data = IGF, random = list (Lot = c(-0.741604809797216, : nlminb problem, convergence error code = 1; message = iteration limit reached without convergence (9) fm1IGF.lme - lme(fm1IGF.lis, control= list(opt=optim)) I wouldn't have expected the default optimizer to not work with an example from this text. Not knowing anything about the optimizers, I'm wondering if this is expected or known behavior, or if there are tips for getting it to converge other than changing optimizers? nlme Version: 3.1-80 R.Version() $platform [1] i386-apple-darwin8.9.1 $arch [1] i386 $os [1] darwin8.9.1 $system [1] i386, darwin8.9.1 $status [1] $major [1] 2 $minor [1] 5.0 $year [1] 2007 $month [1] 04 $day [1] 23 $`svn rev` [1] 41293 $language [1] R $version.string [1] R version 2.5.0 (2007-04-23) -- David Daniel Associate Professor University Statistics Center New Mexico State University [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] Normal and Poisson tail area expectations in R
I am interested in R functions for the following integrals / sums (expressed best I can in text) - Normal: G_u(k) = Integration_{Lower limit=k}^{Upper limit=infinity} [(u -k) f(u) d(u)], where where u is N(0,1), and f(u) is the density function. Poisson: G(lambda,k) = Sum_{Lower limit=k}^{Upper limit=infinity} [(x-k) p(x, lambda)] where P(x,lambda) is the Poisson prob function with parameter lambda. The Normal expression is very commonly used in inventory management to determine safety stocks (and its tabular values can be found in some texts) - and I am also looking for Poisson and/or Gamma as that'd fit the situation better. I am wondering if there are standard functions in R that might allow me to get these values, instead of needing to do the numerical integration, etc. myself. Thank you very much. - Sucker-punch spam with award-winning protection. [[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] lme() doesn't converge on IGF example
On 6/13/07, David Daniel [EMAIL PROTECTED] wrote: Running the Chapter 4 examples in Pinheiro Bates' Mixed-Effects Models in S and S-PLUS (2000), I get a message that the default optimizer doesn't converge, but using optim for the optimizer results in convergence: library(nlme) fm1IGF.lis - lmList(IGF) fm1IGF.lme - lme(fm1IGF.lis) Error in lme.formula(fixed = conc ~ age, data = IGF, random = list (Lot = c(-0.741604809797216, : nlminb problem, convergence error code = 1; message = iteration limit reached without convergence (9) fm1IGF.lme - lme(fm1IGF.lis, control= list(opt=optim)) I wouldn't have expected the default optimizer to not work with an example from this text. Not knowing anything about the optimizers, I'm wondering if this is expected or known behavior, or if there are tips for getting it to converge other than changing optimizers? That model fit corresponds to a singular variance-covariance matrix for the random effects (notice that the correlation is -1). The way that the model was written in lme this corresponds to an infinite value of one of the parameters so it is actually an advantage that the nlminb optimizer doesn't declare convergence. In the lmer2 function from the lme4 package the model is defined in such a way that the singular variance-covariance matrix corresponds to a value of zero for one of the parameters that is constrained to be nonnegative. Try library(lme4) data(IGF, package = nlme) fm1IGF.lmer - lmer2(conc ~ age + (age|Lot), IGF, control = list(msVerbose = TRUE)) and you will see that the second parameter is exactly zero at convergence (or, at least it is on my amd_64 Linux system). Currently I do not flag this for the user in the show method for the fitted model. I should. Depending on your point of view such a fitted model is either a boundary case or not a legitimate mixed model. The ability to converge to a singular model is actually the big difference between the lmer and the lmer2 functions in the lme4 package. For the lmer2 function the model is expressed in such a way that the log-likelihood or the REML criterion can be evaluated for singular variance-covariance matrices. Furthermore such evaluations approach the boundary evaluations smoothly. The lmer function evaluates the log-likelihood using the precision matrix (i.e. the inverse of the variance-covariance) which, by definition, cannot be evaluated when the variance-covariance matrix is singular. nlme Version: 3.1-80 R.Version() $platform [1] i386-apple-darwin8.9.1 $arch [1] i386 $os [1] darwin8.9.1 $system [1] i386, darwin8.9.1 $status [1] $major [1] 2 $minor [1] 5.0 $year [1] 2007 $month [1] 04 $day [1] 23 $`svn rev` [1] 41293 $language [1] R $version.string [1] R version 2.5.0 (2007-04-23) -- David Daniel Associate Professor University Statistics Center New Mexico State University [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.
Re: [R] Read Windows-like .INI files into R data structure?
Earl: Really depends on the need. XML yes can get crazy (having had to deal with some ugly XML). One can do a correctly formatted XML, that parses via the DOM which does not mean well formatted XML. It's all a matter of design and data structures. XML advantages: one can define own data types with attributes, do data validation and nice searching with XPATH which Is a whole subject in itself. Sounds like XML is overkill for what you need. Based on what you indicated, since not an R expert, writing a Simple C function or Fortran routine would be best way to go, Also gives you re-usable code if you are processing .ini Files outside of the R environment. If you program in Visual Basic or C you can develop a simple DLL to call the old .ini functions which are document On MSDN (Microsoft Developers Network). However, Looks like the R experts from threads gave a nice solution using R. Neil -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Earl F. Glynn Sent: Wednesday, June 13, 2007 2:57 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] Read Windows-like .INI files into R data structure? [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... .Ini files are, for lack of a better description, ancient. In this case a device is creating the INI files as part of an experiment, so the file format cannot be changed (at least easily). I've looked at XML files from time to time and I'm amazed more don't complain how bloated, if not wasteful, they are. I've seen XML files that were megabytes long when they held kilobytes worth of data. INI files may be ancient, but they can be efficient and effective compared with XML. In some cases, newer may not really be better (but newer may have the momentum behind it). Gabor Grothendieck [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... In thinking about this a bit more here is an even shorter solution where Lines.raw is as before: # Lines - readLines(myfile.ini) Lines - readLines(textConnection(Lines.raw)) Lines2 - chartr([], ==, Lines) DF - read.table(textConnection(Lines2), as.is = TRUE, sep = =, fill = TRUE) L - DF$V1 == subset(transform(DF, V3 = V2[which(L)[cumsum(L)]])[1:3], V1 != ) Thanks for your helpful suggestions, Gabor. Perhaps your zoo option is more elegant, but I try to use as few packages as possible, so this option seemed the best for me. Since in my problem the structure of the INI sections is almost static and always present, I extended your example to create an in-memory list of everything in the INI file with this function: # Prototype of how to read INI files to process olfactometer data # efg, 13 June 2007 # Thanks to Gabor Grothendieck for helpful suggestions in the R-Help # mailing list on how to parse the INI file. Parse.INI - function(INI.filename) { connection - file(INI.filename) Lines - readLines(connection) close(connection) Lines - chartr([], ==, Lines) # change section headers connection - textConnection(Lines) d - read.table(connection, as.is = TRUE, sep = =, fill = TRUE) close(connection) L - d$V1 == # location of section breaks d - subset(transform(d, V3 = V2[which(L)[cumsum(L)]])[1:3], V1 != ) ToParse - paste(INI.list$, d$V3, $, d$V1, - ', d$V2, ', sep=) INI.list - list() eval(parse(text=ToParse)) return(INI.list) } Here's an example of using the above function (I'll put the sample input file below): INI1 - Parse.INI(sample.ini) # Explore INI contents summary(INI1) INI1$SystemSetup$OlfactometerCode INI1$DefaultLevels unlist(INI1$DefaultLevels) INI1$Map INI1$Map$port1 as.integer( unlist( strsplit(INI1$Map$port1, ,) ) ) = = = = = Sample output: INI1 - Parse.INI(sample.ini) # Explore INI contents summary(INI1) Length Class Mode SystemSetup 1 -none- list Files 8 -none- list DefaultLevels 4 -none- list OdorNames 2 -none- list Map 3 -none- list INI1$SystemSetup$OlfactometerCode [1] 3 INI1$DefaultLevels $FC00 [1] 50 $FC01 [1] 100 $FC02 [1] 50 $FC10 [1] 50 unlist(INI1$DefaultLevels) FC00 FC01 FC02 FC10 50 100 50 50 INI1$Map $port0 [1] 0,0,0,0,0,0,0,0,0,0,0,0 $port1 [1] 0,0,0,0,0,0,0,0,0,0,0,0 $port2 [1] 0,0,0,0,0,0,0,0,0,0,0,0 INI1$Map$port1 [1] 0,0,0,0,0,0,0,0,0,0,0,0 as.integer( unlist( strsplit(INI1$Map$port1, ,) ) ) [1] 0 0 0 0 0 0 0 0 0 0 0 0 = = = = = Sample input file, sample.ini: [SystemSetup] OlfactometerCode=3 [Files] prelog0=Part0.txt date0=2:06:27.461 PM 6/9/2007 note0=group1-1 name0=group1 prelog1=Part1.txt date1=2:09:16.809 PM 6/9/2007 note1=group1-1 name1=group1-1 [DefaultLevels] FC00=50 FC01=100 FC02=50 FC10=50 [OdorNames] port0=None port1=None [Map] port0=0,0,0,0,0,0,0,0,0,0,0,0 port1=0,0,0,0,0,0,0,0,0,0,0,0 port2=0,0,0,0,0,0,0,0,0,0,0,0 = = = = = Thanks again, Gabor! efg Earl F. Glynn Scientific Programmer Stowers Institute for
Re: [R] Awk and Vilno
Rogerio Porto wrote: Hey, What we should really compare is the four situations: R alone R + awk R + vilno R + awk + vilno and maybe R + SAS Data step and see what scripts are more elegant (read 'short and understandable') I don't think that short and understandable necessarily go hand-in-hand. Sometimes longer scripts which are more explicit and use less tricky syntax shortcuts are much easier to understand a year or two later. Ease and speed of script writing (taking into account learning curve and time taken to consult scripting language documentation) are important, as is the ability to re-visit scripts or examine someone else's script and be able to work out what it does and how it works is vital, and speed of execution also counts with large datasets. Also ubiquity of the tool, whether it is freely available on many platforms, either pre-installed or in an easy-to-install form are also considerations. what do you guys think of creating a R-wiki page for syntax comparisons among the various options to enhance R use? I already have two sugestions: 1) syntax examples for using R and other tools to manipulate and analyze large datasets (with a concise description of the datasets); 2) syntax examples for using R and other tools (or R alone) to clean and prepare datasets (simple and very small datasets, for didatic purposes). The ability of the tools to scale to large or very large datasets is also a consideration, as is their speed when dealing with such large data. I think this could be interesting for R users and to promote other software tools, since it seems there is a lot of R users that use other tools also. Besides that, questions on those two above subjects are prevalent at this list. Thus a wiki page seems to be the right place to discuss and teach this to other users. What do you think? Yes, happy to contribute R + Python examples to such wiki pages. Please post the URL. Tim 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] how to optionally include variables in a data.frame at assignment
I am creating a data.frame inside a function and the set of variables to include depends on the current value of other variables. Is there a way to accomplish this in the original assignment? Or must I first create the core data.frame with the variables I always want and then use if blocks to add other variables? Basically, I'm hoping for something like this (which does not work): newDat - data.frame(x, y, if(zInclude) z else NULL) Thanks, Jenny __ 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] passing (or obtaining) index or element name of list to FUN in lapply()
This sounds like a job for mapply, viz: a.list - list(a=cbind(1:4,rnorm(4)),b=cbind(4:1,rnorm(4))) plot.x.main.y - function(x,y,...) plot( x, main=y, ... ) mapply( plot.x.main.y , a.list, names(a.list) ) Chuck On Wed, 13 Jun 2007, Stephen Tucker wrote: Hi Professor Ripley, Thanks for the response. I apologize, my examples were not too real (though your solutions are indeed clever)... I was trying to ask more generally whether the element name or index of 'listObj' could be obtained by the user-function 'myfunction' when used in lapply(X=listObj,FUN=myfunction); below I illustrate two cases in which I have come across this desire: (1) In 'Example 1' I essentially take the list element and do some transformations (optionally some number-crunching), and then plot it with the element name of the list for the title. (2) In 'Example 2' I want to read in data from the list element and write the contents to a file; writing a header line only when operating on the first element of the list. ## data specification data1 - var1 var2 -0.44 0.17 1.03 0.93 0.85 0.39 data2 - var1 var2 -0.16 0.97 0.93 0.23 0.80 0.42 L - list(data1=data1,data2=data2) ##=== Example 1 (want element name) === ## function definition plottingfunc - function(i,x) { plot(read.table(textConnection(x[[i]]),header=TRUE),main=names(x)[i]) } ## function application par(mfrow=c(2,1)) lapply(seq(along=L),plottingfunc,x=L) ##=== Example 2 (want element index) === ## function definition readwritefunc - function(i,x,fout) { data - read.table(textConnection(x[[i]]),header=TRUE) if(i==1) cat(paste(colnames(data),collapse=,),\n,file=fout) write.table(data,file=fout,sep=,,col=FALSE, row=FALSE,quote=FALSE,append=TRUE) } ## function application fout - file(out.dat,open=w) lapply(seq(along=L),readwritefunc,x=L,fout=fout) close(fout) Since the above code works, I suppose this is more of a question of aesthetics since I thought the spirit of lapply() was to operate on the elements of a list and not its indices - I thought perhaps there is a way to get the index number and element name from within the user-function. Also, I recall a lesson on 'loop avoidance' from an earlier version of MASS; this was in the days of S-PLUS dominance and perhaps less applicable now to R as you mentioned... But old habits die hard; my amygdala still invokes a fear response at the thought of a loop... (and as of recently, I have been infatuated with the notion of adhering, albeit loosely, to the 'functional programming' paradigm which makes me doubly fearful of loops) Thanks and best regards, Stephen --- Prof Brian Ripley [EMAIL PROTECTED] wrote: On Tue, 12 Jun 2007, Stephen Tucker wrote: Hello everyone, I wonder if there is a way to pass the index or name of a list to a user-specified function in lapply(). For instance, my desired effect is something like the output of L - list(jack=4098,sape=4139) lapply(seq(along=L),function(i,x) if(i==1) jack else sape,x=L) [[1]] [1] jack [[2]] [1] sape as.list(names(L)) lapply(seq(along=L),function(i,x) if(names(x)[i]==jack) 1 else 2,x=L) [[1]] [1] 1 [[2]] [1] 2 as.list(seq_along(L)) lapply() can be faster than a for-loop, but usually not by much: its main advantage is clarity of code. I think we need a real-life example to see what you are trying to do. But by passing L as the first argument of lapply(). I thought there was a tangentially-related post on this mailing list in the past but I don't recall that it was ever addressed directly (and I can't seem to find it now). The examples above are perfectly good alternatives especially if I wrap each of the lines in names-() to return lists with appropriate names assigned, but Try something like L[] - lapply(seq_along(L),function(i,x) if(i==1) jack else sape,x=L) it feels like I am essentially writing a FOR-LOOP - though I was surprised to find that speed-wise, it doesn't seem to make much of a difference (unless I have not selected a rigorous test): N - 1 y - runif(N) ## looping through elements of y system.time(lapply(y, +function(x) { + set.seed(222) + mean(rnorm(1e4,x,1)) +})) [1] 21.00 0.17 21.29NANA ## looping through indices system.time(lapply(1:N, +function(x,y) { + set.seed(222) + mean(rnorm(1e4,y[x],1)) + },y=y)) [1] 21.09 0.14 21.26NANA In Python, there are methods for Lists and Dictionaries called enumerate(), and iteritems(), respectively. Example applications: ## a list L = ['a','b','c'] [x for x in enumerate(L)] ## returns index of list along with the list element [(0, 'a'), (1, 'b'), (2, 'c')] ## a dictionary D = {'jack': 4098, 'sape': 4139} [x for x in D.iteritems()] ## returns element key (name) along with element contents
Re: [R] Normal and Poisson tail area expectations in R
On Wed, 13 Jun 2007, kavindra malik wrote: I am interested in R functions for the following integrals / sums (expressed best I can in text) - Normal: G_u(k) = Integration_{Lower limit=k}^{Upper limit=infinity} [(u -k) f(u) d(u)], where where u is N(0,1), and f(u) is the density function. Poisson: G(lambda,k) = Sum_{Lower limit=k}^{Upper limit=infinity} [(x-k) p(x, lambda)] where P(x,lambda) is the Poisson prob function with parameter lambda. The Normal expression is very commonly used in inventory management to determine safety stocks (and its tabular values can be found in some texts) - and I am also looking for Poisson and/or Gamma as that'd fit the situation better. I am wondering if there are standard functions in R that might allow me to get these values, instead of needing to do the numerical integration, etc. myself. Not that I know of, but it is not difficult to do the integration: k - 1.1 # for example integrate(function(x) (x-k)*dnorm(x),lower=k,upper=Inf) 0.06861951 with absolute error 5.5e-07 see ?integrate ?qnorm ?qpois ?qgamma Thank you very much. - Sucker-punch spam with award-winning protection. [[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. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ 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] R vs. Splus in Pharma/Devices Industry
I should have also noted that Sweave is available for use with R. This is offset, however, by the fact that I will probably never be able to convince anyone to use Latex. This is a pity as I often find myself admiring reports done in Latex as opposed to the ones I have worked on in MS Word. Cody Hamilton, PhD Edwards Lifesciences As always, I am speaking for myself and not necessarily for Edwards Lifesciences. [EMAIL PROTECTED] wrote: Following up to some extent on Friday's discussion regarding the 'validation' of R, could I ask the list group's opinion on possible advantages of R over Splus from a pharma/devices perspective? I wish to exclude the obvious price difference, which doesnââ¬â¢t seem to carry as much weight as I would have thought. Besides, I have noticed many former Splus users gravitating towards R, and I suspect that the reasons are not purely economic. I can think of a few advantages of Splus: 1. SeqTrial (of course that means more $) 2. Tech support 3. The warm fuzzies that management seems to get from proprietary software I can also think of a few advantages of R: 1. Based on my personal experiences, simulations requiring a lot of looping seem to run faster. 2. R interfaces with BUGS, for example through BRUGS. 3. The wonderful help list! As always, I am speaking for myself and not necessarily for Edwards Lifesciences. Regards, -Cody Cody Hamilton, PhD Edwards Lifesciences [[alternative HTML version deleted]] [[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] Normal and Poisson tail area expectations in R
Thank you very much. This solves the problem I was trying to solve. I am new to R and am learning. A great lesson in the power of R... Charles C. Berry [EMAIL PROTECTED] wrote: On Wed, 13 Jun 2007, kavindra malik wrote: I am interested in R functions for the following integrals / sums (expressed best I can in text) - Normal: G_u(k) = Integration_{Lower limit=k}^{Upper limit=infinity} [(u -k) f(u) d(u)], where where u is N(0,1), and f(u) is the density function. Poisson: G(lambda,k) = Sum_{Lower limit=k}^{Upper limit=infinity} [(x-k) p(x, lambda)] where P(x,lambda) is the Poisson prob function with parameter lambda. The Normal expression is very commonly used in inventory management to determine safety stocks (and its tabular values can be found in some texts) - and I am also looking for Poisson and/or Gamma as that'd fit the situation better. I am wondering if there are standard functions in R that might allow me to get these values, instead of needing to do the numerical integration, etc. myself. Not that I know of, but it is not difficult to do the integration: k - 1.1 # for example integrate(function(x) (x-k)*dnorm(x),lower=k,upper=Inf) 0.06861951 with absolute error 5.5e-07 see ?integrate ?qnorm ?qpois ?qgamma Thank you very much. - Sucker-punch spam with award-winning protection. [[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. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 - [[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] Formatted Data File Question for Clustering -Quickie Project
if you look at the data USArrests by doing data(USArrets) USArrets you will see that it is a data.frame. so by analogy you could do the following: Probably you have this data in Excel (I guess from the format in your mail). Have the data in a sheet as: convertsshortBais 19940131 0.004 -0.0016 19940228 ... save this sheet as tab limited txt file. then use mydata - read.table(yourdata.txt) now you can use the data.frame mydata in the cluster analysis. I would suggest you read the intro to R. You can also use read.csv see ?read.table for more info, read R import/export on http://finzi.psych.upenn.edu/R/doc/manual/R-data.html good luck. AA. - Original Message - From: [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Sent: Wednesday, June 13, 2007 11:46 AM Subject: [R] Formatted Data File Question for Clustering -Quickie Project I am trying to learn how to format Ascii data files for scan or read into R. Precisely for a quickie project, I found some code (at end of this email) to do exactly what I need: To cluster and graph a dendrogram from package (stats). I am stuck on how to format a text file to run the script. I looked at the dataset USArrests (which would be replaced by my data and labels) using UltraEdit. That data appears to be in binary format and I would simply like a readable ASCII text file. How can I: A) format this data to a file for the script below? B) I would like to use squared Euclidean distance, can hclust support this? Thanks, Neil Gottlieb Here is sub-set example of my data set, return series to cluster: 13 cases by 36 observations): Month Convertible Arbitrage Dedicated Short Bias Emerging Markets 1/31/1994 0.004 -0.016 0.105 2/28/1994 0.002 0.020 -0.011 3/31/1994 -0.010 0.072 -0.046 4/30/1994 -0.025 0.013 -0.084 5/31/1994 -0.010 0.023 -0.007 6/30/1994 0.002 0.064 0.005 7/31/1994 0.001 -0.012 0.058 8/31/1994 0.000 -0.057 0.164 9/30/1994 -0.012 0.016 0.052 10/31/1994 -0.014 -0.004 -0.035 11/30/1994 -0.002 0.030 -0.014 12/31/1994 -0.019 -0.002 -0.042 1/31/1995 -0.006 0.013 -0.100 2/28/1995 0.012 -0.022 -0.079 3/31/1995 0.013 0.004 -0.055 4/30/1995 0.023 -0.004 0.073 5/31/1995 0.017 -0.013 0.013 6/30/1995 0.019 -0.069 0.008 7/31/1995 0.009 -0.059 0.022 8/31/1995 0.008 0.008 0.010 9/30/1995 0.011 -0.029 0.019 10/31/1995 0.013 0.064 -0.057 11/30/1995 0.023 -0.010 -0.031 12/31/1995 0.014 0.049 0.007 1/31/1996 0.021 0.006 0.079 2/29/1996 0.012 -0.056 -0.006 3/31/1996 0.015 -0.009 -0.009 4/30/1996 0.013 -0.066 0.051 5/31/1996 0.016 0.000 0.045 6/30/1996 0.015 0.051 0.054 7/31/1996 0.014 0.098 -0.027 8/31/1996 0.013 -0.034 0.036 9/30/1996 0.011 -0.059 0.016 10/31/1996 0.014 0.043 0.017 11/30/1996 0.014 -0.029 0.026 Code Example from Help files: hc - hclust(dist(USArrests), ave) (dend1 - as.dendrogram(hc)) # print() method str(dend1) # str() method str(dend1, max = 2) # only the first two sub-levels op - par(mfrow= c(2,2), mar = c(5,2,1,4)) plot(dend1) ## triangle type and show inner nodes: plot(dend1, nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8), type = t, center=TRUE) plot(dend1, edgePar=list(col = 1:2, lty = 2:3), dLeaf=1, edge.root = TRUE) plot(dend1, nodePar=list(pch = 2:1,cex=.4*2:1, col = 2:3), horiz=TRUE) dend2 - cut(dend1, h=70) plot(dend2$upper) ## leafs are wrong horizontally: plot(dend2$upper, nodePar=list(pch = c(1,7), col = 2:1)) ## dend2$lower is *NOT* a dendrogram, but a list of .. : plot(dend2$lower[[3]], nodePar=list(col=4), horiz = TRUE, type = tr) ## inner and leaf edges in different type color : plot(dend2$lower[[2]], nodePar=list(col=1),# non empty list edgePar = list(lty=1:2, col=2:1), edge.root=TRUE) par(op) str(d3 - dend2$lower[[2]][[2]][[1]]) nP - list(col=3:2, cex=c(2.0, 0.75), pch= 21:22, bg= c(light blue, pink), lab.cex = 0.75, lab.col = tomato) plot(d3, nodePar= nP, edgePar = list(col=gray, lwd=2), horiz = TRUE) addE - function(n) { if(!is.leaf(n)) { attr(n, edgePar) - list(p.col=plum) attr(n, edgetext) - paste(attr(n,members),members) } n } d3e - dendrapply(d3, addE) plot(d3e, nodePar= nP) plot(d3e, nodePar= nP, leaflab = textlike) This information is being sent at the recipient's request or...{{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. __ 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] Difficulties With Posting To Ongoing Threads on the R Mailing List
A number of people are having the same problem as me, when you post as a response to an ongoing thread, in place of your message, the following message appears: An embedded charset-unspecified text was scrubbed ... and a link is given that leads to the desired message. It's better than nothing , but it sure is annoying, and some readers will skip it instead of doing the extra link. It's also annoying to read a thread, when several posters , through no fault of their own, get scrubbed. I always think of an e-mail as pure ASCII text, unless you add an attachment. Is it possible that some e-mail hosts ( I use gmail ) embed binary code into the e-mail? Maybe the R mailing list software is reacting to that. ** On another note, I tryed posting on gmane, to add to the thread from last week. It just disappeared , or maybe not, I don't know. Maybe it's related to the one-time registration requirement for gmane. * As far as I can tell, the above problem (scrubbing) does not occur when you do a stand-alone post, not as a response to an ongoing thread. Hope it stays that way! ** Have a nice day. __ 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] Offline ? Searching for James Wettenhall's TclTk Examples
Hi, as a starting point for using Tcl/Tk in R, I used to refer to James Wettenhall's nicely presented TclTk Examples formerly hosted at http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ These days I have been trying to reach these pages but without success. Does anyone know (James, himself, perhaps ;-) whether they are / will be available at some other location --- it would be a pity if not; I found them really useful. Any advice/comment welcome Peter __ 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] Where to Find Data Transformation Software
Hello All, Here is the requested information. Most of it was on the original post for the Tools For Preparing Data For Analysis thread from last week, but it got overlooked. They are all given under an open source license. Check 'em out! *** Vilno: data transformation software, that reads in input datasets (rows and columns), crunches through the data, and writes out output datasets. It's an open source application that can replace the SAS datastep ( and also replaces proc transpose and proc means ). Find it at: http://code.google.com/p/vilno ( look in the download section for a tarball, it's a Linux application, can be opened up (and maybe installed) on an Apple as well ). DAP and PSPP: open source implementations for SAS and SPSS. Find it at: http://directory.fsf.org/math/stats * Awk: data transformation/filtering software for semi-structured ASCII files. A predecessor to Perl. Find it at: a lot of places, but try: http://www.gnu.org/software/gawk/gawk.html * Some, but not all , data crunching problems can be handled fairly well by an all-purpose programming language, such as Perl or Python or Ruby. Some, but not all, data crunching problems can be handled reasonably well with the S programming language ( i.e., R ). __ 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] Normal and Poisson tail area expectations in R
More interesting is the Poisson convolution. I don't know if there is an analytic solution to this. I looked at Jolley's Summation of Series and Abramowitz and Stegun, but no help there. It seems that discrete FFT technique should work. Does anyone know the answer? 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 kavindra malik Sent: Wednesday, June 13, 2007 5:45 PM To: Charles C. Berry Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Normal and Poisson tail area expectations in R Thank you very much. This solves the problem I was trying to solve. I am new to R and am learning. A great lesson in the power of R... Charles C. Berry [EMAIL PROTECTED] wrote: On Wed, 13 Jun 2007, kavindra malik wrote: I am interested in R functions for the following integrals / sums (expressed best I can in text) - Normal: G_u(k) = Integration_{Lower limit=k}^{Upper limit=infinity} [(u -k) f(u) d(u)], where where u is N(0,1), and f(u) is the density function. Poisson: G(lambda,k) = Sum_{Lower limit=k}^{Upper limit=infinity} [(x-k) p(x, lambda)] where P(x,lambda) is the Poisson prob function with parameter lambda. The Normal expression is very commonly used in inventory management to determine safety stocks (and its tabular values can be found in some texts) - and I am also looking for Poisson and/or Gamma as that'd fit the situation better. I am wondering if there are standard functions in R that might allow me to get these values, instead of needing to do the numerical integration, etc. myself. Not that I know of, but it is not difficult to do the integration: k - 1.1 # for example integrate(function(x) (x-k)*dnorm(x),lower=k,upper=Inf) 0.06861951 with absolute error 5.5e-07 see ?integrate ?qnorm ?qpois ?qgamma Thank you very much. - Sucker-punch spam with award-winning protection. [[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. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 - [[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.