Re: [R] Error running lda example from Help File (MASS library )

2009-11-14 Thread Ronggui Huang
gt; > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible c

Re: [R] creating custom package and functions

2009-11-10 Thread Ronggui Huang
rovide 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

[R] RGtk2:::gdkColorToString throws an error

2009-10-20 Thread Ronggui Huang
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

Re: [R] Removing objects from workspace

2009-08-24 Thread Ronggui Huang
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,x

Re: [R] CRAN (and crantastic) updates this week

2009-08-24 Thread Ronggui Huang
I like it. Thanks. 2009/8/24 hadley wickham : > 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

Re: [R] multiple linear regression

2009-08-21 Thread Ronggui Huang
pls use lm(y ~ x1+x2) 2009/8/21 Inchallah Yarab : > 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

Re: [R] why summary() does not work here???

2009-08-15 Thread Ronggui Huang
I cannot reproduce what you mentioned. One possible is that you use summary() without loading VGAM package. 2009/8/16 Hongwei Dong : > 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 g

Re: [R] Estimate Discrete Choice Models with R

2009-08-15 Thread Ronggui Huang
glm can do probit regression, and glmer (lme4 package) and do mixed effect logit model. Ronggui 2009/8/16 Hongwei Dong : > 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

Re: [R] prop.test() - need algorithm or reference

2009-08-13 Thread Ronggui Huang
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

Re: [R] Games in R

2009-08-12 Thread Ronggui Huang
Hi, another package can be found here http://r-forge.r-project.org/projects/fun/ 2009/8/13 Bjørn Arild Mæland : > Hi, > > There's a couple of games listed on crantastic: > http://crantastic.org/tags/games > > -Bjorn > > 2009/8/12 David Croll : >> Hi everybody - this is an oddball question. >> >>

Re: [R] How to Import Excel file into R 2.9.0 version

2009-08-11 Thread Ronggui Huang
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 : > > Hi Every one, > I have a problem with Reading Excel file into R 2.9.0 version. In older > versions i

Re: [R] Example scripts for R Manual

2009-08-10 Thread Ronggui Huang
Is it really necessary? You can just copy the commands in the manual and paste them to R. Ronggui 2009/8/11 Peng Yu : > 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

Re: [R] RES: Saving plots to file

2009-08-10 Thread Ronggui Huang
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 : > You can save plots as specified below. For details see ?png, ?postscrip, > ?tiff, ?jpeg,

Re: [R] import data into R

2009-08-05 Thread Ronggui Huang
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 : > 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

Re: [R] Comparison of Output from "dwtest" and "durbin.watson"

2009-08-04 Thread Ronggui Huang
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 : > > Allow me to reword this question. I have performed two fi

[R] status of boolean package

2009-08-03 Thread Ronggui Huang
FYI -- Forwarded message -- From: Bear Braumoeller Date: 2009/8/4 Subject: Re: Package boolean on CRAN To: "c...@datanalytics.com" Cc: Ronggui Huang , Ben Goodrich Gentlemen, Thanks for your enquiries.  Boolean is under active development, and we should have a n

Re: [R] Collinearity in Linear Multiple Regression

2009-08-02 Thread Ronggui Huang
I think perturb:colldiag implementes condition index as well as variance decomposition proportions. Ronggui 2009/7/21 Stephan Kolassa : > Hi Alex, > > I personally have had more success with the (more complicated) collinearity > diagnostics proposed by Belsley, Kuh & Welsch in their book "Regress

Re: [R] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread Ronggui Huang
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 : > > Hi, > > I would like to apply the L-BFGS optimization algorithm to compute the MLE > of a multilevel multinomial Logist

[R] status of boolean?

2009-08-02 Thread Ronggui Huang
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-

Re: [R] Compare lm() to glm(family=poisson)

2009-08-02 Thread Ronggui Huang
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 : > > > > Mark Na wrote: >> >> Dear R-helper

Re: [R] R book for economists

2009-08-01 Thread Ronggui Huang
How about Kleiber, C. & Zeileis, A. Applied Econometrics with R Springer, 2008? Ronggui 2009/8/1 Thiemo Fetzer : > 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, h

Re: [R] Installing lme4 package in Windows Vista

2009-07-28 Thread Ronggui Huang
After installation of lme4, you need to load it before use it. >library(lme4) >?lmer 2009/7/29 Angela Radulescu : > > 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.pa

Re: [R] r2 question

2009-07-25 Thread Ronggui Huang
summary(lm1) will show you R2 and adjusted R2 too. Ronggui 2009/7/26 Steve Lianoglou : > Hi Sarah, > > On Jul 25, 2009, at 8:25 AM, Buckmaster, Sarah wrote: > >> Hi everyone, >> >> I have a question about calculating r-squared in R. I have tried searching >> the archives and couldn't find what I

Re: [R] Error in object$coefficients : $ operator not defined for this S4 class

2009-07-07 Thread Ronggui Huang
009/7/7 Alessandra Galli : > 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 >> >> What is fit in you

Re: [R] Error in object$coefficients : $ operator not defined for this S4 class

2009-07-07 Thread Ronggui Huang
What is fit in your example? Ronggui 2009/7/7 aledanda : > > 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

Re: [R] save the result into a word file

2009-07-03 Thread Ronggui Huang
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 : > Hi, everyone: > > I forget on how to save a result from R as

Re: [R] Correlation Network Diagram?

2009-07-03 Thread Ronggui Huang
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 : > 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

Re: [R] order by decerasing 1st variable and increasing 2nd variable

2009-06-24 Thread Ronggui Huang
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 : > Hello, > > I have a data.frame which I would like to sort with the primary key > decreasing while the secondry key is increa

Re: [R] Urgent - odfWeave produces graphs /images with Read-Error

2009-06-17 Thread Ronggui Huang
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 : > 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 o

Re: [R] The most straightfoward way to write a function that sums over the rows of a matrix

2009-06-16 Thread Ronggui Huang
Why not just use rowSums? Ronggui 2009/6/16 Stu @ AGS : > 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

[R] How to capture output from a subprocess?

2009-06-13 Thread Ronggui Huang
## 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'".

Re: [R] Install local package

2009-06-10 Thread Ronggui Huang
## 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 : > Hi, I'm working on a package th

Re: [R] Vista + R = *!!?@

2009-06-10 Thread Ronggui Huang
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 : > Hello People of R, > > Is there any way that I can get R to function properly using Vista.  I get > very strange output using

Re: [R] graphically representing frequency of words in a speech?

2009-06-10 Thread Ronggui Huang
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 : > Hi, > > As Gregor Gorjanc mentioned, it's very inconvenient to let R

Re: [R] searchpaths

2009-06-09 Thread Ronggui Huang
No. This function is used to get "a list of 'attach'ed _packages_ " rather than search files in your computer. 2009/6/10 : > 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 equivalen

Re: [R] Writing Reports from R in Office Open XML format (ooxmlWeave?)

2009-06-09 Thread Ronggui Huang
Wow, It sounds great. Looking forward to it. 2009/6/9 Duncan Temple Lang : > 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. > > Tob

Re: [R] SECOND MESSAGE: Re: Question about R an SPSS

2009-06-08 Thread Ronggui Huang
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

Re: [R] RGtk2 help: Show list of column names from dataset and categorize as factor or numeric

2009-06-04 Thread Ronggui Huang
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 : > Hi UseRs, > I recently started working with the RGtk2 library. The do

Re: [R] Binning or grouping data

2009-06-04 Thread Ronggui Huang
Personally, I prefer the recode() in package of car. Ronggui 2009/6/4 Philipp Pagel : >> I'm attempting to "group" or "bin" data together in order to analyze them as >> a combined group rather than as discrete set.  I'll provide a simple example >> of the data for illustrative purposes. >> >> Pat

Re: [R] Getting a column of values from a list - think I'm doing it the hard way

2009-06-03 Thread Ronggui Huang
2009/6/4 Jason Rupert : > > Example code it shown below. > > I think I am doing this the hard way.  I'm just trying to get the full year > value from an array of dates.  An example array is shown below.  Right now, > I'm using a "for" loop to pull the year out of a list where the dates were > sp

Re: [R] Abort run

2009-06-03 Thread Ronggui Huang
It depends on the OS you use. For windows user, the ESC key or "stop all computation" in the menu are the options. Ronggui 2009/6/3 Ali Mahani : > > How can I abort running a script if I determine it's taking too long? > Currently, I simply close the R window and re-open it. Thank you! > -- > Vie

Re: [R] Return variable assignments from a function

2009-06-02 Thread Ronggui Huang
I don't know why you want to do this. But you can try _assign_ simple <- function(m,n) { assign("A",matrix(c(3,3,2,3),2,2),env=.GlobalEnv) assign("B",m,env=.GlobalEnv) assign("c",1:n,env=.GlobalEnv) } > simple(5,4) > A [,1] [,2] [1,]32 [2,]33 > B [1] 5 Ronggui 2009/6/3 Sc

Re: [R] Most used R editors

2009-06-02 Thread Ronggui Huang
Yes, Tinn-R is great for windows users. However, if you work under different OS, it would be great to have an OS-independent editor. Ronggui 2009/6/2 Bos, Roger : > I have not seen Tinn-R mentioned so I will mention it.  Its worked great for > me.  Eclipse is a nice IDE, but its more complicated

Re: [R] GTK Tooltips under Linux

2009-06-02 Thread Ronggui Huang
Thanks, Michael. 2009/6/2 Michael Lawrence : > I think I've got the threaded event loop working. Uploaded it to CRAN as > 2.12.12. Should appear in a few days. > > Michael > > On Fri, May 29, 2009 at 11:24 AM, Ronggui Huang > wrote: >> >> Noted with thanks.

Re: [R] Most used R editors

2009-06-02 Thread Ronggui Huang
I personally use ESS now. I think it is great for programming. I used kate under KDE once, and it worked fine. I quite like kate though I am not a fan of KDE. Ronggui 2009/6/2 Martial Sankar : > > Hi, > > I am a little lonely as R users in my group. So, I would like to know which > editor is the

Re: [R] warning message when running quantile regression

2009-06-01 Thread Ronggui Huang
You may not get response as this is in faq of rq package. 7. [Non-positive fis] "What does the message "Non-positive fis" mean? When method ="nid" is used in summary local density estimates are made at each x_i value, in some cases these estimates can be negative and if so they are set

Re: [R] (no subject)

2009-05-31 Thread Ronggui Huang
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 : > Hi R-users, > > I try to use sn package but it give me the following message: > >> install.packages(repos=

Re: [R] GTK Tooltips under Linux

2009-05-29 Thread Ronggui Huang
Noted with thanks. Regards Ronggui 2009/5/29 Michael Lawrence : > > > On Thu, May 28, 2009 at 7:35 PM, Ronggui Huang > wrote: >> >> Dear all, >> >> I want to set tool-tips for a gtkButton. I use the following code >> which works under Windows. However,

Re: [R] problem with "ls" command

2009-05-29 Thread Ronggui Huang
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] ".GlobalEnv""package:stats" "package:graphics" [4] "package:grDevices" "package:utils" "package:datasets" [7] "package:methods" "Autol

[R] GTK Tooltips under Linux

2009-05-28 Thread Ronggui Huang
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() >

Re: [R] split strings

2009-05-26 Thread Ronggui Huang
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 Pi

Re: [R] R under Ubuntu

2009-05-26 Thread Ronggui Huang
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 : > R-help, > > I have installed R under Ubuntu and > I'm

Re: [R] Draw a rectangle on top of an image using RGtk2?

2009-05-25 Thread Ronggui Huang
t 8:27 AM, Ronggui Huang > 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() w

Re: [R] Draw a rectangle on top of an image using RGtk2?

2009-05-23 Thread Ronggui Huang
) 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 : > > > On Fri, May 22, 2009 at 11:27 PM, Ronggui H

[R] Draw a rectangle on top of an image using RGtk2?

2009-05-22 Thread Ronggui Huang
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 s

Re: [R] Trouble installing package 'systemfit'

2009-05-20 Thread Ronggui Huang
Have you tried another mirror? It seems that downloaded file is incomplete. 2009/5/20 Rui Wang : > 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. > >

Re: [R] Remove objects names like character String

2009-05-19 Thread Ronggui Huang
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=