[R] package license questions
I am looking for some advice on licenses. Here is my situation: Over the last couple years, I have developed a rather large number of fire department analysis functions. I am in the process of trying to publish some packages to make these functions available to the public. I am trying to release two packages that essentially define S4 classes for common types of fire department data. Then, I would like to publish a package that essentially reads in these fire department data types and returns analysis results. My concern is that I may eventually want to build and sell some proprietary functions and I am trying not to box myself out of this future option. It is my understanding that if I use the GPL license, all work based on my packages would have to take on the GPL license (effectively making it impossible to sell software). It looks like the Lesser General Public License (LGPL) may suit my needs by allowing me to make public my current work without eliminating the possibility of future proprietary work. I have a couple questions I am hoping somebody can answer. - It says that libraries licensed under a LGPL can be used by proprietary software. What is meant by libraries? Are class definitions and functions considered libraries? - If I use the LGPL for all my packages, do I maintain the right to build and sell software that is based on these LGPL packages? For instance, could I use the class definitions from a LGPL package as inputs for analysis in a piece of proprietary software? - Other than potentially allowing competitors to also use my LGPL packages in their proprietary software, are there any big disadvantages to using a LGPL? - If somebody improves on my LGPL S4 class definitions, can I still then use them in a proprietary package despite their being modified? I am a big supporter of the open source community and have personally benefitted greately from open source software. My intentions are to release my work as open source, but just don't want to be boxed out of future proprietary developments. These licenses can be pretty confusing, so I appreciate any information that can help me figure this out. Thanks, Markus [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] caculate the frequencies of the Amino Acids
I sent a private reply to the poster yesterday with the solution to his problem, bit evidently he hasn't seen it, so ... # Function to tabulate an amino acid sequence # using strsplit and table: AAtab2 - function(x) { # Creates a frequency table of the characters in a string AA - LETTERS[-c(2, 10, 15, 21, 24, 26)] n - nchar(x) s - substring(x, 1:n, 1:n) table(factor(s, levels = AA)) } AAtabMatrix - function(x) { # Input x is an amino acid sequence as a character string if(!is.character(x)) stop('Input must be a character string or vector.') do.call(rbind, lapply(as.list(x), AAtab2)) } cheseq - scan(url('http://n4.nabble.com/file/n997581/sequence.txt'), what = '') AAtabMatrix(cheseq) A C D E F G H I K L M N P Q R S T V W Y [1,] 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [2,] 21 0 25 28 27 24 0 34 39 31 11 20 16 10 17 25 22 33 3 15 [3,] 34 5 15 25 6 35 7 24 23 32 9 12 15 10 17 14 13 36 2 13 [4,] 33 5 17 24 7 36 7 24 24 32 9 13 14 9 17 12 14 36 2 12 [5,] 33 5 16 25 5 35 6 24 23 33 8 12 15 9 17 17 12 35 2 15 [6,] 33 4 15 6 21 30 3 19 23 22 8 8 8 14 17 14 12 24 5 12 [7,] 30 3 13 4 16 22 2 17 16 17 6 6 7 11 15 11 12 18 3 11 [8,] 39 5 21 8 22 39 2 23 29 25 10 8 7 13 22 14 21 25 7 16 [9,] 34 4 17 6 19 30 2 20 24 21 8 7 7 12 17 14 16 21 5 14 [10,] 35 4 17 6 18 31 3 20 23 21 8 7 7 12 18 12 17 21 5 13 Each row represents the frequency table of an individual AA sequence. DM On Sat, Jan 2, 2010 at 9:28 PM, che fadialn...@live.com wrote: Thanks very much the code is working perfectly, but I hope guys that you can help me to do the same thing but by using the loop structure, i want to know if i am doing right, i want to use the loop structure to scan each sequence from the file sequence.txt (the file is attached) to get the frequency for each Amino Acid, and i wrote the following code so far, and i stopped, got confused, specially that i am a very beginner in R http://n4.nabble.com/file/n997581/sequence.txt sequence.txt : x-read.table(sequence.txt,header=FALSE) AA-c('A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y') test-nchar(as.character(x$V1[i])) frequency-function(X) { y-rep(0,20) for(j in 1:test){ for(i in 1:nrow(x)){ res-which(AA==substr(x$V1[i],j,j)) y[res]=y[res]+1 } } return(y) } So how to fix this code, how to give the life for the i and the j in order to initiate the indexing. Sorry for bothering you guys. che wrote: may some one please help me to sort this out, i am trying to writ a R code for calculating the frequencies of the amino acids in 9 different sequences, i want the code to read the sequence from external text file, i used the following code to do so: x-read.table(sequence.txt,header=FALSE) then i defined an array for 20 amino acids as following: AA-c('A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y') i am using the following code to calculate the frequencies: frequency-function(X) { y-rep(0,20) for(j in 1:nchar(as.character(x$V1[i]))){ for(i in 1:9){ res-which(AA==substr(x$V1[i],j,j)) y[res]=y[res]+1 } } return(y) } but this code actually is not working, it reads only one sequence, i dont know why the loop is not working for the i, which suppose to read the nine rows of the file sequence.txt. the sequence.txt file is attached to this message. cheers http://n4.nabble.com/file/n997072/sequence.txt sequence.txt -- View this message in context: http://n4.nabble.com/caculate-the-frequencies-of-the-Amino-Acids-tp997072p997581.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Run R in server web
Hi Jindo, I don't know how to do what you ask, but I recommend you to have a look at this: http://www.r-statistics.com/2009/12/a-web-application-of-rs-ggplot2/ And try to follow the links to the websites behind it, maybe somewhere in it there will be more information. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- On Sat, Jan 2, 2010 at 10:39 AM, Jiiindo jiin...@yahoo.com wrote: Colleagues, I have a web server (appache Tomcat), and my web application (java-jsp..) run on it, how i can run R on server example, i want running R on server, and save output on server Thanks -- View this message in context: http://n4.nabble.com/Run-R-in-server-web-tp997126p997126.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] questions on generic functions
Hi all, I'm trying to build a package, but run into problems with generic functions. I have two classes aa and bb, and defined the function summary.bb. Now I want to make summary.bb the default method for both classes aa and bb. That is, if I have two objects object.aa and object.bb from class aa and bb respectively, the function call summary(object.aa) and summary(object.bb) will apply the function summary.bb at default. How can I do that? Should I use setMethod ? Thanks a lot. Regards, Wayne __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with function fitdistr in MASS
Please read the footer of this message. ?fitdistr says x: A numeric vector. and setting the class does not make it a numeric vector (it is just a label). And fitdistr early on does if (missing(x) || length(x) == 0L || mode(x) != numeric) stop('x' must be a non-empty numeric vector) so you do have a non-empty numeric vector. It is likely that your data contains NAs, in which case the quoted result is correct. But despite the posting guide we have no details of your 'mydata' and have to guess. On Sat, 2 Jan 2010, Saji Ren wrote: Hi, R users: I want to fit my data into a normal distribution by using the command fitdistr in MASS. I changed my data class from ts to numeric by class(mydata)=numeric but after using fitdistr, I got the result below fitdistr(mydata,normal) meansd NA NA (NA) (NA) the help doc of fitdistr does not mention anything about that, thus I need your help. The help page is not intended to be a very basic statistics/R textbook. Thank you in advanced, Saji from Shanghai -- View this message in context: http://n4.nabble.com/Help-with-function-fitdistr-in-MASS-tp997609p997609.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: problems with column names legend
Hi, Using backticks might work to some extent, library(lattice) `my variable` = 1:10 y=rnorm(10) xyplot(`my variable` ~ y) but if your data is in a data.frame the names should have been converted, make.names('my variable') [1] my.variable HTH, baptiste 2010/1/3 Jay josip.2...@gmail.com: Hello! one more question about xyplot. If I have data which have space in the column names, say xyz 123. How do I create a working graph where this text is displayed in the legend key? Now when I try something like xyplot(xyz 123 ~ variable1, data = mydata, ...) I get nothing. Also, is it possible to genrate the graph with xyplot(mydata[,1] ~ variable1, data = mydata, ...) and then later in the code specify the names that should be displayed in the legend? Thank you! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with function fitdistr in MASS
On Sat, 2010-01-02 at 23:20 -0800, Saji Ren wrote: Hi, R users: I want to fit my data into a normal distribution by using the command fitdistr in MASS. I changed my data class from ts to numeric by class(mydata)=numeric but after using fitdistr, I got the result below fitdistr(mydata,normal) meansd NA NA (NA) (NA) the help doc of fitdistr does not mention anything about that, thus I need your help. Thank you in advanced, Saji from Shanghai Hi Sajj, You hava NA in your data try: fitdistr(na.exclude(mydata),normal) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rscript: how to suppress all output
Thanks! I'm using Mac 10.6.2. This did it: ~/Documents cat test.r #! /usr/bin/Rscript --vanilla --default-packages=utils suppressMessages(require(Hmisc)) suppressMessages(require(gsubfn)) a - 1:100 print(a) ~/Documents Rscript test.r /dev/null ~/Documents -J 2010/1/3 Prof Brian Ripley rip...@stats.ox.ac.uk: On Sat, 2 Jan 2010, johannes rara wrote: How can I suppress ALL output when running Rscript in Terminal? ~/DocumentsRscript test.r Rscript test.r /dev/null or equivalent in your shell. But note that Rscript produces no output itself: tystie% touch test.r tystie% Rscript test.r tystie% so anything you see is created by your script. If your script produces output you do not want, the problem lies in your script. Depending how it is doing it, consider functions like invisible(), sink() and suppressMessages(). I tried options --slave, --vanilla with no success. I get these --slave is the default for Rscript: use Rscript --verbose to see what it is doing (see ?Rscript). Loading required package: methods ..etc.. (That one is because you did not specify methods as part of the initial package list: see ?Rscript.) and other output as well. -J sessionInfo() R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1 locale: fi_FI.UTF-8/fi_FI.UTF-8/C/C/fi_FI.UTF-8/fi_FI.UTF-8 attached base packages: [1] grid splines stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_0.8.3 reshape_0.8.3 plyr_0.1.9 proto_0.3-8 Hmisc_3.7-0 survival_2.35-7 loaded via a namespace (and not attached): [1] cluster_1.12.1 lattice_0.17-26 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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, UK Fax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Off-topic] problem with Tinn-R editor
Ask directly to Jose-Claudio Faria (jcfa...@users.sourceforge.net). He is the author and maintainer of Tinn-R. Best, Philippe Grosjean ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .. Bogaso wrote: This is not directly related with R however I would like to ask for a solution for my TINN-R editor because, I feel that lot many people perhaps use it as a reliable R editor and secondly I could not find any other forum only deals with TINN over net to discuss with. For quite sometime I have been using Tinn-R as an editor for R-code however for some days I am noticing a strange problem on that, I cannot edit anything after typing something there, specially 'back-space' is not working at all. I feel, perhaps I have changed some default setting unintentionally which creates that pinching. Would anyone guide me how to get rid from that? Your help will be highly appreciated. Thanks, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Anova in 'car': SSPE apparently deficient rank
Colleen F. Moore wrote: I have design with two repeated-measures factor, and no grouping factor. I can analyze the dataset successfully in other software, including my legacy DOS version BMDP, and R's 'aov' function. I would like to use 'Anova' in 'car' in order to obtain the sphericity tests and the H-F corrected p-values. I do not believe the data are truly deficient in rank. I followed the methods for this kind of analysis outlined in Bennett's excellent handouts for his Psychology 710 course http://www.psychology.mcmaster.ca/bennett/psy710/lectures/maxwell_chp12.pdf I am trying to convert my own similar course to R for my students for next fall. I have been successful at analyzing a segment of the data as a 2-way repeated measures design. Here is my code: your.data=read.table(pipe(pbpaste),header=T) your.data partic A1B1 A1B2 A1B3 A1B4 A2B1 A2B2 A2B3 A2B4 A3B1 A3B2 A3B3 A3B4 1 p111231247137 10 2 p2223322562469 3 p3122323261479 4 p411221236238 10 5 p5223323572379 attach(your.data) multmodel=lm(cbind(A1B1, A1B2, A1B3, A1B4, A2B1, A2B2, A2B3, A2B4, A3B1, A3B2, A3B3, A3B4)~1) poke.idata=read.table(pipe(pbpaste),header=T) poke.idata Afac Bfac 1A1 B1 2A1 B2 3A1 B3 4A1 B4 5A2 B1 6A2 B2 7A2 B3 8A2 B4 9A3 B1 10 A3 B2 11 A3 B3 12 A3 B4 attach(poke.idata) pokeAnova =Anova(multmodel,idata=poke.idata,idesign=~Afac*Bfac,type=III) Error in linear.hypothesis.mlm(mod, hyp.matrix, SSPE = SSPE, idata = idata, : The error SSP matrix is apparently of deficient rank = 4 6 Thanks for any help or advice. And thanks for the 'car' package, which is a great asset to my course. I'm just stuck on this one example. Hmm, this does seem to work with regular anova.mlm: anova(multmodel, idata=poke.idata, X=~Afac+Bfac,test=Sph) Analysis of Variance Table Contrasts orthogonal to ~Afac + Bfac Greenhouse-Geisser epsilon: 0.2880 Huynh-Feldt epsilon:0.4871 Df F num Df den DfPr(F) G-G Pr H-F Pr (Intercept) 1 36.67 6 24 6.164e-11 2.5249e-04 3.3530e-06 Residuals4 As far as I recall, the epsilon corrections do not have a formal requirement of a nonsingular SSD of the relevant contrast. Not sure about the accuracy of the F probabilities in such cases, though. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Please help me!!!! Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected
thanks ï¼now i reduce the number of the descriptors, It is ok. å¨2010-01-03ï¼Max Kuhn [via R] ml-node+997387-1292262...@n4.nabble.com åéï¼ -åå§é®ä»¶- å件人:Max Kuhn [via R] ml-node+997387-1292262...@n4.nabble.com åéæ¶é´:2010å¹´1æ3æ¥ æææ¥ æ¶ä»¶äºº:bbslover dlu...@yeah.net 主é¢:Re: [R] Please help me Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected Your data set has 217 predictors and 166 samples. If you read the vignette on feature selection for this package, you'll see that the default ranking mechanism that it uses for linear models requires a linear model fit. The note that: prediction from a rank-deficient fit may be misleading should tell you something. If it doesn't: the model fit is over determined and there is no unique solution, so many of the parameter estimates are NA. Either create a modified version of lmFuncs that suits your needs or remove variables prior to modeling (or try some other method that doesn't require more samples than predictors, such as the lasso or elasticnet). Max On Fri, Jan 1, 2010 at 10:14 PM, bbslover [hidden email] wrote: I am learning the package caret, after I do the rfe function, I get the error ,as follows: Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected In addition: Warning message: In predict.lm(object, x) : prediction from a rank-deficient fit may be misleading I try to that manual example, that is good, my data is wrong. I do not know what reanson? my code is : subsets-c(1:5,10,15,20,25) ctrl-rfeControl(functions=lmFuncs, method = cv, verbose=FALSE,returnResamp=final) lmProfile-rfe(trainDescr,trainY,sizes=subsets,rfeControl=ctrl) before it, I have do some pre-process and my data is in the attachment. Please help me. thank you! kevinhttp://n4.nabble.com/file/n996068/trainDescr.txt trainDescr.txt http://n4.nabble.com/file/n996068/trainY.txt trainY.txt -- View this message in context:http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p996068.html Sent from the R help mailing list archive at Nabble.com. __ [hidden email]mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Max __ [hidden email]mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. View message @http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p997387.html To unsubscribe from Please help me Error in `[.data.frame`(x, , retained, drop = FALSE) : undefined columns selected,click here. -- View this message in context: http://n4.nabble.com/Please-help-me-Error-in-data-frame-x-retained-drop-FALSE-undefined-columns-selected-tp996068p997622.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RHTMLForms Package
Can anyone tell me from where to download the package RHTMLForms ? CRAN seems not holding this anymore. I am using Windows Vista OS. Thanks -- View this message in context: http://n4.nabble.com/RHTMLForms-Package-tp997672p997672.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RHTMLForms Package
On Sun, 3 Jan 2010, Ron_M wrote: Can anyone tell me from where to download the package RHTMLForms ? CRAN seems not holding this anymore. I am using Windows Vista OS. It never did: it is an Omegahat package, see http://www.omegahat.org/RHTMLForms/. (I don't understand why a Google search on RHTMLForms did not get you to Omegahat.) As far as I know it is available as source only, so you need to do (untested) something like install.packages(c(RCurl, XML)) # dependencies for which binaries are available on CRANextras options(pkgType=source) setRepositories() # select Omegahat install.packages('RHTMLForms') assuming a current version of R. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: problems with column names legend
Thanks, the backtickes got the code working. However, now I cant get it to draw the legend/key. For example, look at this figure: http://osiris.sunderland.ac.uk/~cs0her/Statistics/xyplot5.png My graph is similar, but instead of 1,2,...,8 as the names of the series I want it to say Data one (a string with spaces) and so on. On Jan 3, 10:58 am, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, Using backticks might work to some extent, library(lattice) `my variable` = 1:10 y=rnorm(10) xyplot(`my variable` ~ y) but if your data is in a data.frame the names should have been converted, make.names('my variable') [1] my.variable HTH, baptiste 2010/1/3 Jay josip.2...@gmail.com: Hello! one more question about xyplot. If I have data which have space in the column names, say xyz 123. How do I create a working graph where this text is displayed in the legend key? Now when I try something like xyplot(xyz 123 ~ variable1, data = mydata, ...) I get nothing. Also, is it possible to genrate the graph with xyplot(mydata[,1] ~ variable1, data = mydata, ...) and then later in the code specify the names that should be displayed in the legend? Thank you! __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] package license questions
On 02/01/2010 11:19 PM, Markus Weisner wrote: I am looking for some advice on licenses. Here is my situation: Over the last couple years, I have developed a rather large number of fire department analysis functions. I am in the process of trying to publish some packages to make these functions available to the public. I am trying to release two packages that essentially define S4 classes for common types of fire department data. Then, I would like to publish a package that essentially reads in these fire department data types and returns analysis results. My concern is that I may eventually want to build and sell some proprietary functions and I am trying not to box myself out of this future option. It is my understanding that if I use the GPL license, all work based on my packages would have to take on the GPL license (effectively making it impossible to sell software). That only applies to other people unless you choose to incorporate other people's GPL'd code into your package. The GPL imposes no conditions on the copyright holder, it's a license given by the copyright holder to other people to allow them to do things (basically copying, modifying, and redistributing) that otherwise would be copyright violations. The obligation the other people need to follow is that *they* must offer the GPL license if they include your code. So they'll have some trouble commercializing it (but it's not impossible to commercialize GPL'd code, it's just supposed to be impossible to do it in a closed source way). The trap with GPL is that other people may make improvements to your code that you'd like to use. If you do, they become copyright holders as well, and then the combined work has to be licensed using GPL unless all of you can agree otherwise. But at that point you've accepted a free contribution from someone else, it's only fair to share the ownership of the product with them. It looks like the Lesser General Public License (LGPL) may suit my needs by allowing me to make public my current work without eliminating the possibility of future proprietary work. I have a couple questions I am hoping somebody can answer. - It says that libraries licensed under a LGPL can be used by proprietary software. What is meant by libraries? Are class definitions and functions considered libraries? - If I use the LGPL for all my packages, do I maintain the right to build and sell software that is based on these LGPL packages? For instance, could I use the class definitions from a LGPL package as inputs for analysis in a piece of proprietary software? - Other than potentially allowing competitors to also use my LGPL packages in their proprietary software, are there any big disadvantages to using a LGPL? - If somebody improves on my LGPL S4 class definitions, can I still then use them in a proprietary package despite their being modified? The LGPL puts weaker constraints on users of your code. You still maintain all the rights you ever did, but it doesn't stop them from commercializing closed-source products using your code as a library, whatever that means. Duncan Murdoch I am a big supporter of the open source community and have personally benefitted greately from open source software. My intentions are to release my work as open source, but just don't want to be boxed out of future proprietary developments. These licenses can be pretty confusing, so I appreciate any information that can help me figure this out. Thanks, Markus [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Scores in Dimensions in Correspondence Analysis
Hi R, I was experimenting with the CA package for correspondence analysis. data(author) ca(author) plot(ca(author)) How can I get the values used by the plot for the two axis for biplot? In other words, how will I be able to obtain the scores in the dimensions (which are obtained by PCA) of the graphs? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scores in Dimensions in Correspondence Analysis
Does the $rowcoord and $colcoord help? Thanks and Regards, Shubha Karanth -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Sunday, January 03, 2010 6:25 PM To: r-help@r-project.org Subject: [R] Scores in Dimensions in Correspondence Analysis Hi R, I was experimenting with the CA package for correspondence analysis. data(author) ca(author) plot(ca(author)) How can I get the values used by the plot for the two axis for biplot? In other words, how will I be able to obtain the scores in the dimensions (which are obtained by PCA) of the graphs? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] F77_CALL, F77_NAME definition
I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for: F77_CALL(dpotri) ? Thank you. Kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F77_CALL, F77_NAME definition
On 03/01/2010 9:11 AM, rkevinbur...@charter.net wrote: I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for: F77_CALL(dpotri) ? It's your search. The definition is in src/include/R_ext/RS.h. BTW, this sort of question is much more of an R-devel question than an R-help one. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scores in Dimensions in Correspondence Analysis
Got that... Thanks and Regards, Shubha Karanth | Amba Research Ph +91 80 3980 8283 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Sunday, January 03, 2010 6:30 PM To: r-help@r-project.org Subject: Re: [R] Scores in Dimensions in Correspondence Analysis Does the $rowcoord and $colcoord help? Thanks and Regards, Shubha Karanth -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Sunday, January 03, 2010 6:25 PM To: r-help@r-project.org Subject: [R] Scores in Dimensions in Correspondence Analysis Hi R, I was experimenting with the CA package for correspondence analysis. data(author) ca(author) plot(ca(author)) How can I get the values used by the plot for the two axis for biplot? In other words, how will I be able to obtain the scores in the dimensions (which are obtained by PCA) of the graphs? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F77_CALL, F77_NAME definition
On Jan 3, 2010, at 9:11 AM, rkevinbur...@charter.net wrote: I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for: F77_CALL(dpotri) G-Search: F77_CALL(dpotri) # second hit https://svn.r-project.org/R/trunk/src/modules/lapack/Lapack.c Given the fact that it occurs in source code module entitled Lapack.c wouldn't the logical assumption be that is is part of that facility? G-Search: Lapack (dpotri) # first hit http://www.netlib.org/lapack/double/dpotri.f (My net searching effort was two Google entries and three URL clicks. You should re-examine your searching strategies. I don't think the fact that I use a Mac is the reason for the relative ease of searching out this information.) -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F77_CALL, F77_NAME definition
On Sun, Jan 3, 2010 at 2:11 PM, rkevinbur...@charter.net wrote: I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for: F77_CALL(dpotri) ? I'm not sure what the Windows equivalent of 'grep -r F77_CALL .' is, but the developer who wrote lbfgsb.c left a blatant clue which popped up as the third match: ./appl/lbfgsb.c:#include R_ext/RS.h /* for F77_CALL */ About three screenfulls later the actual definition itself appeared. If you are going to do a lot of this on a windows box, get cygwin and learn to use the unix utilities in a cygwin bash shell! Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] questions on generic functions
Wayne (Yanwei) Zhang wrote: Hi all, I'm trying to build a package, but run into problems with generic functions. I have two classes aa and bb, and defined the function summary.bb. Now I want to make summary.bb the default method for both classes aa and bb. If you are using S3 approach, you can either define summary.aa - summary.bb or make use of inheritance, i.e. you need to create object of class aa with class(object.aa) - c(aa, bb) That is, if I have two objects object.aa and object.bb from class aa and bb respectively, the function call summary(object.aa) and summary(object.bb) will apply the function summary.bb at default. How can I do that? Should I use setMethod ? Thanks a lot. From the naming scheme above I feel you are going the S3 way. If you want to use S4 (what setMethod is intended for), you can either use setMethod() for the declaration or also use inheritance (already in the class definition of class aa in setClass()). Uwe Ligges Regards, Wayne __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F77_CALL, F77_NAME definition
On 03/01/2010 9:43 AM, Barry Rowlingson wrote: On Sun, Jan 3, 2010 at 2:11 PM, rkevinbur...@charter.net wrote: I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for: F77_CALL(dpotri) ? I'm not sure what the Windows equivalent of 'grep -r F77_CALL .' is, but the developer who wrote lbfgsb.c left a blatant clue which popped up as the third match: ./appl/lbfgsb.c:#include R_ext/RS.h /* for F77_CALL */ About three screenfulls later the actual definition itself appeared. If you are going to do a lot of this on a windows box, get cygwin and learn to use the unix utilities in a cygwin bash shell! I think it's better to use a reasonable text editor here; I used Textpad. I don't think there's anything too special about it, but it does have Search | Find in files, and I can list the file pattern (obviously *.h for a macro definition), and the folder (R-devel/src on my system), and then I only get six hits: two definitions and 4 uses. That's a lot better than 3 screenfuls. You can also use the Windows search facility to find the file, but I find it clunky, and rarely use it. It does also make it easy to limit the searches in the same way as the above, but it won't show the results as nicely. I'm sure you can do the same thing with grep, but I can never remember the syntax to say to search only in *.h files, whereas with the GUI searches it's easy. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F77_CALL, F77_NAME definition
On Sun, Jan 3, 2010 at 3:20 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: I think it's better to use a reasonable text editor here; I used Textpad. I don't think there's anything too special about it, but it does have Search | Find in files, and I can list the file pattern (obviously *.h for a macro definition), and the folder (R-devel/src on my system), and then I only get six hits: two definitions and 4 uses. That's a lot better than 3 screenfuls. Of course. Emacs + Etags. Then it's about four keystrokes :) Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] F77_CALL, F77_NAME definition
On 03/01/2010 10:32 AM, Barry Rowlingson wrote: On Sun, Jan 3, 2010 at 3:20 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: I think it's better to use a reasonable text editor here; I used Textpad. I don't think there's anything too special about it, but it does have Search | Find in files, and I can list the file pattern (obviously *.h for a macro definition), and the folder (R-devel/src on my system), and then I only get six hits: two definitions and 4 uses. That's a lot better than 3 screenfuls. Of course. Emacs + Etags. Then it's about four keystrokes :) But of course to reduce Search for F77_CALL to 4 keystrokes you need to be able to do Lempel-Ziv encoding in your head; that's what I hate about Emacs. Duncan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Anova in 'car': SSPE apparently deficient rank
Dear Peter and Colleen, I think that Peter realizes this, but what Anova() does in this case is equivalent to the MANOVA anova(multmodel, M = ~ Afac*Bfac, X = ~Afac + Bfac, idata=poke.idata) Error in anova.mlm(multmodel, M = ~Afac * Bfac, X = ~Afac + Bfac, idata = poke.idata) : residuals have rank 4 6 which in turn is equivalent to anova(multmodel, idata=poke.idata, X=~Afac+Bfac) Error in anova.mlm(multmodel, idata = poke.idata, X = ~Afac + Bfac) : residuals have rank 4 6 both of which fail for the same reason that Anova() does: Because the within-subject interaction has 6 df and there are just 5 subjects, the residual SSP matrix, say SSPE, is of rank 4. The hypothesis of no interaction has (3 - 1)*(4 - 1) = 6 df, and thus the response-transformation matrix for this hypothesis, say P, has 6 columns. The error SSP matrix for the interaction, t(P) %*% SSPE %*% P, is also therefore of rank 4 6. I believe that under these circumstances, it's possible to do the univariate F-tests but not the multivariate repeated-measures ANOVA. Since Anova() always computes the multivariate tests, however, I don't see a way around the problem without entirely changing how Anova() gets the univariate tests. What's unclear to me is whether the full data set really has just 5 subjects. Regards, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Dalgaard Sent: January-03-10 5:32 AM To: Colleen F. Moore Cc: r-help@r-project.org Subject: Re: [R] Anova in 'car': SSPE apparently deficient rank Colleen F. Moore wrote: I have design with two repeated-measures factor, and no grouping factor. I can analyze the dataset successfully in other software, including my legacy DOS version BMDP, and R's 'aov' function. I would like to use 'Anova' in 'car' in order to obtain the sphericity tests and the H-F corrected p-values. I do not believe the data are truly deficient in rank. I followed the methods for this kind of analysis outlined in Bennett's excellent handouts for his Psychology 710 course http://www.psychology.mcmaster.ca/bennett/psy710/lectures/maxwell_chp12.pdf I am trying to convert my own similar course to R for my students for next fall. I have been successful at analyzing a segment of the data as a 2-way repeated measures design. Here is my code: your.data=read.table(pipe(pbpaste),header=T) your.data partic A1B1 A1B2 A1B3 A1B4 A2B1 A2B2 A2B3 A2B4 A3B1 A3B2 A3B3 A3B4 1 p111231247137 10 2 p2223322562469 3 p3122323261479 4 p411221236238 10 5 p5223323572379 attach(your.data) multmodel=lm(cbind(A1B1, A1B2, A1B3, A1B4, A2B1, A2B2, A2B3, A2B4, A3B1, A3B2, A3B3, A3B4)~1) poke.idata=read.table(pipe(pbpaste),header=T) poke.idata Afac Bfac 1A1 B1 2A1 B2 3A1 B3 4A1 B4 5A2 B1 6A2 B2 7A2 B3 8A2 B4 9A3 B1 10 A3 B2 11 A3 B3 12 A3 B4 attach(poke.idata) pokeAnova =Anova(multmodel,idata=poke.idata,idesign=~Afac*Bfac,type=III) Error in linear.hypothesis.mlm(mod, hyp.matrix, SSPE = SSPE, idata = idata, : The error SSP matrix is apparently of deficient rank = 4 6 Thanks for any help or advice. And thanks for the 'car' package, which is a great asset to my course. I'm just stuck on this one example. Hmm, this does seem to work with regular anova.mlm: anova(multmodel, idata=poke.idata, X=~Afac+Bfac,test=Sph) Analysis of Variance Table Contrasts orthogonal to ~Afac + Bfac Greenhouse-Geisser epsilon: 0.2880 Huynh-Feldt epsilon:0.4871 Df F num Df den DfPr(F) G-G Pr H-F Pr (Intercept) 1 36.67 6 24 6.164e-11 2.5249e-04 3.3530e-06 Residuals4 As far as I recall, the epsilon corrections do not have a formal requirement of a nonsingular SSD of the relevant contrast. Not sure about the accuracy of the F probabilities in such cases, though. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and
[R] update packages from local
Hi all, I have an old package installed, say abc. Now I made some changes to the source, and built a new version of the source code abc_0.1.1.tar.gz. How can I update the old package to this newer version from the local tar.gz file? I was running the following, but it did not work. setwd(directory where the tar.gz file locates) update.packages(repos=NULL,pkgs=abc_0.1.1.tar.gz,type=source) The code runs, but when I load library(abc) again, it is still the old version... What did I miss here? Thanks. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update packages from local
On Jan 3, 2010, at 11:08 AM, Wayne (Yanwei) Zhang wrote: Hi all, I have an old package installed, say abc. Now I made some changes to the source, and built a new version of the source code abc_0.1.1.tar.gz. How can I update the old package to this newer version from the local tar.gz file? I was running the following, but it did not work. setwd(directory where the tar.gz file locates) update.packages(repos=NULL,pkgs=abc_0.1.1.tar.gz,type=source) The code runs, but when I load library(abc) again, it is still the old version... What did I miss here? Thanks. I thought that the library() function checks to see if it's argument is already loaded and ignores the command if it is. I think you need to restart R to see if you update was successful. -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [R-sig-eco] How to create axes in arbitrary positions?
Dear Zongshan Li, I'm forwarding this back to r-help ... it's generally best to keep the conversation going in public, so that (a) other people can chime in with ideas and suggestions, (b) your question doesn't get lost if the original respondent doesn't have time to deal with it, (c) the answers are archived for future reference. Your example (I've attached it, hope it makes it through but it may not) helps. Here is a crude example approximately along the same lines. x = 1850:2000 y1 = runif(length(x))+0.5 y2=seq(0,100,length=length(x)) plot(x,y1,ylim=c(0,1.5)) library(Hmisc) ?subplot subplot({plot(x,y2,axes=FALSE); axis(side=4)},x=range(x),y=c(0,0.5)) Original Message Subject:Re: [R-sig-eco] How to create axes in arbitrary positions? Date: Sat, 2 Jan 2010 07:31:51 -0500 From: Zongshan Li zongshan...@yahoo.com To: Bolker,Benjamin Michael bol...@ufl.edu References: 831079.35547...@web114002.mail.gq1.yahoo.com 4b3e3c40.9010...@ufl.edu Dear Ben Bolker: I appeciate your introducing functions very much for my question, and I am glad that your kindly intention to give me further help. I guess the function layout might draw plots at the specified locations, but i still be confused about the exact meaning of parameter: mat layout(mat, widths = rep(1, ncol(mat)), heights = rep(1, nrow(mat)), respect = FALSE) the attached jpg file is an example of the kind of graphics, and would you like to give me some comments how to draw this kind of graphics in R? Thanks, again. Best regards, ZongShan(Sat, January 2, 2010 ) *From:* Ben Bolker bol...@ufl.edu *Cc:* r-sig-ecol...@r-project.org r-sig-ecol...@r-project.org *Sent:* Sat, January 2, 2010 2:17:36 AM *Subject:* Re: [R-sig-eco] How to create axes in arbitrary positions? See ?layout, ?subplot in the Hmisc package; in the ?par help page, you may also want to see new, mfrow, mfcol. Not quite sure what you're asking (posting an example of the kind of graphics you want to a web page somewhere is sometimes helpful) but maybe this helps. Zongshan Li wrote: Dear the friends of R-Ecology: I am a beginner for R language, and I think my problem may be very simple. Prior to use R, I used matlab to draw several plots of different heights into one object. The codes are that: axes('position', [0.1,0.1,0.4,0.1]); plot…… axes('position', [0.1,0.2,0.4,0.2]); plot……. axes('position', [0.1,0.4,0.4,0.3]); plot……. I am wondering if there is some kind of function in R to draw plots at the specified locations? --- Note: the following is the helping information of the function: axes. AXES Create axes in arbitrary positions. AXES('position', RECT) opens up an axis at the specified location and returns a handle to it. RECT = [left, bottom, width, height] specifies the location and size of the side of the axis box, relative to the lower-left corner of the Figure window, in normalized units where (0,0) is the lower-left corner and (1.0,1.0) is the upper-right. Any help is strongly appreciated, thank you in advance, -- Zongshan, Li 2010-01-01 Research Center for Eco-Environmental Sciences,Chinese Academy of Sciences Shuangqing Road, Haidian street, Beijing, 100085 Tel: 86-10-13699145748 QQ: 1141958023 website: http://www.rcees.ac.cn/ [[alternative HTML version deleted]] -- Ben Bolker Associate professor, Biology Dep't, Univ. of Florida bol...@ufl.edu mailto:bol...@ufl.edu / people.biology.ufl.edu/bolker GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc -- Ben Bolker Associate professor, Biology Dep't, Univ. of Florida bol...@ufl.edu / people.biology.ufl.edu/bolker GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc signature.asc Description: OpenPGP digital signature __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R2HTML Report number format, or Better Way?
Here I am again with question I'll feel foolish for asking, when I see the answer. I'm trying to produce a report and here's where I get stuck: How do I get R2HTML to produce the same number format? Particularly remove the decimal places for Par and Sal. Are there better methods to produce this type of report? Thanks, L.A. R version 2.10.0 XP srtype-cbind(Par,Sal,Median,COD,PRD,LowerCI,UpperCI) srtype Par SalMedian COD PRD LowerCI UpperCI RES I 9683 578 0.9533 29.69 1.191 0.9382 0.9582 RES V4003 155 0.9763 16.51 1.091 0.9499 0.9943 OTHER 1542100.8367 82.35 1.253 0.4759 2.2293 COM I1711260.9521 26.01 1.102 0.7811 0.9789 COM 9 10.93130.00 1.000 0. 0. library(R2HTML) HTMLStart(outdir=c:/R/reports, file=myreport1, extension=html, echo=FALSE, HTMLframe=TRUE) HTML(srtype) HTMLhr() HTMLStop() ParSal Median CODPRD LowerCI UpperCI RES I 9683.00 578.00 0.95 29.69 1.19 0.940.96 RES V4003.00 155.00 0.98 16.51 1.09 0.950.99 OTHER 1542.00 10.000.84 82.35 1.25 0.482.23 COM I1711.00 26.000.95 26.01 1.10 0.780.98 COM V9.001.00 0.93 0.00 1.00 0.00 0.00 -- View this message in context: http://n4.nabble.com/R2HTML-Report-number-format-or-Better-Way-tp997787p997787.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ordering variables in a parallel coordinates plot
On Sat, 2 Jan 2010, Tal Galili wrote: Hello all, I am searching for a way in R to re-order variables before presenting them in a parallel coordinates plot. So far I didn't find anything within a R related context on how to do this. I did find some texts talking about how it should be done in general, here is such example: http://tinyurl.com/ycnsjpe Is there a package or an example of the variable ordering (for parallel coordinate plot) in R ? Follow the posting guide ??parallel library(MASS) ?parcoord example( parcoord ) See the last line of the example. HTH, Chuck Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problems about Quantile Regression for Longitudinal Data
Hello, I uesd Dr. Koenker's code on the following website for quantile regression of longitudinal data: http://www.econ.uiuc.edu/~roger/research/panel/rq.fit.panel.R I can run the code when there are three explanatory variables in X matrix (ncol(X)=4, because there is a vector 1 at the first colume). However, when I increase the number of explanatory variables to four or more than four, R showed me an error message local(x, pivot, ...) : Increase tmpmax. Could I please ask, how do I deal with this problems? By the way, I set w=c(.1,.2,.3,.4,.5,.4,.3,.2,.1),taus=(1:9)/10, and lambda=1. Many thanks for help. -- Chu, Hao-pang, Graduate Department of Economics National Chengchi University e-mail:97258...@nccu.edu.tw __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update packages from local
Thanks. But I after I restarted R, it is still the old version of the package that is loaded. Am I using the update.packages() correctly? Regards, Wayne (Yanwei) Zhang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update packages from local
1. Please quote the old threat, at least I do not keep old messages. 2. Try install.packages() from a freshly started R (that has not loaded the package in advance). 3. Since I am doing things in the shell for package development anyway, I tend to call package installation from the shell as well: R CMD INSTALL foo_x.y-z.tar.gz Uwe Ligges Wayne (Yanwei) Zhang wrote: Thanks. But I after I restarted R, it is still the old version of the package that is loaded. Am I using the update.packages() correctly? Regards, Wayne (Yanwei) Zhang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update packages from local
On Jan 3, 2010, at 12:42 PM, Wayne (Yanwei) Zhang wrote: Thanks. But I after I restarted R, it is still the old version of the package that is loaded. Am I using the update.packages() correctly? Apparently not. I'm not an expert at this so it's perfectly possible that someone smarter could look at your first email and tell you what went wrong, although it seemed lacking in several details. If I were you, I would be checking to see what my .libPaths value was, perhaps using a destdir argument and not trusting the value of working directory to determine where the source was coming from, but instead specifying absolute paths. You might consider an oldPkgs argument. (You might consider including the results of sessionInfo() and the beginning and ending of the compilation output, and I would also not be trimming the email chain.) Regards, Wayne (Yanwei) Zhang David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ADF test : how to deal with the missing values ?
[[alternative(swapped) HTML version deleted]] This is MIME Epilogue __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ADF test : how to deal with the missing values ?
hi everyone, and happy new year. i want to perform an Augmented Dickey Fuller test. the basic adf.test function doesn't work on my dataset as data are missing. has a package a function enabling missing values ? does any one know a trick to get through ? thanks, édouard. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] bio3d package not installing
Is it just me, or is the bio3d package no longer available? Is there another way to do a reasonable nucleic acid sequence alignment in R? Thanks, Jonathan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update packages from local
Sorry. The original message is below. Uwe, do you mean if i just want to update the old package abc, i have to run R INSTALL abc_0.1.1.tar.gz in the shell? I know that will overwrite that package, but can I do something with the update.packages() function within R? From what I read in the documentation, update.packages() seems to work for local source file update as well. Anybody any advice? Thanks Original message Hi all, I have an old package installed, say abc. Now I made some changes to the source, and built a new version of the source code abc_0.1.1.tar.gz. How can I update the old package to this newer version from the local tar.gz file? I was running the following, but it did not work. setwd(directory where the tar.gz file locates) update.packages(repos=NULL,pkgs=abc_0.1.1.tar.gz,type=source) The code runs, but when I load library(abc) again, it is still the old version... What did I miss here? Thanks. Date: Sun, 03 Jan 2010 18:55:44 +0100 From: Uwe Ligges lig...@statistik.tu-dortmund.de Subject: Re: [R] update packages from local To: Wayne (Yanwei) Zhang actuaryzh...@uchicago.edu Cc: David Winsemius dwinsem...@comcast.net, r-help@r-project.org 1. Please quote the old threat, at least I do not keep old messages. 2. Try install.packages() from a freshly started R (that has not loaded the package in advance). 3. Since I am doing things in the shell for package development anyway, I tend to call package installation from the shell as well: R CMD INSTALL foo_x.y-z.tar.gz Uwe Ligges Wayne (Yanwei) Zhang wrote: Thanks. But I after I restarted R, it is still the old version of the package that is loaded. Am I using the update.packages() correctly? Regards, Wayne (Yanwei) Zhang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Regards, Wayne (Yanwei) Zhang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ADF test : how to deal with the missing values ?
On Jan 3, 2010, at 1:27 PM, Edouard Tallent wrote: hi everyone, and happy new year. i want to perform an Augmented Dickey Fuller test. the basic adf.test function ... from package? Yeah, I know I could look it up but it is considered good posting form to mention the package name. doesn't work on my dataset as data are missing. has a package a function enabling missing values ? does any one know a trick to get through ? RSiteSearch('missing values time series') # the first few hits look on point, especially the Grothendieck suggestion of na.locf function in zoo. thanks, édouard. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ordering variables in a parallel coordinates plot
Hi Charles, Thanks for answering - you are right about the posting guide (sorry). In any case, my question wasn't on how to reorder the columns (that is simple), but on how to choose what order to put them in. Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- On Sun, Jan 3, 2010 at 7:05 PM, Charles C. Berry cbe...@tajo.ucsd.eduwrote: On Sat, 2 Jan 2010, Tal Galili wrote: Hello all, I am searching for a way in R to re-order variables before presenting them in a parallel coordinates plot. So far I didn't find anything within a R related context on how to do this. I did find some texts talking about how it should be done in general, here is such example: http://tinyurl.com/ycnsjpe Is there a package or an example of the variable ordering (for parallel coordinate plot) in R ? Follow the posting guide ??parallel library(MASS) ?parcoord example( parcoord ) See the last line of the example. HTH, Chuck Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Anova in 'car': SSPE apparently deficient rank
John Fox wrote: Dear Peter and Colleen, I think that Peter realizes this, but what Anova() does in this case is equivalent to the MANOVA anova(multmodel, M = ~ Afac*Bfac, X = ~Afac + Bfac, idata=poke.idata) Error in anova.mlm(multmodel, M = ~Afac * Bfac, X = ~Afac + Bfac, idata = poke.idata) : residuals have rank 4 6 which in turn is equivalent to anova(multmodel, idata=poke.idata, X=~Afac+Bfac) Error in anova.mlm(multmodel, idata = poke.idata, X = ~Afac + Bfac) : residuals have rank 4 6 both of which fail for the same reason that Anova() does: Because the within-subject interaction has 6 df and there are just 5 subjects, the residual SSP matrix, say SSPE, is of rank 4. The hypothesis of no interaction has (3 - 1)*(4 - 1) = 6 df, and thus the response-transformation matrix for this hypothesis, say P, has 6 columns. The error SSP matrix for the interaction, t(P) %*% SSPE %*% P, is also therefore of rank 4 6. I believe that under these circumstances, it's possible to do the univariate F-tests but not the multivariate repeated-measures ANOVA. Since Anova() always computes the multivariate tests, however, I don't see a way around the problem without entirely changing how Anova() gets the univariate tests. Yep. Just let me add that what you call univariate is what I call spherical, i.e. it is based on the assumption that the true error covariance matrix t(P) %*% Sigma %*% P is proportional t(P) %*% P. What's unclear to me is whether the full data set really has just 5 subjects. These things do happen... -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot question
Hi, I am new to R so forgive me if the following query is somewhat simple. I have a small tab-separated file with n records of glucose values, one record per day, seven measurements per day. It looks like this: date sober no vm nm va na vs 20091229 NA 6.8 NA 2.7 11.7 2.7 6.2 I'd like to make a graph on which the glucose day curves are plotted separately for each day. I'm sure I'll be able to make it pretty (such as labelling, etc), but yesterday I've been struggling just a bit too long to get the basics right. Here's what I've got till sofar: file = d:/temp/glucose.tab glucose - read.table(file, header=TRUE, sep=\t, row.names=datum) # # Not sure if I got the row.names correct, I may need to use as.character (I believe I did use #that in the interactive session). attach(glucose) summary(glucose) ncol - length(names(glucose)) xrange - range(1, ncol) yrange - range(0, max(!is.na(glucose[1:ncol]))) nrecs - nrow(glucose) colors - rainbow(nrecs) linetype - c(1:nrecs) plot(xrange, yrange, type=n, xlab=Measurement moment, ylab=Glucose (mmol/liter)) for (i in 1: nrecs) { daily_values - glucose[i,] lines(daily_values, type=b, lwd=1.5, lty=linetype[i], col=colors[i]) } So I want to loop over the file and add the plot lines one by one (day by day), but it seems that something's not yet right because nothing appears on the graph. Can anybody give me some pointers? Thank you in advance Cheers!! Albert-Jan ~~ In the face of ambiguity, refuse the temptation to guess. ~~ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ordering variables in a parallel coordinates plot
Hi Charles, You're solution is great (and is actually what my professor suggested me to do today). In the meantime I searched even more and found this article: http://davis.wpi.edu/~xmdv/docs/tr0313_osf.pdf That gives a good description of the problem and of his attempts at solving it. I started by implementing (in a very rough way) the solution of all possible combinations, but it is not relevant for more then 7 dimensions. His solution will involve a mix of your solution with a local optimum, but I don't think I will go more into solving it anytime soon (but instead, make due with your solution). Thanks again, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- On Sun, Jan 3, 2010 at 10:05 PM, Charles C. Berry cbe...@tajo.ucsd.eduwrote: On Sun, 3 Jan 2010, Tal Galili wrote: Hi Charles, Thanks for answering - you are right about the posting guide (sorry). In any case, my question wasn't on how to reorder the columns (that is simple), but on how to choose what order to put them in. OK, and I see you included a reference, so there is probably more to this than meets my eye. But would something as simple as this be good enough?? library(MASS) hc1 - hclust(dist(cor(log(iris[, 1:4] parcoord(log(ir)[, hc1$order ], col = 1 + (0:149)%/%50) or possibly hc1 - hclust(dist( abs( cor(log(iris[, 1:4]) Chuck Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- On Sun, Jan 3, 2010 at 7:05 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote: On Sat, 2 Jan 2010, Tal Galili wrote: Hello all, I am searching for a way in R to re-order variables before presenting them in a parallel coordinates plot. So far I didn't find anything within a R related context on how to do this. I did find some texts talking about how it should be done in general, here is such example: http://tinyurl.com/ycnsjpe Is there a package or an example of the variable ordering (for parallel coordinate plot) in R ? Follow the posting guide ??parallel library(MASS) ?parcoord example( parcoord ) See the last line of the example. HTH, Chuck Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] update packages from local
On Sun, 3 Jan 2010, Wayne (Yanwei) Zhang wrote: Sorry. The original message is below. Uwe, do you mean if i just want to update the old package abc, i have to run R INSTALL abc_0.1.1.tar.gz in the shell? I know that will overwrite that package, but can I do something with the update.packages() function within R? From what I read in the documentation, update.packages() seems to work for local source file update as well. You read incorrectly: install.packages() works with local files, but to *update* you need to use a repository (which can be on your disc, but needs to have a PACKAGES or PACKAGES.gz file). The main function of the set is ‘update.packages’. First a list of all packages/bundles found in ‘lib.loc’ is created and compared with those available at the repositories. ... Anybody any advice? Thanks Original message Hi all, I have an old package installed, say abc. Now I made some changes to the source, and built a new version of the source code abc_0.1.1.tar.gz. How can I update the old package to this newer version from the local tar.gz file? I was running the following, but it did not work. setwd(directory where the tar.gz file locates) update.packages(repos=NULL,pkgs=abc_0.1.1.tar.gz,type=source) The code runs, but when I load library(abc) again, it is still the old version... What did I miss here? Thanks. Date: Sun, 03 Jan 2010 18:55:44 +0100 From: Uwe Ligges lig...@statistik.tu-dortmund.de Subject: Re: [R] update packages from local To: Wayne (Yanwei) Zhang actuaryzh...@uchicago.edu Cc: David Winsemius dwinsem...@comcast.net, r-help@r-project.org 1. Please quote the old threat, at least I do not keep old messages. 2. Try install.packages() from a freshly started R (that has not loaded the package in advance). 3. Since I am doing things in the shell for package development anyway, I tend to call package installation from the shell as well: R CMD INSTALL foo_x.y-z.tar.gz Uwe Ligges Wayne (Yanwei) Zhang wrote: Thanks. But I after I restarted R, it is still the old version of the package that is loaded. Am I using the update.packages() correctly? Regards, Wayne (Yanwei) Zhang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Regards, Wayne (Yanwei) Zhang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Questions regarding sem using hetcor() function from polycor and diagrams
Hello R Users, While I have attempted to dig into the R help files and I have not identified the answer to these questions, I apologize in advance if my questions were answered in the past. I also recognize that one of my questions unfortunately verges on statistical rather than code territory. I have two rather unrelated questions about using the sem and polycor packages for a relatively simple confirmatory path analysis: (1) My data requires using the hetcor function from the polycor package, and I ran the sem() function using a matrix from this code: hcor-function(data) hetcor(data,std.err=FALSE,use=pairwise.complete.obs)$correlations I believe this means I am using a correlation rather than a covariance matrix for the model fit statistics. I am then assuming (perhaps incorrectly) that the model fit and coefficient p values are reliable. However, I don't know if there are additional steps I should go to in order to report the correct standardized coefficients for my the model? The boot.sem() function results in identical parameter estimates but slightly altered standard errors. Are these boot strapped errors the right ones to report if I am interested in reporting standardized coefficients from this model? If this description sets off alarm bells (as in, it appears I have misunderstood the basics of the statistics behind the code I am using), I would appreciate constructive criticism regarding the correct code to use. (2) I also searching for a way to use graphviz to create graphs with arrow widths corresponding to the value of the standardized coefficients (as in several J.B. Grace publications with data similar to my own). Ideally, the coefficient values would also be embedded within the arrows. Any insight is much appreciated. Thank you, Stella -- Stella Copeland PhD Student Graduate Group in Ecology University of California, Davis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] bio3d package not installing
Is this link of use: http://mccammon.ucsd.edu/~bgrant/bio3d/download/download.html -Peter Ehlers Jonathan wrote: Is it just me, or is the bio3d package no longer available? Is there another way to do a reasonable nucleic acid sequence alignment in R? Thanks, Jonathan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Ehlers University of Calgary 403.202.3921 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Artificial Neural Networks
Hi! I am studying to use some R libraries which are applied for working with artificial neural neworks (amore, nnet). Can you recommend some useful, reliable and easy to get example data to use in R for creating and testing a neural network? And what library will you advise? __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yaho [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Questions regarding sem using hetcor() function from polycor and diagrams
Dear Stella, -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Stella Copeland Sent: January-03-10 3:40 PM To: r-help@r-project.org Subject: [R] Questions regarding sem using hetcor() function from polycor and diagrams Hello R Users, While I have attempted to dig into the R help files and I have not identified the answer to these questions, I apologize in advance if my questions were answered in the past. I also recognize that one of my questions unfortunately verges on statistical rather than code territory. I have two rather unrelated questions about using the sem and polycor packages for a relatively simple confirmatory path analysis: (1) My data requires using the hetcor function from the polycor package, and I ran the sem() function using a matrix from this code: hcor-function(data) hetcor(data,std.err=FALSE,use=pairwise.complete.obs)$correlations I believe this means I am using a correlation rather than a covariance matrix for the model fit statistics. I am then assuming (perhaps incorrectly) that the model fit and coefficient p values are reliable. Because your ordinal variables have no metric, you may as well use the standardized variables implied by the polychoric correlations computed by hetcor(). If, however, some of the variables are metric variables with understandable units of measurement, then you could restore the metrics of these variables by converting the correlation matrix computed by hetcor() to a covariance matrix -- that is change the polyserial and Pearson correlations in this matrix to covariances along with the variances of the metric variables. The model-fit statistics and coefficient standard errors (and p-values) are in any event inappropriate since they don't reflect the additional uncertainty in estimating the correlations induced by having ordinal indicators. However, I don't know if there are additional steps I should go to in order to report the correct standardized coefficients for my the model? The boot.sem() function results in identical parameter estimates but slightly altered standard errors. Are these boot strapped errors the right ones to report if I am interested in reporting standardized coefficients from this model? If this description sets off alarm bells (as in, it appears I have misunderstood the basics of the statistics behind the code I am using), I would appreciate constructive criticism regarding the correct code to use. You don't give much detail (about sample size, complexity of model, etc.), but the bootstrapped standard errors should be more reliable than those computed by sem(), since the latter assume directly observed multinormal variables. Typically, the bootstrap standard errors will be at least a little larger than the ones computed by sem(). Also, if the bootstrap estimates of the parameters are equal to the estimates computed by sem(), that implies that the bootstrap estimates of bias are zero. (2) I also searching for a way to use graphviz to create graphs with arrow widths corresponding to the value of the standardized coefficients (as in several J.B. Grace publications with data similar to my own). Ideally, the coefficient values would also be embedded within the arrows. path.diagram() in the sem package will construct commands for dot to draw a path diagram. That might serve as a starting point. I'm afraid that I can't help with details. I hope this helps, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox Any insight is much appreciated. Thank you, Stella -- Stella Copeland PhD Student Graduate Group in Ecology University of California, Davis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot question
I gather that each row defines one series, right? In that case try this: Lines - datesobernovmnmvanavs 20091229NA6.8NA2.711.72.76.2 20091230NA6.8NA2.711.72.76.2 20091231NA6.8NA2.711.72.76.2 # g - read.table(myfile.txt, header = TRUE) g - read.table(textConnection(Lines), header = TRUE) # create zoo object with each series in a column and plot it # na.approx fills in NAs with interpolated values library(zoo) z - zoo(t(g[, -1])) colnames(z) - g[,1] plot(na.approx(z), type = b, main = Glucose) If you want the series surperimposed on one panel then add the screens=1 argument to the last line. On Sun, Jan 3, 2010 at 3:24 PM, Albert-Jan Roskam fo...@yahoo.com wrote: Hi, I am new to R so forgive me if the following query is somewhat simple. I have a small tab-separated file with n records of glucose values, one record per day, seven measurements per day. It looks like this: date sober no vm nm va na vs 20091229 NA 6.8 NA 2.7 11.7 2.7 6.2 I'd like to make a graph on which the glucose day curves are plotted separately for each day. I'm sure I'll be able to make it pretty (such as labelling, etc), but yesterday I've been struggling just a bit too long to get the basics right. Here's what I've got till sofar: file = d:/temp/glucose.tab glucose - read.table(file, header=TRUE, sep=\t, row.names=datum) # # Not sure if I got the row.names correct, I may need to use as.character (I believe I did use #that in the interactive session). attach(glucose) summary(glucose) ncol - length(names(glucose)) xrange - range(1, ncol) yrange - range(0, max(!is.na(glucose[1:ncol]))) nrecs - nrow(glucose) colors - rainbow(nrecs) linetype - c(1:nrecs) plot(xrange, yrange, type=n, xlab=Measurement moment, ylab=Glucose (mmol/liter)) for (i in 1: nrecs) { daily_values - glucose[i,] lines(daily_values, type=b, lwd=1.5, lty=linetype[i], col=colors[i]) } So I want to loop over the file and add the plot lines one by one (day by day), but it seems that something's not yet right because nothing appears on the graph. Can anybody give me some pointers? Thank you in advance Cheers!! Albert-Jan ~~ In the face of ambiguity, refuse the temptation to guess. ~~ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ordering variables in a parallel coordinates plot
On Sun, 3 Jan 2010, Tal Galili wrote: Hi Charles, Thanks for answering - you are right about the posting guide (sorry). In any case, my question wasn't on how to reorder the columns (that is simple), but on how to choose what order to put them in. OK, and I see you included a reference, so there is probably more to this than meets my eye. But would something as simple as this be good enough?? library(MASS) hc1 - hclust(dist(cor(log(iris[, 1:4] parcoord(log(ir)[, hc1$order ], col = 1 + (0:149)%/%50) or possibly hc1 - hclust(dist( abs( cor(log(iris[, 1:4]) Chuck Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- On Sun, Jan 3, 2010 at 7:05 PM, Charles C. Berry cbe...@tajo.ucsd.eduwrote: On Sat, 2 Jan 2010, Tal Galili wrote: Hello all, I am searching for a way in R to re-order variables before presenting them in a parallel coordinates plot. So far I didn't find anything within a R related context on how to do this. I did find some texts talking about how it should be done in general, here is such example: http://tinyurl.com/ycnsjpe Is there a package or an example of the variable ordering (for parallel coordinate plot) in R ? Follow the posting guide ??parallel library(MASS) ?parcoord example( parcoord ) See the last line of the example. HTH, Chuck Thanks, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com/ (English) -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ordering variables in a parallel coordinates plot
Hi, Tal, Tal Galili wrote: In any case, my question wasn't on how to reorder the columns (that is simple), but on how to choose what order to put them in. So is your question answered? Or what exactly is the problem using the example below? library(lattice) parallel(~iris[1:4] | Species, iris) # if I understand you, this is easy parallel(~iris[c(3,2,1,4)] | Species, iris) # so I only can think you mean this... iris$SpeciesR = with(iris, factor(Species,levels= levels(Species)[c(3,1,2)])) parallel(~iris[1:4] | SpeciesR, iris) # .. but I am sure you know this already Dieter -- View this message in context: http://n4.nabble.com/Ordering-variables-in-a-parallel-coordinates-plot-tp997388p997909.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Thin bars in R hist !!??
Hi, I am trying to plot a histogram with my dataset that has 68 elements, 67 of which are zero and the last one is 18. It can be reproduced as follows: x-array(0, dim=(68)) x[1] = 18 I am trying to plot its histogram using: hist(x, breaks=10, xlim=c(0, 100), axes=F) axis(2, at=seq(0, 70, 5)) # for the y-axis axis(1, at=seq(0, 100, 10)) # for the x-axis As you would also see if you reproduced the plot, the bars become really thin. I would very much appreciate any help on fixing this issue. Thanks so much in advance! -- View this message in context: http://n4.nabble.com/Thin-bars-in-R-hist-tp997908p997908.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R2HTML Report number format, or Better Way?
On 01/04/2010 03:36 AM, L.A. wrote: Here I am again with question I'll feel foolish for asking, when I see the answer. I'm trying to produce a report and here's where I get stuck: How do I get R2HTML to produce the same number format? Particularly remove the decimal places for Par and Sal. Are there better methods to produce this type of report? Hi L.A., Try this: # la1.dat is a text file with your sample data srtype-read.table(la1.dat,header=TRUE) # I don't know where the rownames came from # so I added them rownames(srtype)- c(RES I,RES V,OTHER,COM I,COM) library(prettyR) delim.table(srtype,srtype.html,delim=td, tabegin=table border=0,bor=trtd, tablend=/table,header=htmlbody, trailer=/body/html) Now have a look at the file srtype.html. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R2HTML Report number format, or Better Way?
L.A. wrote: Here I am again with question I'll feel foolish for asking, when I see the answer. I'm trying to produce a report and here's where I get stuck: srtype-cbind(Par,Sal,Median,COD,PRD,LowerCI,UpperCI) srtype Chances are better to get a reply when you supply the data as code as in the example below Maybe Eric Lecoutre could have a look at it. Dieter srtype=data.frame(Par=as.numeric(1000:1005), Sal=as.numeric(1:6),Median=rnorm(6)) srtypeM = as.matrix(srtype) library(R2HTML) HTMLStart(outdir=c:/tmp, file=myreport1, extension=html, echo=FALSE, HTMLframe=TRUE) # Use a data frame: will make column-wise decisions HTML(srtype) # When you have a matrix... HTML(srtypeM) # ... using the format arguments should work, but # I think this might be a bug, because only the first # in the vector is used. HTML(srtypeM,nsmall=c(1,5,7),digits=c(2,9,10)) # Same happens in the examples on the doc page HTML(iris[1:2,1:2],nsmall=c(2,5)) HTMLhr() HTMLStop() -- View this message in context: http://n4.nabble.com/R2HTML-Report-number-format-or-Better-Way-tp997787p997914.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Thin bars in R hist !!??
On 01/04/2010 08:25 AM, Whalojazz wrote: Hi, I am trying to plot a histogram with my dataset that has 68 elements, 67 of which are zero and the last one is 18. It can be reproduced as follows: x-array(0, dim=(68)) x[1] = 18 I am trying to plot its histogram using: hist(x, breaks=10, xlim=c(0, 100), axes=F) axis(2, at=seq(0, 70, 5)) # for the y-axis axis(1, at=seq(0, 100, 10)) # for the x-axis As you would also see if you reproduced the plot, the bars become really thin. I would very much appreciate any help on fixing this issue. Thanks so much in advance! Hi Whalojazz, There is the possibility of matching the x axis limits to the range of the data: hist(x, breaks=10, xlim=c(0, 18), axes=FALSE) axis(2, at=seq(0, 70, 5)) axis(1, at=seq(0, 18, 9)) but this would not leave you all that tempting, empty space in which you could insert a cartoon or humorous epigram. Why don't we split the difference and try: x11(width=10,height=7) hist(x, breaks=10, xlim=c(0, 40), axes=FALSE) axis(2, at=seq(0, 70, 5)) axis(1, at=seq(0, 40, 10)) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Thin bars in R hist !!??
Just seting breaks=2 should fix your 'issue'. But what could such a histogram possibly tell anyone? Unless this is a pathological case in a more elaborate analysis, I can't see any sense in what you're doing. -Peter Ehlers Whalojazz wrote: Hi, I am trying to plot a histogram with my dataset that has 68 elements, 67 of which are zero and the last one is 18. It can be reproduced as follows: x-array(0, dim=(68)) x[1] = 18 I am trying to plot its histogram using: hist(x, breaks=10, xlim=c(0, 100), axes=F) axis(2, at=seq(0, 70, 5)) # for the y-axis axis(1, at=seq(0, 100, 10)) # for the x-axis As you would also see if you reproduced the plot, the bars become really thin. I would very much appreciate any help on fixing this issue. Thanks so much in advance! -- Peter Ehlers University of Calgary 403.202.3921 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Thin bars in R hist !!??
Whalojazz wrote: Hi, I am trying to plot a histogram with my dataset that has 68 elements, 67 of which are zero and the last one is 18. It can be reproduced as follows: x-array(0, dim=(68)) x[1] = 18 I am trying to plot its histogram using: hist(x, breaks=10, xlim=c(0, 100), axes=F) axis(2, at=seq(0, 70, 5)) # for the y-axis axis(1, at=seq(0, 100, 10)) # for the x-axis As you would also see if you reproduced the plot, the bars become really thin. I would very much appreciate any help on fixing this issue. Thanks so much in advance! You are asking for a range of data from 0 to 18 to be divided into about 10 bins, so each bin will have a width of roughly 0.2. If this is not what you wanted, then you need to do something else, depending on what you wanted but didn't tell... Were you perhaps looking for hist(x, breaks=seq(0, 100,10))? (Notice that if breaks is a single number, it will generate breaks based on range(x), not xlim.) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Artificial Neural Networks
Hi Alex, I am not a NN user, but I would suggestion you give more information about what are you planning to do. May be it helps the helper. Happy New Year. miltinho On Sun, Jan 3, 2010 at 3:54 PM, Alex Olafson alex.olaf...@yahoo.com wrote: Hi! I am studying to use some R libraries which are applied for working with artificial neural neworks (amore, nnet). Can you recommend some useful, reliable and easy to get example data to use in R for creating and testing a neural network? And what library will you advise? __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yaho [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Thin bars in R hist !!??
Peter Ehlers wrote: Just seting breaks=2 should fix your 'issue'. But what could such a histogram possibly tell anyone? Unless this is a pathological case in a more elaborate analysis, I can't see any sense in what you're doing. Yes it did! However, this requires that I explicitly set break to the number of nonzero entries in the x's count. I see your point about the histogram but I believe it's important for me to show zero values as well. Thanks a lot! -- View this message in context: http://n4.nabble.com/Thin-bars-in-R-hist-tp997908p997943.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Thin bars in R hist !!??
Peter Dalgaard wrote: Were you perhaps looking for hist(x, breaks=seq(0, 100,10))? (Notice that if breaks is a single number, it will generate breaks based on range(x), not xlim.) Great! That's *exactly* what I needed. Thanks a lot! -- View this message in context: http://n4.nabble.com/Thin-bars-in-R-hist-tp997908p997945.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Emacs vs Eclipse vs Rcmdr
Hi everyone, I could have posted this on R-devel or the GUI list, however don't feel it's that serious. Hence, decided R-help would be the most appropriate. I'm not so much interested in which is the best user interface for R. Rather which is the best ***platform*** for developing ***new*** user interfaces for R. Noting I'm using the term user interface is a very general sense. (i.e. Can include anything from console/pseudoterminal widgets, to text editors with customised syntax highlighting, to elaborate menus and dialog boxes). Here are my initial thoughts: Emacs Pros: - A lot of computer experts use it. - Plus some high profile R people are involved in the development of ESS. - High level of customisation. Emacs Cons: - Need to know Lisp. - Counter intuitive. - It's really ugly. - No decent widget set (which is probably why it's ugly). Eclipse Pros: - It's kind of fashionable and nice looking. Eclipse Cons: - Unnecessarily complicated. - Need to know SWT (and maybe XML too?). - The process for installing (and finding) add on packages, is terrible. Rcmdr Pros and Cons: - I haven't used it for a long time, so can't really comment. - However, I was surprised by how many reverse dependencies it has. So I will assume it has some potential. Other people's thoughts welcome... kind regards -- Charlotte Maia Open Source Developer and Statistician http://sites.google.com/site/maiagx __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot question
Hi: My understanding is that you want a separate plot over time of each of your repeated measures variables. If that's the case, then perhaps something along the following lines will work. Given the manufactured data set Gabor provided (g from lines), let's use the reshape package and then plot using lattice and ggplot2: library(ggplot2) # attaches reshape along the way library(lattice) g2 - melt(g, id = 'date') # lattice plot xyplot(value ~ date | variable, data = g3) # ggplot ggplot(g3, aes(date, value)) + geom_point() + facet_wrap(~ variable) The plots are less than publication quality, but the labels, etc. can be tweaked and you can change the layout of the graphics region if you wish. The advantage of melt() in this circumstance is that it allows one to use variable names as factor labels in lattice and ggplot2. HTH, Dennis On Sun, Jan 3, 2010 at 12:24 PM, Albert-Jan Roskam fo...@yahoo.com wrote: Hi, I am new to R so forgive me if the following query is somewhat simple. I have a small tab-separated file with n records of glucose values, one record per day, seven measurements per day. It looks like this: datesobernovmnmvanavs 20091229NA6.8NA2.711.72.76.2 I'd like to make a graph on which the glucose day curves are plotted separately for each day. I'm sure I'll be able to make it pretty (such as labelling, etc), but yesterday I've been struggling just a bit too long to get the basics right. Here's what I've got till sofar: file = d:/temp/glucose.tab glucose - read.table(file, header=TRUE, sep=\t, row.names=datum) # # Not sure if I got the row.names correct, I may need to use as.character (I believe I did use #that in the interactive session). attach(glucose) summary(glucose) ncol - length(names(glucose)) xrange - range(1, ncol) yrange - range(0, max(!is.na(glucose[1:ncol]))) nrecs - nrow(glucose) colors - rainbow(nrecs) linetype - c(1:nrecs) plot(xrange, yrange, type=n, xlab=Measurement moment, ylab=Glucose (mmol/liter)) for (i in 1: nrecs) { daily_values - glucose[i,] lines(daily_values, type=b, lwd=1.5, lty=linetype[i], col=colors[i]) } So I want to loop over the file and add the plot lines one by one (day by day), but it seems that something's not yet right because nothing appears on the graph. Can anybody give me some pointers? Thank you in advance Cheers!! Albert-Jan ~~ In the face of ambiguity, refuse the temptation to guess. ~~ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] calculations on columns with partially matching names
Is there a command for partial matching of character strings? Specifically, I'd like to be able to calculate the mean of the values in any columns in a data frame or matrix that have identity in part of their column names. For example, columns labeled mpw06a and mpw06b match on the first five characters; their mean would be taken whereas any columns beginning with other than mpw06 would be excluded. I need to compare every pair of columns in the frame, and in some cases, possibly three at a time. Thanks in advance for any ideas. Jim Bouldin Research Ecologist Department of Plant Sciences, UC Davis Davis CA, 95616 530-554-1740 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] CRAN (and crantastic) updates this week
CRAN (and crantastic) updates this week New packages * dcemriS4 (0.20.1) Brandon Whitcher http://crantastic.org/packages/dcemriS4 A collection of routines and documentation that allows one to perform a quantitative analysis of dynamic contrast-enhanced or diffusion-weighted MRI data. Medical imaging data should be organized using either the Analyze or NIfTI data formats. * genefu (1.0.0) Benjamin Haibe-Kains http://crantastic.org/packages/genefu R package providing various functions relevant for gene expression analysis with emphasis on breast cancer. * micEconAids (0.6-0) Arne Henningsen http://crantastic.org/packages/micEconAids Demand analysis with the Almost Ideal Demand System (AIDS) suggested by Deaton and Muellbauer (1980) * miscTools (0.6-0) Arne Henningsen http://crantastic.org/packages/miscTools Miscellanneous small tools and utilities * nytR (0.1) Shane Conway http://crantastic.org/packages/nytR Provides access to various data sources (congressional vote data) through the NY Times API. * partitionMetric (1.0) Unknown http://crantastic.org/packages/partitionMetric partitionMetric computes a distance between two partitions of a set. Updated packages accuracy (1.35), arm (1.2-13), aspect (1.0-0), BAS (0.4), BAS (0.45), coin (1.0-9), fitdistrplus (0.1-2), frontier (0.996-4), gap (1.0-22), gRbase (1.3.0), gRbase (1.2.0), inline (0.3.4), KFAS (0.4.9), LambertW (0.1.8), mi (0.08-06), micEcon (0.6-0), nparLD (1.2), partDSA (0.6.0), pomp (0.26-3), RcmdrPlugin.IPSUR (0.1-6), rgl (0.89), sdcTable (0.0.8), SpatialExtremes (1.5-0), TShistQuote (2009.12-1) This email provided as a service for the R community by http://crantastic.org. Like it? Hate it? Please let us know: crana...@gmail.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R2HTML Report number format, or Better Way?
Thanks for the replys. I've played with both suggestions, but must not understand as I could not get them to work. In the first, do I have to save my results as a *.dat file? Where do I find the HTML file? For the second, As a beginner, is this what you mean by supply the data as code? The actual data is 17000 rows and 31 columns. L.A. Par-by(Dataset[ , ACCOUNTNO], Dataset[TYPE], length) Sal-by(Dataset[ , ratio], Dataset[TYPE], length) PRD-with(Dataset, by(Dataset[ , prdb], TYPE, max)) COD-with(Dataset, by(Dataset[ , coda], TYPE, max)) LowerCI-with(Dataset, by(Dataset[ , LLCI], TYPE, max)) UpperCI-with(Dataset, by(Dataset[ , UUCI], TYPE, max)) srtype-cbind(Parcels,Sales,Median,COD,PRD,LowerCI,UpperCI) srtype Par SalMedian COD PRD LowerCI UpperCI RES I 9683 578 0.9533 29.69 1.191 0.9382 0.9582 RES V4003 155 0.9763 16.51 1.091 0.9499 0.9943 OTHER 1542100.8367 82.35 1.253 0.4759 2.2293 COM I1711260.9521 26.01 1.102 0.7811 0.9789 COM 9 10.93130.00 1.000 0. 0. library(R2HTML) HTMLStart(outdir=c:/R/reports, file=myreport1, extension=html, echo=FALSE, HTMLframe=TRUE) HTML(srtype) HTMLhr() HTMLStop() ParSal Median CODPRD LowerCI UpperCI RES I 9683.00 578.00 0.95 29.69 1.19 0.940.96 RES V4003.00 155.00 0.98 16.51 1.09 0.950.99 OTHER 1542.00 10.000.84 82.35 1.25 0.482.23 COM I1711.00 26.000.95 26.01 1.10 0.780.98 COM V9.001.00 0.93 0.00 1.00 0.00 0.00 -- View this message in context: http://n4.nabble.com/R2HTML-Report-number-format-or-Better-Way-tp997787p997974.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] calculations on columns with partially matching names
On Jan 3, 2010, at 6:09 PM, Jim Bouldin wrote: Is there a command for partial matching of character strings? Specifically, I'd like to be able to calculate the mean of the values in any columns in a data frame or matrix that have identity in part of their column names. For example, columns labeled mpw06a and mpw06b match on the first five characters; their mean would be taken whereas any columns beginning with other than mpw06 would be excluded. ?grep ?[ tdf - data.frame(mpw06a=rnorm(10), mpw06b=rnorm(10), abc=rnorm(10)) lapply(tdf[ , grep(mpw06, names(tdf)) ], mean) $mpw06a [1] -0.1825447 $mpw06b [1] -0.2386772 I need to compare every pair of columns in the frame, and in some cases, possibly three at a time. ?combn Thanks in advance for any ideas. Jim Bouldin Research Ecologist Department of Plant Sciences, UC Davis Davis CA, 95616 530-554-1740 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R2HTML Report number format, or Better Way?
On 01/04/2010 10:49 AM, L.A. wrote: Thanks for the replys. I've played with both suggestions, but must not understand as I could not get them to work. In the first, do I have to save my results as a *.dat file? No, I simply showed how I obtained the data frame that you gave as an example. Where do I find the HTML file? The HTML file will be in the current R directory. If you include a valid path in the filename argument, it will be wherever you specify. The delim.table function formats the result in whatever way the object would normally be printed and is usually called in an R script that is to have HTML output produced by the htmlize function. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Emacs vs Eclipse vs Rcmdr
Hello On 1/3/10, Charlotte Maia mai...@gmail.com wrote: Rcmdr Pros and Cons: - I haven't used it for a long time, so can't really comment. - However, I was surprised by how many reverse dependencies it has. So I will assume it has some potential. Rcmdr is probably not the best editor around. However, it is a fairly robust and useful GUI that can be used as a menu-panel to any underlying R terminal, including text editors that can run R (consider using ?Commander start-up options console.output=TRUE and prefixes=c( , + , , ) ). As to the editor choice, I am currently using Geany SVN + Rcmdr (the next Geany release will have the hidden option send_selection_unsafe that allows for quick code execution when set to true and Send selection to terminal bound to a key). Geany is a cross-platform intuitive IDE that understands R files and has an integrated VTE (Terminal) that can run R. Regards Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Assistance with boot() Package
Good Evening R Community: I believe I understand the basics of using the boot() bootstrap resampling function in the boot() package. I have not had any trouble creating a boot.object to which I apply the boot.ci() function to calculate one or all of the available confidence intervals. What I am not sure about is if this set of functions can generate more than one confidence interval of one or all of the types available. I have a large data set (n=133,456) data set from which I would like to remove random samples of different sizes and then calculate 95% confidence intervals for the mean, 10% trimmed mean and median. I would like to determine how often the confidence intervals generated by boot.ci() contain the mean, 10% trimmed mean and median of the large data set. I have looked at some examples for using the boot() and boot.ci() functions to generate confidence intervals for the intercept and predictive variables from a regression model, but I do not, or cannot I suppose, determine how I can generate more than one set of normal, basic, percentile and BCa confidence intervals using these two functions. I am running R version 2.9.2 on an IBM T61 laptop. My OS is Win XP professional SP 3, and the machine has a 1.99 GHz processor with 2.99 GB of RAM. The version of the boot() package I am running is 1.2-41. Thanks in advance for taking the time to help me. Adam [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Questions bout SVM
2010/1/2 Nancy Adam nancyada...@hotmail.com: Hi Steve, Thanks a lot for your reply. 1)I’m still confused which equation (1- sqrt(mean(mymodel$MSE)) OR 2- mean(sqrt(mymodel$MSE)) )is equivalent to sqrt(mean(error**2))? So, as I mentioned before, mymodel$MSE is a vector that's as long as the number of folds your are using for cross validation. If you're setting cross=10, $MSE will have 10 values in it. Each value is the *mean squared error* for each fold (as described in the ?svm documentation under the `cross` parameter). If you do 1: sqrt(mean(mymodel$MSE)), then you're taking the square root of the averaged mean squared error. If you do 2: mean(sqrt(mymodel$MSE)), you are taking the average of the square root of the MSE from each fold. I just want to compute the typical RMSE that is usually used for measuring the performance of regression systems. It sounds like you want to do 2. 2)I’m talking about another addition related to the svm parameters in the call to SVM. i.e. my_svm_model- function(myformula, mydata, mytestdata, parameterlist) { mymodel - svm(myformula, data=mydata, cross=10, cost=parameterlist[[1]], epsilon=parameterlist[[2]],gamma=parameterlist[[3]]) If I don’t set these parameters of svm (like: my_svm_model- function(myformula, mydata, mytestdata), how does svm know them? Functions can define default values for their arguments. So if you don't define their values when you call the function, they will take their defaults. For example, if you don't explicitly set things like the `cost` (for c-classification), or `epsilon` for regression, etc. it will take the default values. You can see the default value for these params in the documentation for ?svm 3) in 2) Is it correct to use “mydata” instead of “data=mydata”? Or I can do that only if it is the “last” argument in the function call? It's not because it's the last argument, but because it's the second argument. `data` is defined as the second argument of the `svm` function (when used with a formula), and you are passing it as the 2nd argument when you call the function. 4)Does mytestdata[,1] means that the model will use only the last column on the testing set? mytestdata[,1] means you are taking the first column of the mytestdata matrix and treating it as a vector and ignoring the rest of the matrix ... From some previous correspondence, and questions 2 and 3 from here, honestly I'd suggest investing some time in brushing up on R basics. Reading the R intro is as good a place to start as any: http://cran.r-project.org/doc/manuals/R-intro.html There are several sections on indexing vectors, matrices, etc. Section 10 of that document also talks a bit about named, positional, and default arguments ... HTH, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] bio3d package not installing
On Jan 3, 2010, at 1:41 PM, Jonathan wrote: Is it just me, or is the bio3d package no longer available? Is there another way to do a reasonable nucleic acid sequence alignment in R? Sounds like a BioC question to me. Thanks, Jonathan David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] bio3d package not installing
On Jan 3, 2010, at 2:11 PM, David Winsemius wrote: On Jan 3, 2010, at 1:41 PM, Jonathan wrote: Is it just me, or is the bio3d package no longer available? Is there another way to do a reasonable nucleic acid sequence alignment in R? Sounds like a BioC question to me. My (faulty) memory was that the BioC Mailing list was part of the R Mailing list selections: Instead it's here: http://www.bioconductor.org/docs/mailList.html -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Artificial Neural Networks
1) there are plenty of data for neural net testing in R. you might check datasets package on CRAN. 2) which neural net are you talking about, BP, RBF, LVQ, or something else. the world of neural nets is pretty much like a zoo. without knowing which animal you are talking about, nobody can help you. On Sun, Jan 3, 2010 at 3:54 PM, Alex Olafson alex.olaf...@yahoo.com wrote: Hi! I am studying to use some R libraries which are applied for working with artificial neural neworks (amore, nnet). Can you recommend some useful, reliable and easy to get example data to use in R for creating and testing a neural network? And what library will you advise? __ The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yaho [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- == WenSui Liu Blog : statcompute.spaces.live.com Tough Times Never Last. But Tough People Do. - Robert Schuller == __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] function in aggregate applied to specific columns only
I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] function in aggregate applied to specific columns only
On Jan 3, 2010, at 10:46 PM, david hilton shanabrook wrote: I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) basicSubMean - aggregate(basicSub$score, by=list(basicSub $student), FUN=mean, na.rm=TRUE) basicSubMean Group.1x 1 1 55.0 2 2 60.0 3 3 67.5 This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] function in aggregate applied to specific columns only
Hi: Perhaps the plyr package would be useful. It contains functions colwise(), numcolwise() and catcolwise() that will perform the same operation on the stated type of object. In this case, numcolwise() is appropriate: str(basicSub) 'data.frame': 5 obs. of 3 variables: $ student: num 1 2 3 3 1 $ gender : Factor w/ 2 levels f,m: 2 2 1 1 2 $ score : num 50 60 70 65 60 basicSub$student - factor(basicSub$student) # convert student to factor library(plyr) # First argument is data frame, the next is the grouping variable, the # third is the function to apply. ddply(basicSub, .(student), numcolwise(mean)) student score 1 1 55.0 2 2 60.0 3 3 67.5 HTH, Dennis On Sun, Jan 3, 2010 at 7:46 PM, david hilton shanabrook dhsha...@acad.umass.edu wrote: I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] function in aggregate applied to specific columns only
You want this? basicSubMean - aggregate(basicSub[c(score)], by=list(basicSub$student), FUN=mean, na.rm=TRUE) basicSubMean Group.1 score 1 1 55.0 2 2 60.0 3 3 67.5 bests milton On Sun, Jan 3, 2010 at 10:46 PM, david hilton shanabrook dhsha...@acad.umass.edu wrote: I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] function in aggregate applied to specific columns only
Here are 6 ways: 1. aggregate aggregate(basicSub[score], basicSub[student], mean) student score 1 1 55.0 2 2 60.0 3 3 67.5 2. tapply with(basicSub, tapply(score, student, mean)) 123 55.0 60.0 67.5 3. summaryBy in doBy package library(doBy) summaryBy(. ~ student, basicSub) student score.mean 1 1 55.0 2 2 60.0 3 3 67.5 4. sqldf in sqldf package. Uses SQL: library(sqldf) sqldf(select student, avg(score) from basicSub group by student) student avg(score) 1 1 55.0 2 2 60.0 3 3 67.5 5. summary.formula in Hmisc summary(score ~ student, basicSub) scoreN=5 +---+-+-+-+ | | |N|score| +---+-+-+-+ |student|1|2|55.0 | | |2|1|60.0 | | |3|2|67.5 | +---+-+-+-+ |Overall| |5|61.0 | +---+-+-+-+ 6. plyr (see Dennis Murphy's solution in this thread) On Sun, Jan 3, 2010 at 10:46 PM, david hilton shanabrook dhsha...@acad.umass.edu wrote: I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] function in aggregate applied to specific columns only
Just for the fun of it, here are two more: by and ave. with(basicSub, by(score, student, mean)) student: 1 [1] 55 student: 2 [1] 60 student: 3 [1] 67.5 Not my favorite print method; to return a vector, do instead as.vector(with(basicSub, by(score, student, mean))) [1] 55.0 60.0 67.5 You can cbind the unique student IDs to get a matrix result. ave() is used to map the average (or comparable summary) to each observation. By itself, it returns a vector of the same length as the number of observations: with(basicSub, ave(score, student)) [1] 55.0 60.0 67.5 67.5 55.0 It's more useful if you want to add the means to the data frame: transform(basicSub, avg = ave(score, student)) student gender score avg 1 1 m50 55.0 2 2 m60 60.0 3 3 f70 67.5 4 3 f65 67.5 5 1 m60 55.0 That makes eight solutions. Any others? :) Dennis On Sun, Jan 3, 2010 at 8:14 PM, Gabor Grothendieck ggrothendi...@gmail.comwrote: Here are 6 ways: 1. aggregate aggregate(basicSub[score], basicSub[student], mean) student score 1 1 55.0 2 2 60.0 3 3 67.5 2. tapply with(basicSub, tapply(score, student, mean)) 123 55.0 60.0 67.5 3. summaryBy in doBy package library(doBy) summaryBy(. ~ student, basicSub) student score.mean 1 1 55.0 2 2 60.0 3 3 67.5 4. sqldf in sqldf package. Uses SQL: library(sqldf) sqldf(select student, avg(score) from basicSub group by student) student avg(score) 1 1 55.0 2 2 60.0 3 3 67.5 5. summary.formula in Hmisc summary(score ~ student, basicSub) scoreN=5 +---+-+-+-+ | | |N|score| +---+-+-+-+ |student|1|2|55.0 | | |2|1|60.0 | | |3|2|67.5 | +---+-+-+-+ |Overall| |5|61.0 | +---+-+-+-+ 6. plyr (see Dennis Murphy's solution in this thread) On Sun, Jan 3, 2010 at 10:46 PM, david hilton shanabrook dhsha...@acad.umass.edu wrote: I want to use aggregate with the mean function on specific columns gender - factor(c(m, m, f, f, m)) student - c(0001, 0002, 0003, 0003, 0001) score - c(50, 60, 70, 65, 60) basicSub - data.frame(student, gender, score) basicSubMean - aggregate(basicSub, by=list(basicSub$student), FUN=mean, na.rm=TRUE) This doesn't work, one cannot take the mean of a factor (gender). Is there any way of specifying which columns to use for the mean? I want to aggregate by student, obtaining mean scores, and assume any other factors are unchanging in a specific student, ie. gender. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Likelihood Ratio Tests
Is there any package available in R to do the following hypothesis tests? Testing the means of two Poissons (equivalent to the difference of two proportions) Testing the equality of two proportions from binomials Testing the equality of proprtions of two negative binomials (both conditional and unconditional tests). No large sample approximation tests...I need exact tests Thanks, Jim [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extract vector elements until cumsum = x
Hi All, I have a vector n, and for each n[i] I want to extract n[i], n[i+1], n[i+2]..., until the cumulative sum of n[i] and subsequent elements exceeds a CheckValue, whereupon I move to the next index and repeat. I am trying to find a Vectorized approach, and have seen similar posts where filter{stat} and rollmean{zoo} were suggested, but, I haven't been able to figure a way to use them for this problem. Best wishes to all, and thanks for the help! Dgnn -- View this message in context: http://n4.nabble.com/Extract-vector-elements-until-cumsum-x-tp998023p998023.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Interpreting coefficient in selection and outcome Heckman models in sampleSelection
Hi there Within sampleSelection, I'm trying to calculate the marginal effects for variables that are present in both the selection and outcome models. For example, age might have a positive effect on probability of selection, but then a negative effect on the outcome variable. i.e. Model-selection(participation~age, frequency~age, ...) Documentation elsewhere describes one method for doing this in Stata based on Sigelman and Zeng: http://polisci.osu.edu/prl/Selection%20Models.pdf - see page 16. I'd like to replicate this in r, but wanted to check I'm not reinventing the wheel, before doing so. Any help is much appreciated. Best regards Mark [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rggobi: Installation problems on OS X Snow Leopard
Hello: I have successfully installed both R and R64 for Apple OS X from CRAN plus GTK+2.14 and GGobi 2.1.8 from: http://www.ggobi.org/downloads I launch either R or R64 and try to install the rrgobi package and get (with R64) the following: R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. [R.app GUI 1.31 (5537) x86_64-apple-darwin9.8.0] install.packages(rggobi) --- Please select a CRAN mirror for use in this session --- Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘rggobi’ is not available I get substantially the same thing with R. Here is some info about my OS: System Version: Mac OS X 10.6.2 (10C540) Kernel Version: Darwin 10.2.0 Boot Mode:Normal Secure Virtual Memory:Not Enabled 64-bit Kernel and Extensions: No What am I doing wrong? Any help would be MOST appreciated. Thanks Betsy __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to draw abline correctly?
Hello, I am frastruated with this graph, just cannot get what I need. Thank you for any suggestions or help. I really appreciate it. I wrote the following code, but there are 3 problems 1, the red line is added on the graph but without any marker on the y-axis. I want to display the number '.1361' on the y-axis. So people can easily tell 'method 2' gets a constant estimate, which is 0.1361. 2, since 'method2' is a constant. I prefer in the legend area, it just shows 'method2' as a short red bar instead of a knot/spot in the middle of the red bar in the legend area. How can I delete that spot? 3, when I draw 'method1' in blue one, I prefer a filled/shaded circle instead of the unshaded circle. I tried pch='.', seems it does not really work. Hopefully I make my question clear. Thanks a lot for any help! size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type=o, lwd=1.5, col=blue, ylim=c(0, 0.2), xlim=c(0,80)) abline(h=0.1361, col=red, lwd=1.5) legend(0, 0.2,c(method1,method2), cex=0.8,col=c(blue,red), pch=21:1, lty=1); -- View this message in context: http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R2HTML Report number format, or Better Way?
L.A. wrote: For the second, As a beginner, is this what you mean by supply the data as code? The actual data is 17000 rows and 31 columns. In your case, it is irrelevant if the data are 17000x31 or 2x3, so an example with few columns is sufficient. And if you supply the data in code, other people can copy it to provide a tested example. See my example, or simply (not tested) df = matrix(c(1,2,0.3,0.4,nrow=2) As a test, go to another computer and let you sample run there? Does is complain object not found? Dieter -- View this message in context: http://n4.nabble.com/R2HTML-Report-number-format-or-Better-Way-tp997787p998085.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xyplot: several plots in one creates y-scale problem
Hi As you did not provide an example as per posting guide here is one dataset cobbled from zoo help. It is fairly rough but is optioned up to give you an idea. The legend takes is cues from trellis.par.set() and you can set this for the plot by using par settings It makes use of strip.left which gives you more space for the panel area rather than taken up by horizontal strips. require(zoo) require(lattice z1 - matrix(rep(1:12,4)+round(rnorm(48),1),12,4, dimnames=list(1:12,paste(C,1:4) ) ) z2 -zoo(z1, as.Date(2003-01-01) + 0:11) xyplot(z2, auto.key = list(text=paste(names(z2)), points = FALSE, lines = T, space = bottom), par.settings = list(superpose.line = list(col = rep(1,7, lty = rep(1, 7)) )), strip.left = strip.custom(factor.levels = paste(C,1:4), par.strip.text = list(cex = 0.75), horizontal = FALSE), strip = F, scales=list(x=list(at=as.numeric(as.Date(2003-01-01) + 0:11)[seq(1,12,2)], labels=paste(format(c(as.Date(2003-01-01) + 0:11)[seq(1,12,2)],%d %b))), y = list(alternating = T, limits = list(c(0,12),c(0, 12), c(0, 12), c(0, 15)) , relation= free, rot = 0) ) , col=1 ) HTH Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email Home: mac...@northnet.com.au At 09:09 3/01/2010, you wrote: Hello, I've been looking for a solution to this problem for some time now but I seem unable to solve it.. so this is the case: I want to plot 4 time series in the same graph using xyplot(). When I do this with xyplot(mydata[,2]+mydata[,3]+mydata[,4]+mydata[,5] ~ mydata[,1], data = mydata, type = l, auto.key = list(space=right, lines = T, points = F), par.settings = simpleTheme(lty = c(1,2,3,4)) ) I get a graph where all lines are maximized to cover the entire y- scale width. I.e., they are use their own scale independent of each other (my data has some columns that are one magnitude smaller than the others). How do I force them all to use the same y-scale? I found this thread: http://n4.nabble.com/superimposing-xyplots-on-same-scale-td905525.html, but I'm not really sure what is going on there. Any ideas? /J __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to draw abline correctly?
Hi there, May be part of your problem is solved. size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type=o, lwd=1.5, col=blue, ylim=c(0, 0.2), xlim=c(0,80), pch=19, axes=F) abline(h=0.1361, col=red, lwd=1.5) legend(0, 0.2,c(method1,method2), cex=0.8, col=c(blue,red), pch=c(19,NA), lty=1); axis(1) axis(2,at=c(0,0.10,0.1361,0.2)) bests milton On Sun, Jan 3, 2010 at 9:26 PM, aegea gche...@gmail.com wrote: Hello, I am frastruated with this graph, just cannot get what I need. Thank you for any suggestions or help. I really appreciate it. I wrote the following code, but there are 3 problems 1, the red line is added on the graph but without any marker on the y-axis. I want to display the number '.1361' on the y-axis. So people can easily tell 'method 2' gets a constant estimate, which is 0.1361. 2, since 'method2' is a constant. I prefer in the legend area, it just shows 'method2' as a short red bar instead of a knot/spot in the middle of the red bar in the legend area. How can I delete that spot? 3, when I draw 'method1' in blue one, I prefer a filled/shaded circle instead of the unshaded circle. I tried pch='.', seems it does not really work. Hopefully I make my question clear. Thanks a lot for any help! size=c(80, 40, 20, 16, 10, 8, 4, 2) estimate=c(0.1353, 0.1337, 0.1237, 0.1164, 0.1058, 0.0983, 0.0759 , 0.0607) plot(size, estimate, type=o, lwd=1.5, col=blue, ylim=c(0, 0.2), xlim=c(0,80)) abline(h=0.1361, col=red, lwd=1.5) legend(0, 0.2,c(method1,method2), cex=0.8,col=c(blue,red), pch=21:1, lty=1); -- View this message in context: http://n4.nabble.com/how-to-draw-abline-correctly-tp998018p998018.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.