Re: [R] Discovering methods
On Sun, 30 Nov 2003, Thomas Lumley wrote: > On Fri, 28 Nov 2003, Gabor Grothendieck wrote: > > > Sure, but why are some methods found using methods("POSIXct") > > while other methods not found? > > > > It would be nice to have some reliable documentation-independent > > way to discover all the methods for a class. > > Indeed it would, but that requires registration of methods using either > the S4 approach or the functions for handling S3 methods in namespaces. > > Without this, it is simply not possible to decide, for example, whether > t.test.formula is a method for t() or for t.test() or a separate function. It also needs registration of generics. No one thought to list the members of the group generics (such as "+") as individual generics until recently, and methods() does try to find a corresponding generic to at least find out if t() and t.test() are generic functions. methods() is R-devel does a better job -- even that in R-patched does a better job now a couple of long-standing bugs in find() have been fixed. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] strptime Usage
On Mon, 1 Dec 2003, Ko-Kang Kevin Wang wrote: > Thanks! > > On Wed, 26 Nov 2003, Gabor Grothendieck wrote: > > > Date: Wed, 26 Nov 2003 00:34:11 -0500 (EST) > > From: Gabor Grothendieck <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED], [EMAIL PROTECTED] > > Subject: RE: [R] strptime Usage > > > > > > > > strptime takes a character input and produces a POSIXlt output so > > the format you specify to strptime is the format of the input, > > not the output: > > > >format( strptime("10/22/1986", "%m/%d/%Y"), "%Y-%m" ) > > It worked perfect. Just out of interest, if I want to convert (either > from the original form, i.e. mm/dd/, or the -mm form, to quarterly > format, e.g.: > 1999-1 > 1999-2 > 1999-3 > 1999-4 > is it possible to do with strptime? Or do I have to do something > creative? ;-D Well, strptime converts from strings to internal date format, so it is logically impossible to do this with strptime. As for quarters: how do you define them? Does the quarters() function do what you want? If almost, look at > quarters.POSIXt function (x, ...) { x <- (as.POSIXlt(x)$mon)%/%3 paste("Q", x + 1, sep = "") } for ideas. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] significance in difference of proportions: What problema
> On 28-Nov-03 Torsten Hothorn wrote: > > yes, thats my understanding too. The "enumerative techniques" as > > you call it condition on the data actually observed and determine > > the null distribution of the associated test statistic from the data. > > In contrast, unconditional procedures require some assumptions to the > > underlying data generating process from which the null distribution is > > derived. The appropriate choice depends of the kind of experiment > > under test: In a randomized trial we would like to see all possible > > outcomes of the trial caused by "rerandomization" and the enumerative > > techniques are natural here. When we draw many samples from predefined > > populations, men and women, say, "rerandomization" of gender is of > > course not that easy and we may assume something about the data > > generating process :-) > > Nice example, but it depends on how you look at it! > indeed. > Suppose you have samples of n1 Men and n2 Women and record, for instance, > whether or not each is suffering from a cold (r1 and r2 respectively). > Do M & W differ in their risk of catching cold? > > NH: No difference; implies that the R = (r1+r2) colds have selected > a random subset of the N=(n1+n2) individuals as victims; implies > that the n1 Men out of N are a random subset of the R+(N-R) > Colds/NonColds. So you then have a hypergeometric distribution and are > back with an "exact" test. But are we "assuming somthing about the > data generating process" here? > This is the exact conditional approach where both the row and column marginal totals are fixed and, because in this "simple" 2x2 case the distribution of the test statistic is known to be hypergeometric, there is no need for explicit enumeration (and `fisher.test()' computes the corresponding P-values) and, indeed, we do not need to make any assumtion. But is fixing both the number of women and men (rows) AND the numbers of colds (columns) intuitive when we would like to "learn" something about the two different populations, i.e. the distribution of colds in women and the distribution of colds in men? If we only assume the sample sizes in both populations to be fixed, this reduces to a comparison of two binomial parameters for two independent samples. And in this special situation, we assume something about the data generating process: we assume "cold" to be distributed according to binomial law (OK: this is not really a restrictive assumption, but for continuous responses people tend to assume something like normality). And the comparison of two binomial distribtions leads to exact unconditional inference: this is explained in a very nice way in Agresti (StatMed 20, 2001, 2709-2722) and I hope read it correctly :-) > (Of course, in the background lurks the Ogre of Exchangeability, > in that the probability of catching cold may vary from person to > person, whether Man or Woman, but nothing in the information > plus NH suggests any reason to distinguish any arrangement of the > N people from any other; equivalent to a re-randomisation of > gender ... ??). yes, looks like that. But re-randomization of gender ( = fixed column marginal totals) is maybe hard to sell to our customers :-) Best, Torsten > > Best wishes, > Ted. > > > > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 167 1972 > Date: 29-Nov-03 Time: 10:09:18 > -- XFMail -- > > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Indexing ANOVA table
Prof Brian Ripley wrote: On Sat, 29 Nov 2003 [EMAIL PROTECTED] wrote: Hi all, I'd like to extract a value from an ANOVA table, but experience the following problem: ### This works: s.pseudo <- summary(aov(m ~ block + mix*graz,data=split1)) s.pseudo Df Sum Sq Mean Sq F value Pr(>F) block2 1114.66 557.33 4.4296 0.04192 * mix 16.146.14 0.0488 0.82956 graz 21.450.72 0.0057 0.99427 mix:graz 23.821.91 0.0152 0.98495 Residuals 10 1258.19 125.82 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 s.pseudo[[1]]["mix ","Pr(>F)"] [1] 0.8295556 ### But this doesn't -- why? Why should it? s.split <- summary(aov(m ~ block + mix*graz + Error(Plot),data=split1)) s.split Error: Plot Df Sum Sq Mean Sq F value Pr(>F) block 2 1114.66 557.33 0.8994 0.5265 mix16.146.14 0.0099 0.9298 Residuals 2 1239.37 619.68 Error: Within Df Sum Sq Mean Sq F value Pr(>F) graz 2 1.4464 0.7232 0.3073 0.7437 mix:graz 2 3.8206 1.9103 0.8117 0.4776 Residuals 8 18.8278 2.3535 s.split[["Error: Plot"]] ## extracting first list element works Df Sum Sq Mean Sq F value Pr(>F) block 2 1114.66 557.33 0.8994 0.5265 mix16.146.14 0.0099 0.9298 Residuals 2 1239.37 619.68 s.split[["Error: Plot"]]["mix ","Pr(>F)"] ### <== FAILS Error in s.split[["Error: Plot"]]["mix ", "Pr(>F)"] : incorrect number of dimensions You should have written s.split[["Error: Plot"]][[1]]["mix ","Pr(>F)"] So where is the difference between the two? One is an "aov" object, the other an "aovlist" object. Take a closer look at print.summary.aov, for example. More generally, learn how to look at R objects instead of assuming you know what you are doing: unclass(s.split[["Error: Plot"]]) would have been informative. Thanks for the help - it works now. I had of course tried str(s.split) and str(s.split[["Error: Plot"]]) and also [ ] and [[ ]], but wrongly thought that the remaining "List of 1" was because I extracted a slice of the list instead of a specific list element only... Need to look better next time... Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] wilcoxon-pratt signed rank test in R - drug-effiacy
Hi. I'm going to introduce the R-package for a group of medical doctors later this week and is a little confused about there use of a test named "willcoxon-pratt" for testing if the clinical and biochemical markers has decreased significantly after the use of some drugs for a group of patients. Looking into the R-functions I would in R recommand using a matched-pairs Wilcoxon test with a formula like: wilcox.test(pre,post,alternative='greater',paired=T) Looking deeper into the writings of Pratt I found some 1964-stuff "Pratt JW. Remarks on zeros and ties in the Wilcoxon signed rank procedures. J.Americ.Statistical Assoc. 1959; 54: 655-67. " Do'es any of you know what is the wilcoxon-pratt test compared with the formula described above and how it should be implemented in R. Thanks in advance /Niels Cand. Polit. Niels Steen Krogh Solsortvej 44 2000 F. Tlf: 3888 8613 ZiteLab / EmpoweR youR data with R, Zope and SOAP __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] wilcoxon-pratt signed rank test in R - drug-effiacy
"Niels Steen Krogh" <[EMAIL PROTECTED]> writes: > Hi. > I'm going to introduce the R-package for a group of medical doctors ^ Nitpick: R is a "language and environment (for statististical computation and graphics)". An R-package is something that you load into R, as in the contrib sections on CRAN. > later this week and is a little confused about there use of a test > named "willcoxon-pratt" for testing if the clinical and biochemical > markers has decreased significantly after the use of some drugs for a > group of patients. > > Looking into the R-functions I would in R recommand using a > matched-pairs Wilcoxon test with a formula like: > wilcox.test(pre,post,alternative='greater',paired=T) > > Looking deeper into the writings of Pratt I found some 1964-stuff > "Pratt JW. Remarks on zeros and ties in the Wilcoxon signed rank > procedures. J.Americ.Statistical Assoc. 1959; 54: 655-67. " > > Do'es any of you know what is the wilcoxon-pratt test compared with > the formula described above and how it should be implemented in R. wilcox.test does the original Wilcoxon procedure, discarding any tied pairs (zero difference). The Pratt procedure (rank all differences first, *then* discard tied pairs) is not immediately available, but would be fairly easy to implement, at least for the large-sample case. I wouldn't be surprised if the exact procedure could be performed using Torsten's ExactRankTests package (perm.test or wilcox.exact), but I haven't gone deeply into it. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Changing distance scale in plclust()
I want to plot the cluster trees from the results of hclust() on different datasets, but all with the same distance scale corresponding to the dataset with the largest distance range. However, plclust() does not accept ylim values. Does anyone know of a way around this problem? Mike White __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Rd Files?
Hi! Are there scripts or packages for generating Rd files out of "S3" code on cran? Has any one written such scripts (e.g. in Perl?) and are willing to share them? Thanks in advance. Eryk. Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: [EMAIL PROTECTED]---W-W [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Sampling
UseRs, I imported a table using "read.table". It has 209 observations, I want to select a sample with 106 observations. What function I use? thanks. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
On 1 Dec 2003 at 13:21, Wolski wrote: It is not entirely clear what you want, but if you want to translate S[-Plus] help files to Rd format, there is [windows] Rcmd Sd2Rd [unix] R cmd Sd2Rd Kjetil Halvorsen > Hi! > > Are there scripts or packages for generating Rd files out of "S3" code > on cran? Has any one written such scripts (e.g. in Perl?) and are > willing to share them? > > Thanks in advance. > > Eryk. > > Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > Genomics Ihnestrasse 73 14195 Berlin 'v' tel: > 0049-30-84131285 / \ mail: [EMAIL PROTECTED] > ---W-W > > > [[alternative HTML version deleted]] > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
Hi Kjetil! I have an *.R file with a lot of functions and I am looking for a script which would generate the skeleton of an Rd file for all functions found in the R file. It will be nice if the can already generate the "name","usage" and the "arguments" field from the source so that i have to edit only the description and examples Eryk *** REPLY SEPARATOR *** On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: >On 1 Dec 2003 at 13:21, Wolski wrote: > >It is not entirely clear what you want, but if you want to translate >S[-Plus] help files to Rd format, there is [windows] >Rcmd Sd2Rd >[unix] >R cmd Sd2Rd > >Kjetil Halvorsen > >> Hi! >> >> Are there scripts or packages for generating Rd files out of "S3" code >> on cran? Has any one written such scripts (e.g. in Perl?) and are >> willing to share them? >> >> Thanks in advance. >> >> Eryk. >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] >> ---W-W >> >> >> [[alternative HTML version deleted]] >> >> __ >> [EMAIL PROTECTED] mailing list >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Cluster analysis for multinominal data?
Dear all, Are there some other clusters algorithms suitable for multinominal data (except DAISY) available for R? Thanks Michal --- Odchozí zpráva neobsahuje viry. Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz). Verze: 6.0.543 / Virová báze: 337 - datum vydání: 21.11.2003 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
AW: [R] Sampling
Hi, you can use something like > example.data <- data.frame(x=rnorm(209), y=rnorm(209)) > selected.sample <- example.data[sample(209,106), ] See ?sample. -Heinrich. > -Ursprüngliche Nachricht- > Von: Savano [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 01. Dezember 2003 13:38 > An: Lista R > Betreff: [R] Sampling > > > UseRs, > > I imported a table using "read.table". It has 209 > observations, I want to > select a sample with 106 observations. What function I use? > > thanks. > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
?prompt ?package.skeleton and do read `Writing R Extensions' On Mon, 1 Dec 2003, Wolski wrote: > Hi Kjetil! > > I have an *.R file with a lot of functions and I am looking for a script > which would generate the skeleton of an Rd file for all functions found > in the R file. It will be nice if the can already generate the > "name","usage" and the "arguments" field from the source so that i have > to edit only the description and examples > > Eryk > > > > *** REPLY SEPARATOR *** > > On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: > > >On 1 Dec 2003 at 13:21, Wolski wrote: > > > >It is not entirely clear what you want, but if you want to translate > >S[-Plus] help files to Rd format, there is [windows] > >Rcmd Sd2Rd > >[unix] > >R cmd Sd2Rd > > > >Kjetil Halvorsen > > > >> Hi! > >> > >> Are there scripts or packages for generating Rd files out of "S3" code > >> on cran? Has any one written such scripts (e.g. in Perl?) and are > >> willing to share them? > >> > >> Thanks in advance. > >> > >> Eryk. > >> > >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: > >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] > >> ---W-W > >> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> [EMAIL PROTECTED] mailing list > >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics > Ihnestrasse 73 14195 Berlin 'v' > tel: 0049-30-84131285 / \ > mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Sampling
> UseRs, > > I imported a table using "read.table". It has 209 observations, I want to > select a sample with 106 observations. What function I use? sample(), of course. See the help page (?sample) for the details and the options (with or without replacement). I guess you want something like: DF[sample(1:209, 106), ] where DF is your imported table. Emmanuel Paradis > thanks. > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
Hi! Seems to me that package.skeleton(...) does not like assignment functions. System: Windows 2000 package.skeleton(name="testpack",list=ls(),path="c:/home/wolski/devel",force=T) Creating directories ... Creating DESCRIPTION ... Creating READMEs ... Saving functions and data ... Error in file(file, ifelse(append, "a", "w")) : unable to open connection In addition: Warning message: cannot open file `c:/home/wolski/devel/testpack/R/[[<-.caliblist.R' Eryk *** REPLY SEPARATOR *** On 12/1/2003 at 1:08 PM Prof Brian Ripley wrote: >?prompt >?package.skeleton > >and do read `Writing R Extensions' > > >On Mon, 1 Dec 2003, Wolski wrote: > >> Hi Kjetil! >> >> I have an *.R file with a lot of functions and I am looking for a script >> which would generate the skeleton of an Rd file for all functions found >> in the R file. It will be nice if the can already generate the >> "name","usage" and the "arguments" field from the source so that i have >> to edit only the description and examples >> >> Eryk >> >> >> >> *** REPLY SEPARATOR *** >> >> On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: >> >> >On 1 Dec 2003 at 13:21, Wolski wrote: >> > >> >It is not entirely clear what you want, but if you want to translate >> >S[-Plus] help files to Rd format, there is [windows] >> >Rcmd Sd2Rd >> >[unix] >> >R cmd Sd2Rd >> > >> >Kjetil Halvorsen >> > >> >> Hi! >> >> >> >> Are there scripts or packages for generating Rd files out of "S3" code >> >> on cran? Has any one written such scripts (e.g. in Perl?) and are >> >> willing to share them? >> >> >> >> Thanks in advance. >> >> >> >> Eryk. >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >> >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: >> >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] >> >> ---W-W >> >> >> >> >> >> [[alternative HTML version deleted]] >> >> >> >> __ >> >> [EMAIL PROTECTED] mailing list >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >Genomics >> Ihnestrasse 73 14195 Berlin 'v' >> tel: 0049-30-84131285 / \ >> mail: [EMAIL PROTECTED]---W-W >http://www.molgen.mpg.de/~wolski >> >> __ >> [EMAIL PROTECTED] mailing list >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> > >-- >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 Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
On Mon, 1 Dec 2003, Wolski wrote: > Hi! > > > Seems to me that package.skeleton(...) does not like assignment functions. > System: Windows 2000 And that's your problem! It's a problem with your OS, not package.skeleton. And it is known. > > > package.skeleton(name="testpack",list=ls(),path="c:/home/wolski/devel",force=T) > Creating directories ... > Creating DESCRIPTION ... > Creating READMEs ... > Saving functions and data ... > Error in file(file, ifelse(append, "a", "w")) : > unable to open connection > In addition: Warning message: > cannot open file `c:/home/wolski/devel/testpack/R/[[<-.caliblist.R' > > Eryk > > > *** REPLY SEPARATOR *** > > On 12/1/2003 at 1:08 PM Prof Brian Ripley wrote: > > >?prompt > >?package.skeleton > > > >and do read `Writing R Extensions' > > > > > >On Mon, 1 Dec 2003, Wolski wrote: > > > >> Hi Kjetil! > >> > >> I have an *.R file with a lot of functions and I am looking for a script > >> which would generate the skeleton of an Rd file for all functions found > >> in the R file. It will be nice if the can already generate the > >> "name","usage" and the "arguments" field from the source so that i have > >> to edit only the description and examples > >> > >> Eryk > >> > >> > >> > >> *** REPLY SEPARATOR *** > >> > >> On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: > >> > >> >On 1 Dec 2003 at 13:21, Wolski wrote: > >> > > >> >It is not entirely clear what you want, but if you want to translate > >> >S[-Plus] help files to Rd format, there is [windows] > >> >Rcmd Sd2Rd > >> >[unix] > >> >R cmd Sd2Rd > >> > > >> >Kjetil Halvorsen > >> > > >> >> Hi! > >> >> > >> >> Are there scripts or packages for generating Rd files out of "S3" code > >> >> on cran? Has any one written such scripts (e.g. in Perl?) and are > >> >> willing to share them? > >> >> > >> >> Thanks in advance. > >> >> > >> >> Eryk. > >> >> > >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > >> >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: > >> >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] > >> >> ---W-W > >> >> > >> >> > >> >> [[alternative HTML version deleted]] > >> >> > >> >> __ > >> >> [EMAIL PROTECTED] mailing list > >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >> > >> > >> > >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > >Genomics > >> Ihnestrasse 73 14195 Berlin 'v' > >> tel: 0049-30-84131285 / \ > >> mail: [EMAIL PROTECTED]---W-W > >http://www.molgen.mpg.de/~wolski > >> > >> __ > >> [EMAIL PROTECTED] mailing list > >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >> > >> > > > >-- > >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 > > > > Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics > Ihnestrasse 73 14195 Berlin 'v' > tel: 0049-30-84131285 / \ > mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski > > > -- 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 272860 (secr) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
Hi! I can generate the package skeleton under unix. But i am not shure what are further consequences? Would it be still possible to rcmd install ... the package under windows? If I stay under windows how than to name the Rd files for assignement functions? Does it matter how the name of the Rd file are? Eryk I would like to have a windows version of the package. *** REPLY SEPARATOR *** On 12/1/2003 at 1:26 PM Prof Brian D Ripley wrote: >On Mon, 1 Dec 2003, Wolski wrote: > >> Hi! >> >> >> Seems to me that package.skeleton(...) does not like assignment >functions. >> System: Windows 2000 > >And that's your problem! It's a problem with your OS, not >package.skeleton. And it is known. > >> >> >> >package.skeleton(name="testpack",list=ls(),path="c:/home/wolski/devel",force=T) >> Creating directories ... >> Creating DESCRIPTION ... >> Creating READMEs ... >> Saving functions and data ... >> Error in file(file, ifelse(append, "a", "w")) : >> unable to open connection >> In addition: Warning message: >> cannot open file `c:/home/wolski/devel/testpack/R/[[<-.caliblist.R' >> >> Eryk >> >> >> *** REPLY SEPARATOR *** >> >> On 12/1/2003 at 1:08 PM Prof Brian Ripley wrote: >> >> >?prompt >> >?package.skeleton >> > >> >and do read `Writing R Extensions' >> > >> > >> >On Mon, 1 Dec 2003, Wolski wrote: >> > >> >> Hi Kjetil! >> >> >> >> I have an *.R file with a lot of functions and I am looking for a >script >> >> which would generate the skeleton of an Rd file for all functions >found >> >> in the R file. It will be nice if the can already generate the >> >> "name","usage" and the "arguments" field from the source so that i >have >> >> to edit only the description and examples >> >> >> >> Eryk >> >> >> >> >> >> >> >> *** REPLY SEPARATOR *** >> >> >> >> On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: >> >> >> >> >On 1 Dec 2003 at 13:21, Wolski wrote: >> >> > >> >> >It is not entirely clear what you want, but if you want to translate >> >> >S[-Plus] help files to Rd format, there is [windows] >> >> >Rcmd Sd2Rd >> >> >[unix] >> >> >R cmd Sd2Rd >> >> > >> >> >Kjetil Halvorsen >> >> > >> >> >> Hi! >> >> >> >> >> >> Are there scripts or packages for generating Rd files out of "S3" >code >> >> >> on cran? Has any one written such scripts (e.g. in Perl?) and are >> >> >> willing to share them? >> >> >> >> >> >> Thanks in advance. >> >> >> >> >> >> Eryk. >> >> >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >> >> >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: >> >> >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] >> >> >> ---W-W >> >> >> >> >> >> >> >> >> [[alternative HTML version deleted]] >> >> >> >> >> >> __ >> >> >> [EMAIL PROTECTED] mailing list >> >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> >> >> >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >> >Genomics >> >> Ihnestrasse 73 14195 Berlin 'v' >> >> tel: 0049-30-84131285 / \ >> >> mail: [EMAIL PROTECTED]---W-W >> >http://www.molgen.mpg.de/~wolski >> >> >> >> __ >> >> [EMAIL PROTECTED] mailing list >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> >> >> >> > >> >-- >> >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 >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >Genomics >> Ihnestrasse 73 14195 Berlin 'v' >> tel: 0049-30-84131285 / \ >> mail: [EMAIL PROTECTED]---W-W >http://www.molgen.mpg.de/~wolski >> >> >> > >-- >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 272860 (secr) >Oxford OX1 3TG, UKFax: +44 1865 272595 > >__ >[EMAIL PROTECTED] mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
On Mon, 1 Dec 2003, Wolski wrote: > Hi! > I can generate the package skeleton under unix. > But i am not shure what are further consequences? > Would it be still possible to > rcmd install ... > the package under windows? > > If I stay under windows how than to name the Rd files for assignement > functions? Does it matter how the name of the Rd file are? It does not matter. > > Eryk > > > > > I would like to have a windows version of the package. > *** REPLY SEPARATOR *** > > On 12/1/2003 at 1:26 PM Prof Brian D Ripley wrote: > > >On Mon, 1 Dec 2003, Wolski wrote: > > > >> Hi! > >> > >> > >> Seems to me that package.skeleton(...) does not like assignment > >functions. > >> System: Windows 2000 > > > >And that's your problem! It's a problem with your OS, not > >package.skeleton. And it is known. > > > >> > >> > >> > >package.skeleton(name="testpack",list=ls(),path="c:/home/wolski/devel",force=T) > >> Creating directories ... > >> Creating DESCRIPTION ... > >> Creating READMEs ... > >> Saving functions and data ... > >> Error in file(file, ifelse(append, "a", "w")) : > >>unable to open connection > >> In addition: Warning message: > >> cannot open file `c:/home/wolski/devel/testpack/R/[[<-.caliblist.R' > >> > >> Eryk > >> > >> > >> *** REPLY SEPARATOR *** > >> > >> On 12/1/2003 at 1:08 PM Prof Brian Ripley wrote: > >> > >> >?prompt > >> >?package.skeleton > >> > > >> >and do read `Writing R Extensions' > >> > > >> > > >> >On Mon, 1 Dec 2003, Wolski wrote: > >> > > >> >> Hi Kjetil! > >> >> > >> >> I have an *.R file with a lot of functions and I am looking for a > >script > >> >> which would generate the skeleton of an Rd file for all functions > >found > >> >> in the R file. It will be nice if the can already generate the > >> >> "name","usage" and the "arguments" field from the source so that i > >have > >> >> to edit only the description and examples > >> >> > >> >> Eryk > >> >> > >> >> > >> >> > >> >> *** REPLY SEPARATOR *** > >> >> > >> >> On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: > >> >> > >> >> >On 1 Dec 2003 at 13:21, Wolski wrote: > >> >> > > >> >> >It is not entirely clear what you want, but if you want to translate > >> >> >S[-Plus] help files to Rd format, there is [windows] > >> >> >Rcmd Sd2Rd > >> >> >[unix] > >> >> >R cmd Sd2Rd > >> >> > > >> >> >Kjetil Halvorsen > >> >> > > >> >> >> Hi! > >> >> >> > >> >> >> Are there scripts or packages for generating Rd files out of "S3" > >code > >> >> >> on cran? Has any one written such scripts (e.g. in Perl?) and are > >> >> >> willing to share them? > >> >> >> > >> >> >> Thanks in advance. > >> >> >> > >> >> >> Eryk. > >> >> >> > >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > >> >> >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: > >> >> >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] > >> >> >> ---W-W > >> >> >> > >> >> >> > >> >> >> [[alternative HTML version deleted]] > >> >> >> > >> >> >> __ > >> >> >> [EMAIL PROTECTED] mailing list > >> >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >> >> > >> >> > >> >> > >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > >> >Genomics > >> >> Ihnestrasse 73 14195 Berlin 'v' > >> >> tel: 0049-30-84131285 / \ > >> >> mail: [EMAIL PROTECTED]---W-W > >> >http://www.molgen.mpg.de/~wolski > >> >> > >> >> __ > >> >> [EMAIL PROTECTED] mailing list > >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >> >> > >> >> > >> > > >> >-- > >> >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 > >> > >> > >> > >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate > >Genomics > >> Ihnestrasse 73 14195 Berlin 'v' > >> tel: 0049-30-84131285 / \ > >> mail: [EMAIL PROTECTED]---W-W > >http://www.molgen.mpg.de/~wolski > >> > >> > >> > > > >-- > >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 272860 (secr) > >Oxford OX1 3TG, UKFax: +44 1865 272595 > > > >__ > >[EMAIL PROTECTED] mailing list > >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics > Ihnestrasse 73 14195 Berlin 'v' > tel: 0049-30-84131285 / \ > mail: [EMAIL PROTECTED]
Re: [R] Rd Files?
Hallo! If it does not matter how the name of the Rd file are, would it be difficult than to modify the package.skeleton function, so that it works under windows 2000 too? Eryk *** REPLY SEPARATOR *** On 12/1/2003 at 1:54 PM Prof Brian Ripley wrote: >On Mon, 1 Dec 2003, Wolski wrote: > >> Hi! >> I can generate the package skeleton under unix. >> But i am not shure what are further consequences? >> Would it be still possible to >> rcmd install ... >> the package under windows? >> >> If I stay under windows how than to name the Rd files for assignement >> functions? Does it matter how the name of the Rd file are? > >It does not matter. > >> >> Eryk >> >> >> >> >> I would like to have a windows version of the package. >> *** REPLY SEPARATOR *** >> >> On 12/1/2003 at 1:26 PM Prof Brian D Ripley wrote: >> >> >On Mon, 1 Dec 2003, Wolski wrote: >> > >> >> Hi! >> >> >> >> >> >> Seems to me that package.skeleton(...) does not like assignment >> >functions. >> >> System: Windows 2000 >> > >> >And that's your problem! It's a problem with your OS, not >> >package.skeleton. And it is known. >> > >> >> >> >> >> >> >> >>package.skeleton(name="testpack",list=ls(),path="c:/home/wolski/devel",force=T) >> >> Creating directories ... >> >> Creating DESCRIPTION ... >> >> Creating READMEs ... >> >> Saving functions and data ... >> >> Error in file(file, ifelse(append, "a", "w")) : >> >> unable to open connection >> >> In addition: Warning message: >> >> cannot open file `c:/home/wolski/devel/testpack/R/[[<-.caliblist.R' >> >> >> >> Eryk >> >> >> >> >> >> *** REPLY SEPARATOR *** >> >> >> >> On 12/1/2003 at 1:08 PM Prof Brian Ripley wrote: >> >> >> >> >?prompt >> >> >?package.skeleton >> >> > >> >> >and do read `Writing R Extensions' >> >> > >> >> > >> >> >On Mon, 1 Dec 2003, Wolski wrote: >> >> > >> >> >> Hi Kjetil! >> >> >> >> >> >> I have an *.R file with a lot of functions and I am looking for a >> >script >> >> >> which would generate the skeleton of an Rd file for all functions >> >found >> >> >> in the R file. It will be nice if the can already generate the >> >> >> "name","usage" and the "arguments" field from the source so that i >> >have >> >> >> to edit only the description and examples >> >> >> >> >> >> Eryk >> >> >> >> >> >> >> >> >> >> >> >> *** REPLY SEPARATOR *** >> >> >> >> >> >> On 12/1/2003 at 8:44 AM [EMAIL PROTECTED] wrote: >> >> >> >> >> >> >On 1 Dec 2003 at 13:21, Wolski wrote: >> >> >> > >> >> >> >It is not entirely clear what you want, but if you want to >translate >> >> >> >S[-Plus] help files to Rd format, there is [windows] >> >> >> >Rcmd Sd2Rd >> >> >> >[unix] >> >> >> >R cmd Sd2Rd >> >> >> > >> >> >> >Kjetil Halvorsen >> >> >> > >> >> >> >> Hi! >> >> >> >> >> >> >> >> Are there scripts or packages for generating Rd files out of >"S3" >> >code >> >> >> >> on cran? Has any one written such scripts (e.g. in Perl?) and >are >> >> >> >> willing to share them? >> >> >> >> >> >> >> >> Thanks in advance. >> >> >> >> >> >> >> >> Eryk. >> >> >> >> >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. >Vertebrate >> >> >> >> Genomics Ihnestrasse 73 14195 Berlin 'v' tel: >> >> >> >> 0049-30-84131285 / \ mail: [EMAIL PROTECTED] >> >> >> >> ---W-W >> >> >> >> >> >> >> >> >> >> >> >> [[alternative HTML version deleted]] >> >> >> >> >> >> >> >> __ >> >> >> >> [EMAIL PROTECTED] mailing list >> >> >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> >> >> >> >> >> >> >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >> >> >Genomics >> >> >> Ihnestrasse 73 14195 Berlin 'v' >> >> >> tel: 0049-30-84131285 / \ >> >> >> mail: [EMAIL PROTECTED]---W-W >> >> >http://www.molgen.mpg.de/~wolski >> >> >> >> >> >> __ >> >> >> [EMAIL PROTECTED] mailing list >> >> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help >> >> >> >> >> >> >> >> > >> >> >-- >> >> >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 >> >> >> >> >> >> >> >> Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate >> >Genomics >> >> Ihnestrasse 73 14195 Berlin 'v' >> >> tel: 0049-30-84131285 / \ >> >> mail: [EMAIL PROTECTED]---W-W >> >http://www.molgen.mpg.de/~wolski >> >> >> >> >> >> >> > >> >-- >> >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 1
Re: [R] Rd Files?
On Mon, 1 Dec 2003, Wolski wrote: > If it does not matter how the name of the Rd file are, would it be > difficult than to modify the package.skeleton function, so that it works > under windows 2000 too? Why don't you try to do it and find out how difficult it is *for you*? -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] wilcoxon-pratt signed rank test in R - drug-effiacy
Hi, after Dixon and Mood (1946) had originally proposed a sign test with ties included, the suggestion to "discard" ties was then made by Dixon and Massey (1951), Putter (1955) and, then, Pratt (1959). Recently, this problem has been revisited and it has been found that ties can only be discarded if they are "exact", meaning that there is no possibility that differences have been merely overlooked. This often applies to genetics. * Wittkowski KM, Liu X (2002) A statistically valid alternative to the TDT. Hum Hered 54: 157-164 If, instead, ties are due to rounding or the use of discrete surrogate variables for continuous phenomena, ties must not be excluded. * Wittkowski, KM (1998) Versions of the sign test in the presence of ties. Biometrics 54: 789791 * Rayner JCW, Best DJ (1999) Modelling Ties in the Sign Test. Biometrics 55: 663-665 * Randles HR (2001) On neutral responses (zeros) in the sign test and ties in the Wilcoxon-Mann-Whitney Test. Am Statist 55: 96-101 * Fong DYT, Kwan CW, Lam KF et al. (2002) Use of the sign test for the median in the presence of ties. Am Statist 57: 237-240 While the above papers address the sign test, rather than the Wilcoxon signed rank test, the same rationale applies. Note that if two tests, i.e., the sign test with ties discarded and the sign test with ties not discarded, are not asymptotically equivalent, a single "exact" tests cannot be appropriate for both. I hope this helps Knut At 13:04 2003-12-01 +0100, you wrote: >"Niels Steen Krogh" <[EMAIL PROTECTED]> writes: > > > a group of medical doctors ... is a little confused about there use of > a test > > named "willcoxon-pratt" for testing if the clinical and biochemical > > markers has decreased significantly after the use of some drugs for a > > group of patients. > > > > Looking into the R-functions I would in R recommand using a > > matched-pairs Wilcoxon test with a formula like: > > wilcox.test(pre,post,alternative='greater',paired=T) > > > > Looking deeper into the writings of Pratt I found some 1964-stuff > > "Pratt JW. Remarks on zeros and ties in the Wilcoxon signed rank > > procedures. J.Americ.Statistical Assoc. 1959; 54: 655-67. " > > > > Do'es any of you know what is the wilcoxon-pratt test compared with > > the formula described above and how it should be implemented in R. > >wilcox.test does the original Wilcoxon procedure, discarding any tied >pairs (zero difference). The Pratt procedure (rank all differences >first, *then* discard tied pairs) is not immediately available, but >would be fairly easy to implement, at least for the large-sample case. >I wouldn't be surprised if the exact procedure could be performed >using Torsten's ExactRankTests package (perm.test or wilcox.exact), >but I haven't gone deeply into it. > >-- >O__ Peter Dalgaard Blegdamsvej 3 > c/ /'_ --- Dept. of Biostatistics 2200 Cph. N > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 >~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 > >__ >[EMAIL PROTECTED] mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help Knut M. Wittkowski, PhD,DSc -- The Rockefeller University, GCRC Experimental Design and Biostatistics 1230 York Ave #121B, Box 322, NY,NY 10021 +1(212)327-7175, +1(212)327-8450 (Fax) [EMAIL PROTECTED] http://www.rucares.org/clinicalresearch/dept/biometry/ [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Discovering methods
On Sun, 30 Nov 2003, Gabor Grothendieck wrote: > > > Thanks. I guess we have to be content to approximate this via: > >apropos("POSIXt$|POSIXct$") > > although this supposes we know that POSIXct inherits from POSIXt > and its not clear that there is a reliable way to discover that > for S3 classes. It's actually easier for S3 classes, since there it is objects that inherit, not classes: eg > class(.leap.seconds) [1] "POSIXt" "POSIXct" -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] cclust - cindex - binary data
If anybody had the same problem I had in calculating the cindex with the clustIndex function (binary data), replace this line of code: if (length(unique(x))==2) with this one: if (length(unique(as.vector(x)))==2) located in the call to the procedure for calculating the cindex, in the cclust file, in the library/cclust/R folder. Bruno - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 28, 2003 12:10 PM Subject: [R] cclust - cindex - binary data > Hi, > I'm trying to debug a function I wrote to calculate the cindex for a > hierarchical tree. > For this it is useful to compare my calculations with those in output from > the clustindex function, in the cclust library. > There's no way, however, to have the cindex value for a given output of the > cclust function, as a NA value is always returned. > This happens almost surely because the cindex in clustIndex is calculated > only for binary data, but, in turn, I can't find a way to specify either > with the cclust function or with the clustIndex function, that an eventual > input data set is binary. > > Thanks a lot > Bruno > > > Bruno L. Giordano - Ph. D. student > Dipartimento di Psicologia Generale > Via Venezia 8 - 35131 Padova, Italy > > currently hosted by > > KTH - Royal Institute of Technology > TMH - Department of Speech, Music and Hearing > Drottning Kristinas v. 31 > SE-100 44 Stockholm, Sweden > > - > This mail sent through IMP: webmail.unipd.it __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] with for objects
I'm not sure S4 objects are really meant to be used this way. Maybe you could write a plot method? -roger Hadley Wickham wrote: Is there a form of with (or an equivalent function) that can be applied to objects? I'd like to be able to write something like (drawing from bioconductor + trellis as an example) xyplot(maA ~ maM | maPrintTip, object = swirl[,1]) which would be interpreted as xyplot(swirl[,[EMAIL PROTECTED] ~ swirl[,[EMAIL PROTECTED] | swirl[,[EMAIL PROTECTED]) (or even better, match functions not slots eg. as xyplot(maA(swirl[,1]) ~ maM(swirl[,1]) | maPrintTip(swirl[,1]))) If there isn't, can any one offer any tips on writing such a function. I presume I'd have to deparse the formula, match the text with the slots/methods of the function, create the appropriate call objects and then call them? Thanks for you help, Hadley __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] matrix bending
Dear All, I was wondering whether any one knows of a matrix bending function in R that can turn non-positive definite matrices into the nearest positive definite matrix. I was hoping there would be something akin to John Henshall's flbend program (http://agbu.une.edu.au/~kmeyer/pdmatrix.html), which allows the standard errors of the estimated matrix elements to be considered in the bending process. Thanks, Jarrod. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] white's general heterocedasticity test
UseRs, I want to do the white's general heterocedasticity test, but I don't find that function. I find "white.test" that's ' White Neural Network Test for Nonlinearity'. Anybody help me? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
Hi! Thanks for suggestions. Sincerely Eryk Ps. In the attachment are prompt and package.skeleton modified so that it works on windows 2000 too. It substitutes <- in file names = before writing if sys.info()["sysname"]=="Windows". *** REPLY SEPARATOR *** On 12/1/2003 at 2:23 PM Prof Brian Ripley wrote: >On Mon, 1 Dec 2003, Wolski wrote: > >> If it does not matter how the name of the Rd file are, would it be >> difficult than to modify the package.skeleton function, so that it works >> under windows 2000 too? > >Why don't you try to do it and find out how difficult it is *for you*? > >-- >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 Dipl. bio-chem. Eryk Witold Wolski@MPI-MG Dep. Vertebrate Genomics Ihnestrasse 73 14195 Berlin 'v' tel: 0049-30-84131285 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] significance in difference of proportions
Hello, thanks for the replies to this subject. I'm using a fisher.test to test if the proportions of my 2 samples are different (see Ted's example below). The assumption was that the two samples are from the same population and that they may contain a different number of "positives" (due to different treatment). I may be able to figues out the true probability to get a "positive", since I for some of my experiments I know the entire population. E.g. the samples (111 items, and 10 items) come from a population of 10,000 items, and I know that there are 200 positives in the population. Is it possible to use the fisher test for testing equallity of proportions and to include the known probability to find a positive - would that make sense at all? If the two samples come from the same population the probability to find a positive shouldn't influence the test for difference of proportions, should it? At some point I'd like to extend the statistics so that the two samples can come from 2 different populations (with known probability for the positives). I'm happy to receive suggestions and comments on this. thanks a lot again for your help, Arne > > On 27-Nov-03 [EMAIL PROTECTED] wrote: > > I've 2 samples A (111 items) and B (10 items) drawn from the same > > unknown population. Witihn A I find 9 "positives" and in B 0 > > positives. I'd like to know if the 2 samples A and B are different, > > ie is there a way to find out whether the number of "positives" is > > significantly different in A and B? > > Pretty obviously not, just from looking at the numbers: > > 9 out of 111 -> p = P(positive) approx = 1/10 > > P(0 out of 10 when p = 1/10) is not unlikely (in fact = 0.35). > > However, a Fisher exact test will give you a respectable P-value: > > > library(ctest) > > ?fisher.test > > fisher.test(matrix(c(102,9,10,0),nrow=2)) > [...] > p-value = 1 > alternative hypothesis: true odds ratio is not equal to 1 > 95 percent confidence interval: >0.00 6.088391 > > fisher.test(matrix(c(102,9,9,1),nrow=2)) > p-value = 0.5926 > > fisher.test(matrix(c(102,9,8,2),nrow=2)) > p-value = 0.2257 > > fisher.test(matrix(c(102,9,7,3),nrow=2)) > p-value = 0.0605 > > fisher.test(matrix(c(102,9,6,4),nrow=2)) > p-value = 0.01202 > > So there's a 95% CI (0,6.1) for the odds ratio which, for > identical probabilities of "+", is 1.0 hence well within the CI. > And, keeping the numbers for the larger sample fixed for > simplicity, you have to go quite a way with the smaller one to get > a result significant at 5%: > > (102,9):(7,3) -> P = 0.06 > (102,9):(6,4) -> P = 0.01 > > and, to have 80% power (0.8 probability of this event), the > probability of "+" in the second sample would have to be as > high as 0.41. > > Conclusion: your second sample size is quite inadequate except > to detect rather large differences between the true proportions > in the two cases! > > Best wishes, > Ted. > > > > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 167 1972 > Date: 27-Nov-03 Time: 17:43:00 > -- XFMail -- > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
On Mon, 1 Dec 2003, Wolski wrote: > In the attachment are prompt and package.skeleton modified so that it > works on windows 2000 too. It substitutes <- in file names = before > writing if sys.info()["sysname"]=="Windows". However, that is nowhere near sufficient: please take a look at the Perl file `check' for a list of conditions you would need to fulfil on the file names. Did you actually try to find out what are valid filenames on your half-implemented filesystem? Did you consider what happens with names which differ only by case? > *** REPLY SEPARATOR *** > > On 12/1/2003 at 2:23 PM Prof Brian Ripley wrote: > > >On Mon, 1 Dec 2003, Wolski wrote: > > > >> If it does not matter how the name of the Rd file are, would it be > >> difficult than to modify the package.skeleton function, so that it works > >> under windows 2000 too? > > > >Why don't you try to do it and find out how difficult it is *for you*? Too difficult -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: using shapefile as owin
My sincerest apologies, as this is a very elementary problem, but I have searched through archives and FAQs and on the web, and I am at the end of my own resources. I need to do analysis of a spatial point process occuring with four counties, using spatstat. I've had no trouble importing the shapefiles, but I can't seem to figure out what I need to do in order to use the boundary as an owin. Why I use the Map2poly command, it appears to work, but not when I attempt define the window using the shapefile; it also gives me errors when I try to define a ppp.object. I am using the latest release of Raqua on G4. My process looks like this: #begin code > library(maptools) > Shapefile<-read.shape("county.shp", dbf.data=TRUE) Shapefile Type: Polygon # of Shapes: 4 > plot(Shapefile, fg="white") > rm(Map) > shapepoly<-Map2poly(Shapefile, region.id = NULL) Map2lines(Shapefile) Map2points(Shapefile) Map2bbs(Shapefile) [[1]] [,1] [,2] [1,] -116.1655 34.03370 [2,] -116.1672 34.03370 [3,] -116.1819 34.03364 #R does its thing for a gillion more lines, then, Error in Map2lines(Shapefile) : maptype not line/arc > plot(shapepoly) Error in plot.window(xlim, ylim, log, asp, ...) : need finite xlim values In addition: Warning messages: 1: no finite arguments to min; returning Inf 2: no finite arguments to max; returning -Inf 3: no finite arguments to min; returning Inf 4: no finite arguments to max; returning -Inf > library(spatstat) spatstat 1.3-3 Type "demo(spatstat)" for a demonstration See the Introduction and Quick Reference in /Users/lschwei/Library/RAqua/library/spatstat/doc > owin(shapepoly) Error in owin(shapepoly) : If one of xrange, yrange is specified then both must be. #end code Lisa --- Lisa Schweitzer Center for the Study of Urban Poverty Dept. of Urban Planning University of California, Los Angeles ([EMAIL PROTECTED]) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Discovering methods
On Mon, 1 Dec 2003 07:15:47 -0800 (PST), Thomas Lumley <[EMAIL PROTECTED]> wrote : >On Sun, 30 Nov 2003, Gabor Grothendieck wrote: > >> >> >> Thanks. I guess we have to be content to approximate this via: >> >>apropos("POSIXt$|POSIXct$") >> >> although this supposes we know that POSIXct inherits from POSIXt >> and its not clear that there is a reliable way to discover that >> for S3 classes. > >It's actually easier for S3 classes, since there it is objects that >inherit, not classes: eg > >> class(.leap.seconds) >[1] "POSIXt" "POSIXct" But then the obvious guess at what Gabor wants doesn't work: >> apropos(class(.leap.seconds)) > [1] ".__C__POSIXt""-.POSIXt""+.POSIXt" > [4] "as.character.POSIXt" "cut.POSIXt" "diff.POSIXt" > [7] "hist.POSIXt" "julian.POSIXt" "Math.POSIXt" >[10] "months.POSIXt" "Ops.POSIXt" "quarters.POSIXt" >[13] "round.POSIXt""seq.POSIXt" "str.POSIXt" >[16] "trunc.POSIXt""weekdays.POSIXt" >Warning messages: >1: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >2: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >3: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >4: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >5: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >6: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >7: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >8: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >9: the condition has length > 1 and only the first element will be used in: if >(is.na(pattern)) { >> What works is this: apropos(paste(class(.leap.seconds),'$',sep='',collapse='|')) Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] matrix bending
Here is a function that I use for symmetric matrices: make.positive.definite <- function(x, tol=1e-6) { eig <- eigen(x, symmetric=TRUE) rtol <- tol * eig$values[1] if(min(eig$values) < rtol) { vals <- eig$values vals[vals < rtol} <- rtol srev <- eig$vectors %*% (vals * t(eig$vectors)) dimnames(srev) <- dimnames(x) return(srev) } else { return(x) } } Patrick Burns Burns Statistics [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: Dear All, I was wondering whether any one knows of a matrix bending function in R that can turn non-positive definite matrices into the nearest positive definite matrix. I was hoping there would be something akin to John Henshall's flbend program (http://agbu.une.edu.au/~kmeyer/pdmatrix.html), which allows the standard errors of the estimated matrix elements to be considered in the bending process. Thanks, Jarrod. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Kurtosis function
Hi, Which R package contains Kurtosis function? Where can I get it? Thank you very much. Xiao __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Kurtosis function
The e1071 package does kurtosis. kurtosis(x, na.rm=FALSE) HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help with random numbers and Rmpi
Dear People, This may not be the right place to ask a question about Rmpi, but I don't know of a better one. I am trying to get a simple program working using Rmpi with the model of 1 R master and n C slaves. What I am trying to do is have each of the C slaves generate a random number from U[0,1], and then have the master collect all n numbers as a vector and output it. However even doing this is rather over my head. I'm trying to use rsprng and sprng, but I am sure what I am currently doing is wrong. I enclose a first attempt. Any suggestions would be appreciated. Thanks in advance. Faheem. * rand.R * library(Rmpi) rand <- function () { if (mpi.comm.size(1) > 1) stop ("It seems some slaves running on comm 1.") mpi.comm.spawn("./rand") mpi.intercomm.merge(2,0,1) mpi.init.sprng() free.sprng() #does this function exist here? rdata <- double(sum(mpi.comm.size(1))) out <- mpi.gather(0, 2, rdata) ##this isn't right mpi.comm.free() out } * rand.c * #include #include int main(int argc, char **argv) { double rand; double* randarray; MPI_Comm slavecomm, all_processes; /*Initialize MPI*/ MPI_Init(&argc, &argv); MPI_Comm_get_parent(&slavecomm); MPI_Intercomm_merge(slavecomm, 1, &all_processes); /*How many processes are there?*/ MPI_Comm_size(all_processes, &size); /*Which one am I?*/ MPI_Comm_rank(all_processes, &rank); init_sprng() rand = sprng(); free.sprng() randarray = (double *)malloc(sizeof(double)*size); /*Gather random numbers from all C slave processes*/ /* Using randarray doesn't make sense since this should correspond to the rdata vector in the R master process */ MPI_GAther(&rand, 1, 1, MPI_DOUBLE, randarray, 1, MPI_DOUBLE, 0, all_processes); /*All done*/ MPI_Comm_free(&all_processes); MPI_Finalize(); exit(0); } __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] with for objects
Why not? A data frame is a convenient way of grouping related data together. So is an object. Writing with(expr, a + b) is just shorthand for writing expr$a + expr$b, so why shouldn't I be able to write with(obj, a + b) for [EMAIL PROTECTED] + [EMAIL PROTECTED] I'm not keen to write a plot method because I'm trying to create a more generalised way of exploring data stored in objects. For example, with microarray data from bioconductor, I might want to do one MA for all the data, or one for each printtip. Hadley Roger D. Peng wrote: I'm not sure S4 objects are really meant to be used this way. Maybe you could write a plot method? -roger __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Discovering methods
On Mon, 1 Dec 2003, Duncan Murdoch wrote: > But then the obvious guess at what Gabor wants doesn't work: > > >> apropos(class(.leap.seconds)) > > [1] ".__C__POSIXt""-.POSIXt""+.POSIXt" > > [4] "as.character.POSIXt" "cut.POSIXt" "diff.POSIXt" > > [7] "hist.POSIXt" "julian.POSIXt" "Math.POSIXt" > >[10] "months.POSIXt" "Ops.POSIXt" "quarters.POSIXt" > >[13] "round.POSIXt""seq.POSIXt" "str.POSIXt" > >[16] "trunc.POSIXt""weekdays.POSIXt" > >Warning messages: > >1: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >2: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >3: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >4: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >5: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >6: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >7: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >8: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >9: the condition has length > 1 and only the first element will be used in: if > >(is.na(pattern)) { > >> > > What works is this: > > apropos(paste(class(.leap.seconds),'$',sep='',collapse='|')) > or sapply(class(.leap.seconds), apropos) -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with random numbers and Rmpi
use snow. The general approach highlighted in http://www.analytics.washington.edu/~rossini/courses/cph-statcomp in Lab 4 works with Rmpi as well. Faheem Mitha <[EMAIL PROTECTED]> writes: > Dear People, > > This may not be the right place to ask a question about Rmpi, but I don't > know of a better one. > > I am trying to get a simple program working using Rmpi with the model of 1 > R master and n C slaves. What I am trying to do is have each of the C > slaves generate a random number from U[0,1], and then have the master > collect all n numbers as a vector and output it. However even doing this > is rather over my head. I'm trying to use rsprng and sprng, but I am sure > what I am currently doing is wrong. > > I enclose a first attempt. Any suggestions would be appreciated. Thanks in > advance. > > Faheem. > > * > rand.R > * > library(Rmpi) > > rand <- function () > { > if (mpi.comm.size(1) > 1) > stop ("It seems some slaves running on comm 1.") > mpi.comm.spawn("./rand") > mpi.intercomm.merge(2,0,1) > > mpi.init.sprng() > free.sprng() #does this function exist here? > > rdata <- double(sum(mpi.comm.size(1))) > out <- mpi.gather(0, 2, rdata) ##this isn't right > mpi.comm.free() > out > } > > * > rand.c > * > #include > #include > > int main(int argc, char **argv) > { > double rand; > double* randarray; > > MPI_Comm slavecomm, all_processes; > > /*Initialize MPI*/ > MPI_Init(&argc, &argv); > > MPI_Comm_get_parent(&slavecomm); > MPI_Intercomm_merge(slavecomm, 1, &all_processes); > > /*How many processes are there?*/ > MPI_Comm_size(all_processes, &size); > > /*Which one am I?*/ > MPI_Comm_rank(all_processes, &rank); > > init_sprng() > rand = sprng(); > free.sprng() > > randarray = (double *)malloc(sizeof(double)*size); > > /*Gather random numbers from all C slave processes*/ > /* Using randarray doesn't make sense since this should correspond > to the rdata vector in the R master process */ > MPI_GAther(&rand, 1, 1, MPI_DOUBLE, randarray, 1, MPI_DOUBLE, 0, all_processes); > > /*All done*/ > MPI_Comm_free(&all_processes); > MPI_Finalize(); > exit(0); > } > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with random numbers and Rmpi
On Mon, 1 Dec 2003, A.J. Rossini wrote: > > use snow. > > The general approach highlighted in > > http://www.analytics.washington.edu/~rossini/courses/cph-statcomp > > in Lab 4 works with Rmpi as well. Forgive my cluelessness, but are the slaves spawned by snow R slaves or C slaves? I need to work low level with C. I'm looking at (for example) http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html Thanks. Faheem. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rd Files?
Prof Brian Ripley <[EMAIL PROTECTED]> writes: > On Mon, 1 Dec 2003, Wolski wrote: > > > In the attachment are prompt and package.skeleton modified so that it > > works on windows 2000 too. It substitutes <- in file names = before > > writing if sys.info()["sysname"]=="Windows". > > However, that is nowhere near sufficient: please take a look at the Perl > file `check' for a list of conditions you would need to fulfil on the file > names. Did you actually try to find out what are valid filenames on your > half-implemented filesystem? Did you consider what happens with names > which differ only by case? > > > > > >Why don't you try to do it and find out how difficult it is *for you*? > > Too difficult Brian, if you pull any more, it will come off at the hip! Just one thing to add: If Wolski gets sufficiently annoyed to actually try and do this right, he'll want a naming scheme that works on *all* platforms, so branching on sys.info()["sysname"]=="Windows" is surely wrong. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with random numbers and Rmpi
Faheem Mitha <[EMAIL PROTECTED]> writes: > On Mon, 1 Dec 2003, A.J. Rossini wrote: > >> >> use snow. >> >> The general approach highlighted in >> >> http://www.analytics.washington.edu/~rossini/courses/cph-statcomp >> >> in Lab 4 works with Rmpi as well. > > Forgive my cluelessness, but are the slaves spawned by snow R slaves or C > slaves? I need to work low level with C. R slaves. If you need to work with C slaves, you need to be pretty careful with SPRNG. Is there a reason you can't use C from R code? If so, you get SPRNG for free, if not, it's a royal pain. I'd be careful about SPRNG's MPI code, as well -- works with MPICH, but it's been touchy with LAM-MPI, at least with the versions (LAM, MPICH) I've worked with. And versions seem to be somewhat important. best, -tony -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: using shapefile as owin
On Mon, 1 Dec 2003, Lisa Schweitzer wrote: > My sincerest apologies, as this is a very elementary problem, but I have > searched through archives and FAQs and on the web, and I am at the end of my > own resources. > > I need to do analysis of a spatial point process occuring with four > counties, using spatstat. I've had no trouble importing the shapefiles, but > I can't seem to figure out what I need to do in order to use the boundary as > an owin. Why I use the Map2poly command, it appears to work, but not when I > attempt define the window using the shapefile; it also gives me errors when > I try to define a ppp.object. I am using the latest release of Raqua on G4. > My process looks like this: > > #begin code > > library(maptools) > > Shapefile<-read.shape("county.shp", dbf.data=TRUE) > Shapefile Type: Polygon # of Shapes: 4 > > plot(Shapefile, fg="white") > > rm(Map) Why this? > > > shapepoly<-Map2poly(Shapefile, region.id = NULL) This should create a polylist object as a list with four elements, each a ring of county boundary points, an n by 2 matrix with a number of attributes. > Map2lines(Shapefile) > Map2points(Shapefile) > Map2bbs(Shapefile) Why this? > > [[1]] > [,1] [,2] >[1,] -116.1655 34.03370 >[2,] -116.1672 34.03370 >[3,] -116.1819 34.03364 > > #R does its thing for a gillion more lines, then, > > Error in Map2lines(Shapefile) : maptype not line/arc > Obviously, since it is contains polygons ... > > plot(shapepoly) > Error in plot.window(xlim, ylim, log, asp, ...) : > need finite xlim values > In addition: Warning messages: > 1: no finite arguments to min; returning Inf > 2: no finite arguments to max; returning -Inf > 3: no finite arguments to min; returning Inf > 4: no finite arguments to max; returning -Inf No, not (yet) plot.polylist(), but plotpolys(). > > library(spatstat) > spatstat 1.3-3 > Type "demo(spatstat)" for a demonstration > See the Introduction and Quick Reference in > /Users/lschwei/Library/RAqua/library/spatstat/doc > > owin(shapepoly) > Error in owin(shapepoly) : If one of xrange, yrange is specified then both > must be. Why would you think that owin() accepts a polylist object as its default argument? Although help(owin.object) doesn't tell you, you can finf out from: http://www.maths.uwa.edu.au/~adrian/spatstat/doc/Intro/ that: "If the window boundary is a single polygon, then p should be a list with components x and y giving the coordinates of the vertices of the window boundary, traversed anticlockwise. Note that polygons should not be closed, i.e. the last vertex should not equal the first vertex. If the window boundary consists of several separate polygons, then p should be a list, each of whose components p[[i]] is a list with components x and y describing one of the polygons. The vertices of each polygon should be traversed anticlockwise for external boundaries and clockwise for internal boundaries (holes)" >From the ESRI shapefile definition, we read that the vertices of a single ringed polygon are in clockwise order. So your object does not conform at all to the structure owin() seems to need, although there are ways of doing this - contributions welcome (owin.polylist() for example). Roger Bivand > #end code > > > Lisa > --- > Lisa Schweitzer > Center for the Study of Urban Poverty > Dept. of Urban Planning > University of California, Los Angeles > ([EMAIL PROTECTED]) > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with random numbers and Rmpi
On Mon, 1 Dec 2003, A.J. Rossini wrote: > Faheem Mitha <[EMAIL PROTECTED]> writes: > > > On Mon, 1 Dec 2003, A.J. Rossini wrote: > > > >> > >> use snow. > >> > >> The general approach highlighted in > >> > >> http://www.analytics.washington.edu/~rossini/courses/cph-statcomp > >> > >> in Lab 4 works with Rmpi as well. > > > > Forgive my cluelessness, but are the slaves spawned by snow R slaves or C > > slaves? I need to work low level with C. > > R slaves. > > If you need to work with C slaves, you need to be pretty careful with > SPRNG. > > Is there a reason you can't use C from R code? If so, you get SPRNG > for free, if not, it's a royal pain. It would be great if I could do it that way. I've used the .C interface to R (for example) for ages. However, I need to parallise the code at the C level, which is where I do nearly all of the heavy lifting. More explicitly, I want the C code to do different things on different processors, pass data back and forth and so on, where everything would be controlled from the R level. My impression is that if I was to use C from R, then the parallelization would only be done at the R level. So, can this (parallelization at the C level) be done without running a bunch of C slaves along the lines I had previously written? Any examples would be helpful. > I'd be careful about SPRNG's MPI code, as well -- works with MPICH, > but it's been touchy with LAM-MPI, at least with the versions (LAM, > MPICH) I've worked with. And versions seem to be somewhat important. Yes, the whole SPRNG thing seems rather difficult. Thanks for your help. Faheem. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] histogram density division
Hi, I would like to plot an histogram with modified density values. My Y-axis represent the occurences of the ranges (specified by the breaks argument) of my data (represented by a big vector). Now, I would like to divide by X the number of occurences in each bands and do a plot of "lower" occurences. How can I do that? Thanks, Mathieu __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] with for objects
On Tue, 2 Dec 2003, Hadley Wickham wrote: > Why not? A data frame is a convenient way of grouping related data > together. So is an object. Writing with(expr, a + b) is just shorthand > for writing expr$a + expr$b, so why shouldn't I be able to write > with(obj, a + b) for [EMAIL PROTECTED] + [EMAIL PROTECTED] It is a bad idea because it has to break the information hiding that is an important point of objects. If you define a class "A" that either includes or inherits from another class "B" then you don't know what slots your object has (without looking at the internals of the implementation of class "B"). Suppose you define slots a and b in addition to whatever you have inherited. You don't know what with(obj, a+x) will do: is it [EMAIL PROTECTED] or [EMAIL PROTECTED]@x for some inherited slot x? And even worse, if someone extends your class and adds a slot x in the subclass, what should it do? Now, as it happens, the function slotNames() will give you all the slots, so it is possible to work out where x is, but this doesn't make it a good idea. Without rewriting the internal code for eval() it is also hard to do: it would require either a recursive search through the expression changing slot names to [EMAIL PROTECTED], or a function to convert objects into environments that could be fed to eval(). -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] with for objects
Why not? A data frame is a convenient way of grouping related data together. So is an object. Writing with(expr, a + b) is just shorthand for writing expr$a + expr$b, so why shouldn't I be able to write with(obj, a + b) for [EMAIL PROTECTED] + [EMAIL PROTECTED] It is a bad idea because it has to break the information hiding that is an important point of objects. Good point - but with can be abused in this way too, eg. with(lm(...), plot(fitted.values ~ residuals)). What about if with(obj, a + b) was shorthand for a(obj) + b(obj)? ie. it uses accessor functions instead of the slots (assuming that the accessor functions take no other arguments). If you define a class "A" that either includes or inherits from another class "B" then you don't know what slots your object has (without looking at the internals of the implementation of class "B"). I thought you did. If I say [EMAIL PROTECTED] I expect that R will find the correct slot regardless of where in the class heirachy it is, though I suppose that is a slightly different question. Suppose you define slots a and b in addition to whatever you have inherited. You don't know what with(obj, a+x) will do: is it [EMAIL PROTECTED] or [EMAIL PROTECTED]@x for some inherited slot x? I'm not sure I understand the problem - I would expect it to try the slot in the object "environment" (if such a thing existed) first, and the parent environment etc. Isn't this effectively what with() does? And even worse, if someone extends your class and adds a slot x in the subclass, what should it do? Yes, that is a (big) problem. What do you suggest as an alternative? I am experimenting visualising microarray data using trellis. I end up with a whole lot of calls like xyplot(maA(swirl[,1]) ~ maM(swirl[,1]) | maPrintTip(swirl[,1])) and then if I want to plot the same thing for array 2, I need xyplot(maA(swirl[,2]) ~ maM(swirl[,2]) | maPrintTip(swirl[,2]))... I don't want to limit myself to a fixed set of plots because I'm still exploring different ways to look at the data, but I would like to save myself some typing. Without rewriting the internal code for eval() it is also hard to do: it would require either a recursive search through the expression changing slot names to [EMAIL PROTECTED], or a function to convert objects into environments that could be fed to eval(). I did end up writing something (very rough) to create an environment containing the results from the necessary function calls. It works for my needs, but is very frail against changes in the objects I'm using. Hadley __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with random numbers and Rmpi
Faheem Mitha <[EMAIL PROTECTED]> writes: > So, can this (parallelization at the C level) be done without running a > bunch of C slaves along the lines I had previously written? Any examples > would be helpful. How much heavy lifting happens before you spawn the slaves, and can that not be moved to R? Your best bet is to read the SNOW code for handling SPRNG/RSPRNG, otherwise. Good luck! best, -tony -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] search site for R (http://finzi.psych.upenn.edu)
My search site, http://finzi.psych.upenn.edu, has had several problems recently, all my fault, for which I apologize. But it now seems to be running reliably, on a new computer that is much faster than the old one. It uses htdig to permit search of the Rhelp mailing list, R documents, R functions, and various combinations of these. Search has several options, including Boolean search (with AND, etc.). Suggestions are welcome. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] search site for R (http://finzi.psych.upenn.edu)
It's a great service, which I use on average several times each day. Thanks for providing this. Spencer Graves Jonathan Baron wrote: My search site, http://finzi.psych.upenn.edu, has had several problems recently, all my fault, for which I apologize. But it now seems to be running reliably, on a new computer that is much faster than the old one. It uses htdig to permit search of the Rhelp mailing list, R documents, R functions, and various combinations of these. Search has several options, including Boolean search (with AND, etc.). Suggestions are welcome. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Sampling
YourData[sample(209,106),] Regards Christian Mora -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Savano Sent: Monday, December 01, 2003 9:38 AM To: Lista R Subject: [R] Sampling UseRs, I imported a table using "read.table". It has 209 observations, I want to select a sample with 106 observations. What function I use? thanks. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R and Memory
Dear all, This is my first post. We have started to use R here and have also started teaching it to our PhD students. Our unit will be the HQ for developing R throughout Thailand. I would like some help with a problem we are having. We have one sample of data that is quite large in fact - over 2 million records (ok ok it's more like a population!). The data is stored in SPSS. The file is over 350Mb but SPSS happily stores this much data. Now when I try to read it into R it grunts and groans for a few seconds and then reports that there is not enough memory (the computer has 250MB RAM). I have tried setting the memory in the command line (--max-vsize and --max-mem-size) but all to no avail. Any help would be muchly appreciated! Edward McNeil (son of Don) Epidemiology Unit Faculty of Medicine Prince of Songkhla University Hat Yai 90110 THAILAND __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Vector Assignments
Hi, I have simple R question. I have a vector x that contains real numbers. I would like to create another vector col that is the same length of x such that: if x[i] < 250 then col[i] = "red" else if x[i] < 500 then col[i] = "blue" else if x[i] < 750 then col[i] = "green" else col[i] = "black" for all i I am convinced that there is probably a very efficient way to do this in R but I am not able to figure it out. Any help would be greatly appreciated. Thanks in advance, Arend van der Veen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Vector Assignments
One way is to use "ifelse": x <- seq(100, 1000, by=100) x.col <- ifelse(x < 250, "red", ifelse(x<500, "blue", ifelse(x<750, "green", "black"))) data.frame(x, x.col) x x.col 1 100 red 2 200 red 3 300 blue 4 400 blue 5 500 green 6 600 green 7 700 green 8 800 black 9 900 black 10 1000 black Does this seem reasonable? spencer graves Arend P. van der Veen wrote: Hi, I have simple R question. I have a vector x that contains real numbers. I would like to create another vector col that is the same length of x such that: if x[i] < 250 then col[i] = "red" else if x[i] < 500 then col[i] = "blue" else if x[i] < 750 then col[i] = "green" else col[i] = "black" for all i I am convinced that there is probably a very efficient way to do this in R but I am not able to figure it out. Any help would be greatly appreciated. Thanks in advance, Arend van der Veen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] smoothing functions
Dear all, I am trying to program an estimator which maximizes a likelihood type objective function which is basically just lots of sums of indicator functions of data and parameters. In order to make the optimization I would like to smooth these functions. Since they are either 0 or 1, one possibility is to use the normal cdf. I am wondering whether anyone is aware of a less arbitrary choice of a smoothing function? (is there any theory that suggests what's best to use?) Does anyone have any recommendations on what works best numerically? Thanks, Eugene. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Vector Assignments
One way would be to create a vector of colours and then cut() to index the vector: colours <- c("red", "blue", "green","back") colours[cut(x, c(min(x),250,500,700,max(x)),lab=F)] Hadley Arend P. van der Veen wrote: Hi, I have simple R question. I have a vector x that contains real numbers. I would like to create another vector col that is the same length of x such that: if x[i] < 250 then col[i] = "red" else if x[i] < 500 then col[i] = "blue" else if x[i] < 750 then col[i] = "green" else col[i] = "black" for all i I am convinced that there is probably a very efficient way to do this in R but I am not able to figure it out. Any help would be greatly appreciated. Thanks in advance, Arend van der Veen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Vector Assignments
Arend - Here is a sequence of commands which will do it. These first build a vector of (4+1) cutpoints, then cut() returns a factor whose labels are the colors and codes are determined by x. Last, as.character() turns the factor into the character vector which you ask for. Or, perhaps the factor data structure is more useful directly. (Factors are sort of an acquired taste.) Note that in the call to cut, I am passing many arguments into the function by their position in the call. You will need to look at help("cut") to figure out which argument is which. Note also that by monkeying with the two logical arguments, ("include.lowest" and "right"), I didn't need to fudge any of the cutpoints. tmp <- range(x) tmp <- c(tmp[1], 250, 500, 750, tmp[2]) fac <- cut(x, tmp, c("red","blue","green","black"), TRUE, FALSE) col <- as.character(fac) HTH - tom blackwell - u michigan medical school - ann arbor - On Mon, 1 Dec 2003, Arend P. van der Veen wrote: > Hi, > > I have simple R question. > > I have a vector x that contains real numbers. I would like to create > another vector col that is the same length of x such that: > > if x[i] < 250 then col[i] = "red" > else if x[i] < 500 then col[i] = "blue" > else if x[i] < 750 then col[i] = "green" > else col[i] = "black" for all i > > I am convinced that there is probably a very efficient way to do this in > R but I am not able to figure it out. Any help would be greatly > appreciated. > > Thanks in advance, > Arend van der Veen > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] white's general heteroscedasticity test
I have a vague idea about heteroscedasticity so I thought I would see what I could come up with. Unfortunately it's going to take me a while before I am well enough versed in the ways in which it is used within different packages. But I thought that if you haven't already tried you should try searching the R-archives. I found 55 references to heteroscedasticity and one which looks particularly relevant http://finzi.psych.upenn.edu/R/Rhelp02/archive/1460.html Ciao, Tom _ Tom Mulholland Senior Policy Officer WA Country Health Service Tel: (08) 9222 4062 The contents of this e-mail transmission are confidential an...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] smoothing functions
Eugene - Is the estimand in your problem (the parameter which you seek to estimate) discrete-valued or continuous-valued ? If it is discrete-valued, then you are heading in the wrong direction, because no matter how smooth you make the objective function, you will not be able to differentiate it with respect to the parameter ! I think I don't have quite enough information to give a helpful answer to your question . . . but more important is for you to find the answer yourself. - tom blackwell - u michigan medical school - ann arbor - On Mon, 1 Dec 2003, Eugene Salinas (R) wrote: > Dear all, > > I am trying to program an estimator which maximizes a likelihood type > objective function which is basically just lots of sums of indicator > functions of data and parameters. In order to make the optimization I > would like to smooth these functions. Since they are either 0 or 1, one > possibility is to use the normal cdf. > > I am wondering whether anyone is aware of a less arbitrary choice of a > smoothing function? (is there any theory that suggests what's best to > use?) Does anyone have any recommendations on what works best numerically? > > Thanks, Eugene. > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Help with this topic
Dear ladies and gentlemen, I would like to calculate autocovarinace and cross-covariance scores 1, 2 and 3 of four classes A, B, C and D. I am using acf and ccf from time sires library. My problem is that I can not separate my data among the classes A, B, C and D. When I calculated acf for Score 1, I got a wrong result. The reason being that instead of using ony 60, 40 and 20, the program use all the data in column under Score 1. What should I do to calculate acf and ccf scores for each class A, B, C and D according to he data below? ClassScore 1 Score 2 Score 3 A60 11 21 A40 21 16 A20 16 18 B10 23 62 B168 13 B14 13 18 C22 15 22 C245 18 C24 12 12 D16 6 16 D12 3 8 D15 2 13 Thanks for your help. SO __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Help with this topic
Stephen - If the four columns shown below are in this order in a data frame named 'data', then use covariances <- by(data[ ,-1], data$Class, cov) to get the covariance matrices within each of the four classes. Alternative functions would be tapply() or aggregate(), but the syntax for by() is easiest to understand. - tom blackwell - u michigan medical school - ann arbor - On Mon, 1 Dec 2003, Stephen Opiyo wrote: > Dear ladies and gentlemen, > > I would like to calculate autocovarinace and cross-covariance scores 1, > 2 and 3 of four classes A, B, C and D. I am using acf and ccf from time > sires library. My problem is that I can not separate my data among the > classes A, B, C and D. When I calculated acf for Score 1, I got a wrong > result. The reason being that instead of using ony 60, 40 and 20, the > program use all the data in column under Score 1. What should I do to > calculate acf and ccf scores for each class A, B, C and D according to > he data below? > > ClassScore 1 Score 2 Score 3 > A60 11 21 > A40 21 16 > A20 16 18 > B10 23 62 > B168 13 > B14 13 18 > C22 15 22 > C245 18 > C24 12 12 > D16 6 16 > D12 3 8 > D15 2 13 > > Thanks for your help. > > SO > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] check WARNING...
I've been developing a package and have been getting the following warning when running the check command: * checking S3 generic/method consistency ... WARNING plot: function(x, ...) plot.summaries: function(trees, sp) * checking for replacement functions with final arg not named 'value' ... OK * checking Rd files ... OK ...blah, blah, blah... * checking examples ... OK * creating cruisepak-manual.tex ... OK * checking cruisepak-manual.tex ... OK WARNING: There were 3 warnings, see C://cruisepak.Rcheck/00check.log for details C:\> I can fix the other two warnings with no problem, but the S3 generic/method consistency warning is puzzling me... . I have a function called plot.summaries <- function( trees, sp=NULL ) { ...yak, kay, yak... } and I'm not sure if this is causing the problem. I'm developing a package for forestry and the field makes use of many terms commonly found in technology (logs, trees, plots, points, etc) and would like to know if the nomenclature will cause a problem. Thanks, Jeff. --- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon USA 97339-1421 (office) 541-754-1428 (cell) 541-740-5988 [EMAIL PROTECTED] www.forestinformatics.com --- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon USA 97339-1421 (office) 541-754-1428 (cell) 541-740-5988 [EMAIL PROTECTED] www.forestinformatics.com __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Vector Assignments
Just some small refinements/corrections: colours <- c("red", "blue", "green","back") colours[cut(x, c(-Inf,250,500,700,Inf),right=F,lab=F)] --- Date: Tue, 02 Dec 2003 14:38:55 +1300 From: Hadley Wickham <[EMAIL PROTECTED]> To: Arend P. van der Veen <[EMAIL PROTECTED]> Cc: R HELP <[EMAIL PROTECTED]> Subject: Re: [R] Vector Assignments One way would be to create a vector of colours and then cut() to index the vector: colours <- c("red", "blue", "green","back") colours[cut(x, c(min(x),250,500,700,max(x)),lab=F)] Hadley Arend P. van der Veen wrote: >Hi, > >I have simple R question. > >I have a vector x that contains real numbers. I would like to create >another vector col that is the same length of x such that: > >if x[i] < 250 then col[i] = "red" >else if x[i] < 500 then col[i] = "blue" >else if x[i] < 750 then col[i] = "green" >else col[i] = "black" for all i > >I am convinced that there is probably a very efficient way to do this in >R but I am not able to figure it out. Any help would be greatly >appreciated. > >Thanks in advance, >Arend van der Veen > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with random numbers and Rmpi
On 1 Dec 2003, Faheem Mitha spake thusly: > I am trying to get a simple program working using Rmpi with the model of 1 > R master and n C slaves. What I am trying to do is have each of the C > slaves generate a random number from U[0,1], and then have the master > collect all n numbers as a vector and output it. However even doing this > is rather over my head. I'm trying to use rsprng and sprng, but I am sure > what I am currently doing is wrong. > > * > rand.R > * > library(Rmpi) > > rand <- function () > { > if (mpi.comm.size(1) > 1) > stop ("It seems some slaves running on comm 1.") > mpi.comm.spawn("./rand") > mpi.intercomm.merge(2,0,1) > >X mpi.init.sprng() >X free.sprng() #does this function exist here? I'm not familiar with Rmpi code. But here you don't need call any SPRNG function. Instead, generate a seed (an integer) can pass it on to the slaves. > rdata <- double(sum(mpi.comm.size(1))) > out <- mpi.gather(0, 2, rdata) ##this isn't right > mpi.comm.free() > out > } > > * > rand.c > * > #include > #include > > int main(int argc, char **argv) > { > double rand; > double* randarray; > > MPI_Comm slavecomm, all_processes; > > /*Initialize MPI*/ > MPI_Init(&argc, &argv); > > MPI_Comm_get_parent(&slavecomm); > MPI_Intercomm_merge(slavecomm, 1, &all_processes); > > /*How many processes are there?*/ > MPI_Comm_size(all_processes, &size); > > /*Which one am I?*/ > MPI_Comm_rank(all_processes, &rank); > >X init_sprng() >X rand = sprng(); >X free.sprng() Receive the seed from the master and call int * stream_id; stream_id = init_sprng (gtype, rank, size, seed, param); where gtype and param can be predefined or got from the master as well. Now you can generate random numbers by: rand = sprng (stream_id); free_sprng (stream_id); > randarray = (double *)malloc(sizeof(double)*size); > > /*Gather random numbers from all C slave processes*/ > /* Using randarray doesn't make sense since this should correspond > to the rdata vector in the R master process */ > MPI_GAther(&rand, 1, 1, MPI_DOUBLE, randarray, 1, MPI_DOUBLE, 0, > all_processes); > > /*All done*/ > MPI_Comm_free(&all_processes); > MPI_Finalize(); > exit(0); > } There is nothing mysterious about the MPI code in SPRNG, don't use it. Generating and passing seeds around yourself. Michael -- Na (Michael) Li, Ph.D. Assistant Professor Division of Biostatistics, University of Minnesota A443 Mayo Bldg, MMC 303 Phone: (612) 626-4765 420 Delaware St SE Fax: (612) 626-0660 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Vector Assignments
And one other thing. Are you sure you want character variables as the result of all this? A column whose entries are each one of four colors seems like a good job for a factor: colours <- c("red", "blue", "green","black") cut(x, c(-Inf,250,500,700,Inf),right=F,lab=colours) --- Date: Mon, 1 Dec 2003 23:47:39 -0500 (EST) From: Gabor Grothendieck <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Subject: Re: [R] Vector Assignments Just some small refinements/corrections: colours <- c("red", "blue", "green","back") colours[cut(x, c(-Inf,250,500,700,Inf),right=F,lab=F)] --- Date: Tue, 02 Dec 2003 14:38:55 +1300 From: Hadley Wickham <[EMAIL PROTECTED]> To: Arend P. van der Veen <[EMAIL PROTECTED]> Cc: R HELP <[EMAIL PROTECTED]> Subject: Re: [R] Vector Assignments One way would be to create a vector of colours and then cut() to index the vector: colours <- c("red", "blue", "green","back") colours[cut(x, c(min(x),250,500,700,max(x)),lab=F)] Hadley Arend P. van der Veen wrote: >Hi, > >I have simple R question. > >I have a vector x that contains real numbers. I would like to create >another vector col that is the same length of x such that: > >if x[i] < 250 then col[i] = "red" >else if x[i] < 500 then col[i] = "blue" >else if x[i] < 750 then col[i] = "green" >else col[i] = "black" for all i > >I am convinced that there is probably a very efficient way to do this in >R but I am not able to figure it out. Any help would be greatly >appreciated. > >Thanks in advance, >Arend van der Veen > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] check WARNING...
Jeff D. Hamann wrote: I've been developing a package and have been getting the following warning when running the check command: * checking S3 generic/method consistency ... WARNING plot: function(x, ...) plot.summaries: function(trees, sp) I'm unclear; is "summaries" a class? If not, try naming the function plotSummaries, or some such thing (no dot ".") Cheers Jason -- Indigo Industrial Controls Ltd. http://www.indigoindustrial.co.nz 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help