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

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

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

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 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

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

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,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

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

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 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???

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 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

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 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

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 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

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 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

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 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

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 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

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 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

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 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

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

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 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?

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-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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

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 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

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 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

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

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 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

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

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

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  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

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 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

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 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

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 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

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

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'. 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

2009-06-11 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 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?

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 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 = *!!?@

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 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?)

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

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  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

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 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

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 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)

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 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

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] .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

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

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()

 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

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 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

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 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?

2009-05-25 Thread Ronggui Huang
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?

2009-05-23 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 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?

2009-05-23 Thread Ronggui Huang
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'

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

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=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.