Re: [R] Error running lda example from Help File (MASS library )
I don't run into any problem when runing examples from lda help file. sessionInfo() R version 2.10.0 Patched (2009-11-09 r50375) i386-pc-mingw32 locale: [1] LC_COLLATE=Chinese_People's Republic of China.936 [2] LC_CTYPE=Chinese_People's Republic of China.936 [3] LC_MONETARY=Chinese_People's Republic of China.936 [4] LC_NUMERIC=C [5] LC_TIME=Chinese_People's Republic of China.936 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] MASS_7.3-3 ASRR_0.0-1 ASAtable_0.0-1 QCA3_0.0-3 loaded via a namespace (and not attached): [1] car_1.2-16 tools_2.10.0 2009/11/15 Greg Riddick riddic...@mail.nih.gov: Hello all, I'm trying to run lda() from the MASS library but the Help example generates the following error: #Code from example in lda Help file # Resulting Error Error in if (targetlist[i] == stringname) { : argument is of length zero My Current R Installation: MacOSX: 10.5.8 R: 2.10.0 -- Gregory Riddick, PhD. CRTA Research Fellow National Institutes of Health National Cancer Institute, Neuro-Oncology Branch http://home.ccr.cancer.gov/nob/ 37 Convent Drive Building 37, Room 1142 Bethesda, MD 20892-8202 Phone: 301-443-2490 Fax: 240-396-5920 [[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. -- Wincent Ronggui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html __ 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] creating custom package and functions
You can find guidance from Writing R Extensions manual, which is shipped with R and available on CRAN. Besides, you can have a look at package.skeleton. 2009/11/11 venkata kirankumar kiran4u2...@gmail.com Hi all, I am new to R-project I have to create custom package and some required functions in that package can any one help me how to create a custompackage and how to write my function in to that package These things I have to use in many places as per requirements in my solution please help me to create these custom packages thanks in advance kiran. [[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. -- Wincent Ronggui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html __ 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] RGtk2:::gdkColorToString throws an error
Dear all, I try to use RGtk2:::gdkColorToString, but it throws an error: Error in .RGtkCall(S_gdk_color_to_string, object, PACKAGE = RGtk2) : gdk_color_to_string exists only in Gdk = 2.12.0 I know what it means, but don't know to solve this problem because I don't know where I can download the referred gdk library. Any information? Thank you. -- HUANG Ronggui, Wincent Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] CRAN (and crantastic) updates this week
I like it. Thanks. 2009/8/24 hadley wickham crana...@gmail.com: Sorry, we had some problems with the initial sending of our weekly digest which resulted in a rather empty email. Here is the correct version: CRAN (and crantastic) updates this week New packages * atm (0.1.0) Charlotte Maia http://crantastic.org/packages/atm An R package for creating additive models with semiparametric predictors, emphasizing term objects, especially (1) implementation of a term class hierarchy, and (2) interpretation and evaluation of term estimates as functions of explanatories. * gnumeric (0.5-1) Karoly Antal http://crantastic.org/packages/gnumeric Read data files readable into R. Can read whole sheet or a range, from several file formats, including the native format of gnumeric. Reading is done by using ssconvert (a file converter utility included in the gnumeric distribution) to convert the requested part to CSV. * KFAS (0.3.1) Jouni Lehtonen http://crantastic.org/packages/KFAS Fast multivariate Kalman filter, smoother, simulation smoother and forecasting. Uses exact diffuse initialisation when distributions of some or all elements of initial state vector are unknown. * munsell (0.1) Charlotte Wickham http://crantastic.org/packages/munsell Functions for exploring and using the Munsell colour system * oosp (0.1.0) Charlotte Maia http://crantastic.org/packages/oosp An R package designed to support object oriented statistical programming, especially by extending S3 capabilities, providing pointer and component objects, and providing basic support for symbolic-numeric statistical programming. * PLIS (1.0) Zhi Wei http://crantastic.org/packages/PLIS PLIS is a multiple testing procedure for testing several groups of hypotheses. Linear dependency is expected from the hypotheses within the same group and is modeled by hidden Markov Models. It is noted that, for PLIS, a smaller p value does not necessarily imply more significance because of dependency among the hypotheses. A typical applicaiton of PLIS is to analyze genome wide association studies datasets, where SNPs from the same chromosome are treated as a group and exhibit strong linear genomic dependency. * rrv (0.0.1) Charlotte Maia http://crantastic.org/packages/rrv An incomplete R package for working with random return variables. The current package provides limited support for formatting money. More features will be added in the future. * ttrTests (1.0) David St John http://crantastic.org/packages/ttrTests Four core functions evaluate the efficacy of a technical trading rule. - Conditional return statistics - Bootstrap resampling statistics - Reality Check for data snooping bias among parameter choices - Robustness, or Persistence, of parameter choices Updated packages AdMit (1-01.03), alr3 (1.1.9), alr3 (1.1.10), cmprskContin (1.1), dataframes2xls (0.4.3), digeR (1.2), doBy (4.0.1), DoE.base (0.7), FrF2 (0.97-1), FrF2 (0.97-3), hdrcde (2.10), HH (2.1-30), JM (0.4-0), memisc (0.95-21), minet (2.0.0), MLDS (0.2-0), monomvn (1.7-3), mrt (0.3), nsRFA (0.6-9), PBSmodelling (2.21), plink (1.2-0), plotrix (2.7), RaschSampler (0.8-2), RCurl (1.0-0), rgdal (0.6-14), RSiena (1.0.5), rtv (0.3.0), sdef (1.1), SIS (0.2), spdep (0.4-36) New reviews --- * sqldf, by m.e.driscoll http://crantastic.org/reviews/26 * SensoMineR, by padmanabhan.vijayan http://crantastic.org/reviews/25 * plyr, by eamani http://crantastic.org/reviews/24 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. On Mon, Aug 24, 2009 at 4:18 PM, Hadley Wickham crana...@gmail.com wrote: CRAN (and crantastic) updates this week New packages Updated packages New reviews --- 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. [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Removing objects from workspace
It depends. If there are patterns in the names, you can make use of pattern argument of ls(). For example, x1=a;x2=b;x3=c ls(pattern=x[1-2]) [1] x1 x2 ls(pattern=x[^1-2]) [1] x3 # to remove x1-x3 rm(list=ls(pattern=x[1-2])) More generally, if you want to remove all butx,xx,xxx, you can use rm(list=ls()[! ls() %in% c(x,xx,xxx)]) Hope this helps. 2009/8/25 Steven Kang stochastick...@gmail.com: Hi all, I am currently woking with hundreds of objects in workspace and whenever I invoke ls() to observe the names of the objects, there are too much of unnecessary variables. For example, if I only require say 3 or 4 objects from hundreds of objects in workspace, are there any methods that may do the job? I have tried rm(-c(x,xx,xxx)), but no luck.. Your feedback in this problem would be highly appreciated. Steve [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] multiple linear regression
pls use lm(y ~ x1+x2) 2009/8/21 Inchallah Yarab inchallahya...@yahoo.fr: Good morning, I want to make a linear regression of a variable fuction of two variables y = a1 x1 + a2 x2 + c I found the function lm (y ~ x) but it used for a simple linear regression, but for multiple regression i do not know which function do this!! Can you help me please!! Thank you in advance [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Estimate Discrete Choice Models with R
glm can do probit regression, and glmer (lme4 package) and do mixed effect logit model. Ronggui 2009/8/16 Hongwei Dong pdxd...@gmail.com: Thanks for the replies. What I'm really interest in are the functions that can do GEV, probit, and mixed logit. I searched R, and I did find the function that can do the regular multinomial logit model, but I did not see the function that can do GEV, probit, and mixed logit. Any further advices? Thanks. Harry On Fri, Aug 14, 2009 at 3:49 PM, Hongwei Dong pdxd...@gmail.com wrote: Hi, R users, Does anyone know whether there are any Discrete Choice Modeling modules for R? Any books or websites discussing this? Thanks Harry [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] why summary() does not work here???
I cannot reproduce what you mentioned. One possible is that you use summary() without loading VGAM package. 2009/8/16 Hongwei Dong pdxd...@gmail.com: Hi, R users, I'm using the function vglm to estimate a multinomial logit model. Every time I use summary() to ask for the coefficients and std error, I got this: Length Class Mode 1 vglm S4 Anyone know what's wrong here? Thanks. Harry [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] prop.test() - need algorithm or reference
The help page of prop.test gives you three references. Isn't it enough? For example, Newcombe R.G. (1998) Two-Sided Confidence Intervals for the Single Proportion: Comparison of Seven Methods. _Statistics in Medicine_ *17*, 857-872. Newcombe R.G. (1998) Interval Estimation for the Difference Between Independent Proportions: Comparison of Eleven Methods. _Statistics in Medicine_ *17*, 873-890. 2009/8/13 ghe...@mathnmaps.com: Preparing a paper for a medical journal. Using the prop.test() function in R (v2.4.0) to compare two groups' response to data like the following. A sample of 100 individuals from Population I, 18 with positive readings from a certain test, vs. A sample of 148 individuals from Population II, 61 with positive readings. Results look like this: R version 2.4.0 Patched (2006-11-25 r39997) .. prop.test(c(18,61),c(100,148)) 2-sample test for equality of proportions with continuity correction data: c(18, 61) out of c(100, 148) X-squared = 13.7676, df = 1, p-value = 0.0002069 alternative hypothesis: two.sided 95 percent confidence interval: -0.3498963 -0.1144280 sample estimates: prop 1 prop 2 0.180 0.4121622 Presumably the p-value measures that the likelihood that the two populations have the same proportion of response. My question is this. The reviewer of the paper has asked for a reference on the algorithm used to compute the p-value. The R Reference Manual is not clear on this. Is this a standard algorithm that can be quoted by name (e.g., Two-sample T Test)? I do note that the manual quotes a 1927 article by E.B. Wilson. Is the method of computation explained there? Thank you for any assistance you can provide. George Heine ghe...@mathnmaps.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Games in R
Hi, another package can be found here http://r-forge.r-project.org/projects/fun/ 2009/8/13 Bjørn Arild Mæland bjorn.mael...@gmail.com: Hi, There's a couple of games listed on crantastic: http://crantastic.org/tags/games -Bjorn 2009/8/12 David Croll david.cr...@gmx.ch: Hi everybody - this is an oddball question. I wonder if anybody has programmed any games in R, such as Sudoku, Tic-Tac-Toe and the like. Or even a flight simulator... R mateys! Let's make some t-tests! Regards, David __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 Import Excel file into R 2.9.0 version
You can download it from http://treetron.googlepages.com/xlsreadwrite.htm Also, you may have a look at Data import/export manual, which has a relevant section. Ronggui 2009/8/11 rajclinasia r...@clinasia.com: Hi Every one, I have a problem with Reading Excel file into R 2.9.0 version. In older versions it is working with xlsReadWrite package. But in 2.9.0 version there is no package like that. so help me out in this aspect. Thanks in Advance. -- View this message in context: http://www.nabble.com/How-to-Import-Excel-file-into-R-2.9.0-version-tp24914638p24914638.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] RES: Saving plots to file
Or you can plot first, when you are satisfied with it, copy the plot to another device. for example, X11() plot(rnorm(10)) dev.copy(png) ## copy the plot to an png file. Best 2009/8/11 Rodrigo Aluizio r.alui...@gmail.com: You can save plots as specified below. For details see ?png, ?postscrip, ?tiff, ?jpeg, ?bmp. postscript(file = ifelse(onefile, Rplots.ps, Rplot%03d.ps), onefile, family, title, fonts, encoding, bg, fg, width, height, horizontal, pointsize, paper, pagecentre, print.it, command, colormodel, useKerning) bmp(filename = Rplot%03d.bmp, width = 480, height = 480, units = px, pointsize = 12, bg = white, res = NA, restoreConsole = TRUE) jpeg(filename = Rplot%03d.jpg, width = 480, height = 480, units = px, pointsize = 12, quality = 75, bg = white, res = NA, restoreConsole = TRUE) png(filename = Rplot%03d.png, width = 480, height = 480, units = px, pointsize = 12, bg = white, res = NA, restoreConsole = TRUE) tiff(filename = Rplot%03d.tif, width = 480, height = 480, units = px, pointsize = 12, compression = c(none, rle, lzw, jpeg, zip), bg = white, res = NA, restoreConsole = TRUE) -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Sean MacEachern Enviada em: segunda-feira, 10 de agosto de 2009 13:26 Para: r-help@r-project.org Assunto: [R] Saving plots to file Appologies if this has been addressed before, but I can't seem to find it in the help archives. I'm looking to do something like the following but it looks like save.plot is deprecated. save.plot(plot(glm1$residuals,gain,main = Hist of residuals and gain),file=Desktop/hist1.png) Thanks in advance, Sean Session Info: R version 2.9.1 (2009-06-26) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.9.1 __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Example scripts for R Manual
Is it really necessary? You can just copy the commands in the manual and paste them to R. Ronggui 2009/8/11 Peng Yu pengyu...@gmail.com: Hi, I am wondering if some experienced users would help put the ready-to-run code of the examples in the manuals. It would help new users learn R faster by putting all the examples in an ready-to-run R script file. Can somebody help do so sometime and post the code along with the pdf manuals? http://cran.r-project.org/manuals.html Regards, Peng __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] import data into R
You can not import xls file by read.table. You may save xls as csv file, and import it by read.csv. 2009/8/6 Inchallah Yarab inchallahya...@yahoo.fr: Thank you Gabor Grothendieck for your answer !! i have charge the pachage but now i have this massage read.table(c:/TOTAL.xls,h=T) [1] ÐÏ.à.. 0 rows (or 0-length row.names) Warning messages: 1: In read.table(c:/TOTAL.xls, h = T) : incomplete final line found by readTableHeader on 'c:/TOTAL.xls' 2: In if (!header) rlabp - FALSE : the condition has length 1 and only the first element will be used 3: In if (header) { : the condition has length 1 and only the first element will be used thank you [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Comparison of Output from dwtest and durbin.watson
I think the statistics are the same, but the p-values are not exactly the same as they used different methods for the p-value. car uses bootstrapping and lmtest uses the pan algorithm, said from the help pages. 2009/8/4 Tom La Bone boo...@gforcecable.com: Allow me to reword this question. I have performed two fits to the same set of data below: a weighted fit and an unweighted fit. I performed the Durbin-Watson tests on each fit using dwtest and durbin.watson. For a given fit (weighted or unweighted), should both dwtest and durbin.watson be giving me the same DW statistic and p-value? Should I get the same DW statistic and p-value for the weighted and unweighted fits as I do using dwtest? library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric library(car) X - c(4.8509E-1,8.2667E-2,6.4010E-2,5.1188E-2,3.4492E-2,2.1660E-2, + 3.2242E-3,1.8285E-3) Y - c(2720,1150,1010,790,482,358,78,35) W - 1/Y^2 fit - lm(Y ~ X - 1) dwtest(fit,alternative=two.sided) Durbin-Watson test data: fit DW = 0.7599, p-value = 0.05935 alternative hypothesis: true autocorelation is not 0 durbin.watson(fit,alternative=two.sided) lag Autocorrelation D-W Statistic p-value 1 0.5897666 0.7599161 0.368 Alternative hypothesis: rho != 0 fit - lm(Y ~ X - 1,weights=W) dwtest(fit,alternative=two.sided) Durbin-Watson test data: fit DW = 0.7599, p-value = 0.05935 alternative hypothesis: true autocorelation is not 0 durbin.watson(fit,alternative=two.sided) lag Autocorrelation D-W Statistic p-value 1 -0.07663672 1.209076 0.77 Alternative hypothesis: rho != 0 -- View this message in context: http://www.nabble.com/Comparison-of-Output-from-%22dwtest%22-and-%22durbin.watson%22-tp24783494p24808540.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] status of boolean package
FYI -- Forwarded message -- From: Bear Braumoeller braumoelle...@polisci.osu.edu Date: 2009/8/4 Subject: Re: Package boolean on CRAN To: c...@datanalytics.com c...@datanalytics.com Cc: Ronggui Huang ronggui.hu...@gmail.com, Ben Goodrich goodr...@fas.harvard.edu Gentlemen, Thanks for your enquiries. Boolean is under active development, and we should have a new release on CRAN soon; we'll be happy to notify you when it's up. It may be delayed as I am out of the office until mid-August. Thanks for your interest. I'd appreciate it if you'd post this information to the r-help list (or send it to anyone else who needs it directly) as my Internet connection is excruciatingly slow. Best regards, Bear Braumoeller Entered on a mobile device; please pardon brevity and typos. On Aug 2, 2009, at 8:38 PM, Carlos J. Gil Bellosta c...@datanalytics.com wrote: Dear Prof. Braumoeller, I am writing to you as I have realized that the R package boolean that you maintained on CRAN has become orphaned and unavailable. This happens when, after a new version of R arrives, there are some checks that the package does not pass and the author can no longer be contacted. I do not know whether you are still interested in this piece of code. It is a pity, though, that it becomes unavailable while there are some people asking for it in the R-help lists. If you are still interested in it, I would appreciate if you would take the steps to make it available again. If you have no time or you are not interested in it any more, I would gladly volunteer to maintain it and make the appropriate fixes so that it becomes available to the community again. Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Compare lm() to glm(family=poisson)
In practices, it is not easy to make such decision. One example is size of social ties in social network study. It is very common to use OLS thought it is count variable rather than normal. I think AIC is suggestive as well. Ronggui 2009/8/2 Alain Zuur highs...@highstat.com: Mark Na wrote: Dear R-helpers, I would like to compare the fit of two models, one of which I fit using lm() and the other using glm(family=poisson). The latter doesn't provide r-squared, so I wonder how to go about comparing these models (they have the same formula). Thanks very much, Mark Na [[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. The decision which distribution to use (Normal versus Poisson) should be an a priori choice. If you really want to compare them, then inspect the residuals of both models and see which model doesn't have any residual patterns. Alain - Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Email: highs...@highstat.com URL: www.highstat.com -- View this message in context: http://www.nabble.com/Compare-lm%28%29-to-glm%28family%3Dpoisson%29-tp24764558p24772802.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] status of boolean?
package of boolean has been removed from CRAN. Anyone know why? Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 Function for Multinomial Logistic Regression and its partial derivatives
You may refer to mlogit for the ordinary multinomial regression. As fas as I know, there are no functions for multilevel multinomial regression. Ronggui 2009/8/2 nikolay12 nikola...@gmail.com: Hi, I would like to apply the L-BFGS optimization algorithm to compute the MLE of a multilevel multinomial Logistic Regression. The likelihood formula for this model has as one of the summands the formula for computing the likelihood of an ordinary (single-level) multinomial logit regression. So I would basically need the R implementation for this formula. The L-BFGS algorithm also requires computing the partial derivatives of that formula in respect to all parameters. I would appreciate if you can point me to existing implementations that can do the above. Nick PS. The long story for the above: My data is as follows: - a vector of observed values (lenght = D) of the dependent multinomial variable each element belonging to one of N levels of that variable - a matrix of corresponding observed values (O x P) of the independent variables (P in total, most of them are binary but also a few are integer-valued) - a vector of current estimates (or starting values) for the Beta coefficients of the independent variables (length = P). This data is available for 4 different pools. The partially-pooled model that I want to compute has as a likelihood function a sum of several elements, one being the classical likelihood function of a multinomial logit regression for each of the 4 pools. This is the same model as in Finkel and Manning Hierarchical Bayesian Domain Adaptation (2009). -- View this message in context: http://www.nabble.com/Likelihood-Function-for-Multinomial-Logistic-Regression-and-its-partial-derivatives-tp24772731p24772731.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Collinearity in Linear Multiple Regression
I think perturb:colldiag implementes condition index as well as variance decomposition proportions. Ronggui 2009/7/21 Stephan Kolassa stephan.kola...@gmx.de: Hi Alex, I personally have had more success with the (more complicated) collinearity diagnostics proposed by Belsley, Kuh Welsch in their book Regression Diagnostics than with Variance Inflation Factors. See also: Belsley, D. A. A Guide to using the collinearity diagnostics. Computational Economics, 1991, 4, 33-50 However, I know of no R package that implements these diagnostics. Anyway, it's not hard to do so oneself. Good luck! Stephan Alex Roy schrieb: Dear all, How can I test for collinearity in the predictor data set for multiple linear regression. Thanks Alex [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 book for economists
How about Kleiber, C. Zeileis, A. Applied Econometrics with R Springer, 2008? Ronggui 2009/8/1 Thiemo Fetzer t...@devmag.net: Dear Group, I am an economics student starting with PhD work in London. As preparation I would like to get to know R a little bit better. For Stata there are tons of books, however, can you recommend a book for R? I have some substantiated econometrics knowledge, so it should be more a how-to book. Best regards Thiemo --- Thiemo Fetzer, Economist http://freigeist.devmag.net http://www.devmag.net __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Installing lme4 package in Windows Vista
After installation of lme4, you need to load it before use it. library(lme4) ?lmer 2009/7/29 Angela Radulescu angela.radule...@gmail.com: Hi all, I have a problem with package installing in Windows, on my PC machine. The end goal is to be able to use the lme() function. Here's what I did so far: install.packages(lme4) Warning in install.packages(lme4) : argument 'lib' is missing: using 'C:\Users\Angela\Documents/R/win-library/2.9' --- Please select a CRAN mirror for use in this session --- trying URL 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.9/lme4_0.999375-31.zip' Content type 'application/zip' length 1140865 bytes (1.1 Mb) opened URL downloaded 1.1 Mb package 'lme4' successfully unpacked and MD5 sums checked The downloaded packages are in C:\Users\Angela\AppData\Local\Temp\Rtmp1t8vjT\downloaded_packages updating HTML package descriptions Warning message: In file.create(f.tg) : cannot create file 'C:\PROGRA~1\R\R-29~1.1/doc/html/packages.html', reason 'Permission denied' I had to change permissions on some of the library folder before this. Still, after installation, R cannot find the lme function of interest. lme Error: object 'lme' not found Does anyone know why this is happening, and what the solution to the problem is? Many thanks, Angela -- View this message in context: http://www.nabble.com/Installing-lme4-package-in-Windows-Vista-tp24709932p24709932.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Error in object$coefficients : $ operator not defined for this S4 class
What is fit in your example? Ronggui 2009/7/7 aledanda danda.ga...@gmail.com: Hallo, I received this error message while calculating the coefficents coef(fit, matrix=TRUE) Error in object$coefficients : $ operator not defined for this S4 class what is this? How can I solve it? Ale -- View this message in context: http://www.nabble.com/Error-in-object%24coefficients-%3A-%24-operator-not-defined-for-this-S4-class-tp24371231p24371231.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Error in object$coefficients : $ operator not defined for this S4 class
I can not reproduce your problem with the latest version of VGAM. Besides, if you want to get the coef and std. error etc. you can use summary(fit)@coef3 Value Std. Error t value (Intercept):1 -1.020388 0.03215889 -31.72957 (Intercept):2 1.335657 0.04206706 31.75067 2009/7/7 Alessandra Galli danda.ga...@gmail.com: Sure, sorry, I am fitting with beta distribution: y= rbeta(n - 1000, shape1=exp(0), shape2=exp(1)) fit = vglm (y ~ 1, betaff, trace =TRUE) Thanks 2009/7/7 Ronggui Huang ronggui.hu...@gmail.com What is fit in your example? Ronggui 2009/7/7 aledanda danda.ga...@gmail.com: Hallo, I received this error message while calculating the coefficents coef(fit, matrix=TRUE) Error in object$coefficients : $ operator not defined for this S4 class what is this? How can I solve it? Ale -- View this message in context: http://www.nabble.com/Error-in-object%24coefficients-%3A-%24-operator-not-defined-for-this-S4-class-tp24371231p24371231.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html -- Alessandra Galli Mechelsestraat 155 /6 3000 Leuven Belgium T: +32 473 588179 -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Correlation Network Diagram?
Maybe not address your question directly. There is a package for correlation visualization in r-forge (http://r-forge.r-project.org/projects/corrplot/). 2009/7/3 rory.wins...@gmail.com: Hi all On page 39 of this paper [1] by Andrew Lo there is a very interesting correlation network diagram (sorry I dont have a more convenient link to the type of diagram I'm talking about). does anyone know of any package in R that can generate these types of diagrams? Cheers -- Rory [1] http://web.mit.edu/alo/www/Papers/august07.pdf [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] save the result into a word file
How about export it to a HTML and then copy to MS word. I have packaged some code to export lm object to HTML in AJS style. You can have a look at ASAtable (http://r-forge.r-project.org/R/?group_id=328). Ronggui 2009/7/3 Suyan Tian st...@mail.rockefeller.edu: Hi, everyone: I forget on how to save a result from R as a word document. For example, if I run the linear regression and want to save the result: summary(lm(y~x) in a word file. So I can show it later to my clients. Any idea on how to do this? Thanks a lot, Suyan __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] order by decerasing 1st variable and increasing 2nd variable
How about this: x[order(x$One,-x$Two,decreasing=T),] One Two 8 5 3 7 4 3 6 3 3 4 2 2 5 2 3 3 1 1 1 1 2 2 1 3 2009/6/24 Daniel Brewer daniel.bre...@icr.ac.uk: Hello, I have a data.frame which I would like to sort with the primary key decreasing while the secondry key is increasing e.g. x - data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3)) I would like to order it so it looks like this: One Two 8 5 3 7 4 3 6 3 3 4 2 2 5 2 3 3 1 1 1 1 2 2 1 3 i.e. primarily decreasing in the 1st column but if there is a tie increasing in the second column. Is this possible? I can not find anything in order that seems to support this. I would have thought, x[order(x$One,x$Two,decreasing=c(T,F)),] would do it but it doesn't. Thanks Dan -- ** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.bre...@icr.ac.uk ** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}} __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Urgent - odfWeave produces graphs /images with Read-Error
If you use lattice to produce the figures, you need to wrap them in print, say, = print(xyplot(y~x,data=dat)) @ Ronggui 2009/6/17 Fredrik Karlsson dargo...@gmail.com: Dear list, I have been working on a report with around 60 images in it, and everything has been fine, until now. I find that the image output that is produced by odfWeave produces images that are NOT readable by OpenOffice or NeoOffice. I get empty boxes with Read-Error written in them. While generating the file using odfWeave, I can see them being generated on the screen, and they all seem fine. Have anybody seen this before? Is there a way around it? /Fredrik -- Life is like a trumpet - if you don't put anything into it, you don't get anything out of it. __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] The most straightfoward way to write a function that sums over the rows of a matrix
Why not just use rowSums? Ronggui 2009/6/16 Stu @ AGS s...@agstechnet.com: Hello! I am trying to write a function with vector and data.frame parameters that uses the sum() function and values from the rows of the data.frame. I need to pass this function as a parameter to optim(). My starting point is: observs - data.frame(y, x1, x2, x3) Fn - function(par, observs) { sum( (y - (par[1] * (x1 + 1) * x2^(-par[2]) * x3^par[3])^2 ) } y, x1, x2, x3 are all vectors. I am a bit new to R and I have not been able to find a good description of how to iterate over rows in a data.frame. What is a straightforward way to do this? What am I missing? Thanks Stu [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 capture output from a subprocess?
## open a pipe a - pipe(mplayer -slave -quiet /media/wind/Music/a.mp3,w) write(get_file_name,a) ## send get_file_name command to player. ## ANS_FILENAME='a.mp3' write(quit,a) ## exit mplayer Can I capture the output from mplayer into a R object? In this case, it is ANS_FILENAME='a.mp3'. I try sink(), but it doesn't work as what I want to capture is not a return from R. Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Install local package
## Check the package R CMD check path.of.package ## Build the package R CMD build pathof.package ## INSTALL the package R CMD INSTALL path.of.package You can use _R --help _ (from within terminal) to get more information. Ronggui 2009/6/11 Jorge Cornejo cornejo...@gmail.com: Hi, I'm working on a package that I would someday put in CRAN. Now I want to test it on my computer. I already check and compile the files but I don't know how to install the package located on my hard drive. I'm running R under linux. Can anyone tell my how to do it? Thanks in advance. __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] graphically representing frequency of words in a speech?
There is a similar discussion in statalist (http://n2.nabble.com/st%3A-Tag-clouds-in-Stata--tt2992551.html#none), I think they make a reasonable argument that tag cloud is not a good statistical graphic. 2009/6/10 Yihui Xie xieyi...@gmail.com: Hi, As Gregor Gorjanc mentioned, it's very inconvenient to let R decide the fontsize and placement of words in a plot. There have already been very mature applications of tag cloud; one of them I'm relatively familiar is the WordPress plugin wp-cumulus, which makes use of a Flash object to generate tag cloud, and it has fantastic 3D rotation effect of the cloud. I've spent a couple of hours porting it into R; see the source code and effect here: http://yihui.name/en/2009/06/creating-tag-cloud-using-r-and-flash-javascript-swfobject/ HTH. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing, 100872, China On Mon, Jun 8, 2009 at 2:41 AM, Brown, Tony Nicholastony.n.br...@vanderbilt.edu wrote: Dear all, I recently saw a graph on television that displayed selected words/phrases in a speech scaled in size according to their frequency. So words/phrases that were often used appeared large and words that were rarely used appeared small. The closest thing I can find on the web to approximate what I saw can be found here: http://stateoftheunion.onetwothree.net/ The example at that website is more complicated but captures the general idea. Would someone point me in the right direction in terms of replicating such a graph. Thanks in advance, Tony - Tony N. Brown, Ph.D. Editor-Elect, American Sociological Review Associate Professor of Sociology and Human and Organizational Development (secondary) Program Faculty, Effective Health Communication and African American Diaspora Studies Faculty Head of Hank Ingram House, The Commons Vanderbilt University (615) 322-7518 (615) 322-7505 fax [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Vista + R = *!!?@
lmer will not produce p-value but glmer does. So, if you want to estimate a lmm model, you can use lme in nlme package instead. Ronggui 2009/6/11 John Townsend-Mehler towns...@msu.edu: Hello People of R, Is there any way that I can get R to function properly using Vista. I get very strange output using lmer, as in no p-values. Is there ANY way I can fix this. Thank you for your time, John Townsend-Mehler PhD Candidate Department of Zoology Michigan State University __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Writing Reports from R in Office Open XML format (ooxmlWeave?)
Wow, It sounds great. Looking forward to it. 2009/6/9 Duncan Temple Lang dun...@wald.ucdavis.edu: Yes. We will release a version in the next few weeks when I have time to wrap it all up. There is also a Docbook-based version that uses R extensions to Docbook for authoring structured documents. D. Tobias Sing wrote: Dear all, has someone implemented functionality for writing reports from R in Office Open XML format (*), similar to what odfWeave does for the ODF format of OpenOffice? It would be great to have a kind of ooxmlWeave at least for those of us who are forced to work in an MS ecosystem. (*) Office Open XML is the default, XML-based, file format for MS Word: http://en.wikipedia.org/wiki/Office_Open_XML Kind regards, Tobias __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] searchpaths
No. This function is used to get a list of 'attach'ed _packages_ rather than search files in your computer. 2009/6/10 mau...@alice.it: May I use searchpaths() with arguments partially matching file names that are found in different directories ? My question is whether this is th R function equivalent of Linux find or Windows search. Both O.S. calls are given a starting point so that they search all diectories from then downwards looking for files whose names match the searching criteria. Thank you. Maura tutti i telefonini TIM! [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] SECOND MESSAGE: Re: Question about R an SPSS
There is a technical report on comparison of R and other statistical software (http://www.ats.ucla.edu/stat/technicalreports/Number1/R_relative_statpack.pdf). You can have an overall view from this document. You may have better chance to get answers if you specify what you want to do and if R can do it. Of course, R can read data of SPSS format by read.spss function in foreign package. Ronggui 2009/6/9 DIEGO CHAVEZ diego.cha...@andinanet.net: Sent: Sunday, June 07, 2009 5:43 PM Subject: Question about R an SPSS Dears Sirs: Venables, Smith and R-Development Core Team I am reading about the functional features of R statistical software, because I want to compare these progarm with the basic module of SPSS software. I would like to know if the R version 2.9.0 application is capable of read and procces entry files that were created in SPSS program version 17 or earliers. In adittion, If you have more information about the functional comparisons between R and SPSS software, please send to my email address I will be grateful for you response. Best regards. Diego Chávez [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] RGtk2 help: Show list of column names from dataset and categorize as factor or numeric
I use gWidgetsRGtk2, which provides widgets such as notebook etc. You can start with gWidgetsRGtk2, and if you want to tailor the GUI according to your needs, you can modified them with RGtk2 package. Ronggui 2009/6/4 Harsh singhal...@gmail.com: Hi UseRs, I recently started working with the RGtk2 library. The documentation is comprehensive and I've tried learning from the examples in most Gtk tutorials (which have C code). This is a little problematic, but has helped quite a bit in getting me started. I would like to create a GUI for file selection, which then displays the column names from the selected file, and provides the user with checkboxes with each column name for the user to select. Two columns of check boxes (Factor Type, Numeric Type) and one column of names is what I would like to display. Moreover, I am planning to create a GUI tool that would have tabs in a notebook layout, each tab providing a certain functionality, beginning from basic charting of data, and going on to applying regression models and such on the data. This requires extensive knowledge in components that RGtk2 provides which could be implemented for the task outlined above. I have looked at the omegahat.org examples, but would like to see examples for such simple tasks as to how one could create a drop down list of column names to choose for x axis and another drop down allowing the choice of y axis, etc. Having made the choice to use RGtk2, I would appreciate if users could share their RGtk experience with me. Regards Harsh Singhal __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] (no subject)
use _search()_ to see if the package is on the search path. If yes, use _detach(package:sn,unload=TRUE)_ to detach it and then try to install it again. Ronggui 2009/6/1 Roslina Zakaria zrosl...@yahoo.com: Hi R-users, I try to use sn package but it give me the following message: install.packages(repos=NULL,pkgs=c:\\Tinn-R\\sn_0.4-12.zip) Warning: package 'sn' is in use and will not be installed updating HTML package descriptions I did tried a few time to save the .zip file but it give me the same error message. Thank you so much for any help given. [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] problem with ls command
I am not sure what you want. The error msg is clear to me. You can use search() to search what are in the search path, for example. search() [1] .GlobalEnvpackage:stats package:graphics [4] package:grDevices package:utils package:datasets [7] package:methods Autoloads package:base ls(package:graphics) [1] abline arrows assocplot axis Ronggui 2009/5/29 anupam sinha anupam.cont...@gmail.com: Hi all , I am facing some problems with 'ls' command. Whenever I use it I get the following error : ls(KEGG.db) Error in as.environment(pos) : no item called KEGG.db on the search list ls(pkgname) Error in as.environment(pos) : no item called KEGG.db on the search list and this is true for any package. Can anything be done ? Regards, Anupam Sinha, Graduate Student, Laboratory of Computational Biology, Centre for DNA fingerprinting and Diagnostics Hyderabad, India - 51 [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] GTK Tooltips under Linux
Noted with thanks. Regards Ronggui 2009/5/29 Michael Lawrence mflaw...@fhcrc.org: On Thu, May 28, 2009 at 7:35 PM, Ronggui Huang ronggui.hu...@gmail.com wrote: Dear all, I want to set tool-tips for a gtkButton. I use the following code which works under Windows. However, it doesn't work under Linux. Any hints? Thanks. Unfortunately, on platforms besides Windows, the event loop runs via an input handler connected to X11. If you're waiting for a tooltip to show up, there's obviously no input, so the event loop is not iterated. I think I could fix this by creating a separate thread that writes to a file descriptor connected to an input handler. I'll try to do that. Michael library(RGtk2) b-gtkButtonNewWithLabel(OK) gtkTooltips()$setTip(b,Memo for a Button.) gw - gtkWindow(show=F) gw$Add(b) gw$Show() sessionInfo() R version 2.8.0 Patched (2008-12-10 r47137) i686-pc-linux-gnu locale: LC_CTYPE=zh_CN.UTF-8;LC_NUMERIC=C;LC_TIME=zh_CN.UTF-8;LC_COLLATE=zh_CN.UTF-8;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=zh_CN.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=zh_CN.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RGtk2_2.12.11 RQDA_0.1-8 igraph_0.5.2-2 [4] gWidgetsRGtk2_0.0-51 gWidgets_0.0-35 RSQLite_0.7-1 [7] DBI_0.2-4 loaded via a namespace (and not attached): [1] tools_2.8.0 -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] GTK Tooltips under Linux
Dear all, I want to set tool-tips for a gtkButton. I use the following code which works under Windows. However, it doesn't work under Linux. Any hints? Thanks. library(RGtk2) b-gtkButtonNewWithLabel(OK) gtkTooltips()$setTip(b,Memo for a Button.) gw - gtkWindow(show=F) gw$Add(b) gw$Show() sessionInfo() R version 2.8.0 Patched (2008-12-10 r47137) i686-pc-linux-gnu locale: LC_CTYPE=zh_CN.UTF-8;LC_NUMERIC=C;LC_TIME=zh_CN.UTF-8;LC_COLLATE=zh_CN.UTF-8;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=zh_CN.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=zh_CN.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RGtk2_2.12.11RQDA_0.1-8 igraph_0.5.2-2 [4] gWidgetsRGtk2_0.0-51 gWidgets_0.0-35 RSQLite_0.7-1 [7] DBI_0.2-4 loaded via a namespace (and not attached): [1] tools_2.8.0 -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 under Ubuntu
I think it is standard practice. If you want R to load a workspace automatically when R is launched, you can add the command in .Rprofile. See ?Startup for more on Initialization at Start of an R Session. Ronggui 2009/5/26 Luis Ridao Cruz lu...@hav.fo: R-help, I have installed R under Ubuntu and I'm very new to a Linux distribution. To open an empty R session I just type R on the Terminal aplication. But how can I open a saved workspace? At present I just start R and then load (my_workspace) but it must be possible to do it all at onceright? Thanks in advance __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] split strings
They look like file path, so you can make use of basename() first, then use gsub to strip the suffix. x-c(F:/Naval_Live_Oaks/2005/data//BE.tif,F:/Naval_Live_Oaks/2005/data//CH.tif) x2-sapply(x,basename,USE.NAMES=FALSE) gsub([.].{1,}$,,x2) [1] BE CH Ronggui 2009/5/26 Monica Pisica pisican...@hotmail.com: Hi everybody, I have a vector of characters and i would like to extract certain parts. My vector is named metr_list: [1] F:/Naval_Live_Oaks/2005/data//BE.tif [2] F:/Naval_Live_Oaks/2005/data//CH.tif [3] F:/Naval_Live_Oaks/2005/data//CRR.tif [4] F:/Naval_Live_Oaks/2005/data//HOME.tif And i would like to extract BE, CH, CRR, and HOME in a different vector named names.id for example. I read the help files for sub and grep and the likes but i have to recognize that i did not understand it. So i've done this (which does the job but extremely clumsy): b - strsplit(metr_list, //) b - unlist(b) d - strsplit(b, \\.) d - unlist(d) names.id - d[c(2, 5, 8, 11)] Can anybody show what would be the proper way to achieve this with some explanations? Thanks, Monica _ Hotmail® goes with you. ial_Mobile1_052009 __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Draw a rectangle on top of an image using RGtk2?
I see. So if I want to draw a rectangle by a function outside the expose_fn, I need to refer to the drawable within the expose_fn. One possibility is to use an environment, so I can refer to it dynamically. Thanks, Ronggui 2009/5/25 Michael Lawrence mflaw...@fhcrc.org: On Sat, May 23, 2009 at 8:27 AM, Ronggui Huang ronggui.hu...@gmail.com wrote: Thanks, Michael. Just one more follow-up question. Is there other way to get the GdkDrawable (here da2) without using - or other assignment operation from within expose_fn? I thought da$GetRootWindow() would work, but it does not. You need to be drawing the rectangle within expose_fn, otherwise it won't show up. There should be no need to access the GdkWindow (da2) of the drawing area outside of expose_fn. Michael da - gtkDrawingArea() da2 - NULL expose_fn - function(widget,event,...){ img - gdkPixbufNewFromFile(/media/wind/Pictures/kaehatu.jpg)$retval da2 -widget[[window]] gdkDrawPixbuf(da2, gc = NULL, pixbuf=img, event[[area]][[x]], event[[area]][[y]], event[[area]][[x]], event[[area]][[y]], event[[area]][[width]], event[[area]][[height]]) return(FALSE) } gSignalConnect(da,expose-event,expose_fn) w-gtkWindow(show=F) w$SetSizeRequest(400,300) w$Add(da) w$Show() dgc - gdkGCNew(da2) gdkGCSetLineAttributes(dgc, line.width=2, line.style=solid,round,round) gdkDrawRectangle(da2,dgc,FALSE,10,10,100,100) Ronggui 2009/5/23 Michael Lawrence mflaw...@fhcrc.org: On Fri, May 22, 2009 at 11:27 PM, Ronggui Huang ronggui.hu...@gmail.com wrote: Dear all, I use gtkImageFromFile to display an image. Then I want to do some gsignal to handle mouse event. I click the mouse and move a another position and release. I can get the position of the firs click and the release position, then I would to draw a rectangle to display the region I have selected. I need some hints on what functions should I look for. I tried to google but don't know how. The GtkImage widget is just for showing images. If you want to start doing interactive graphics, I'd suggest moving to the more general GtkDrawingArea widget and connecting to the expose-event signal. You can then use GdkPixbuf for loading and drawing the image onto the drawing area. And then draw a rectangle on top with gdkDrawRectangle(). See demos drawingArea and images. Michael Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Draw a rectangle on top of an image using RGtk2?
Dear all, I use gtkImageFromFile to display an image. Then I want to do some gsignal to handle mouse event. I click the mouse and move a another position and release. I can get the position of the firs click and the release position, then I would to draw a rectangle to display the region I have selected. I need some hints on what functions should I look for. I tried to google but don't know how. Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Draw a rectangle on top of an image using RGtk2?
Thanks, Michael. Just one more follow-up question. Is there other way to get the GdkDrawable (here da2) without using - or other assignment operation from within expose_fn? I thought da$GetRootWindow() would work, but it does not. da - gtkDrawingArea() da2 - NULL expose_fn - function(widget,event,...){ img - gdkPixbufNewFromFile(/media/wind/Pictures/kaehatu.jpg)$retval da2 -widget[[window]] gdkDrawPixbuf(da2, gc = NULL, pixbuf=img, event[[area]][[x]], event[[area]][[y]], event[[area]][[x]], event[[area]][[y]], event[[area]][[width]], event[[area]][[height]]) return(FALSE) } gSignalConnect(da,expose-event,expose_fn) w-gtkWindow(show=F) w$SetSizeRequest(400,300) w$Add(da) w$Show() dgc - gdkGCNew(da2) gdkGCSetLineAttributes(dgc, line.width=2, line.style=solid,round,round) gdkDrawRectangle(da2,dgc,FALSE,10,10,100,100) Ronggui 2009/5/23 Michael Lawrence mflaw...@fhcrc.org: On Fri, May 22, 2009 at 11:27 PM, Ronggui Huang ronggui.hu...@gmail.com wrote: Dear all, I use gtkImageFromFile to display an image. Then I want to do some gsignal to handle mouse event. I click the mouse and move a another position and release. I can get the position of the firs click and the release position, then I would to draw a rectangle to display the region I have selected. I need some hints on what functions should I look for. I tried to google but don't know how. The GtkImage widget is just for showing images. If you want to start doing interactive graphics, I'd suggest moving to the more general GtkDrawingArea widget and connecting to the expose-event signal. You can then use GdkPixbuf for loading and drawing the image onto the drawing area. And then draw a rectangle on top with gdkDrawRectangle(). See demos drawingArea and images. Michael Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Trouble installing package 'systemfit'
Have you tried another mirror? It seems that downloaded file is incomplete. 2009/5/20 Rui Wang r...@hawaii.edu: I tried unnder R 2.9.0 and R 2.8.1. Both versions failed to install 'systemfit'. I downloaded file 'systemfit_1[1].0-8.zip' to install the package. I am using Windows 2000 service pack 4. The error message is: Error in gzfile(file, r) : cannot open the connection In addition: Warning message: In gzfile(file, r) : cannot open compressed file 'systemfit_1[1].0-8/DESCRIPTION', probable reason 'No such file or directory' 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Remove objects names like character String
I don't get the error you mention: site1_data-1 site2_data-2 site3_data-3 for (i in 1:3) paste(site,i,_data,sep=) In my example, another way is: rm(list=paste(site,1:3,_data,sep=)) Or you can use rm(list=ls(pattern=you pattern)), in my example, it is: rm(list=ls(pattern=site[1-3]_data)) Ronggui 2009/5/19 Katharina May may.kathar...@googlemail.com: Hi, how can I use rm() on objects named like: paste(site,i,_data,sep=) while looping through i? I tried rm(paste(site,i,_data,sep=)) but I get the error that rm() must contain names or text strings which is confusing me as I thought paste() would create something like that...? Thanks, Katharina -- Time flies like an arrow, fruit flies like bananas. __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 do you save in R?
I would second Dieter's point. 2009/5/18 Dieter Menne dieter.me...@menne-biomed.de: Patrick Burns pburns at pburns.seanet.com writes: I disagree with Dieter's last point. Whether you use 'attach' or 'load' should depend on whether you want the objects in the file to remain separate ('attach') or mixed into the global environment ('load'). Technically a good point, but I found it helpful for starters who want to avoid the inferno of what's attached now? not to use it at all. My suggestion is to use with() instead because it has a higher locality. I know, many of the examples use attach. Dieter __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Do you use R for data manipulation?
2009/5/6 Emmanuel Charpentier charp...@bacbuc.dyndns.org: Le mercredi 06 mai 2009 à 00:22 -0400, Farrel Buchinsky a écrit : Is R an appropriate tool for data manipulation and data reshaping and data organizing? [ Large Snip ! ... ] Depends on what you have to do. I've done what can be more or less termed data management with almost uncountable tools (from Excel (sigh...) to R with SQL, APL, Pascal, C, Basic (in 1982 !), Fortran and even Lisp in passing...). SQL has strong points : join is, to my tastes, more easily expressed in SQL than in most languages, projection and aggregation are natural. However, in SQL, there is no natural ordering of row tables, which makes expressing algorithms using this order difficult. Try for example to express the differences of a time series ... (it can be done, but it is *not* a pretty sight). On the other hand, R has some unique expressive possibilities (reshape() comes to mind). So I tend to use a combination of tools : except for very small samples, I tend to manage my data in SQL and with associated tools (think data editing, for example ; a simple form in OpenOffice's Base is quite easy to create, can handle anything for which an ODBC driver exists, and won't crap out for more than a few hundreds line...). finer manipulation is usually done in R with native tools and sqldf. But, at least in my trade, the ability to handle Excel files is a must (this is considered as a standard for data entry. Sigh ...). So the first task is usually a) import data in an SQL database, and b) prepare some routines to dump SQL tables / R dataframes in Excel tor returning back to the original data author... I don't think Excel is a standard tool for data entry. Epidata entry is much more professional. HTH Emmanuel Charpentier __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Splitting a vector into equal groups
lattice:::equal.count may be what you want. 2009/5/4 utkarshsinghal utkarsh.sing...@global-analytics.com: Hi All, I have vector of length 52, say, x=sample(30,52,replace=T). I want to sort x and split into five *nearly equal groups*. Note that the observations are repeated in x so in case of a tie I want both the observations to fall in same group. This seems a very common task to do, but still I couldn't find an R function to do this. Any help would be highly appreciated. Regards Utkarsh [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Encoding issue with replacement operation
I have a length-1 character vector x, and I want to replace ' in the character into ''. What I do now is to iconv x into suitable current Encoding, then use gsub. It works well if I knows what x is (e.g. Chinese charater), as I can use suitable locales to handle it. ### it works x- some chinese character with ' in it Encoding(x) - UTF-8 Sys.setlocale(,CHS) gsub(','',x) ## It would be great if I can achieve the same effect without the suitable locales setting (e.g. even the Sys.setlocale(,English) instead of Sys.setlocale(,CHS)). Is it possible? Thanks. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] evaluate a expression
eval(parse(text=expr)) [1] 15 2009/5/2 Ning Ma pnin...@gmail.com: Hi, I am new to R. Can anyone tell me how to evaluate an expression stored in a string? such as: expr - 3*5 I want to get the result 15. Thanks in advance. __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] issue building my own package... moving from Apple OS to Windows
Yeah, you have to build a binary package for windows, unless you just want to simply source all the functions into R. 2009/4/24 Daryl Morris dar...@u.washington.edu: Hello, I have written my own very simple package. On an Apple, I was able to run through the R CMD build and R CMD check successfully. I have also installed the package, and successfully loaded the library on my Apple. This package is written entirely in R and requires no compilation. I am trying to move the package to a Windows machine. I (perhaps naively) thought, given that it contains no code requiring compilation, that I should just be able to take the .tar.gz file and directly install it in Windows. This didn't work. Nor did translating' the contents of the .tar.gz file into a .zip file. I was about to provide the errors, but more googling on this issue suggests that maybe what I'm trying to do is impossible. Do I really have to build on a Windows box ... even when the package requires no compilation? Is there no simple translation tool available for this case? thank you, Daryl U. Washington Biostatistics __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] issue building my own package... moving from Apple OS to Windows
I don't think it is wired. Just like you cannot install a program in Mac using .exe or install in Windows using .app. Once you have build a binary package for windows, you/others can install it by packages--install packages from local zip file Best 2009/4/25 Daryl Morris dar...@u.washington.edu: Thanks Mark, That was it. (ie the --binary option on R CMD build) I'll just state for the web-o-sphere (just in case it helps any one else) that part of my confusion in building this came from misunderstanding what they call source and what the call binary in this environment. I always think of source as something that must be compiled into a binary (like C-code for instance). And I guess I didn't think the process of making some R functions into a loadable package was compiling. I thought it was more like wrapping. So, when the documentation referred to source packages, I didn't think it was talking about what I was doing. Nor did I think I had a binary package. Live and learn I guess. It's still weird to me that I have to install source packages from the command line. But I'm through the learning curve now, so I'll pipe down. Thanks to everyone who responded! Daryl Morris Univ. of Washington Biostatistics markle...@verizon.net wrote: Hii Daryl: to install from the GUI or just generally on windows, build it so that it's by binary by doing R CMD BUILD --binary whatever. that will create a zip file that you can either extract using winzip or install from the gui. john chambers new book explains some of this but, i still found it difficult ( and got help also ) so I know where you're coming from. if you want relevant package tutorials: duncan murdoch ,, friedrich leisch and alan lenarcic all have them on the web. but i think you are way past the point where you need them. ( and I couldn't get them to work anyway but they were still quite helpful ). as far as not needing Perl, I don't know how to do that ? I think they are changing the CMD commands to use R rather than Perl so, when that is finished, you won't need Perl. oh, if you do do any of those tutorials and get any of them to woprk, let me know because I couldn't. 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] to extract data
If Year is numeric data, then you can use: beechworth.dt.2 - subset(beechworth.dt, Year=1997 Year =2008) If it is character, then you can use: beechworth.dt.2 - subset(beechworth.dt, Year %in% as.character(1997:2008)) 2009/4/20 Roslina Zakaria zrosl...@yahoo.com: Hi R-users, I have a set of data from 1958-2009, how do I extract the data from 1927 and 2007? beechworth.dt Year Month Rain 1 1858 3 21.8 2 1858 4 47.0 3 1858 5 70.1 4 1858 6 78.7 5 1858 7 101.6 6 1858 8 129.8 7 1858 9 80.8 8 1858 10 41.9 ... 2009 .. I tried: beechworth.dt.2 - beechworth.dt[beechworth.dt$Year==1927:2007,] and got Warning message: In beechworth.dt$Year == 1927:2007 : longer object length is not a multiple of shorter object length Thank you so much for any help given. __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] explicit documentation (was: get() versus getAnywhere())
It is always unfair to complain about volunteer work, and what you should do is to make contributions. 2009/4/20 Rolf Turner r.tur...@auckland.ac.nz: On 19/04/2009, at 8:59 PM, Patrick Burns wrote: Rolf Turner wrote: On 17/04/2009, at 10:21 PM, Duncan Murdoch wrote: Benjamin Tyner wrote: Many thanks Duncan. Perhaps this merits a more explicit note in the documentation? The quote I gave is from the documentation. How could it be more explicit? This is unfortunately typical of the attitude of R-core people toward the documentation. ``It's clear.'' they say. ``It's explicit.'' Clear and explicit once you *know* what it's saying. Not before, but. I think this unfairly blames R-core for being human. Why is this unfair? R-core is supposed to be superhuman! :-) cheers, Rolf ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Neural Networks in R - Query
More specifically, it is nnet package. Best 2009/4/18 Tobias Verbeke tobias.verb...@telenet.be: Hi Lars, I'd like to ask your guidance regarding the following two questions: (i) I just finished reading Chris Bishop's book Neural Networks for Pattern Recognition. Although the book gave me good theoretical foundation about NN, I'm now looking for something more practical regarding architecture selection strategies. Is there any good reference about best practices for architecure selection? (ii) Which R package provides a good implementation of NN? The CRAN Task View on Machine Learning http://cran.r-project.org/web/views/MachineLearning.html opens with the following topical item: o Neural Networks : Single-hidden-layer neural network are implemented in package nnet as part of the VR bundle (shipped with base R). HTH, Tobias __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Using trace
Here is a partial solution: trace(fact,quote({cat(sprintf(x= %i\n,x));return}),print=T) [1] fact fact(4) Tracing fact(4) on entry x= 4 Tracing fact(x - 1) on entry x= 3 Tracing fact(x - 1) on entry x= 2 Tracing fact(x - 1) on entry x= 1 Tracing fact(x - 1) on entry x= 0 [1] 24 2009/4/17 Stavros Macrakis macra...@alum.mit.edu: Well, yes, of course I could add the code to the function by hand. I could also calculate square roots by hand. But -- as in every other basic programming environment -- there exists an R function 'trace' which appears to automate the process, and I can't figure out how to use it to handle this most elementary and standard case. Clearly I'm missing something. -s On Thu, Apr 16, 2009 at 9:26 PM, ronggui ronggui.hu...@gmail.com wrote: Can you just print what you need to know? For example: fact - function(x) { + if(x1) ans - 1 else ans - x*fact(x-1) + print(sys.call()) + cat(sprintf(X is %i\n,x)) + print(ans) + } fact(4) fact(x - 1) X is 0 [1] 1 fact(x - 1) X is 1 [1] 1 fact(x - 1) X is 2 [1] 2 fact(x - 1) X is 3 [1] 6 fact(4) X is 4 [1] 24 2009/4/13 Stavros Macrakis macra...@alum.mit.edu: I would like to trace functions, displaying their arguments and return value, but I haven't been able to figure out how to do this with the 'trace' function. After some thrashing, I got as far as this: fact - function(x) if(x1) 1 else x*fact(x-1) tracefnc - function() dput(as.list(parent.frame()), # parent.frame() holds arg list control=NULL) trace(fact,tracer=tracefnc,print=FALSE) but I couldn't figure out how to access the return value of the function in the 'exit' parameter. The above also doesn't work for ... arguments. (More subtly, it forces the evaluation of promises even if they are otherwise unused -- but that is, I suppose, a weird and obscure case.) Surely someone has solved this already? What I'm looking for is something very simple, along the lines of old-fashioned Lisp trace: defun fact (i) (if ( i 1) 1 (* i (fact (+ i -1) FACT (trace fact) (FACT) (fact 3) 1 (FACT 3) 2 (FACT 2) 3 (FACT 1) 4 (FACT 0) 4 (FACT 1) 3 (FACT 1) 2 (FACT 2) 1 (FACT 6) 6 Can someone help? Thanks, -s __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] source code for prompt()
prompt function (object, filename = NULL, name = NULL, ...) UseMethod(prompt) environment: namespace:utils methods(prompt) [1] prompt.data.frame* prompt.default* Non-visible functions are asterisked getAnywhere(prompt.default) 2009/4/18 Markus Loecher markus.loec...@gmail.com: Dear R community, pardon my ignorance but how would you get the source code fornon-visible functions ? For example, I would like to see and modify the source code for the prompt() function. 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Using trace
Can you just print what you need to know? For example: fact - function(x) { + if(x1) ans - 1 else ans - x*fact(x-1) + print(sys.call()) + cat(sprintf(X is %i\n,x)) + print(ans) + } fact(4) fact(x - 1) X is 0 [1] 1 fact(x - 1) X is 1 [1] 1 fact(x - 1) X is 2 [1] 2 fact(x - 1) X is 3 [1] 6 fact(4) X is 4 [1] 24 2009/4/13 Stavros Macrakis macra...@alum.mit.edu: I would like to trace functions, displaying their arguments and return value, but I haven't been able to figure out how to do this with the 'trace' function. After some thrashing, I got as far as this: fact - function(x) if(x1) 1 else x*fact(x-1) tracefnc - function() dput(as.list(parent.frame()), # parent.frame() holds arg list control=NULL) trace(fact,tracer=tracefnc,print=FALSE) but I couldn't figure out how to access the return value of the function in the 'exit' parameter. The above also doesn't work for ... arguments. (More subtly, it forces the evaluation of promises even if they are otherwise unused -- but that is, I suppose, a weird and obscure case.) Surely someone has solved this already? What I'm looking for is something very simple, along the lines of old-fashioned Lisp trace: defun fact (i) (if ( i 1) 1 (* i (fact (+ i -1) FACT (trace fact) (FACT) (fact 3) 1 (FACT 3) 2 (FACT 2) 3 (FACT 1) 4 (FACT 0) 4 (FACT 1) 3 (FACT 1) 2 (FACT 2) 1 (FACT 6) 6 Can someone help? Thanks, -s __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Equivalent to Stata egen
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] (no subject)
?par and please note the ctex.main parameter. BTW, it would be better if you use an informative email subject. Best 2009/4/11 Mary Winter statsstud...@hotmail.com: Hi, Is it possible to increase just the text size of the main title on my graph? If so, how?! Along the same lines..along the x axis at a lot of the labels overlap each other, is it possible to make this text smaller of write it on two lines so it doesn't take up as much space along the x axis? Any help would be much appreciated! Mary _ [[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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] re trieve R session?
Does load() work? 2009/4/3 purpleshirt yonggang@citadelgroup.com: I login Linux machine on my windows desktop via Exceed, then run R. Somehow my desktop got rebooted by accident, when I re-login, I can see the R session is still listed there (run top). My question is, is there any way I can bring back that R session? Thanks, -- View this message in context: http://www.nabble.com/retrieve-R-session--tp22857303p22857303.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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 can I use R through command line?
you can use source() to Read R Code from a File. 2009/4/1 minben minb...@gmail.com: Suppose I have written a R program and saved it in test.R . How can I call the program in the command line? __ 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. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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 sowas
There is a binary version for Windows in the homepage of it. http://www.cru.uea.ac.uk/~douglas/software/sowas_0.94.zip You can find more on http://tocsy.agnld.uni-potsdam.de/wavelets/ Best 2009/3/22 stephen sefick ssef...@gmail.com: You must go to his website because it is not on CRAN. I have built it on mac osx by installing it with R CMD install. This should work on other unix platforms. Stephen Sefick On Sat, Mar 21, 2009 at 9:26 PM, mau...@alice.it wrote: I cannot find sowas package by Douglas Mauran in CRAN packages list- On which platforms does sowas run ? Has anybody used such a package at all ? hHank you very much, Maura tutti i telefonini TIM! [[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. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. __ 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: package sowas
Executable file is not required. You must install R first, then you click packages--install package(s) from local zip file ... to install the sowas package. Best 2009/3/22 mau...@alice.it: I downloaded it. But I could not find the installation executable file. How can I install it on Windows XP ? Thank you. Maura -Messaggio originale- Da: ronggui [mailto:ronggui.hu...@gmail.com] Inviato: dom 22/03/2009 10.47 A: mau...@alice.it; r-help@r-project.org Oggetto: Re: [R] package sowas There is a binary version for Windows in the homepage of it. http://www.cru.uea.ac.uk/~douglas/software/sowas_0.94.zip You can find more on http://tocsy.agnld.uni-potsdam.de/wavelets/ Best 2009/3/22 stephen sefick ssef...@gmail.com: You must go to his website because it is not on CRAN. I have built it on mac osx by installing it with R CMD install. This should work on other unix platforms. Stephen Sefick On Sat, Mar 21, 2009 at 9:26 PM, mau...@alice.it wrote: I cannot find sowas package by Douglas Mauran in CRAN packages list- On which platforms does sowas run ? Has anybody used such a package at all ? hHank you very much, Maura tutti i telefonini TIM! [[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. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e tutti i telefonini TIM! Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Multilevel modeling using R
You can use intervals to get the Confidence intervals of fixed and random effects. Best 2009/3/17 WONG, Ka Yau ka...@ied.edu.hk: Dear All, I use R to conduct multilevel modeling. However, I have a problem about the interpretation of random effect. Unlike the variables in fixed effects, the variables in random effects have not shown the p-value, so I don't know whether they are significant or not? I want to obtain this figure to make the decision. Thanks a lot! Below is the syntax and output of my program: library(nlme) dataset - read.csv(d:/dataset.csv) lme11 - lme(Overall~1, random=~1|School, method=ML, data=dataset) summary(lme11) Linear mixed-effects model fit by maximum likelihood Data: dataset AIC BIC logLik 12637.06 12656.27 -6315.53 Random effects: Formula: ~1 | School (Intercept) Residual StdDev: 0.2912031 0.9894488 (-- No p-value) Fixed effects: Overall ~ 1 Value Std.Error DF t-value p-value (Intercept) 0.7755495 0.06758038 11.47596 0 (-- Have p-value) Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.797466473 -0.661750231 -0.007874993 0.652625939 3.549169733 Number of Observations: 4464 Number of Groups: 20 Best Regards, Tommy Research Assistant of HKIEd [[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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. __ 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] errors when install RSQLite
It seems you use Unix-like OS. Does it happen that you did not use root to install the package? BTW, RSQLite does not require sqlite installed separately, it is embedded in the package. Best 2009/3/17 Dongyan Song yzhsk...@hotmail.com: Dear all, I am trying to install RSQLite package since I want to install sqldf, and I used install.packages(RSQLite) first, which gave Error message as below: make: *** [RS-DBI.o] Error 1 chmod: cannot access `/usr/lib/R/library/RSQLite/libs/*': No such file or directory ERROR: compilation failed for package 'RSQLite' ** Removing '/usr/lib/R/library/RSQLite' ** Restoring previous '/usr/lib/R/library/RSQLite' The downloaded packages are in /tmp/RtmpZwBFdo/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(RSQLite) : installation of package 'RSQLite' had non-zero exit status And then I tried # R CMD INSTALL RSQLite_0.7-1.tar.gz # R CMD INSTALL --configure-args=--with-sqlite3-dir=/usr/lib/sqlite-3.6.11/bld/ RSQLite_0.7-1.tar.gz # R CMD INSTALL --configure-args=--with-sqlite-dir=/usr/bin RSQLite_0.7-1.tar.gz and all of them gave similar error messages. I have sqlite installed in my computer, in the directory /usr/bin, and I do not have a clue how to install it then. Thank you for help! Best, Dongyan Song -- View this message in context: http://www.nabble.com/errors-when-install-RSQLite-tp22541474p22541474.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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. __ 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] Multilevel modeling using R
If you want to know how to calculate the CI, you can study the code of this function. You can access the code by nlme:::intervals.lme. Best 2009/3/17 WONG, Ka Yau ka...@ied.edu.hk: No standard deviation of variable in the random effect is provided. How to construct CI? Best Regards, Tommy Research Assistant of HKIEd From: ronggui [mailto:ronggui.hu...@gmail.com] Sent: 17/3/2009 [Tue] 14:10 To: WONG, Ka Yau Cc: r-help@r-project.org Subject: Re: [R] Multilevel modeling using R You can use intervals to get the Confidence intervals of fixed and random effects. Best 2009/3/17 WONG, Ka Yau ka...@ied.edu.hk: Dear All, I use R to conduct multilevel modeling. However, I have a problem about the interpretation of random effect. Unlike the variables in fixed effects, the variables in random effects have not shown the p-value, so I don't know whether they are significant or not? I want to obtain this figure to make the decision. Thanks a lot! Below is the syntax and output of my program: library(nlme) dataset - read.csv(d:/dataset.csv) lme11 - lme(Overall~1, random=~1|School, method=ML, data=dataset) summary(lme11) Linear mixed-effects model fit by maximum likelihood Data: dataset AIC BIC logLik 12637.06 12656.27 -6315.53 Random effects: Formula: ~1 | School (Intercept) Residual StdDev: 0.2912031 0.9894488 (-- No p-value) Fixed effects: Overall ~ 1 Value Std.Error DF t-value p-value (Intercept) 0.7755495 0.06758038 11.47596 0 (-- Have p-value) Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.797466473 -0.661750231 -0.007874993 0.652625939 3.549169733 Number of Observations: 4464 Number of Groups: 20 Best Regards, Tommy Research Assistant of HKIEd [[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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. __ 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] updating packages?
Maybe they are loaded, use search() to see if they are. If yes, then use detach() to unload them first. Best 2009/3/13 rkevinbur...@charter.net: I am trying to update the packages that I have installed but I get the following warning messages: package 'tseries' successfully unpacked and MD5 sums checked Warning: cannot remove prior installation of package 'tseries' bundle 'forecasting' successfully unpacked and MD5 sums checked Warning: cannot remove prior installation of package 'forecast' What does that mean? How can I update these packages? 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. __ 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] HAC corrected standard errors
sandwich package is what you want. Best 2009/3/10 Shruthi Jayaram shruthi.jayaram...@gmail.com: Hi, I have a simple linear regression for which I want to obtain HAC corrected standard errors, since I have significant serial/auto correlation in my residuals, and also potential heteroskedasticity. Would anyone be able to direct me to the function that implements this in R? It's a basic question and I'm sure I'm missing something obvious here. I looked up this post: http://www.nabble.com/Re%3A-Moving-Window-regressions-with-corrections-for-Heteroscedasticity-and-Autocorrelations(HAC)-td6075371.html#a6075371 which recommended that I use the coeftest() function in package lmtest, but when I tried to assign an object: result - coeftest(regre, NeweyWest), where regre is an object of class lm, this returned an error. I'd be grateful for any advice, since I'm sure I'm making one of those simple bloopers. Thanks! Shruthi -- View this message in context: http://www.nabble.com/HAC-corrected-standard-errors-tp22430163p22430163.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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html A sociologist is someone who, when a beautiful women enters the room and everybody look at her, looks at everybody. __ 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 on netbooks et al?
May I ask what is the OS? Thanks. 2009/3/5 Erik Iverson iver...@biostat.wisc.edu: I've installed Ubuntu, Emacs, and R on my Samsung NC10 with 2 GB RAM. I think the keyboard is very usable on the NC10, and it has about 5-7 hours of battery life, which is also nice. R runs just fine on it. I'd consider paying extra for the Samsung just for the keyboard. herrdittm...@yahoo.co.uk wrote: Dear useRs, With the rise of netbooks and 'lifestyle laptops I am tempted to get one of these to mainly run R on it. Processor power and hard disk space seem to be ok. What I wonder is the handling and feel with respect to R. Has anyone here installed or is running R on one of these, and if so, what is your experience? Would it be more of a nice looking gadget than a feasable platform to do some stats on? Many thanks, Bernd __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page and public schedule: http://asrr.r-forge.r-project.org/rghuang.html __ 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] Inference for R Spam
I received it too without the conference registration. 2009/2/24 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Dieter Menne wrote: Dear List, I registered for the useR conference in Rennes today; half an hour after the confirmation I received a first requested newsletter from a company selling a product named Inference for R. This coincidence might be spurious. Or not, depending on frequency. i haven't registered, but have received the newsletter too. vQ __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ 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] basic inquiry regarding write.csv
If the file is a relative path, then it should be in the working directory. Say, the working directory is E:/my_work_directory (of course, you can get it by getwd()), and you export a data frame a to csv by: write.csv(a, file=a.csv), then the file should be E:/my_work_directory/a.csv. Best 2009/2/18 CJ Rubio cjru...@kongju.ac.kr: i have a loop which looks likes this: data.info - rbind(data.info, cbind(station.id, year, date, max.discharge)) + y - split(data.info, data.info[station.id]) + for (i in names(y)) {write.csv(y[[i]], file=paste(i, .csv, sep=,))} i am wondering, where the file (which i am about to write in .csv format) will be saved? i looked at ?write.csv and it says there that : file either a character string naming a file or a connection open for writing. indicates output to the console. correct me if i'm wrong but the way i undestand it is, i should have a file or a working directory where the .csv will be written. if for example i have a working directory E:/my_work_directory, how can i save this splitted files in the same directory? can anybody please enlighten me more with write.csv and the argument file? thanks.. -- View this message in context: http://www.nabble.com/basic-inquiry-regarding-write.csv-tp22073053p22073053.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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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] basic inquiry regarding write.csv
So far, I cannot see any mistake, though the sep= will be more elegant that sep=,. Are you sure your working directory is E:/my_work_directory? and is there any error msg? BTW, a reproducible example will help to get better response from the list. 2009/2/18 CJ Rubio cjru...@kongju.ac.kr: thanks for your reply.. is there something wrong with the code i have? because it doesn't write the file in the directory that i am using... for (i in names(y)) {write.csv(y[[i]], file=paste(i, .csv, sep=,))} thanks again.. ronggui-2 wrote: If the file is a relative path, then it should be in the working directory. Say, the working directory is E:/my_work_directory (of course, you can get it by getwd()), and you export a data frame a to csv by: write.csv(a, file=a.csv), then the file should be E:/my_work_directory/a.csv. Best 2009/2/18 CJ Rubio cjru...@kongju.ac.kr: i have a loop which looks likes this: data.info - rbind(data.info, cbind(station.id, year, date, max.discharge)) + y - split(data.info, data.info[station.id]) + for (i in names(y)) {write.csv(y[[i]], file=paste(i, .csv, sep=,))} i am wondering, where the file (which i am about to write in .csv format) will be saved? i looked at ?write.csv and it says there that : file either a character string naming a file or a connection open for writing. indicates output to the console. correct me if i'm wrong but the way i undestand it is, i should have a file or a working directory where the .csv will be written. if for example i have a working directory E:/my_work_directory, how can i save this splitted files in the same directory? can anybody please enlighten me more with write.csv and the argument file? thanks.. -- View this message in context: http://www.nabble.com/basic-inquiry-regarding-write.csv-tp22073053p22073053.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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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. -- View this message in context: http://www.nabble.com/basic-inquiry-regarding-write.csv-tp22073053p22073393.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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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] Chinese language R email list?
There is one in google group (http://groups.google.com/group/R-Forum), but the traffic is very low. Personally, I don't see the why we need a Chinese mail list. Besides, there are two online forum of R, both of which is quite active. http://rbbs.biosino.org/Rbbs/forums/list.page http://cos.name/bbs/thread.php?fid=15 Best On Wed, Feb 11, 2009 at 8:00 AM, Jonathan Greenberg greenb...@ucdavis.edu wrote: A colleague from China is visiting our lab is working with us on some R-based remote sensing projects, and he was curious if there is a r-help listserv in Chinese and, if not, if it would be possible to set one up? I didn't see one listed on the Mailing List page on the cran-r website. Thanks! --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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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] Frequency and summary statistics table with different variables and categories
Since %male is basically the mean if you code male=1 and female=0, which is more informative than absolute frequency. So, you may want to have a glance at doBy package, especially the summaryBy function. All the best On Thu, Jan 22, 2009 at 7:17 PM, Stefan Björk stefan.bj...@gmail.com wrote: Hello helpers, This is probably quite simple, but I'm stuck. I want to create a summary statistics table with frequencies and summary statistics for a large number of variables. The problem here is that (1) there are two different classes of categories (sex, type of substance abuse and type of treatent) which overlap, (2) the data for different variables should be presented in different ways -- sometimes with relative frequencies, other times with mean values. The table would finally look something like: All Male Female Alcohol Drug ... Age (mean) (mean) ... Sex (% male)(freq) (freq) ... Alcohol CS (mean) (mean) ... ... ... Data is in a data frame with quite a lot of columns (variables) and each row represents a single case. I have found out that part of this can be done with tapply, for example tapply(age, sex, mean) and join it with tapply(age, abuse, mean). But how to do with frequencies? Or is there an even simpler way? /S [[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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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] converting a factor in numeric values with direct control of the numeric values
I think you have to recode the derived variable of as.numeric(z). On Sun, Jan 18, 2009 at 12:40 AM, Jörg Groß jo...@licht-malerei.de wrote: Hi, I know how to convert a factor-variable into a numeric variable via as.numeric(). But how can I control the values that are assigned? For example, I have this factor-variable: z - c(male, male, female) z - as.factor(z) And I want to convert male in 3 and female into the numeric value 5 (just for the example) so that I get: [1] 3 3 5 Thanks for any help! __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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] converting a factor in numeric values with direct control of the numeric values
BTW, a better way to convert factor into a numeric variable is to use unclass(). On Sun, Jan 18, 2009 at 12:40 AM, Jörg Groß jo...@licht-malerei.de wrote: Hi, I know how to convert a factor-variable into a numeric variable via as.numeric(). But how can I control the values that are assigned? For example, I have this factor-variable: z - c(male, male, female) z - as.factor(z) And I want to convert male in 3 and female into the numeric value 5 (just for the example) so that I get: [1] 3 3 5 Thanks for any help! __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate Dept of Public and Social Administration City University of Hong Kong Homepage: http://ronggui.huang.googlepages.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] [R-pkgs] RQDA-0.1-6 is on CRAN
Major new features of RQDA-0.1-6: GUI: * GUI for file-organization (e.g searching, categorization etc.). * GUI for settings (e.g. colors for ) Functions: * Import a batch of files * Calculate the relation between two codings, given the coding index * Gives a summary of coding and inter-code relationship -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] QCA adn Fuzzy
Dear Gott and Prof Adrian DUSA , I am learning fuzzy set QCA and recently, I just write a function to construct a truthTable, which can be passed to QCA:::eqmcc to do the Boolean minimization. The function is here: http://code.google.com/p/asrr/source/browse/trunk/R/fs_truthTable.R and the help page is: http://code.google.com/p/asrr/source/browse/trunk/man/fs_truthTable.rd and the example dataset from Ragin (2009) is here http://code.google.com/p/asrr/source/browse/trunk/data/Lipset_fs.rda Best On Wed, Mar 8, 2006 at 2:13 AM, Adrian DUSA dusa.adr...@gmail.com wrote: Dear Prof. Gott, On Monday 06 March 2006 14:37, R Gott wrote: Does anybody know of aything that will help me do Quantitiative Comparative Analysis (QCA) and/or Fuzzy set analysis?? Or failing that Quine? ta rg Prof R Gott Durham Univesrity UK There is a package called QCA which (in its first release) performs only crisp set analysis. I am currently adapting a Graphical User Interface, but the functions are nevertheless usefull. For fuzzy set analysis, please consider Charles Ragin's web site http://www.u.arizona.edu/%7Ecragin/fsQCA/index.shtml which offers a software (still not complete, though). Also to consider is a good software called Tosmana (http://www.tosmana.org/) which does multi-value QCA. I am considering writing the inclusion algorithms in the next releases of my package, but it is going to take a little while. Any contributions and/or feedback are more than welcome. I hope this helps you, Adrian -- Adrian DUSA Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ r-h...@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ 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] Functions in R like lincom and nlcom of Stata
There is function for linear combination in car package as well. Best Ronggui On Sun, Dec 14, 2008 at 1:42 PM, Andrew Robinson a.robin...@ms.unimelb.edu.au wrote: estimable in the gmodels package provides point estimates, standard errors and confidence intervals for arbitrary linear combinations of model parameters. I don't know for non-linear combinations, though. Cheers Andrew On Sat, Dec 13, 2008 at 11:33:12PM -0600, Stas Kolenikov wrote: Those commands provide point estimates, standard errors and confidence intervals based on linear combination of parameters or linearization/delta-method, respectively. R's contrasts appear to be limited to a single factor and combinations that sum up to zero. I am too so used to this Stata's concept, I now think it's odd R does not seem to have it readily identifiable in two-three search commands. And I would not believe R does not have this functionality, it must be hiding somewhere! :)) On 12/13/08, David Winsemius dwinsem...@comcast.net wrote: On Dec 12, 2008, at 11:14 AM, Marc Mar? Dell'Olmo wrote: Hello all, Does anyone know if there exists any function in R that resembles the lincom and nlcom of STATA?. These functions computes point estimates, standard errors, significance levels, confidence intervals, etc. for linear and non linear combinations of previous estimated parameters. Down here you've got links to descriptions of the functions of STATA nlcom: http://www.stata.com/help.cgi?nlcom lincom: http://www.stata.com/help.cgi?lincom I did not find a description of the mathematical operations that let me understand exactly what lincom is doing, but suspect that you should be looking at how R handles contrasts. The help pages reference ch 2 of Statistical Models in S. The search at the console prompt would be: ?C ?contrasts ?se.contrast ?model.tables -- Stas Kolenikov, also found at http://stas.kolenikov.name Small print: I use this email account for mailing lists only. __ 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. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-6410 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ 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 mimic select.list using RGtk2/gWidgetsRGtk2?
I want to write a function mimic the function of select.list(), here is my preliminary version. select - function(x,multiple=TRUE,...){ ans-new.env() g - gwindow(title=title,wid=200,heigh=500) x1-ggroup(FALSE,con=g) x2-gtable(x,multiple=multiple,con=x1,expand=TRUE) gbutton(OK,con=x1,handler=function(h,...){ value - svalue(x2) if (length(value)==0) value= assign(selected,value,env=h$action$env) dispose(x1) },action=list(env=ans)) ans } However, it doesn't behave as what I want. What I want is that: for {select(c(a,b)); foo()}, foo() only runs after I have clicked the OK button of select(). Any hints? Thanks. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ 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 mimic select.list using RGtk2/gWidgetsRGtk2?
Hi, John, Thanks very much. I have another question about gformlayout(). addSettingGUI - function(container){ Setting - list(type = ggroup, horizontal = FALSE, children = list( list(type=fieldset, columns = 1, label = Settings, label.pos = top, label.font = c(weight=bold), children = list( list(name = owner, label = Name of Coder, type = gedit, text = ) ) ) ) ) SettingFL - gformlayout(Setting, cont = container, expand=TRUE) } g-gwindow(width=50) addSettingGUI (g) ## It seems that argument of width in gwindow has no effects on the resultant widget ## How can can re-scale the width of the resultant widget? ## thanks. Ronggui On Sat, Dec 13, 2008 at 1:12 PM, John Verzani verz...@math.csi.cuny.edu wrote: ronggui ronggui.huang at gmail.com writes: I want to write a function mimic the function of select.list(), here is my preliminary version. select - function(x,multiple=TRUE,...){ ans-new.env() g - gwindow(title=title,wid=200,heigh=500) x1-ggroup(FALSE,con=g) x2-gtable(x,multiple=multiple,con=x1,expand=TRUE) gbutton(OK,con=x1,handler=function(h,...){ value - svalue(x2) if (length(value)==0) value= assign(selected,value,env=h$action$env) dispose(x1) },action=list(env=ans)) ans } Hi, You can call foo in the handler above or for gWidgetsRGtk2 use gbasicdialog which will create a modal dialog: options(guiToolkit=RGtk2) library(gWidgets) select - function(x,multiple=TRUE,...){ ans-new.env() x1-ggroup(horizontal=FALSE) # no parent container here x2-gtable(x,multiple=multiple,con=x1,expand=TRUE) ret - gbasicdialog(title=select a widget, widget=x1,handler=function(h,...){ value - svalue(x2) if (length(value)==0) value= assign(selected,value,env=h$action$env) dispose(x1) },action=list(env=ans)) ans } ans - select(c(a,b)) print(ans$selected) Hope that helps. However, it doesn't behave as what I want. What I want is that: for {select(c(a,b)); foo()}, foo() only runs after I have clicked the OK button of select(). Any hints? 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ 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] Sorting problem
Sys.setlocale(,C) x1 - as.character(date()) # I use date to record the time, and save it to sqlite database, to it converted to character x1_2 - strptime(x1, %a %b %d %H:%M:%S %Y) x2 - as.character(date()) x2_2 - strptime(x2, %a %b %d %H:%M:%S %Y) X-c(x1_2,x2_2) order(X) ## I want to get the permutation other than the sorted vector. ## order(X) works in windows but not Linux. any alternative way to the the permutation? -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ 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] Sorting problem
Sorry for the last post. I didn't use the latest version of R. It works under Linux as well for R-2.8.0 patch. Best On Thu, Dec 11, 2008 at 11:34 PM, ronggui [EMAIL PROTECTED] wrote: Sys.setlocale(,C) x1 - as.character(date()) # I use date to record the time, and save it to sqlite database, to it converted to character x1_2 - strptime(x1, %a %b %d %H:%M:%S %Y) x2 - as.character(date()) x2_2 - strptime(x2, %a %b %d %H:%M:%S %Y) X-c(x1_2,x2_2) order(X) ## I want to get the permutation other than the sorted vector. ## order(X) works in windows but not Linux. any alternative way to the the permutation? -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong Website: http://ronggui.huang.googlepages.com/ RQDA project: http://rqda.r-forge.r-project.org/ __ 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] about body-
In body(fun, envir = environment(fun)) - value, value can be an expression or a list of R expressions. But it seems that value must be length-1 list (if it is a list), is it right? f2 - function(x) {} body(f2) - list(quote(x- x^5),quote(return(y))) Error in as.function.default(c(formals(fun), value), envir) : invalid formal argument list for function I want to construct a function by computing, what I do at this moment is as follows: f - function(x) {} body(f)[[2]] - quote(x- x^5) body(f)[[3]] - quote(return(y)) Is there a better way to do this? Thanks -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 PhD Candidate, City University of Hong Kong http://ronggui.huang.googlepages.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] [R-pkgs] RQDA-0.1.5 is released
RDQA is a package for Qualitative Data Analysis built upon R. It works both on the Windows and Linux/FreeBSD platforms. RQDA is an easy-to-use tool to assist in the analysis of textual data. At the present, it supports only plain text format data. All the information is stored in SQLite database via the R package of RSQLite. The GUI is based on RGtk2, via the aid of gWidgetsRGtk2. It includes a number of standard Computer-Aided Qualitative Data Analysis features. Besides, it seamlessly integrated with R, which means that a) statistical analysis on the coding is possible, and b) functions about data manipulation and analysis can be easily extended by writing R functions. To some extent, RQDA and R makes an integrated platform for both quantitative and qualitative data analysis. The current version should be regarded as Release Candidate Version, I will test it preliminary under Chinese Windows OS, but it should work under Linux and FreeBSD. By the GUI, it can: # Import documents from plain text # Support non-English documents, Simplified Chinese Character is well-tested under Windows # Character-level coding using codes # Memos of documents, codes, coding, project, files and more # Retrieval of coding # Single-file (*.rqda) format, which is basically SQLite database. Data are stored in UTF-8, so it should be portable # Facilitator helps to categorize codes,which is key to theory building. I deliberately avoid using tree-like categorization # There is a case category, which is crucial feature to bridge qualitative and quantative research # Search information about selected case from the Internet vis popup menu # Temporary delete files and codes # Rename the files,code, code category, case and others More information can be found in http://rqda.r-forge.r-project.org/ Comments and suggestions are welcome:) -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 Ph.D. Candidate, CityU of HK Master of sociology, Fudan University, China Bachelor of Social Work, Fudan University, China Personal homepage: http://ronggui.huang.googlepages.com/ ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] Citing R in journal articles (or the failure to)
In two recent in press articles where I cited R packages, I was asked by the copy-editor to add a location or url to the references. Could I suggest that citation() be modified to include the URL automatically? I second this suggestion. I experienced similar case once as well. -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 Ph.D. Candidate, CityU of HK Master of sociology, Fudan University, China Bachelor of Social Work, Fudan University, China Personal homepage: http://ronggui.huang.googlepages.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] Returning a vector from by
If you just want that result, you can try tapply instead of by. tapply(res$Score,res$ID,max) a b 2 1 On Mon, Nov 3, 2008 at 7:31 PM, Daniel Brewer [EMAIL PROTECTED] wrote: Hello, I am trying to return a vector from a simply by but I cannot get it working, even using simplify=TRUE. res - data.frame(ID=c(a,a,a,b,b),Score=c(0,1,2,0,1)) yoda - by(res$Score,res$ID,max,simplify=T) class(yoda) [1] by I would like it to return a vector with the names as the ID column. The only way I could work out how to do this was result - as.vector(yoda) names(result) - names(yoda) result a b 2 1 Is there a better way? Thanks Dan -- ** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: [EMAIL PROTECTED] ** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the...{{dropped:19}} __ 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 count unique observations by variables
How about this: df1=data.frame(v1=c(1,1,2,3,2,4,1)) df1$v2 - ave(df1$v1,df1$v1,FUN=length) df1 v1 v2 1 1 3 2 1 3 3 2 2 4 3 1 5 2 2 6 4 1 7 1 3 On Thu, Oct 16, 2008 at 1:27 PM, Lijiang Guo [EMAIL PROTECTED] wrote: Dear R-helpers, I have a data frame with 3 variables, each record is a unique combination of the three variables. I would like to count the number of unique values of v3 in each v1, and save it as a new variable v4 in the same data frame. e.g. df1 [v1] [v2] [v3] [1,] a C 1 [2,] b C 2 [3,] c B 3 [4,] a B 3 [5,] b A 2 [6,] c A 1 In this case, the 4th column would become (2, 1, 2, 2, 1, 2). Could someone tell me how to do this? regards, Lijiang -- [[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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 Ph.D. Candidate, CityU of HK Master of sociology, Fudan University, China Bachelor of Social Work, Fudan University, China Personal homepage: http://ronggui.huang.googlepages.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] IIA test on multinomial logit
Hi, you should look at hmftest in mlogit package. However, be cautious when you use IIA test, it is not very reliable as Long and Freese (2006:243) have shown. * J. Scott Long and Jeremy Freese. 2006. Regression Models for Categorical Outcomes Using Stata. 2nd. On Wed, Oct 15, 2008 at 3:37 AM, Erika Known [EMAIL PROTECTED] wrote: - Original Message - From: Erika Known [EMAIL PROTECTED] To: r-help@r-project.org Sent: Tuesday, October 14, 2008 11:43 AM Subject: [R] IAA test on my multinomial logit Hi all I'm trying to immigrate from Stata and I want to preform a IIA test (Independence of Irrelevant Alternatives) on my multinomial logit model in R, but I can't seem to find a package that dos the trick. I've been looking at http://bm2.genes.nig.ac.jp/RGM2/R_current/library/systemfit/man/hausman.systemfit.html but I can't figure out what to do! I normally just type 'mlogtest, hausman base' to get the test in Stata. I can even use 'mlogtest, smhsiao base' to get the Small-Hsiao tests of IIA assumption. according to the literature there is also other tests.. thou I cant seem to find any off them in R. Thank for the help. Erika On Tue, 14 Oct 2008 12:11:45 -0500, Gilbert Brenes wrote If I'm not wrong, the test for IIA is the Hausman test. Look for hausman.systemfit in the systemfit package. Gilbert Hi again! Thanks for your answer! Thou that's where I got stuck too, so to say. The link I send was to the systemfit package, but I can't seem to get it to working. This is what I do: model_01 - multinom(Y ~ X1 + X2 + X3 + X4 + X5 + X6, data=data, contrasts = NULL, Hess = TRUE, summ = 0, censored = FALSE, model = TRUE) That's running like a dream! - and the I try: systemfit(model_01) Error in systemfit(dyls.model01) : argument 'formula' must be an object of class 'formula' or a list of objects of class 'formula' In addition: Warning messages: 1: In if (class(formula) == formula) { : the condition has length 1 and only the first element will be used 2: In if (class(formula) == list) { : the condition has length 1 and only the first element will be used hausman.systemfit(model_01) Error in coef(results3sls) : argument results3sls is missing, with no default I relly want to imigrate, but I need help! Just tell mer a website or wher I can read my way out of it. Do you think you can give me one more hint? Sorry for my ignorance Erika __ 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. -- HUANG Ronggui, Wincent Tel: (00852) 3442 3832 Ph.D. Candidate, CityU of HK Master of sociology, Fudan University, China Bachelor of Social Work, Fudan University, China Personal homepage: http://ronggui.huang.googlepages.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] Problem of installing Matrix
Yes, I knew I have to use gmake instead of the BSD one. So, I have set the export MAKE=gmake before the installation process. Your reply reminder me of the possibility that I have failed to install some other related components. After install the GUN version of automake, the problem is solved. Thanks for your reply again. On Sat, Jun 7, 2008 at 1:00 PM, Prof Brian Ripley [EMAIL PROTECTED] wrote: From the DESCRIPTION for Matrix: SystemRequirements: GNU make Presumably you have a BSD make on your FreeBSD system. This has come up before, and FreeBSD users have succeeded with GNU make. On Sat, 7 Jun 2008, ronggui wrote: [EMAIL PROTECTED] MAKE=gmake [EMAIL PROTECTED] R . install.packages(Matrix) --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL 'http://bibs.snu.ac.kr/R/src/contrib/Matrix_0.999375-9.tar.gz' Content type 'application/x-gzip' length 1483674 bytes (1.4 Mb) opened URL == downloaded 1.4 Mb /usr/local/lib/R/library * Installing *source* package 'Matrix' ... ** libs ** arch - Makefile, line 8: Need an operator Makefile, line 13: Need an operator Makefile, line 16: Need an operator Makefile, line 27: Need an operator Makefile, line 29: Need an operator Makefile, line 31: Need an operator make: fatal errors encountered -- cannot continue ERROR: compilation failed for package 'Matrix' ** Removing '/usr/local/lib/R/library/Matrix' The downloaded packages are in /tmp/Rtmpq3enyj/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Matrix) : installation of package 'Matrix' had non-zero exit status sessionInfo() R version 2.6.1 (2007-11-26) i386-portbld-freebsd7.0 locale: zh_CN.eucCN/zh_CN.eucCN/C/C/C/C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] rcompgen_0.1-17 tcltk_2.6.1 tools_2.6.1 R.version _ platform i386-portbld-freebsd7.0 arch i386 os freebsd7.0 system i386, freebsd7.0 status major 2 minor 6.1 year 2007 month 11 day26 svn rev43537 language R version.string R version 2.6.1 (2007-11-26) -- HUANG Ronggui, Wincent http://ronggui.huang.googlepages.com/ Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK. __ 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, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- HUANG Ronggui, Wincent http://ronggui.huang.googlepages.com/ Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK. __ 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] Problem of installing Matrix
[EMAIL PROTECTED] MAKE=gmake [EMAIL PROTECTED] R . install.packages(Matrix) --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL 'http://bibs.snu.ac.kr/R/src/contrib/Matrix_0.999375-9.tar.gz' Content type 'application/x-gzip' length 1483674 bytes (1.4 Mb) opened URL == downloaded 1.4 Mb /usr/local/lib/R/library * Installing *source* package 'Matrix' ... ** libs ** arch - Makefile, line 8: Need an operator Makefile, line 13: Need an operator Makefile, line 16: Need an operator Makefile, line 27: Need an operator Makefile, line 29: Need an operator Makefile, line 31: Need an operator make: fatal errors encountered -- cannot continue ERROR: compilation failed for package 'Matrix' ** Removing '/usr/local/lib/R/library/Matrix' The downloaded packages are in /tmp/Rtmpq3enyj/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Matrix) : installation of package 'Matrix' had non-zero exit status sessionInfo() R version 2.6.1 (2007-11-26) i386-portbld-freebsd7.0 locale: zh_CN.eucCN/zh_CN.eucCN/C/C/C/C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] rcompgen_0.1-17 tcltk_2.6.1 tools_2.6.1 R.version _ platform i386-portbld-freebsd7.0 arch i386 os freebsd7.0 system i386, freebsd7.0 status major 2 minor 6.1 year 2007 month 11 day26 svn rev43537 language R version.string R version 2.6.1 (2007-11-26) -- HUANG Ronggui, Wincent http://ronggui.huang.googlepages.com/ Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK. __ 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] Insert a recorde into a table using SQL
It works. Thanks very much. Best On Mon, May 12, 2008 at 7:02 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Create an encoding function which replaces single quotes with two single quotes: # first string is a single character consisting of single quote # second string is two characters consisting of two single quotes enc - function(x) gsub(', '', x) dbGetQuery(con,sprintf(insert into dd (txt) values ('%s'), enc(dd[2,1]))) On Mon, May 12, 2008 at 1:54 AM, ronggui [EMAIL PROTECTED] wrote: Dear list, I want to insert a recorde into a SQLite table by dbGetQuery(), but there is a problem when the value contains quotation mark. dd-data.frame(txt=c(having both ' and \ in character.,OK)) library(RSQLite) Loading required package: DBI con-dbConnect(dbDriver(SQLite),:memory:) dbWriteTable(con,dd,dd,over=T) [1] TRUE dbGetQuery(con,sprintf(insert into dd (txt) values (\%s\),dd[2,1])) NULL dbGetQuery(con,sprintf(insert into dd (txt) values (\%s\),dd[1,1])) Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: unrecognized token: )) How can I insert a (key, value) pair into a table by dbGetQuery? Thanks. -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK. __ 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. -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK, http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html __ 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] Not to draw the xaxis ticks in ggplot2
Thanks. It is helpful. Best On Mon, May 12, 2008 at 4:34 AM, Paul Murrell [EMAIL PROTECTED] wrote: Hi ronggui wrote: Thanks,Hadley. Another question is how can I know there is a grob path called xaxis::ticks? Is there any easy way to figure out? grid.ls() ? Paul Thanks in advance. On Wed, May 7, 2008 at 10:06 PM, hadley wickham [EMAIL PROTECTED] wrote: On Tue, May 6, 2008 at 11:44 PM, ronggui [EMAIL PROTECTED] wrote: library(ggplot2) (p- qplot(mpg, wt, data=mtcars)) What I am doing is to set color of the ticks to hide them. grid.gedit(gPath(xaxis, ticks), gp=gpar(col=white)) It should be a better way to achieve the purpose. Thanks. Agreed. I've added it to my ggplot2 customisation to do list. Thanks, Hadley -- http://had.co.nz/ -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK, http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html __ 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] Insert a recorde into a table using SQL
Dear list, I want to insert a recorde into a SQLite table by dbGetQuery(), but there is a problem when the value contains quotation mark. dd-data.frame(txt=c(having both ' and \ in character.,OK)) library(RSQLite) Loading required package: DBI con-dbConnect(dbDriver(SQLite),:memory:) dbWriteTable(con,dd,dd,over=T) [1] TRUE dbGetQuery(con,sprintf(insert into dd (txt) values (\%s\),dd[2,1])) NULL dbGetQuery(con,sprintf(insert into dd (txt) values (\%s\),dd[1,1])) Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: unrecognized token: )) How can I insert a (key, value) pair into a table by dbGetQuery? Thanks. -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK. __ 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] Not to draw the xaxis ticks in ggplot2
Thanks,Hadley. Another question is how can I know there is a grob path called xaxis::ticks? Is there any easy way to figure out? Thanks in advance. On Wed, May 7, 2008 at 10:06 PM, hadley wickham [EMAIL PROTECTED] wrote: On Tue, May 6, 2008 at 11:44 PM, ronggui [EMAIL PROTECTED] wrote: library(ggplot2) (p- qplot(mpg, wt, data=mtcars)) What I am doing is to set color of the ticks to hide them. grid.gedit(gPath(xaxis, ticks), gp=gpar(col=white)) It should be a better way to achieve the purpose. Thanks. Agreed. I've added it to my ggplot2 customisation to do list. Thanks, Hadley -- http://had.co.nz/ -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK, http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html __ 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] question about subseting a dataframe
Because id is a factor in your data frame, and the levels (including C) is kept when subsetted. Here is one way to get ride of C. ex1$id - factor(ex1$id) tapply(ex1$x, ex1$id, mean) AB 22.5 32.5 On Sat, May 10, 2008 at 11:23 AM, Dipankar Basu [EMAIL PROTECTED] wrote: Hi! I am using R version 2.7.0 and am working on a panel dataset read into R as a dataframe; I call it ex. The variables in ex are: id year x id: a character string which identifies the unit year: identifies the time period x: the variable of interest (which might contain NAs). Here is an example: id - rep(c(A,B,C),2) year - c(rep(1970,3),rep(1980,3)) x - c(20,30,40,25,35,45) ex - data.frame(id=id,year=year,x=x) ex id year x 1 A 1970 20 2 B 1970 30 3 C 1970 40 4 A 1980 25 5 B 1980 35 6 C 1980 45 I want to draw a subset of ex by selecting only the A and B units: ex1 - subset(ex[which(ex$id==A|ex$id==B),]) Now I want to do some computations on x for each selected unit only: tapply(ex1$x, ex1$id, mean) ABC 22.5 32.5 NA But this gives me an NA value for the unit C, which I thought I had already left out. How do I ensure that the computation (in the last step) is limited to only the units I have selected in the first step? Dipankar [[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. -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK, http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html __ 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.