Re: [R] overlaying plots
You can simply do plot(xx) plot(yy,add=T) Ale iberna - Original Message - From: Mike Jones [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, June 02, 2005 9:53 PM Subject: [R] overlaying plots surely this not hard, but i can't figure it out. i'd like to overlay the results of two ecdf's. e.g. xx--ecdf(x) and yy--ecdf(y). i'd like to plot xx and yy on the same graph. thanks...mj [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] mplot :how to deal with missing data
If you have to deal with missing values, you might be interested in na.omit(). ?na.omit Regards, Christoph -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- NATALIA F TCHETCHERINA writes: Hello all, I have data: Genes time rep vart dye y trt 130911 sa1-d07 030min 1 col g 9.636244 o 145771 sa1-d07 030min 1 col r 8.107577 c 93335sa1-d07 030min 1 ler g 7.409566 o 94821sa1-d07 030min 1 ler r 5.107160 c 10119101 sa1-d07 030min 2 col g 8.336862 o 11605101 sa1-d07 030min 2 col r 7.824530 c 725313 sa1-d07 030min 2 ler g 8.249347 o 740171 sa1-d07 030min 2 ler r 7.565084 c 1160522 sa1-d07 030min 3 col gNA c 1011922 sa1-d07 030min 3 col rNA o 562232 sa1-d07 030min 3 ler g 9.974227 c 547362 sa1-d07 030min 3 ler r 10.341149 o .. .. .. I would like to get graphs means for two-way factor combinations I used Rlab package: mplot(data$y[which(data$Genes==sa1-d07)], data$time[which(data$Genes==sa1-d07)], data$trt[which(data$Genes==sa1-d07)]) However, I have the following error message: plot window will lay out plots in a 3 by 1 matrix Error in plot.window(xlim, ylim, log, asp, ...) : need finite 'ylim' values In addition: Warning messages: 1: no finite arguments to min; returning Inf 2: no finite arguments to max; returning -Inf I think this is because of some y='NA'. My question is: how I can deal with this problem? Sincerely, Natalia. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] New CRAN package `coin'
Conditional Inference Procedures in a Permutation Test Framework The `coin' package implements a general framework for conditional inference procedures, commonly known as permutation tests, theoretically derived by Strasser Weber (1999). The conditional expectation and covariance for a broad class of multivariate linear statistics as well as the corresponding multivariate limiting distribution was derived by Strasser Weber (1999). These results are utilized to construct tests for independence between two sets of variables. Beside a general implementation of the abstract framework the package offers a rather huge set of convenience functions implementing well known classical as well as less prominent classical and non-classical test procedures in a conditional inference framework. Examples are linear rank statistics for the two- and K-sample location and scale problem against ordered and unordered alternatives including post-hoc tests for arbitrary contrasts, tests of independence for contingency tables, two- and K-sample tests for censored data, tests for independence of two continuous variables as well as tests for marginal homogeneity and symmetry. Conditional counterparts of most of the classical procedures given in famous text books like Hollander Wolfe (1999) or Agresti (2002) can be implemented as part of the general framework without much effort. Approximations of the exact null distribution via the limiting distribution and conditional Monte-Carlo procedures are available for every test while the exact null distribution is currently available for two-sample problems only. Inference problems can be specified by a traditional formula based interface. Support for data available as `exprSet' objects in a BioC environment is implemented as well. The theoretical framework is sketched in the vignette and we refer to `vignette(coin)' for further details. Comments, suggestions, bug-reports etc. are more than welcome! Best, Torsten, Kurt, Mark and Achim _ Package: coin Title: Conditional Inference Procedures in a Permutation Test Framework Date: $Date: 2005/06/02 14:55:45 $ Version: 0.2-11 Author: Torsten Hothorn and Kurt Hornik, with contributions by Mark van de Wiel and Achim Zeileis Maintainer: Torsten Hothorn [EMAIL PROTECTED] Description: Conditional inference procedures for the general independence problem including two-sample, K-sample, correlation, censored, ordered and multivariate problems. Depends: R (= 2.0.0), methods, survival, mvtnorm Suggests: multcomp SaveImage: yes LazyData: yes License: GPL ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dot in formula
Adrian Baddeley [EMAIL PROTECTED] writes: gReetings, I want to manipulate a formula object, containing the name . so that . is replaced by a desired (arbitrary) expression. What is a safe way to do this? I'm not vouching for the safety, but something along the lines of mycall - quote(a+b) # NOT mode expression substitute(~., list(.=mycall)) or (this stuff is such a pain) eval(substitute(substitute(formula, list(.=mycall)), list=myformula)) Notice, BTW, that formulas can have . on both sides, so you may want to do it only to either the LHS or RHS as appropriate. Also note that the substitute operations loses the the class and environment of the original, so you may need to put that back in place with as.formula and environment- -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] mvr function
McGehee, Robert writes: dataSet - data.frame(y = vol[, 12]) dataSet$X - data.matrix(vol[, 1:11]) ans.pcr - pcr(y ~ X, 6, data = dataSet, validation = CV) If there's a more elegant way of doing this without using data frames of matrices, I'd be interested as well. I actually find using data frames with matrices the most elegant way. :-) Especially if you have several matrices. Alternatively, to regress one variable of a data frame on the rest of the variables, one can use ans.pcr - pcr(y ~ ., 6, data = vol, validation = CV) (assuming the response variable is called `y' in the data frame; see names(vol).) One does not _have_ to store the data in a data frame (although I would recommend it, because it is then easier to specify test data sets and alternative data sets). One can simply store the variables in the global environment, and skip the `data' argument of `pcr', -- HTH, Bjørn-Helge Mevik __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dot in formula
Adrian Baddeley writes: I want to manipulate a formula object, containing the name . so that . is replaced by a desired (arbitrary) expression. How about myf - y ~ . update(myf, . ~ -. + X) -- HTH, Bjørn-Helge Mevik __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dot in formula
On Fri, 3 Jun 2005, Bjørn-Helge Mevik wrote: Adrian Baddeley writes: I want to manipulate a formula object, containing the name . so that . is replaced by a desired (arbitrary) expression. How about myf - y ~ . update(myf, . ~ -. + X) or just update(myf, . ~ X). Here . is not being treated literally (nor can it be in the internal formula manipulation code). If you just want to replace a rhs `.' then there are easier ways, e.g. myf - y ~ . myf[[3]] - quote(X) myf y ~ X However, I think Adrian might want something like myf - y ~ a + . + x update(myf, . ~ -. + X) y ~ X I think the best way to do that is by substitute(), e.g. substitute(y ~ a + . + x, list(.=quote(X))) y ~ a + X + x If that is not enough ideas, perhaps Adrian could give us an example? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] post hoc kruskal wallis
On Thu, 2 Jun 2005, Liaw, Andy wrote: By post hoc I guess you meant pairwise comparisons. You might want to check out the npmc package on CRAN. ?oneway_test in `coin' has an example, essentially ### Length of YOY Gizzard Shad from Kokosing Lake, Ohio, ### sampled in Summer 1984, Hollander Wolfe (1999), Table 6.3, page 200 YOY - data.frame(length = c(46, 28, 46, 37, 32, 41, 42, 45, 38, 44, 42, 60, 32, 42, 45, 58, 27, 51, 42, 52, 38, 33, 26, 25, 28, 28, 26, 27, 27, 27, 31, 30, 27, 29, 30, 25, 25, 24, 27, 30), site = factor(c(rep(I, 10), rep(II, 10), rep(III, 10), rep(IV, 10 ### Kruskal-Wallis test, approximate exact p-value kw - kruskal_test(length ~ site, data = YOY, distribution = approximate(B = )) kw pvalue(kw) ### Nemenyi-Damico-Wolfe-Dunn test (joint ranking) ### Hollander Wolfe (1999), page 244 ### (where Steel-Dwass results are given) if (require(multcomp)) { NDWD - oneway_test(length ~ site, data = YOY, ytrafo = function(data) trafo(data, numeric_trafo = rank), xtrafo = function(data) trafo(data, factor_trafo = function(x) model.matrix(~x - 1) %*% t(contrMat(table(x), Tukey))), teststat = maxtype, distribution = approximate(B = 9)) ### global p-value print(pvalue(NDWD)) ### sites (I = II) != (III = IV) at alpha = 0.01 (page 244) print(pvalue(NDWD, adjusted = TRUE)) } the key step is xtrafo = function(data) trafo(data, factor_trafo = function(x) model.matrix(~x - 1) %*% t(contrMat(table(x), Tukey))) where you may specify _any_ contrast matrix, for example just a subset of all pairwise comparisons you are willing to pay for. Torsten Andy From: [EMAIL PROTECTED] I´m looking for a program with a post hoc kruskall Wallis test like the Tukey- type non parametric test of ZAR(Biostatistical Analysis 2ºEdition). SSPS hasn´t got any non parametric post host test. I don´t know if R has an appropiate post hoc non parametric test. I´m not sure if NDWD test of the package coin is an appropiate test or if the package npmc is a best option. Thank you Alfredo Bermúdez - - Fin del mensaje reenviado - __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] geometric mean regression
Hi, is it possible to perform a geometric mean regression with R ? Thanks. Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Simplify formula for iterative programming
Dear R-ians, I am looking for the simplification of a formula to improve the calculation speed of my program. Therefore I want to simplify the following formula: H = Si (Sj ( sqrt [ (Ai - Aj)² + (Bi - Bj)² ] ) ) where: A, B = two vectors (with numerical data) of length n sqrt = square root Si = summation over i (= 0 to n) Sj = summation over j (= 0 to n) Ai = element of A with index i Aj = element of A with index j Bi = element of B with index i Bj = element of B with index j n is not fixed, but it changes with every run for my program. Therefore for I am looking for a simplication of h in order to calculate it when my A and B get extendend by 1 element (n = n + 1). I know a computional simplified formula exists for the standard deviation (sd) that is much easier in iterative programming. Therefore I wondered I anybody knew about analog simplifications to simplify H: sd = sqrt [ ( Si (Xi - mean(X) )² ) /n ] - simplified computation - sqrt [ (n * Si( X² ) - ( Si( X ) )² )/ n² ] This simplied formula is much easier in iterative programming, since I don't have to keep every element of X. E.g.: I have a vector X[1:10] and I already have caculated Si( X[1:10]² ) (I will call this A) and Si( X ) (I will call this B). When X gets extendend by 1 element (eg. X[11]) it easy fairly simple to calculate sd(X[1:11]) without having to reuse the elements of X[1:10]. I just have to calculate: sd = sqrt [ (n * (A + X[11]²) - (A + X[11]²)² ) / n² ] This is fairly easy in an iterative process, since before we continue with the next step we set: A = (A + X[11]²) B = (B + X[11]) Can anybody help me to do something comparable for H? Any other help to calculate H easily in an iterative process is also welcome! Kind regards, Stef __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Segmentation fault using gentoo linux and mysql
Dear Listmembers We have a data server with some amounts of data which we try to analyze using R. Now having some MySQL databases with MySQL Ver 12.22 Distrib 4.0.24 and R 2.1.0 compiled from sources on this machine: Fujitsu Siemens CELSIUS V810 4 GB RAM Dual AMD Opteron Processor 246 Harddisk via SAN. (see user details:) sysname Linux - gentoo linux release 2.6.11-hardened-r13 version #1 SMP Fri May 27 15:25:55 CEST 2005 machine x86_64 Editor: Emacs with ESS 5.2.3 While I can connect R to the database (RMySQL/DBI) and retrieve basic information (e.g. SHOW TABLE, DESCRIBE) it is not possible to send SQL Queries. The moment I try to do: res - dbSendQuery(con, select * from table) or any other SELECT statement R terminates and I receive a Segmentation Fault. Is anyone out there having similar problems in this environment. Any hints welcome. Regards Dubravko Dolic Statistical Analyst Tel: +49 (0)89-55 27 44 - 4630 Fax: +49 (0)89-55 27 44 - 2463 Email: [EMAIL PROTECTED] Komdat GmbH Nymphenburger Straße 86 80636 München - ONLINE MARKETING THAT WORKS - This electronic message contains information from Komdat Gmb...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Need Help - Urgent
Hello, I am a student and some really urgent help.I am using R software and while creating a grid with eight elements its showing the error and while if i do it with seven it says that the memory is not sufficient... here is the line ...with the error Z-as.matrix(expand.grid(x,y,x,y,t,s,t,s)) Error in rep.int(rep.int(seq(length = nx), rep.int(rep.fac, nx)), orep) : cannot allocate vector of length 112896 Is it possible to somehow increase the default size of the matrix? please help.. THanking you nivesh pawar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] post hoc kruskal wallis
I´m looking for a program with a post hoc kruskall Wallis test like the Tukey- type non parametric test of ZAR(Biostatistical Analysis 2ºEdition). SSPS hasn´t got any non parametric post host test. I don´t know if R has an appropiate post hoc non parametric test. I´m not sure if NDWD test of the package coin is an appropiate test or if the package npmc is a best option. Thank you Alfredo Bermúdez __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Simplify formula for iterative programming
Dear Stef Please check my code below carefully, because it is Friday afternoon and there might be mistakes in it: ## initialize two random vectors (length n = 100) a - rnorm(100) b - rnorm(100) ## computation of your formula (see ?outer which is very ## useful here) (c - sum(sqrt(outer(a,a,-)^2 + outer(b,b,-)^2))) ## expand a and b to length n+1 a1 - c(a,rnorm(1)) b1 - c(b,rnorm(1)) ## computation calculating the whole sum (c1 - sum(sqrt(outer(a1,a1,-)^2 + outer(b1,b1,-)^2))) ## computation using the result of the smaller vectors c + 2*sum(sqrt((a1 - a1[length(a1)])^2 + (b1 - b1[length(b1)])^2)) Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Stefaan Lhermitte writes: Dear R-ians, I am looking for the simplification of a formula to improve the calculation speed of my program. Therefore I want to simplify the following formula: H = Si (Sj ( sqrt [ (Ai - Aj)² + (Bi - Bj)² ] ) ) where: A, B = two vectors (with numerical data) of length n sqrt = square root Si = summation over i (= 0 to n) Sj = summation over j (= 0 to n) Ai = element of A with index i Aj = element of A with index j Bi = element of B with index i Bj = element of B with index j n is not fixed, but it changes with every run for my program. Therefore for I am looking for a simplication of h in order to calculate it when my A and B get extendend by 1 element (n = n + 1). I know a computional simplified formula exists for the standard deviation (sd) that is much easier in iterative programming. Therefore I wondered I anybody knew about analog simplifications to simplify H: sd = sqrt [ ( Si (Xi - mean(X) )² ) /n ] - simplified computation - sqrt [ (n * Si( X² ) - ( Si( X ) )² )/ n² ] This simplied formula is much easier in iterative programming, since I don't have to keep every element of X. E.g.: I have a vector X[1:10] and I already have caculated Si( X[1:10]² ) (I will call this A) and Si( X ) (I will call this B). When X gets extendend by 1 element (eg. X[11]) it easy fairly simple to calculate sd(X[1:11]) without having to reuse the elements of X[1:10]. I just have to calculate: sd = sqrt [ (n * (A + X[11]²) - (A + X[11]²)² ) / n² ] This is fairly easy in an iterative process, since before we continue with the next step we set: A = (A + X[11]²) B = (B + X[11]) Can anybody help me to do something comparable for H? Any other help to calculate H easily in an iterative process is also welcome! Kind regards, Stef __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] reading tables into R
I have been using R and Perl. When I read in a text file using the read.table option, and I try to mathematically manipulate the individual elements in the table, I keep getting an object is not subsettable error. If I try to use a different method, it works, but takes too much time(basically, I then need to read in values individually into R instead of as a 2D array, so the number of function calls from Perl to R is very large). Could you suggest another method whereby I could read an entire matrix or a file using an R function call? Thanks! Sincerely, Mugdha Wagle, Hartwell center for Bioinformatics and Biotechnology, St.Jude Children's Research Hospital __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Creating datasets
Hi folks, Having lost count of the times I have read the relevant section in R-exts.html (and by the way, where has that useful file gone? I had to look at it on CRAN.), searched for creating datasets (this is the first time that Jon Baron's excellent search site has let me down) and read the idiot's guide for creating packages, I am willing to admit that I have failed the test. First: Linux (Fedora Core 2) R-2.1.0 I am attempting to integrate three functions that have been kindly donated to the plotrix package by Sander Oom dealing with plotting soil texture. Everything works okay, but I want to add a dataset to the package. R-exts says that three types of data files are okay: R code, rectangular tables (e.g. CSV) or files created by save (.rda) I note that all the real packages (oops, bundles) like MASS have three files in their data directory that look like an index of the datasets, the datasets themselves and something I haven't worked out yet. I haven't found a description of how to do that trick. Thus I created the dataset by reading a CSV data file into a data frame oksoil-read.table(oksoil.csv,sep=,) That data frame works fine in all the functions. Then I saved it: save(oksoil,file=/home/jim/R/plotrix/data/oksoil.rda) But when I check the package, the examples don't work: R CMD check /home/jim/R/plotrix ... data(oksoil) Warning in data(oksoil) : data set 'oksoil' not found # first just show the soil triangle soil.texture() # now plot the observations show.soil.texture(oksoil) Error in show.soil.texture(oksoil) : Object oksoil not found Execution halted I promise to try writing an Idiot's Guide to Creating Datasets if someone can provide a method. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating datasets *IN PACKAGES*
Hi Jim, are you sure you haven't confused *source* packages with *installed* (aka binary) packages ?? Source packages' ./data/ subdirectories have no funny files in them. Martin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating datasets
Jim Lemon wrote: Hi folks, Having lost count of the times I have read the relevant section in R-exts.html (and by the way, where has that useful file gone? I had to look at it on CRAN.), searched for creating datasets (this is the first time that Jon Baron's excellent search site has let me down) and read the idiot's guide for creating packages, I am willing to admit that I have failed the test. First: Linux (Fedora Core 2) R-2.1.0 I am attempting to integrate three functions that have been kindly donated to the plotrix package by Sander Oom dealing with plotting soil texture. Everything works okay, but I want to add a dataset to the package. R-exts says that three types of data files are okay: R code, rectangular tables (e.g. CSV) or files created by save (.rda) I note that all the real packages (oops, bundles) like MASS have three files in their data directory that look like an index of the datasets, the datasets themselves and something I haven't worked out yet. I haven't found a description of how to do that trick. These are created from the original data sets when the package is installed, provided that the LazyData switch is turned on in the DESCRIPTION file or the call to R CMD INSTALL. Thus I created the dataset by reading a CSV data file into a data frame oksoil-read.table(oksoil.csv,sep=,) That data frame works fine in all the functions. Then I saved it: save(oksoil,file=/home/jim/R/plotrix/data/oksoil.rda) But when I check the package, the examples don't work: R CMD check /home/jim/R/plotrix ... data(oksoil) Warning in data(oksoil) : data set 'oksoil' not found # first just show the soil triangle soil.texture() # now plot the observations show.soil.texture(oksoil) Error in show.soil.texture(oksoil) : Object oksoil not found Execution halted You must put the data set into a source package directory then install the package using Rcmd INSTALL or R CMD INSTALL. Some indices are created during the installation process and it is these that allow R to find the data sets by name. I promise to try writing an Idiot's Guide to Creating Datasets if someone can provide a method. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating datasets
On 6/3/2005 6:46 PM, Jim Lemon wrote: Hi folks, Having lost count of the times I have read the relevant section in R-exts.html (and by the way, where has that useful file gone? I had to look at it on CRAN.), Should be in R_HOME/doc/manual. searched for creating datasets (this is the first time that Jon Baron's excellent search site has let me down) and read the idiot's guide for creating packages, I am willing to admit that I have failed the test. First: Linux (Fedora Core 2) R-2.1.0 I am attempting to integrate three functions that have been kindly donated to the plotrix package by Sander Oom dealing with plotting soil texture. Everything works okay, but I want to add a dataset to the package. R-exts says that three types of data files are okay: R code, rectangular tables (e.g. CSV) or files created by save (.rda) I note that all the real packages (oops, bundles) like MASS have three files in their data directory that look like an index of the datasets, the datasets themselves and something I haven't worked out yet. I haven't found a description of how to do that trick. Thus I created the dataset by reading a CSV data file into a data frame oksoil-read.table(oksoil.csv,sep=,) That data frame works fine in all the functions. Then I saved it: save(oksoil,file=/home/jim/R/plotrix/data/oksoil.rda) But when I check the package, the examples don't work: R CMD check /home/jim/R/plotrix ... data(oksoil) Warning in data(oksoil) : data set 'oksoil' not found This looks like it should have worked. I don't know what went wrong for you. Can you look in plotrix.Rcheck/plotrix/data and confirm that oksoil.rda got installed there? Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reading tables into R
On Jun 3, 2005, at 8:40 AM, Wagle, Mugdha wrote: I have been using R and Perl. When I read in a text file using the read.table option, and I try to mathematically manipulate the individual elements in the table, I keep getting an object is not subsettable error. If I try to use a different method, it works, but takes too much time(basically, I then need to read in values individually into R instead of as a 2D array, so the number of function calls from Perl to R is very large). Could you suggest another method whereby I could read an entire matrix or a file using an R function call? Mugdha, I think you will probably have to be more specific. Could you give an example of the data format, the commands you used to load it that didn't work, and those that did and explain how perl comes into this? Also, knowing what OS and version of R you are using is quite helpful. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Creating datasets
RSiteSearch(creating datasets, restrict=doc) gives me R-exts.html as the first hit... I did pretty much the same thing you did and had no problem. In the data/ directory of the source package I only have the one .rda file and nothing else. Did you try installing the package and test it before you run check? Andy From: Jim Lemon Hi folks, Having lost count of the times I have read the relevant section in R-exts.html (and by the way, where has that useful file gone? I had to look at it on CRAN.), searched for creating datasets (this is the first time that Jon Baron's excellent search site has let me down) and read the idiot's guide for creating packages, I am willing to admit that I have failed the test. First: Linux (Fedora Core 2) R-2.1.0 I am attempting to integrate three functions that have been kindly donated to the plotrix package by Sander Oom dealing with plotting soil texture. Everything works okay, but I want to add a dataset to the package. R-exts says that three types of data files are okay: R code, rectangular tables (e.g. CSV) or files created by save (.rda) I note that all the real packages (oops, bundles) like MASS have three files in their data directory that look like an index of the datasets, the datasets themselves and something I haven't worked out yet. I haven't found a description of how to do that trick. Thus I created the dataset by reading a CSV data file into a data frame oksoil-read.table(oksoil.csv,sep=,) That data frame works fine in all the functions. Then I saved it: save(oksoil,file=/home/jim/R/plotrix/data/oksoil.rda) But when I check the package, the examples don't work: R CMD check /home/jim/R/plotrix ... data(oksoil) Warning in data(oksoil) : data set 'oksoil' not found # first just show the soil triangle soil.texture() # now plot the observations show.soil.texture(oksoil) Error in show.soil.texture(oksoil) : Object oksoil not found Execution halted I promise to try writing an Idiot's Guide to Creating Datasets if someone can provide a method. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] reading tables into R. .
Hi, The file I am reading is a text file, whose contents are a matrix that has 15 rows and 58 columns. The first row has column names, and the first column has row names, so the format is correct as far as using read.table is concerned. The other values in the table are all float values (numeric). So when I read in the file using data1 - read.table(HAL001_HAL0015_Signals.txt), it gets read in as a table, but when I try to manipulate an individual value as follows: data1[2 ,2] - log(data1[2 ,2]+20) , I get the object is not subsettable message. This error occurs when I use R only...Perl is not being used at this point. My script needs to take input from an HTML page (using a CGI interface) which will be the name of the file to be passed onto R as a table. Since read.table isn't working within R itself, I haven't used it for the function call from Perl to R yet. Instead, I have been making repeated function calls using a loop in Perl, to access other R and Bioconductor funct! ions that I need such as t.test and ANOVA. This is very time-consuming, however. I am working in a Linux environment, and using R 2.1.0 Thanks for any help and suggestions! Mugdha Wagle From: Sean Davis [mailto:[EMAIL PROTECTED] Sent: Fri 6/3/2005 8:03 AM To: Wagle, Mugdha Cc: r-help@stat.math.ethz.ch Subject: Re: [R] reading tables into R. . On Jun 3, 2005, at 8:40 AM, Wagle, Mugdha wrote: I have been using R and Perl. When I read in a text file using the read.table option, and I try to mathematically manipulate the individual elements in the table, I keep getting an object is not subsettable error. If I try to use a different method, it works, but takes too much time(basically, I then need to read in values individually into R instead of as a 2D array, so the number of function calls from Perl to R is very large). Could you suggest another method whereby I could read an entire matrix or a file using an R function call? Mugdha, I think you will probably have to be more specific. Could you give an example of the data format, the commands you used to load it that didn't work, and those that did and explain how perl comes into this? Also, knowing what OS and version of R you are using is quite helpful. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Need Help - Urgent
You're asking for a matrix with length(x)^2*length(y)^2*length(s)^2*length(t)^2 rows. What are these lengths? Is that what you're expecting? Perhaps you want the distinct factor levels in x,y,s,t rather than x,y,s,t themselves? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nivesh Pawar Sent: Friday, June 03, 2005 8:00 AM To: r-help@stat.math.ethz.ch Subject: [R] Need Help - Urgent Hello, I am a student and some really urgent help.I am using R software and while creating a grid with eight elements its showing the error and while if i do it with seven it says that the memory is not sufficient... here is the line ...with the error Z-as.matrix(expand.grid(x,y,x,y,t,s,t,s)) Error in rep.int(rep.int(seq(length = nx), rep.int(rep.fac, nx)), orep) : cannot allocate vector of length 112896 Is it possible to somehow increase the default size of the matrix? please help.. THanking you nivesh pawar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] RE: GARCH (1 , 1), Hill estimator of alpha, Pareto estimator
Dear R users, Could you please help me out. I am unable to formulate a model in R to graphs a GARCH (1 , 1) model, the Hill estimator (of alpha), and the Pareto estimator. I have a financial time series data from the DAX and CAC40. I just got introduce to R. I am working on a paper which must be worked from R. I successfully imported the data into R. I also succeeded to produce te qq-plots and histograms from the data. My difficulty at the moment lies where I could not go further to plot the GARCH plots, the Hill estimator of alpha and the Pareto estimator. Reading from the FAQs of this list, I attempted the following and wasn't succeesful. Could anyone show me the steps that I might have omited. Check my errors from the following. library(stats) data(DAX_CAC) Warning message: Data set 'DAX_CAC' not found in: data(DAX_CAC) data(DAX_CAC) Warning message: Data set 'DAX_CAC' not found in: data(DAX_CAC) dax- diff(log(DAX_CAC$DAX[1:1865])) m1- garch(dax) Error: couldn't find function garch m1- garch(dax[1:1865]) Error: couldn't find function garch m1- garch(dax[1:1865]) Thank you in advance, Ukech U. kidi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reading tables into R. .
Hi, a good start is to verify that what you have read meets your expectations. Try str(data1) dim(data1) print(data1) and make sure you read ?read.table. There are plenty of *arguments* that affects the way R reads your data text file. /Henrik Wagle, Mugdha wrote: Hi, The file I am reading is a text file, whose contents are a matrix that has 15 rows and 58 columns. The first row has column names, and the first column has row names, so the format is correct as far as using read.table is concerned. The other values in the table are all float values (numeric). So when I read in the file using data1 - read.table(HAL001_HAL0015_Signals.txt), it gets read in as a table, but when I try to manipulate an individual value as follows: data1[2 ,2] - log(data1[2 ,2]+20) , I get the object is not subsettable message. This error occurs when I use R only...Perl is not being used at this point. My script needs to take input from an HTML page (using a CGI interface) which will be the name of the file to be passed onto R as a table. Since read.table isn't working within R itself, I haven't used it for the function call from Perl to R yet. Instead, I have been making repeated function calls using a loop in Perl, to access other R and Bioconductor fun ct! ions that I need such as t.test and ANOVA. This is very time-consuming, however. I am working in a Linux environment, and using R 2.1.0 Thanks for any help and suggestions! Mugdha Wagle From: Sean Davis [mailto:[EMAIL PROTECTED] Sent: Fri 6/3/2005 8:03 AM To: Wagle, Mugdha Cc: r-help@stat.math.ethz.ch Subject: Re: [R] reading tables into R. . On Jun 3, 2005, at 8:40 AM, Wagle, Mugdha wrote: I have been using R and Perl. When I read in a text file using the read.table option, and I try to mathematically manipulate the individual elements in the table, I keep getting an object is not subsettable error. If I try to use a different method, it works, but takes too much time(basically, I then need to read in values individually into R instead of as a 2D array, so the number of function calls from Perl to R is very large). Could you suggest another method whereby I could read an entire matrix or a file using an R function call? Mugdha, I think you will probably have to be more specific. Could you give an example of the data format, the commands you used to load it that didn't work, and those that did and explain how perl comes into this? Also, knowing what OS and version of R you are using is quite helpful. Sean __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reading tables into R
You will have to be more specific, if you want specific help. However, when I get the object is not subsettable error, it is because I have accidentally referred to the wrong object. For example, cespl[1,4] Error in cespl[1, 4] : object is not subsettable mode(cespl) [1] function It is not possible to take a subset of a function; this is an action that makes no sense. -Don At 7:40 AM -0500 6/3/05, Wagle, Mugdha wrote: I have been using R and Perl. When I read in a text file using the read.table option, and I try to mathematically manipulate the individual elements in the table, I keep getting an object is not subsettable error. If I try to use a different method, it works, but takes too much time(basically, I then need to read in values individually into R instead of as a 2D array, so the number of function calls from Perl to R is very large). Could you suggest another method whereby I could read an entire matrix or a file using an R function call? Thanks! Sincerely, Mugdha Wagle, Hartwell center for Bioinformatics and Biotechnology, St.Jude Children's Research Hospital __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] plots from batchfile on windows
Hi, On windows I'd like to run a batchfile that leaves me a plot. As a test I have the scriptfile test.r which only contains: x - 1:10; y - sample( 10 ) plot( x, y ) Now I tried the following (but nothing worked): a) R --vanilla test.r in the cmd window, = that doesn't give me a plot b) the same, but I added bitmap(file=outplot.png) in the scriptfile = Here I get an error that gswin32c.exe was not found. (Maybe I need to install ghostscript???) c) some attempts with Rgui.exe = I didn't arrive to pass a command argument. It would be nice, to get some hints, how this could be done. I did search the newsgroup archive, but unfortunately didn't find something. Thanks and best regards, Hans-Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plots from batchfile on windows
On 6/3/05, Hans-Peter [EMAIL PROTECTED] wrote: Hi, On windows I'd like to run a batchfile that leaves me a plot. As a test I have the scriptfile test.r which only contains: x - 1:10; y - sample( 10 ) plot( x, y ) Now I tried the following (but nothing worked): a) R --vanilla test.r in the cmd window, = that doesn't give me a plot b) the same, but I added bitmap(file=outplot.png) in the scriptfile = Here I get an error that gswin32c.exe was not found. (Maybe I need to install ghostscript???) c) some attempts with Rgui.exe = I didn't arrive to pass a command argument. It would be nice, to get some hints, how this could be done. I did search the newsgroup archive, but unfortunately didn't find something. This was discussed previously this week. Look right at the end of: https://www.stat.math.ethz.ch/pipermail/r-help/2005-June/071147.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to 'de-cross' a table?
Dear R users, I have received a table in the following format: id a b c1 c2 d1 d2 1 1 1 65 97 78 98 2 1 2 65 97 42 97 3 2 1 65 68 97 98 4 2 2 65 97 97 98 Factors of the design are: a, b, and e, where e has levels c and d. The levels c and d then have 2 replicates (r) each. Now I would like to get: id a b e r value 1 1 1 c 1 65 2 1 1 c 2 97 3 1 1 d 1 78 4 1 1 d 2 98 Any suggestions on how to tackle this? I'm not sure what the 'task' is called, so struggle to effectively search the web or R help. Thanks, Sander. Dr Sander P. Oom Animal, Plant and Environmental Sciences, University of the Witwatersrand Private Bag 3, Wits 2050, South Africa Tel (work) +27 (0)11 717 64 04 Tel (home) +27 (0)18 297 44 51 Fax +27 (0)18 299 24 64 Email [EMAIL PROTECTED] Web www.oomvanlieshout.net/sander __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] usign system() both quietly and quickly
I try to run an external application (A diffusive transport model programmed in Fortran 95) in a loop using the approach for(i in 1:100) { 1. write parameters[i] to inputfile for application 2. Run application using system(application.exe) 3. Read output written to a file by application to a list } The thing that annoys me is I can not figure out how to suppress the output from this application to the screen. If I use system(...,intern=T) it takes much longer to complete and is obviously not what I want. Any ideas? Have a nice weekend! R running under ESS/Emacs -- platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.0 year 2005 month04 day 18 language R - Henrik Andersson Netherlands Institute of Ecology - Centre for Estuarine and Marine Ecology P.O. Box 140 4400 AC Yerseke Phone: +31 113 577473 [EMAIL PROTECTED] http://www.nioo.knaw.nl/ppages/handersson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reading biplot function's source code
Hi everybody, Excuse me for this silly question, but after searching the help archives I'm still unable to find my way to read the source code of the biplot function in R. I have installed the mvbutils package, and tried: fixr(biplot) which only gives me: function (x, ...) UseMethod(biplot) with no further details I'd like to read the code to see if it is possible to display arrows only for some significant variables to avoid cluttering. Thank you in advance. -- Héctor Villalobos [EMAIL PROTECTED] IPN-CICIMAR. A.P. 592. Col. Centro La Paz, Baja California Sur, MÉXICO. 23000 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plots from batchfile on windows
On 6/3/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: This was discussed previously this week. Look right at the end of: https://www.stat.math.ethz.ch/pipermail/r-help/2005-June/071147.html I had to add a win.graph... command, now it works: x - 1:10; y - sample( 10 ) win.graph(width = 7, height = 7, pointsize = 12) plot( x, y ) savePlot( filename = test, type = png ) Great, thanks a lot for the tipp! Hans-Peter -- Regards, Hans-Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] plots from batchfile on windows
Just open a device before you plot: pdf( plotfile.pdf ) plot( x, y ) dev.off() also have a look at: ?Devices Best Bendix -- Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2 DK-2820 Gentofte Denmark tel: +45 44 43 87 38 mob: +45 30 75 87 38 fax: +45 44 43 07 06 [EMAIL PROTECTED] www.biostat.ku.dk/~bxc -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gabor Grothendieck Sent: Friday, June 03, 2005 4:33 PM To: Hans-Peter Cc: r-help@stat.math.ethz.ch Subject: Re: [R] plots from batchfile on windows On 6/3/05, Hans-Peter [EMAIL PROTECTED] wrote: Hi, On windows I'd like to run a batchfile that leaves me a plot. As a test I have the scriptfile test.r which only contains: x - 1:10; y - sample( 10 ) plot( x, y ) Now I tried the following (but nothing worked): a) R --vanilla test.r in the cmd window, = that doesn't give me a plot b) the same, but I added bitmap(file=outplot.png) in the scriptfile = Here I get an error that gswin32c.exe was not found. (Maybe I need to install ghostscript???) c) some attempts with Rgui.exe = I didn't arrive to pass a command argument. It would be nice, to get some hints, how this could be done. I did search the newsgroup archive, but unfortunately didn't find something. This was discussed previously this week. Look right at the end of: https://www.stat.math.ethz.ch/pipermail/r-help/2005-June/071147.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Simplify formula for iterative programming
Dear Christoph, Thanks for your help! I checked it in R and it works if we extend a and b with one element for each run. Unfortunately, I actually want to merge two vectors and then calculate the H for the merge. It is consequently no addition of 1 element but an addition of x elements. I did not mention it in my first post in order not to make it too complicated. The second problem that still remains is that I have to keep the original values of my original vectors. In the example I gave with sd only a calculated value and the new value are needed. The iterative process does not the need previously processed values of A anymore. I hoped something comaprable was possible for H. Thanks anyway for your help! Kind regards, Stef __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading biplot function's source code
Hector Villalobos Ortiz wrote: Hi everybody, Excuse me for this silly question, but after searching the help archives I'm still unable to find my way to read the source code of the biplot function in R. I have installed the mvbutils package, and tried: fixr(biplot) which only gives me: function (x, ...) UseMethod(biplot) with no further details I'd like to read the code to see if it is possible to display arrows only for some significant variables to avoid cluttering. Thank you in advance. That is the code for biplot()! biplot() is a generic function, and biplot methods can be written to draw biplots of results produced by different functions. methods(biplot) [1] biplot.default* biplot.prcomp* biplot.princomp* Shows us that currently there are 3 methods for biplot in my environment. The * indicates that the code for those methods are not visible to users directly. getAnywhere(biplot.prcomp) is one way of viewing the code. HTH Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Need Help - Urgent
Those sizes are smaller than I thought they would be, but you repeat the variables more than once in expand.grid, so its still large overall. Maybe you can try a simpler example first and then build up to what you really want once you get the simpler one working. The underlying problem is that the expand.grid is so large you don't have enough memory to store it. Its easy to do this since because of the nature of expand.grid. Your other option is to post a new message explaining the end goal and asking for suggestions on how to get there. Thanks, Roger On 6/3/05, Huntsinger, Reid [EMAIL PROTECTED] wrote: You're asking for a matrix with length(x)^2*length(y)^2*length(s)^2*length(t)^2 rows. What are these lengths? Is that what you're expecting? Perhaps you want the distinct factor levels in x,y,s,t rather than x,y,s,t themselves? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nivesh Pawar Sent: Friday, June 03, 2005 8:00 AM To: r-help@stat.math.ethz.ch Subject: [R] Need Help - Urgent Hello, I am a student and some really urgent help.I am using R software and while creating a grid with eight elements its showing the error and while if i do it with seven it says that the memory is not sufficient... here is the line ...with the error Z-as.matrix(expand.grid(x,y,x,y,t,s,t,s)) Error in rep.int(rep.int(seq(length = nx), rep.int(rep.fac, nx)), orep) : cannot allocate vector of length 112896 Is it possible to somehow increase the default size of the matrix? please help.. THanking you nivesh pawar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to 'de-cross' a table?
On Fri, Jun 03, 2005 at 04:33:44PM +0200, Sander Oom wrote : Dear R users, I have received a table in the following format: id a b c1 c2 d1 d2 1 1 1 65 97 78 98 2 1 2 65 97 42 97 3 2 1 65 68 97 98 4 2 2 65 97 97 98 Factors of the design are: a, b, and e, where e has levels c and d. The levels c and d then have 2 replicates (r) each. Now I would like to get: id a b e r value 1 1 1 c 1 65 2 1 1 c 2 97 3 1 1 d 1 78 4 1 1 d 2 98 I think that reshape is the tool you are looking for. -- Charles __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Load package using R code rather than GUI Package menu
Is there any way to load a package using R code rather than the Load Package command in the Package menu? I would like to load the boot package. R.2.1.0 Patched Win 2k. Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 - NOTE NEW EMAIL ADDRESS: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problems of performance between linux and freebsd
Dear All, I posted the following message to the Freebsd-questions mailing = snip On my laptop I've being using linux for some years now and landed at last to the gentoo distribution which I tuned for working with the statistical software R and the bunch of TeX programs such as latex, pdflatex, context and the likes (this absorb 95% of my activity on the linux box). The main action I took with gentoo was to compile everything from scratch for my pc hardware, limiting the use of X kde using all the above mentioned software prevailingly in a simple console. Now in a partition of the same laptop I installed freebsd 5.4, set softupdates, dma=1, and the same pieces of software as those I had installed under linux using the ports, therefore, compiling everything for my pc hardware, but, owing to my poor knowledge of Freebsd I'm experiencing some problems. In a nutshell I prepared the following test files: 1) a ConTeXt file full of long (useless) chapters and pictures to run with texexec; 2) An R program which reads a long text file, puts the data in dataframes, then loops to accomplish many repetitive mathematical calculations. Now running the test files in a console linux turns out to be roughly 20-25% fast er than freebsd. Particulary slow results the loop phase of the R source code that while running slows down and seems to clog in the end. The slowing down is also perceptible under linux but not at the same level. Admiring the ordered and unitary layout of freebsd, the logical way of setting it up, the richness of applications, I would like to line the freebsd installation up to the linux one, improving its performance at most, not necessarily making it faster than linux. How could I obtain those improvements? What could I do to speed those programs under freebsd? /snip Now I can be more precise about R. i) I downloaded the tarball of R 2.0.1 from CRAN; ii) I compiled the **same source *** source by means of ./configure, make, make install both on gentoo and on freebsd which share the same make.conf to optimize for a pentium4 and -O2 flag. iii) I created 2 R test programs one (simula.r) as described above at point 2) and the other (test.R) using the previous and adding some moreR code usin the library nnet and looping desperately with it (see attached files). simula.r takes 29 sec to be executed under win xp, 25 sec under linux gentoo and 26 under freebsd 5.4, all comparable. On the contrary the program test.R takes 93 sec under win xp, 85 sec under linux gentoo and an unbelievable 165 sec under freebsd. What I noticed is that test.R produces a lot of output while looping the nnet section of the program which under win xp you can only see at end of the run, under a gentoo text-console flows happily briskly on the screen whilst under a freebsd text-console it starts happily, slows down in the middle of the looping process and clogs in the end. In a nutshell freebsd takes twice as much the time of the other 2 OSs to execute the program. Sorry for my being so detailed. What shall I do? Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Load package using R code rather than GUI Package menu
library(boot) On Friday 03 June 2005 18:00, John Sorkin wrote: Is there any way to load a package using R code rather than the Load Package command in the Package menu? I would like to load the boot package. R.2.1.0 Patched Win 2k. Thanks, John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 -- NOTE NEW EMAIL ADDRESS: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- * Miguel A. Arranz Tol-Project [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Histogram of multiple series on one histogram
Hello, I have three sample, for example a-c(10,20,10,20,30) b-c(10,20,20,30,30) c-c(20,20,10) I would like to have only one histogram with these series, I try the following code: hist(a) hist(b,add=TRUE,col=red) hist(c,add=TRUE,col=green) but it's not that I want I would like an histogram with, from left to right, count of 10 for a, count of 10 for b, count of 10 for c, count of 20 for a, count of 20 for b, ... not overlapped Thanks -- Alexandre DEPIRE INRETS / GARIG Tel.: (+33) 01 47 40 71 66 Fax: (+33) 01 45 47 56 06 2 av. du général Malleret-Joinville 94114 Arcueil - France __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help with guiDlgOpen
Hi, I am trying to open a file with guidlgOpen. on windows. When the file is in a directory whose name contains a space, the name is splitted into 2, i.e. Afile - guiDlgOpen(title= Open file,defaultFile=,defaultDir=, multi=FALSE, filters = c(All files (*.*), *.*)) file [1] C:/ProgramFiles/R/Work/dcdc2_levels.txt Am I doing something wrong ? Marco [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Hclust question
Hey, I am running hclust on several different distance matrices and I have a question thats more about labeling. I've been looking for a way to label the edge values on the graph with their distances between them. I've been looking through the documentation and I haven't found anything yet. Anyone know if there is a way to plot 'hclust' graphs with such edge values? Or convert it to another type that can have its edge values labeled? And to clarify what I mean by edge values, I have two pictures describing what I mean. First, http://clavius.bc.edu/~schulerm/images/test.gif [3.8k] is what I currently have. What I'm looking for is something similar to this: http://clavius.bc.edu/~schulerm/images/test2.gif [5.1k]. I arbitrarily put in values on the edges with the Gimp but I'm looking for some way to do that on my plots of 'hclust'. Thanks in advance Mike Schuler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to 'de-cross' a table?
On Fri, 3 Jun 2005, Sander Oom wrote: Dear R users, I have received a table in the following format: id a b c1 c2 d1 d2 1 1 1 65 97 78 98 2 1 2 65 97 42 97 3 2 1 65 68 97 98 4 2 2 65 97 97 98 Factors of the design are: a, b, and e, where e has levels c and d. The levels c and d then have 2 replicates (r) each. Now I would like to get: id a b e r value 1 1 1 c 1 65 2 1 1 c 2 97 3 1 1 d 1 78 4 1 1 d 2 98 Any suggestions on how to tackle this? I'm not sure what the 'task' is called, so struggle to effectively search the web or R help. reshape() is the probably function. It seems you need to use it twice, for the two levels of uncrossing d1-reshape(d, direction=long, varying=list(c(c1,d1),c(c2,d2)), v.names=c(rep1,rep2),timevar=r, times=c(c,d)) d1 id a b r rep1 rep2 1.c 1 1 1 c 65 97 2.c 2 1 2 c 65 97 3.c 3 2 1 c 65 68 4.c 4 2 2 c 65 97 1.d 1 1 1 d 78 98 2.d 2 1 2 d 42 97 3.d 3 2 1 d 97 98 4.d 4 2 2 d 97 98 reshape(d1, direction=long, varying=list(c(rep1,rep2)), v.names=value,idvar=tmp, timevar=r) id a b r value tmp 1.1 1 1 1 165 1 2.1 2 1 2 165 2 3.1 3 2 1 165 3 4.1 4 2 2 165 4 5.1 1 1 1 178 5 6.1 2 1 2 142 6 7.1 3 2 1 197 7 8.1 4 2 2 197 8 1.2 1 1 1 297 1 2.2 2 1 2 297 2 3.2 3 2 1 268 3 4.2 4 2 2 297 4 5.2 1 1 1 298 5 6.2 2 1 2 297 6 7.2 3 2 1 298 7 8.2 4 2 2 298 8 You can then delete the `tmp` variable if you don't need it. An easier way to uncross would be with stack() stack(d[,4:7]) values ind 1 65 c1 2 65 c1 3 65 c1 4 65 c1 5 97 c2 6 97 c2 7 68 c2 8 97 c2 9 78 d1 10 42 d1 11 97 d1 12 97 d1 13 98 d2 14 97 d2 15 98 d2 16 98 d2 but you lose the other variables. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hclust question
On Fri, 03 Jun 2005 12:22:52 -0400, Mike Schuler (MS) wrote: Hey, I am running hclust on several different distance matrices and I have a question thats more about labeling. I've been looking for a way to label the edge values on the graph with their distances between them. I've been looking through the documentation and I haven't found anything yet. Anyone know if there is a way to plot 'hclust' graphs with such edge values? Or convert it to another type that can have its edge values labeled? And to clarify what I mean by edge values, I have two pictures describing what I mean. First, http://clavius.bc.edu/~schulerm/images/test.gif [3.8k] is what I currently have. What I'm looking for is something similar to this: http://clavius.bc.edu/~schulerm/images/test2.gif [5.1k]. I arbitrarily put in values on the edges with the Gimp but I'm looking for some way to do that on my plots of 'hclust'. help(dendrogram) example(dendrogram) should give you a start. -- --- Friedrich Leisch Institut für Statistik Tel: (+43 1) 58801 10715 Technische Universität WienFax: (+43 1) 58801 10798 Wiedner Hauptstraße 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RE: GARCH (1 , 1), Hill estimator of alpha, Pareto estimator
First, I doubt if you need library(stats), because it is normally automatically attached when R starts. To confirm, request search(). When I just did this with R 2.1.0 patched, package:stats was the third item. Second, if you've already produced qq-plots and histograms, then I doubt if you need the data(DAX_CAC). If you have not exited R since you successfully imported the data, and you stored it as DAX_CAC, it should still be available. Third, the message 'Error: couldn't find function garch' indicates that no function by that name is in the current search() path. The command 'RSiteSearch(garch)' revealed that it was part of package tseries. To be able to access that, you need to 'install.packages(tseries)', 'update.packages()', and then 'library(tseries)'. This should get you past the error messages I see. spencer graves Ukech U. Kidi wrote: Dear R users, Could you please help me out. I am unable to formulate a model in R to graphs a GARCH (1 , 1) model, the Hill estimator (of alpha), and the Pareto estimator. I have a financial time series data from the DAX and CAC40. I just got introduce to R. I am working on a paper which must be worked from R. I successfully imported the data into R. I also succeeded to produce te qq-plots and histograms from the data. My difficulty at the moment lies where I could not go further to plot the GARCH plots, the Hill estimator of alpha and the Pareto estimator. Reading from the FAQs of this list, I attempted the following and wasn't succeesful. Could anyone show me the steps that I might have omited. Check my errors from the following. library(stats) data(DAX_CAC) Warning message: Data set 'DAX_CAC' not found in: data(DAX_CAC) data(DAX_CAC) Warning message: Data set 'DAX_CAC' not found in: data(DAX_CAC) dax- diff(log(DAX_CAC$DAX[1:1865])) m1- garch(dax) Error: couldn't find function garch m1- garch(dax[1:1865]) Error: couldn't find function garch m1- garch(dax[1:1865]) Thank you in advance, Ukech U. kidi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help with guiDlgOpen
On 6/3/2005 12:17 PM, Marco Zucchelli wrote: Hi, I am trying to open a file with guidlgOpen. on windows. When the file is in a directory whose name contains a space, the name is splitted into 2, i.e. Afile - guiDlgOpen(title= Open file,defaultFile=,defaultDir=, multi=FALSE, filters = c(All files (*.*), *.*)) file [1] C:/ProgramFiles/R/Work/dcdc2_levels.txt I think that function is in the contributed package svDialogs. You should probably address your question to its author, Philippe Grosjean ([EMAIL PROTECTED]). Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Dirty Rotten Hack. (reversing tickmarks on axes?)
I feel dirty. I have some graphs I'm building to communicate chargeback rates and service usage for our backup system here at the University of Florida. These come down to daily data points on a graph of number-of-bytes transferred and stored. Since we chargeback on the same basis (price per MB this, price per KB that) the same chart with a different scale can be used to communicate bytes and dollars. I set about trying to accomplish this like so: http://nersp.nerdc.ufl.edu/~asr/media/r-foo/try1.png Those axes are a little messy. I tried nudging them around http://nersp.nerdc.ufl.edu/~asr/media/r-foo/try2.png which is better but not good. What I really want to do is tell my axis() function to reverse the tick direction: put your ticks and labels inside the graph. Something like http://nersp.nerdc.ufl.edu/~asr/media/r-foo/dirty-hack.png which I accomplished by telling axis() 'line=-47.7'. Eugh. Note that the distance between the left side and the right is different between the right side to the left. :) I don't particularly object to this, when you abuse a tool in this manner you need to expect oddities. I've wandered through the mailing list logs, and haven't seen reference to this particular desire. Am I alone? :) - Allen S. Rout __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Dirty Rotten Hack. (reversing tickmarks on axes?)
?par tck Make tck a positive fraction .5 (e.g. .02) in your call. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allen S. Rout Sent: Friday, June 03, 2005 9:51 AM To: r-help@stat.math.ethz.ch Subject: [R] Dirty Rotten Hack. (reversing tickmarks on axes?) I feel dirty. I have some graphs I'm building to communicate chargeback rates and service usage for our backup system here at the University of Florida. These come down to daily data points on a graph of number-of-bytes transferred and stored. Since we chargeback on the same basis (price per MB this, price per KB that) the same chart with a different scale can be used to communicate bytes and dollars. I set about trying to accomplish this like so: http://nersp.nerdc.ufl.edu/~asr/media/r-foo/try1.png Those axes are a little messy. I tried nudging them around http://nersp.nerdc.ufl.edu/~asr/media/r-foo/try2.png which is better but not good. What I really want to do is tell my axis() function to reverse the tick direction: put your ticks and labels inside the graph. Something like http://nersp.nerdc.ufl.edu/~asr/media/r-foo/dirty-hack.png which I accomplished by telling axis() 'line=-47.7'. Eugh. Note that the distance between the left side and the right is different between the right side to the left. :) I don't particularly object to this, when you abuse a tool in this manner you need to expect oddities. I've wandered through the mailing list logs, and haven't seen reference to this particular desire. Am I alone? :) - Allen S. Rout __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Dirty Rotten Hack. (reversing tickmarks on axes?)
Allen S. Rout [EMAIL PROTECTED] writes: I feel dirty. I have some graphs I'm building to communicate chargeback rates and service usage for our backup system here at the University of Florida. These come down to daily data points on a graph of number-of-bytes transferred and stored. Since we chargeback on the same basis (price per MB this, price per KB that) the same chart with a different scale can be used to communicate bytes and dollars. I set about trying to accomplish this like so: http://nersp.nerdc.ufl.edu/~asr/media/r-foo/try1.png Those axes are a little messy. I tried nudging them around http://nersp.nerdc.ufl.edu/~asr/media/r-foo/try2.png which is better but not good. What I really want to do is tell my axis() function to reverse the tick direction: put your ticks and labels inside the graph. Something like http://nersp.nerdc.ufl.edu/~asr/media/r-foo/dirty-hack.png which I accomplished by telling axis() 'line=-47.7'. Eugh. Note that the distance between the left side and the right is different between the right side to the left. :) I don't particularly object to this, when you abuse a tool in this manner you need to expect oddities. I've wandered through the mailing list logs, and haven't seen reference to this particular desire. Am I alone? :) Possibly in space, but not in time and space: Someone seems to have been there before. Check out plot(0,tcl=.5,mgp=c(-3,-2,0)) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Problems of performance between linux and freebsd
From: [EMAIL PROTECTED] Dear All, I posted the following message to the Freebsd-questions mailing = snip On my laptop I've being using linux for some years now and landed at last to the gentoo distribution which I tuned for working with the statistical software R and the bunch of TeX programs such as latex, pdflatex, context and the likes (this absorb 95% of my activity on the linux box). The main action I took with gentoo was to compile everything from scratch for my pc hardware, limiting the use of X kde using all the above mentioned software prevailingly in a simple console. Now in a partition of the same laptop I installed freebsd 5.4, set softupdates, dma=1, and the same pieces of software as those I had installed under linux using the ports, therefore, compiling everything for my pc hardware, but, owing to my poor knowledge of Freebsd I'm experiencing some problems. In a nutshell I prepared the following test files: 1) a ConTeXt file full of long (useless) chapters and pictures to run with texexec; 2) An R program which reads a long text file, puts the data in dataframes, then loops to accomplish many repetitive mathematical calculations. Now running the test files in a console linux turns out to be roughly 20-25% fast er than freebsd. Particulary slow results the loop phase of the R source code that while running slows down and seems to clog in the end. The slowing down is also perceptible under linux but not at the same level. Admiring the ordered and unitary layout of freebsd, the logical way of setting it up, the richness of applications, I would like to line the freebsd installation up to the linux one, improving its performance at most, not necessarily making it faster than linux. How could I obtain those improvements? What could I do to speed those programs under freebsd? /snip Now I can be more precise about R. i) I downloaded the tarball of R 2.0.1 from CRAN; ii) I compiled the **same source *** source by means of ./configure, make, make install both on gentoo and on freebsd which share the same make.conf to optimize for a pentium4 and -O2 flag. iii) I created 2 R test programs one (simula.r) as described above at point 2) and the other (test.R) using the previous and adding some moreR code usin the library nnet and looping desperately with it (see attached files). simula.r takes 29 sec to be executed under win xp, 25 sec under linux gentoo and 26 under freebsd 5.4, all comparable. On the contrary the program test.R takes 93 sec under win xp, 85 sec under linux gentoo and an unbelievable 165 sec under freebsd. What I noticed is that test.R produces a lot of output while looping the nnet section of the program which under win xp you can only see at end of the run, under a gentoo text-console flows happily briskly on the screen whilst under a freebsd text-console it starts happily, slows down in the middle of the looping process and clogs in the end. In a nutshell freebsd takes twice as much the time of the other 2 OSs to execute the program. Sorry for my being so detailed. What shall I do? Vittorio I'm no expert (not even amateur) in these matters... Anyway, under Windows R(gui) buffers its console output by default, so you don't see the output until the execution is finished (or the output exceeds the buffer size). I have no idea how konsole (I assume that's what you're using in Linux) or whatever you're using in freeBSD does. What would the numbers be if you run the R script via R CMD BATCH? Supposedly that comparison would eliminate the differences in how console outputs are buffered (or not). Andy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] geometric mean regression
Poizot Emmanuel wrote: Hi, is it possible to perform a geometric mean regression with R ? Thanks. As has been said on this list before, This is R, there is no if, only how, but if you actually wanted to ask how it is possible, it would help if you explained what is geometric mean regression. Kjetil Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 01/06/2005 -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R IRC channel?
Is there an IRC channel for R? I have a bunch of relatively simple questions that I can't find answers to. So it'd be nice to send them to an IRC channel rather than clutter up the mailing list. I'm sure after a few examples and pointers to the right docs I'll be able to find my way. Regards, - Robert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R IRC channel?
On 6/3/2005 1:20 PM, Robert Citek wrote: Is there an IRC channel for R? I have a bunch of relatively simple questions that I can't find answers to. So it'd be nice to send them to an IRC channel rather than clutter up the mailing list. I'm sure after a few examples and pointers to the right docs I'll be able to find my way. I don't know if there's an IRC list, but you shouldn't feel bad about asking simple questions in R-help. You should do your homework first (see the posting guide), but if you've done that and are still at a loss, feel free to post here. (Mention what sort of searches you did that turned up empty; besides getting the answer you want, you might help to improve the documentation). Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Histogram of multiple series on one histogram
I think you can use barplot for what you want. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Depire Alexandre Sent: June 3, 2005 12:14 PM To: r-help@stat.math.ethz.ch Subject: [R] Histogram of multiple series on one histogram Hello, I have three sample, for example a-c(10,20,10,20,30) b-c(10,20,20,30,30) c-c(20,20,10) I would like to have only one histogram with these series, I try the following code: hist(a) hist(b,add=TRUE,col=red) hist(c,add=TRUE,col=green) but it's not that I want I would like an histogram with, from left to right, count of 10 for a, count of 10 for b, count of 10 for c, count of 20 for a, count of 20 for b, ... not overlapped Thanks -- Alexandre DEPIRE INRETS / GARIG Tel.: (+33) 01 47 40 71 66 Fax: (+33) 01 45 47 56 06 2 av. du général Malleret-Joinville 94114 Arcueil - France __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Errors on bar plots
Hi R Gurus, I am a new R user. I did my home work by reading the manuals and searching the internet for examples but failed to find an example before writing this message for help. I would like to create bar plots with the standard error of the mean (or 95% confidence intervals) on the bar. Any suggestions will be appreciated. Operating system: Windows XP pro R version 2.1.0 Data look like this: Site Family Height 1 A 12.3 1 B 13.5 1 C 17.4 2 A 14.0 2 B 11.1 2 C 15.9 . . . Fikret Isik -- Fikret Isik, Research Assistant Prof. Department of Forestry and Env. Resources 3010 Biltmore Hall NC State University, Campus Box 8002, Raleigh, NC 27695 PHONE: 919-515-5029, FAX: 919-515-3169 WEB: http://www4.ncsu.edu/~fisik __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] noise poser spectral density
Dear Signal Processing Expert, I would like to generate a random stationary signal of gaussian probability density function to simulate narrow band noise at the output of an IF amplifier. I know the receiver's system temperature (Ts) and IF bandwidth (B) therefore I assume that my narrow band noise mean power equals KTsB watts and therefore the power spectral density No=KTs per Hz. Do you know any relationship between No and sigma^2 so I can simulate the stationary random signal in matlab? Theory says that for white noise No/2=sigma^2 but this formula I believe is only valid for white broadband noise. I will appreciate your opinion. Regards Dim Patridge I know there are some time series experts on this list, and I am hoping one of you might help me with this problem. I am trying to understand the relationship between No (noise power spectral density) and Gaussian white noise sigma^2. I want to check numerically the theoretical relationship (from Selin,1965) No = sigma^2/(2*W) = sigma^2 * delta t, where No is power spectral density delta t is sampling interval in sec = 1/(2*W) W is the bandwidth: the power spectral density (psd) is flat (equal to No) for freqs between -W and W Hz - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Errors on bar plots
On 6/3/05, Fikret Isik [EMAIL PROTECTED] wrote: Hi R Gurus, I am a new R user. I did my home work by reading the manuals and searching the internet for examples but failed to find an example before writing this message for help. I would like to create bar plots with the standard error of the mean (or 95% confidence intervals) on the bar. Any suggestions will be appreciated. Operating system: Windows XP pro R version 2.1.0 Data look like this: Site Family Height 1 A 12.3 1 B 13.5 1 C 17.4 2 A 14.0 2 B 11.1 2 C 15.9 . . . Is this what you are looking for? http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=54 If so look at barplot2 in package gplots which is in the gregmisc bundle. You could also look at the notch argument to boxplot. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Histogram of multiple series on one histogram
Something like this!?!? Rnew a [1,] 10 1 [2,] 20 1 [3,] 10 1 [4,] 20 1 [5,] 30 1 [6,] 10 2 [7,] 20 2 [8,] 20 2 [9,] 30 2 [10,] 30 2 [11,] 20 3 [12,] 20 3 [13,] 10 3 Rbarplot(table(new[,2],new[,1]),beside=T,legend.text=c(a,b,c)) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Depire Alexandre Sent: June 3, 2005 12:14 PM To: r-help@stat.math.ethz.ch Subject: [R] Histogram of multiple series on one histogram Hello, I have three sample, for example a-c(10,20,10,20,30) b-c(10,20,20,30,30) c-c(20,20,10) I would like to have only one histogram with these series, I try the following code: hist(a) hist(b,add=TRUE,col=red) hist(c,add=TRUE,col=green) but it's not that I want I would like an histogram with, from left to right, count of 10 for a, count of 10 for b, count of 10 for c, count of 20 for a, count of 20 for b, ... not overlapped Thanks -- Alexandre DEPIRE INRETS / GARIG Tel.: (+33) 01 47 40 71 66 Fax: (+33) 01 45 47 56 06 2 av. du général Malleret-Joinville 94114 Arcueil - France __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Histogram of multiple series on one histogram
Hello alexandre, what you are trying to do is *not* an histogram (as a density estimator), if you divide each bar in 3, the surfaces of a won't sum to 1. However a barplot or a barplot2 (in package gplots, bundle gregmisc) would do the trick. See graph 54 on the graph gallery : http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=54 BTW, don't call your vector 'c' unless you want funny things to happen Romain Le 03.06.2005 18:14, Depire Alexandre a écrit : Hello, I have three sample, for example a-c(10,20,10,20,30) b-c(10,20,20,30,30) c-c(20,20,10) I would like to have only one histogram with these series, I try the following code: hist(a) hist(b,add=TRUE,col=red) hist(c,add=TRUE,col=green) but it's not that I want I would like an histogram with, from left to right, count of 10 for a, count of 10 for b, count of 10 for c, count of 20 for a, count of 20 for b, ... not overlapped Thanks -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] factor vector manipulation
Hi, I have one question on factor vector. I have 3 factor vectors: a-factor(c(1, 2, 3)) b-factor(c(a, b, c)) c-factor(c(b, a, c)) what I want is like: c x 1 b 2 2 a 1 3 c 3 which means, I use b as keys and vector a as values and I find values for c. I used the following codes: x-c() d-data.frame(b,a) for (each in 1:length(c)){ # i don't know why each in c did not work tmp-d$a[d$b==c[each]] # question x-append(x, levels(tmp)[as.integer(tmp)]) } data.frame(c,x) If someone has a better way to do it, please help!! Also, I don't understand why I have to use levels() since w/o it, i only added the index for levels in to x. BTW, when b is like 60,000, the process is very slow. Should I use hash here? Thanks, Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] p-value 1 in fisher.test()
The following contingency table generates p-value 1 from fisher.test() ff = c(0,10,250,5000); dim(ff) = c(2,2); fhisher.test(ff)$p.value Sean [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] p-value 1 in fisher.test()
Yi-Xiong Zhou [EMAIL PROTECTED] writes: The following contingency table generates p-value 1 from fisher.test() ff = c(0,10,250,5000); dim(ff) = c(2,2); fhisher.test(ff)$p.value On this system (PIII, Fedora Core 3): ff = c(0,10,250,5000); dim(ff) = c(2,2); fisher.test(ff)$p.value -1 [1] 1.384892e-12 Is that interesting? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] p-value 1 in fisher.test()
At 10:01 PM +0200 6/3/05, Peter Dalgaard wrote: Yi-Xiong Zhou [EMAIL PROTECTED] writes: The following contingency table generates p-value 1 from fisher.test() ff = c(0,10,250,5000); dim(ff) = c(2,2); fhisher.test(ff)$p.value On this system (PIII, Fedora Core 3): ff = c(0,10,250,5000); dim(ff) = c(2,2); fisher.test(ff)$p.value -1 [1] 1.384892e-12 Is that interesting? And on this system (powerpc, darwin7.8.0) ff = c(0,10,250,5000); dim(ff) = c(2,2); fisher.test(ff)$p.value -1 [1] -2.603184e-11 About equally interesting. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] ts.intersect a multivariate and univariate ts
This seems like a FAQ, but I can't figure it out. I have a mv ts object: R tsp(pg) [1] 1982 20031 R dim(pg) [1] 22 12 and a univariate ts: R tsp(rw) [1] 1690 19961 Yet, when I try to intersect them: R tsp(ts.intersect(rw, pg)) [1] 1982 21761 the process goes awry. How to I get rw and pg to be one ts that runs from 1982 to 1996 and has 13 univariate time series in it. Any help appreciated. -Andy R version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.0 year 2005 month04 day 18 language R __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Lattice xyplot -- footnote font size / mtext
Is there a way of controlling the font size and alignment of a footnote in an xyplot, or alternatively of using 'mtext' to place a footnote at the bottom of a graph? --Rich Richard Kittler Advanced Micro Devices, Inc. Sunnyvale, CA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] geometric mean regression
I presume the reference is to the 'geometric mean functional regression' or the 'line of organic correlation' or 'reduced major axis regression'. If so, this is relatively easy alsmost trivial to implement in R. Maybe it's in a package, but I never looked. I worked from Helsel's description in his classic water resources statistics book. See Chapter 10 here: http://water.usgs.gov/pubs/twri/twri4a3/ Now, if you are after confidence intervals or prediction intervals, I haven't found anything on that yet. Seems that I did something a couple of year ago by hacking some approximate residuals using the LOC line and the data, and then feeding that into the CL and PL equations for OLS. (Be advised that I'm not a statistician and did that in the spirit of approximation--who knows? :O) ) By coincidence I've been looking at this again recently. Maybe bootstrapping Regards, Michael Grant --- Kjetil Brinchmann Halvorsen [EMAIL PROTECTED] wrote: Poizot Emmanuel wrote: Hi, is it possible to perform a geometric mean regression with R ? Thanks. As has been said on this list before, This is R, there is no if, only how, but if you actually wanted to ask how it is possible, it would help if you explained what is geometric mean regression. Kjetil Emmanuel Poizot Cnam/Intechmer B.P. 324 50103 Cherbourg Cedex Phone (Direct) : (00 33)(0)233887342 Fax : (00 33)(0)233887339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 01/06/2005 -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
FW: [R] p-value 1 in fisher.test()
The problem is from the most recent version. Here is the platform: R 2.1.0 2005-04-18, on winXP SP2, Sean -Original Message- From: Douglas Grove [mailto:[EMAIL PROTECTED] Sent: Friday, June 03, 2005 12:49 PM To: Yi-Xiong Zhou Subject: Re: [R] p-value 1 in fisher.test() You need to upgrade to a newer version of R. This has already been fixed. On Fri, 3 Jun 2005, Yi-Xiong Zhou wrote: The following contingency table generates p-value 1 from fisher.test() ff = c(0,10,250,5000); dim(ff) = c(2,2); fhisher.test(ff)$p.value Sean [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice xyplot -- footnote font size / mtext
On Friday 03 June 2005 15:47, Kittler, Richard wrote: Is there a way of controlling the font size and alignment of a footnote in an xyplot, or alternatively of using 'mtext' to place a footnote at the bottom of a graph? Your best bet is using 'page', e.g. library(grid) library(lattice) xyplot(1 ~ 1, page = function(n) grid.text(paste(footnote for page, n), x = .99, y = 0.01, default.units = npc, just = c(right, bottom))) You could also use panel.text instead of grid.text, but the latter is more flexible. You could make the font smaller by adding the following in the grid.text call: gp = gpar(fontsize = 8) Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R IRC channel?
/server irc.freenode.net /join #R :) On Fri, 3 Jun 2005, Robert Citek wrote: Is there an IRC channel for R? I have a bunch of relatively simple questions that I can't find answers to. So it'd be nice to send them to an IRC channel rather than clutter up the mailing list. I'm sure after a few examples and pointers to the right docs I'll be able to find my way. Regards, - Robert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Lattice xyplot -- footnote font size / mtext
Great! That should do it. Thanks. --Rich -Original Message- From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] Sent: Friday, June 03, 2005 2:16 PM To: r-help@stat.math.ethz.ch Cc: Kittler, Richard Subject: Re: [R] Lattice xyplot -- footnote font size / mtext On Friday 03 June 2005 15:47, Kittler, Richard wrote: Is there a way of controlling the font size and alignment of a footnote in an xyplot, or alternatively of using 'mtext' to place a footnote at the bottom of a graph? Your best bet is using 'page', e.g. library(grid) library(lattice) xyplot(1 ~ 1, page = function(n) grid.text(paste(footnote for page, n), x = .99, y = 0.01, default.units = npc, just = c(right, bottom))) You could also use panel.text instead of grid.text, but the latter is more flexible. You could make the font smaller by adding the following in the grid.text call: gp = gpar(fontsize = 8) Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] p-value 1 in fisher.test()
On 03-Jun-05 Peter Dalgaard wrote: Yi-Xiong Zhou [EMAIL PROTECTED] writes: The following contingency table generates p-value 1 from fisher.test() ff = c(0,10,250,5000); dim(ff) = c(2,2); fhisher.test(ff)$p.value On this system (PIII, Fedora Core 3): ff = c(0,10,250,5000); dim(ff) = c(2,2); fisher.test(ff)$p.value -1 [1] 1.384892e-12 Is that interesting? And on mine (A: PII, Red Had 9, R-1.8.0): ff - c(0,10,250,5000); dim(ff) - c(2,2); 1-fisher.test(ff)$p.value [1] 1.268219e-11 (B: PIII, SuSE 7.2, R-2.1.0beta): ff - c(0,10,250,5000); dim(ff) - c(2,2); 1-fisher.test(ff)$p.value [1] -1.384892e-12 Peter, I'm not sure which is the more interesting! Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 03-Jun-05 Time: 21:45:13 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] rearrange data
Dear all: I have this: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3 Example: m- matrix(1:15,nrow=3,byrow=T) m v- unlist(list(t(m[,1:4]))) u- rep(c(5,10,15),c(4,4,4)) data.frame(v,u) This is the result I want but I would like to learn a simpler way to do it. Any clue? On the other hand, how can I reorganize the data in the way it was in the begining? I hope someone can help me on this... Thanks in advance j. silva [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] lattice: change point color in densityplot()?
When using the densityplot function from lattice library, is there a way to pick a different color *for the points only*? (I'm using densityplot(..., plot.points=TRUE, ...)) Using col parameter changes the color for both, the points and the curve. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RE: GARCH (1 , 1), Hill estimator of alpha, Pareto estimator]
Ukech U. Kidi wrote: dax- diff(log(DAX_CAC$DAX[1:1865])) m1- garch(dax) Error: couldn't find function garch m1- garch(dax[1:1865]) Error: couldn't find function garch m1- garch(dax[1:1865]) I am sorry, but I forgot to change the addres to r-help in the reply. Well, I am not sure, wheere do you want to get those data from, but if you are able to do that: dax- diff(log(DAX_CAC$DAX[1:1865])) Then it means, that you have managed to do that. The thing is, that garch function is in the tseries package and I haven't seen any call to it, so first try: library(tseries) and then: m1- garch(dax) summary(m1) plot(m1) My scripts usually look like that: library(tseries) #import data from csv file with first row Open, High, Low, Close, Volume wig20 - read.csv(wig20.txt, sep=;, dec=,) #multiply by 100, because sometimes it's easier to converge the model r - 100*diff(log(wig20$CLOSE)) kpss.test(r) pp.test(r) acf(r) pacf(r) #if there is no significant autocorelation: y - r - mean(r) fit - garch(y, order = c(1,1)) summary(fit) plot(fit) #If you need some particular results for further testing, then use: ch - predict(fit, genuine=TRUE) e - fit$residuals #end do what you want or draw any other result this way That's just the basic, but then you can improve it the way you want. If you have lot of models to estimate, I suggest using sink() and postscript(), for saving results, so after writing the code and sourcing that into R by source(), you can go and have a coffe and come back later to browse the results. BTW, check also rmetrics.org. There are also functions for garch modelling in fSeries. Best regards, Wojtek __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] rearrange data
reshape() should do it: d V1 V2 V3 V4 V5 1 A1 B1 C1 D1 E1 2 A2 B2 C2 D2 E2 3 A3 B3 C3 D3 E3 d2 - reshape(d, varying=list(names(d)[1:4]), direction=long)[c(3,1)] d2[order(d2$V5),] V1 V5 1.1 A1 E1 1.2 B1 E1 1.3 C1 E1 1.4 D1 E1 2.1 A2 E2 2.2 B2 E2 2.3 C2 E2 2.4 D2 E2 3.1 A3 E3 3.2 B3 E3 3.3 C3 E3 3.4 D3 E3 Andy From: jose silva Dear all: I have this: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3 Example: m- matrix(1:15,nrow=3,byrow=T) m v- unlist(list(t(m[,1:4]))) u- rep(c(5,10,15),c(4,4,4)) data.frame(v,u) This is the result I want but I would like to learn a simpler way to do it. Any clue? On the other hand, how can I reorganize the data in the way it was in the begining? I hope someone can help me on this... Thanks in advance j. silva [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lattice: change point color in densityplot()?
On Friday 03 June 2005 17:49, M. K. wrote: When using the densityplot function from lattice library, is there a way to pick a different color *for the points only*? (I'm using densityplot(..., plot.points=TRUE, ...)) Using col parameter changes the color for both, the points and the curve. Indirectly. ?panel.densityplot says that there's a parameter for line color, so you could do densityplot(rnorm(100), col = 'red', col.line = 'cyan') Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] p-value 1 in fisher.test()
On 03-Jun-05 Ted Harding wrote: And on mine (A: PII, Red Had 9, R-1.8.0): ff - c(0,10,250,5000); dim(ff) - c(2,2); 1-fisher.test(ff)$p.value [1] 1.268219e-11 (B: PIII, SuSE 7.2, R-2.1.0beta): ff - c(0,10,250,5000); dim(ff) - c(2,2); 1-fisher.test(ff)$p.value [1] -1.384892e-12 I have a suggestion (maybe it should also go to R-devel). There are many functions in R whose designated purpose is to return the value of a probability (or a probability density). This designated purpose is in the mind of the person who has coded the function, and is implicit in its usage. Therefore I suggest that every such function should have a built-in internal check that no probability should be less than 0 (and if the primary computation yields such a value then the function should set it exactly to zero), and should not exceed 1 (in which case the function should set it exactly to 1). [And, in view of recent echanges, I would suggest exactly +0, not -0!] Similar for any attempts to return a negative probability density; while of course a positive value can be allowed to be anything. All probabilities would then be guaranteed to be clean and issues like the Fisher exact test above would no longer be even a tiny problem. Implementing this in the possibly many cases where it is not already present is no doubt a long-term (and tedious) project. Meanwhile, people who encounter problems due to its absence can carry out their own checks and adjustments! Best wishes to all, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 04-Jun-05 Time: 00:02:32 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: RE: [R] rearrange data
perfect. thank you Andy! reshape() should do it: d V1 V2 V3 V4 V5 1 A1 B1 C1 D1 E1 2 A2 B2 C2 D2 E2 3 A3 B3 C3 D3 E3 d2 - reshape(d, varying=list(names(d)[1:4]), direction=long)[c(3,1)] d2[order(d2$V5),] V1 V5 1.1 A1 E1 1.2 B1 E1 1.3 C1 E1 1.4 D1 E1 2.1 A2 E2 2.2 B2 E2 2.3 C2 E2 2.4 D2 E2 3.1 A3 E3 3.2 B3 E3 3.3 C3 E3 3.4 D3 E3 Andy From: jose silva Dear all: I have this: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3 Example: m- matrix(1:15,nrow=3,byrow=T) m v- unlist(list(t(m[,1:4]))) u- rep(c(5,10,15),c(4,4,4)) data.frame(v,u) This is the result I want but I would like to learn a simpler way to do it. Any clue? On the other hand, how can I reorganize the data in the way it was in the begining? I hope someone can help me on this... Thanks in advance j. silva [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments, ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to change the value of a class slot
I defined an S4 class with a slot i. Then I wrote a regular function that attempted to increment i. This didn't work, apparently because of the general rule that a function can't change the values of its arguments outside the function. I gather there are ways around it, but the Green book admonishes cheating on the S evaluation model is to be avoided (p. 190). Thinking that class methods needed to an exception to this rule, I then tried setMethod with the function I had written. However, when I called the function I got setMethod(nextPath, CompletePathMaker, nextPath) Creating a new generic function for 'nextPath' in '.GlobalEnv' [1] nextPath nextPath(pm) Error: protect(): protection stack overflow I can change the value of the slot interactively, so the problem does not appear to be that the slots are considered off-limits. What do I need to do to update slot values? Here are some possibly relevant code fragments setClass(CompletePathMaker, representation(i=integer, timeOffset=numeric, # to avoid 0's truePaths=TruePaths) ) nextPath - function(pm){ #pm is a CompletePathMaker [EMAIL PROTECTED] - [EMAIL PROTECTED](1) [etc] I'm trying to make the class behave like an iterator, with i keeping track of its location. I'm sure there are more R'ish ways to go, but I'm also pretty sure I'm going to want to be able to update slots. Thanks. Ross Boylan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] factor vector manipulation
On 6/3/05, Weiwei Shi [EMAIL PROTECTED] wrote: Hi, I have one question on factor vector. I have 3 factor vectors: a-factor(c(1, 2, 3)) b-factor(c(a, b, c)) c-factor(c(b, a, c)) what I want is like: c x 1 b 2 2 a 1 3 c 3 which means, I use b as keys and vector a as values and I find values for c. I used the following codes: x-c() d-data.frame(b,a) for (each in 1:length(c)){ # i don't know why each in c did not work tmp-d$a[d$b==c[each]] # question x-append(x, levels(tmp)[as.integer(tmp)]) } data.frame(c,x) If someone has a better way to do it, please help!! Also, I don't understand why I have to use levels() since w/o it, i only added the index for levels in to x. BTW, when b is like 60,000, the process is very slow. Should I use hash here? Thanks, Weiwei cbind(c, x = a[match(c,b)]) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ts.intersect a multivariate and univariate ts
Andy: I have a mv ts object: R tsp(pg) [1] 1982 20031 R dim(pg) [1] 22 12 and a univariate ts: R tsp(rw) [1] 1690 19961 Yet, when I try to intersect them: R tsp(ts.intersect(rw, pg)) [1] 1982 21761 the process goes awry. How to I get rw and pg to be one ts that runs from 1982 to 1996 and has 13 univariate time series in it. Any help appreciated. Providing a reproducible example would be a first step... For me the following works without any problems: R pg - ts(matrix(rnorm(22 * 12), ncol = 12), start = 1982) R rw - ts(rnorm(307), start = 1690) R tsp(pg) [1] 1982 20031 R dim(pg) [1] 22 12 R tsp(rw) [1] 1690 19961 R rwpg - ts.intersect(rw, pg) R tsp(rwpg) [1] 1982 19961 R dim(rwpg) [1] 15 13 Best, Z __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] locator() via tcltk
Hello, I'm trying to write a function using tcltk to interactively modify a plot and gather locator() data. I've read Peter's articles in Rnews, the help pages in tcltk, http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/, plus a post in R-help sometime ago, but haven't found a solution. The idea goes something like this: require(tcltk) testplot - function() { getcoords - function(...) { locator(5) } x - 1:1000 y - rnorm(1000) plot(x, y) base - tktoplevel() loc.pts - tkbutton(base, text = Get coordinates, command = getcoords) quit.but - tkbutton(base, text = Quit, command = function() tkdestroy(base)) tkpack(loc.pts, quit.but) } I'd like testplot to return the value from getcoords. The Get coordinates button seems to be correctly calling getcoords, and locator is doing its job, but I don't know how to store its value. Any help is very much appreciated. Regards, Sebastian -- Sebastian P. Luque __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lattice: change point color in densityplot()?
--- Deepayan Sarkar [EMAIL PROTECTED] wrote: Indirectly. ?panel.densityplot says that there's a parameter for line color, so you could do densityplot(rnorm(100), col = 'red', col.line = 'cyan') Ah, great, thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] locator() via tcltk
Sebastian Luque wrote: Hello, I'm trying to write a function using tcltk to interactively modify a plot and gather locator() data. I've read Peter's articles in Rnews, the help pages in tcltk, http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/, plus a post in R-help sometime ago, but haven't found a solution. The idea goes something like this: require(tcltk) testplot - function() { getcoords - function(...) { locator(5) } x - 1:1000 y - rnorm(1000) plot(x, y) base - tktoplevel() loc.pts - tkbutton(base, text = Get coordinates, command = getcoords) quit.but - tkbutton(base, text = Quit, command = function() tkdestroy(base)) tkpack(loc.pts, quit.but) } I'd like testplot to return the value from getcoords. The Get coordinates button seems to be correctly calling getcoords, and locator is doing its job, but I don't know how to store its value. Any help is very much appreciated. You can do this with local functions. For example, testplot - function() { coords - NA getcoords - function(...) { coords - locator(5) } x - 1:1000 y - rnorm(1000) plot(x, y) base - tktoplevel() loc.pts - tkbutton(base, text = Get coordinates, command = getcoords) quit.but - tkbutton(base, text = Quit, command = function() tkdestroy(base)) tkpack(loc.pts, quit.but) return(function() coords) } This stores the results in a variable named coords in the testplot frame. testplot itself returns a function that can read that value. You'd use it like this: lastval - testplot() ## do some button clicking... lastval() # will print the result of the last click. This is one of the somewhat weird but very nice features of R. S-PLUS doesn't work this way. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] the test result is quite different,why?
data:http://fmwww.bc.edu/ec-p/data/wooldridge/CRIME4.dta a$call lm(formula = clcrmrte ~ factor(year) + clprbarr + clprbcon + clprbpri + clavgsen + clpolpc, data = cri) bptest(a,st=F) Breusch-Pagan test data: a BP = 34.4936, df = 10, p-value = 0.0001523 bptest(a,st=T) studentized Breusch-Pagan test data: a BP = 10.9297, df = 10, p-value = 0.363 ncv.test(a) $formula ~fitted.values $formula.name [1] Variance $ChiSquare [1] 1.163501 $Df [1] 1 $p [1] 0.2807406 $test [1] Non-constant Variance Score Test attr(,class) [1] chisq.test __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] locator()
Dear Sebastian: Here is a snippet of code that you may find interesting for labeling points on the plane: plane1 - function(x,main1=) { plot(x,main=main1,ylab= ) zz - locator() text(zz$x,zz$y, labels=paste((,round(zz$x,1), ,,round(zz$y,1),),sep=), pos=2,cex=.55) invisible() } Hope this helps! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re: locator() via tcltk
That's very interesting, thanks a lot Duncan. I should re-read the R Language manual in more detail. Sebastian On 6/3/05, Duncan Murdoch [EMAIL PROTECTED] wrote: Sebastian Luque wrote: Hello, I'm trying to write a function using tcltk to interactively modify a plot and gather locator() data. I've read Peter's articles in Rnews, the help pages in tcltk, http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/, plus a post in R-help sometime ago, but haven't found a solution. The idea goes something like this: require(tcltk) testplot - function() { getcoords - function(...) { locator(5) } x - 1:1000 y - rnorm(1000) plot(x, y) base - tktoplevel() loc.pts - tkbutton(base, text = Get coordinates, command = getcoords) quit.but - tkbutton(base, text = Quit, command = function() tkdestroy(base)) tkpack(loc.pts, quit.but) } I'd like testplot to return the value from getcoords. The Get coordinates button seems to be correctly calling getcoords, and locator is doing its job, but I don't know how to store its value. Any help is very much appreciated. You can do this with local functions. For example, testplot - function() { coords - NA getcoords - function(...) { coords - locator(5) } x - 1:1000 y - rnorm(1000) plot(x, y) base - tktoplevel() loc.pts - tkbutton(base, text = Get coordinates, command = getcoords) quit.but - tkbutton(base, text = Quit, command = function() tkdestroy(base)) tkpack(loc.pts, quit.but) return(function() coords) } This stores the results in a variable named coords in the testplot frame. testplot itself returns a function that can read that value. You'd use it like this: lastval - testplot() ## do some button clicking... lastval() # will print the result of the last click. This is one of the somewhat weird but very nice features of R. S-PLUS doesn't work this way. Duncan Murdoch -- Sebastian Luque Department of Biology Memorial University of Newfoundland __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html