Re: [R] 'non-standard' folder names in R package

2007-07-31 Thread Tao Shi
Oops, somehow I missed that part.  Thank you very much!

Tao


From: Uwe Ligges [EMAIL PROTECTED]
To: Tao Shi [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] 'non-standard' folder names in R package
Date: Tue, 31 Jul 2007 11:52:10 +0200



Tao Shi wrote:
Hi list,

I use a .xml file for a function's demo in the R package I'm creating.  
Since it doesn't belong to any of the 'standard' folders, i.e. those 
mentioned in the 'Writing R Extension', I put it in a folder call myXML, 
much like the 'iris.xl' file in 'xls' folder from 'gdata' package, for 
example.  After running R CMD build, I could see the .xml file is in the 
..tar.gz file.  However, after running R CMD INSTALL -build, the file and 
the folder disappeared in both the .zip file and the installed package.  
(R CMD CHECK, of course, failed too before that, as myXML can't be 
installed.)  Could anybody tell me what's the tricks to keep those folders 
in my installation?  I'm using R-2.5.1 under WinXP.

Thank you very much!



If you want it to be in mypackage/myXML after installation, put it into 
mypackage/inst/myXML in the source package, as the manual you cited 
suggests.

Uwe Ligges




Tao

_
Need a brain boost? Recharge with a stimulating game. Play now!




__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 'non-standard' folder names in R package

2007-07-30 Thread Tao Shi

Hi list,

I use a .xml file for a function's demo in the R package I'm creating.  
Since it doesn't belong to any of the 'standard' folders, i.e. those 
mentioned in the 'Writing R Extension', I put it in a folder call myXML, 
much like the 'iris.xl' file in 'xls' folder from 'gdata' package, for 
example.  After running R CMD build, I could see the .xml file is in the 
..tar.gz file.  However, after running R CMD INSTALL -build, the file and the 
folder disappeared in both the .zip file and the installed package.  (R CMD 
CHECK, of course, failed too before that, as myXML can't be installed.)  
Could anybody tell me what's the tricks to keep those folders in my 
installation?  I'm using R-2.5.1 under WinXP.


Thank you very much!

Tao

_
Need a brain boost? Recharge with a stimulating game. Play now! 

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating windows binary R package (PowerArchiver vs. zip -r9X)

2007-07-28 Thread Tao Shi
Thanks, Uwe!  It workedTao Date: Fri, 27 Jul 2007 09:16:49 +0200 From: 
[EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch 
Subject: Re: [R] Creating windows binary R package (PowerArchiver vs. zip 
-r9X)Tao Shi wrote:  Hi list,I apologize if you see funny fonts, b/c 
I'm using the new  Windows Live Hotmail and don't know how to turn off the 
rich text  mode.I have successfully built and installed a R package in 
 windowsXP for R-2.5.1.  But when I tried to create a .zip file so I  can 
use Packages/install package(s) from local .zip files... to  install it, it 
seems R only recognizes the .zip file created by zip  -r9X not by 
PowerArchiver.  Do you know why?  I vaguely remember I  used WinZip before 
and it worked fine.The two threads I found on  R-help and R-devel help me a 
lot, but don't really answer my  
question.http://tolstoy.newcastle.edu.au/R/help/06/06/29587.htmlhttp://tolstoy.newcastle.edu.au/R/devel/05/12/3336.htmlThanks,...Tao
   In order to provide a Windows binary package, type:  R CMD INSTALL 
--build PackageName_vers.tar.gz and the zip file will be generated by R in the 
correct way.  Uwe Ligges 
_
PC Magazine’s 2007 editors’ choice for best web mail—award-winning Windows Live 
Hotmail.
http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HMWL_mini_pcmag_0707
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Creating windows binary R package (PowerArchiver vs. zip -r9X)

2007-07-26 Thread Tao Shi
Hi list,I apologize if you see funny fonts, b/c I'm using the new Windows Live 
Hotmail and don't know how to turn off the rich text mode.I have 
successfully built and installed a R package in windowsXP for R-2.5.1.  But 
when I tried to create a .zip file so I can use Packages/install package(s) 
from local .zip files... to install it, it seems R only recognizes the .zip 
file created by zip -r9X not by PowerArchiver.  Do you know why?  I vaguely 
remember I used WinZip before and it worked fine.The two threads I found on 
R-help and R-devel help me a lot, but don't really answer my 
question.http://tolstoy.newcastle.edu.au/R/help/06/06/29587.htmlhttp://tolstoy.newcastle.edu.au/R/devel/05/12/3336.htmlThanks,...Tao



_
Missed the show?  Watch videos of the Live Earth Concert on MSN.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to extract R codes that embedded in a HTML file

2007-05-18 Thread Tao Shi

Works perfectly!

Thank you very much, Fritz!

Tao



From: Friedrich Leisch [EMAIL PROTECTED]
To: Tao Shi [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED], r-help@stat.math.ethz.ch

Subject: Re: [R] How to extract R codes that embedded in a HTML file
Date: Fri, 18 May 2007 15:14:48 +0200


    Original Message 
   Subject: Re: [R] How to extract R codes that embedded in a HTML file
   usingStangle?
   Date: Thu, 17 May 2007 17:01:30 +
   From: Tao Shi [EMAIL PROTECTED]
   To: [EMAIL PROTECTED], [EMAIL PROTECTED]
   CC: r-help@stat.math.ethz.ch

   : [EMAIL PROTECTED]

   Hi Uwe,

   Thanks for the answer, but I still need a bit more clearification.  I
   always
   thought that a .rnw or .snw file is a file mixing word processing 
markup

   (e.g. tex or HTML) and R/S code using noweb syntax.  Is the reason for
   'Stangle' is not working with .rnw file with HTML due to there is no 
proper
   driver available (like RweaveHTML driver for Sweave)?  If yes, does 
R2HTML

   package have plans to provide a such driver?

   Tao


The following does the trick for me:

R mytangle - function ()
  list(setup = RtangleSetup, runcode = utils:::RtangleRuncode,
   writedoc = RtangleWritedoc,
   finish = utils:::RtangleFinish, checkopts = RweaveHTMLOptions)

R Stangle(/PATH/TO/R/SITE-LIBRARY/R2HTML/samples/example1.snw,
   driver=mytangle)
Writing to file example1.R


Best,
Fritz




_
PC Magazine’s 2007 editors’ choice for best Web mail—award-winning Windows 
Live Hotmail.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to extract R codes that embedded in a HTML file using Stangle?

2007-05-17 Thread Tao Shi
Hi Uwe,

Thanks for the answer, but I still need a bit more clearification.  I always 
thought that a .rnw or .snw file is a file mixing word processing markup 
(e.g. tex or HTML) and R/S code using noweb syntax.  Is the reason for 
'Stangle' is not working with .rnw file with HTML due to there is no proper 
driver available (like RweaveHTML driver for Sweave)?  If yes, does R2HTML 
package have plans to provide a such driver?

Tao



From: Uwe Ligges [EMAIL PROTECTED]
To: Tao Shi [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] How to extract R codes that embedded in a HTML file using 
Stangle?
Date: Tue, 15 May 2007 22:23:09 +0200



Tao Shi wrote:
I'm using R2HTML package to generate reports, but don't know how to 
extract R codes from .rnw files using Stangle.  It seems Stangle only 
works on ..tex file that has R codes embedded.

Stangle is meant for Rnw files, not for html ...

Uwe Ligges



Thanks,

Tao

_

Hotmail.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

_

Hotmail.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to extract R codes that embedded in a HTML file using Stangle?

2007-05-15 Thread Tao Shi
I'm using R2HTML package to generate reports, but don't know how to extract 
R codes from .rnw files using Stangle.  It seems Stangle only works on 
..tex file that has R codes embedded.

Thanks,

Tao

_

Hotmail.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] can't use Sweave in a function?

2007-05-11 Thread Tao Shi

Thank you very much for the pointer, Duncan!

BTW, one comment.  While testing your suggestion, I found that only 'save' 
works (exactly like you said!), not 'save.image' (see the following R 
session).  'save.image' only sees .globalEnv.  So I guess the 
statement--'save.image()' is just a short-cut for save my current 
workspace, i.e., 'save(list = ls(all=TRUE), file = .RData)'.  in the 
help file is not entirely true.


Tao



ls()

character(0)

f1 - function() {

+   y - 1:5
+   x - ABC
+   #save(x,y, file=tmp.RData)
+   #save(list=ls(all=TRUE), file=tmp.RData)
+   save.image(tmp.RData)
+   #Sweave(test.rnw, driver=RweaveHTML)
+ }


f1()
ls()

[1] f1

load(tmp.RData)
ls()

[1] f1

rm(list=ls())
ls()

character(0)

f1 - function() {

+   y - 1:5
+   x - ABC
+   #save(x,y, file=tmp.RData)
+   save(list=ls(all=TRUE), file=tmp.RData)
+   #save.image(tmp.RData)
+   #Sweave(test.rnw, driver=RweaveHTML)
+ }


f1()
ls()

[1] f1

load(tmp.RData)
ls()

[1] f1 x  y





From: Duncan Murdoch [EMAIL PROTECTED]
To: Tao Shi [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] can't use Sweave in a function?
Date: Thu, 10 May 2007 21:46:27 -0400

On 10/05/2007 9:08 PM, Tao Shi wrote:

Hi List,

Please see the following simple example which illustrate the problem.  I'm 
using R-2.5.0 in WinXP and

R2HTML 1.58.



The code in an Sweave document needs to be self-contained.  It won't see 
variables in some other R session.


If you want to pass the values of x and y into your document, use save() to 
save them to a file, then load() them in the document.


Duncan Murdoch


Thanks,

Tao


#=test.rnw =
html

body
div

h1 align=centerReport/h1

p
echo=FALSE,results=html=
  print(y)
  print(\n)
  print(paste((, x, ), sep=))
@
/p

/div
/body
/html

#


#=== R session ==

ls()

character(0)

f1 - function() {

+   y - 1:5
+   x - ABC
+   Sweave(test.rnw, driver=RweaveHTML)
+ }

f1()

Writing to file test.html
Processing code chunks ...
1 : term html

Error:  chunk 1
Error in print(y) : object y not found

debug(f1)
f1()

debugging in: f1()
debug: {
y - 1:5
x - ABC
Sweave(test.rnw, driver = RweaveHTML)
}
Browse[1]
debug: y - 1:5
Browse[1]
debug: x - ABC
Browse[1]
debug: Sweave(test.rnw, driver = RweaveHTML)
Browse[1] x
[1] ABC
Browse[1] y
[1] 1 2 3 4 5
Browse[1]
Writing to file test.html
Processing code chunks ...
1 : term html

Error:  chunk 1
Error in print(y) : object y not found

undebug(f1)

  y - 1:5
  x - ABC


ls()

[1] f1 x  y

  Sweave(test.rnw, driver=RweaveHTML)

Writing to file test.html
Processing code chunks ...
1 : term html
file  test.html is completed


R.Version()

$platform
[1] i386-pc-mingw32

$arch
[1] i386

$os
[1] mingw32

$system
[1] i386, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 5.0

$year
[1] 2007

$month
[1] 04

$day
[1] 23

$`svn rev`
[1] 41293

$language
[1] R

$version.string
[1] R version 2.5.0 (2007-04-23)


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.




_
Make every IM count. Download Messenger and join the i’m Initiative now. 
It’s free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] can't use Sweave in a function?

2007-05-10 Thread Tao Shi
Hi List,

Please see the following simple example which illustrate the problem.  I'm 
using R-2.5.0 in WinXP and
R2HTML 1.58.

Thanks,

Tao


#=test.rnw =
html

body
div

h1 align=centerReport/h1

p
echo=FALSE,results=html=
  print(y)
  print(\n)
  print(paste((, x, ), sep=))
@
/p

/div
/body
/html

#


#=== R session ==
ls()
character(0)
f1 - function() {
+   y - 1:5
+   x - ABC
+   Sweave(test.rnw, driver=RweaveHTML)
+ }

f1()
Writing to file test.html
Processing code chunks ...
1 : term html

Error:  chunk 1
Error in print(y) : object y not found
debug(f1)
f1()
debugging in: f1()
debug: {
y - 1:5
x - ABC
Sweave(test.rnw, driver = RweaveHTML)
}
Browse[1]
debug: y - 1:5
Browse[1]
debug: x - ABC
Browse[1]
debug: Sweave(test.rnw, driver = RweaveHTML)
Browse[1] x
[1] ABC
Browse[1] y
[1] 1 2 3 4 5
Browse[1]
Writing to file test.html
Processing code chunks ...
1 : term html

Error:  chunk 1
Error in print(y) : object y not found

undebug(f1)

   y - 1:5
   x - ABC


ls()
[1] f1 x  y
   Sweave(test.rnw, driver=RweaveHTML)
Writing to file test.html
Processing code chunks ...
1 : term html
file  test.html is completed


R.Version()
$platform
[1] i386-pc-mingw32

$arch
[1] i386

$os
[1] mingw32

$system
[1] i386, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 5.0

$year
[1] 2007

$month
[1] 04

$day
[1] 23

$`svn rev`
[1] 41293

$language
[1] R

$version.string
[1] R version 2.5.0 (2007-04-23)



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] a question regarding 'lrm'

2006-10-02 Thread Tao Shi
Hi List,

I don't understand why 'lrm' doesn't recognize the '~.' formula.  I'm pretty 
sure it was working before. Please see below:

I'm using R2.3.0, WinXP, Design 2.0-12

thanks,
...Tao

 dat - data.frame(y=factor(rep(1:2,each=50)), x1=rnorm(100), x2=rnorm(100), 
 x3=rnorm(100))
 lrm(y~., data=dat, x=T, y=T)
Error in terms.formula(formula, specials = strat) : 
'.' in formula and no 'data' argument
 lrm(y~x1+x2+x3, data=dat, x=T, y=T)

Logistic Regression Model

lrm(formula = y ~ x1 + x2 + x3, data = dat, x = T, y = T)


Frequencies of Responses
 1  2 
50 50 

   Obs  Max Deriv Model L.R.   d.f.  P  CDxy
  Gamma 
   100  1e-08   3.61  3 0.3066  0.594  0.187
  0.188 
 Tau-a R2  Brier 
 0.095  0.047  0.241 

  Coef S.E.   Wald Z P 
Intercept -0.05224 0.2071 -0.25  0.8009
x1-0.30699 0.1952 -1.57  0.1159
x2 0.08093 0.2171  0.37  0.7093
x3 0.21450 0.2247  0.95  0.3398

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] an error message with 't.test' with R under Unix

2006-09-13 Thread Tao Shi
Hi list,Could you please help me to explain the following error messages with 
't.test' in R Unix 2.1.1?  I don't see it in R under Windows (R 2.3.0) or Unix 
(R2.3.1).  Is it really due to the different R versions?Thanks,...TaoUnix 
session: (R.2.1.1) R.version _ 
  platform x86_64-unknown-linux-gnuarch x86_64  os  
 linux-gnu   system   x86_64, linux-gnu   status
   major2   minor1.1 
year 2005month06  day  20   
   language Rt.test(extra ~ group, 
data = sleep)Welch Two Sample t-testdata:  extra by group t = -1.8608, 
df = 17.776, p-value = 0.0794alternative hypothesis: true difference in means 
is not equal to 0 95 percent confidence interval: -3.3654832  0.2054832 sample 
estimates:mean in group 1 mean in group 2!
 0.752.33  t.test((1:6)~rep(1:2,each=3))Error in 
terms.formula(formula[-3]) : invalid model formula in ExtractVars 
t.test(2^(1:6)~rep(1:2,each=3))Error in terms.formula(formula[-3]) : invalid 
power in formula t.test(2^extra ~ group, data = sleep)Error in 
terms.formula(formula[-3]) : invalid power in formulaUnix session: (R 
2.3.1) R.version   _   
  platform   x86_64-unknown-linux-gnu  arch   x86_64
os linux-gnu system x86_64, 
linux-gnu status   major  2 
minor  3.1   year   
2006  month  06day  
  01svn rev38247 language   
R version.string Version 2.3.1 (2006-06-01) 
t.test(1:6~rep(1:2,each=!
 3))Welch Two Sample t-testdata:  1:6 by rep(1:2, each = 3) t =
 -3.6742, df = 4, p-value = 0.02131alternative hypothesis: true difference in 
means is not equal to 0 95 percent confidence interval: -5.266958 -0.733042 
sample estimates:mean in group 1 mean in group 2   2   
5 Windows session:=== R.version   _
 platform   i386-pc-mingw32   arch   i386   
   os mingw32   system 
i386, mingw32 status   major
  2 minor  3.0   year   
2006  month  04day  
  24svn rev37909 
language   R version.string Version 2.3.0 
(2006-04-24) help(t.test) t.test(extra ~ group, data = sleep)Welch 
Two Sample t-testdata:  extra by group t = -1.8608, df = 17.7!
 76, p-value = 0.0794alternative hypothesis: true difference in means is not 
equal to 0 95 percent confidence interval: -3.3654832  0.2054832 sample 
estimates:mean in group 1 mean in group 20.752.33  
t.test(2^extra ~ group, data = sleep)Welch Two Sample t-testdata:  
2^extra by group t = -1.6362, df = 10.718, p-value = 0.1308alternative 
hypothesis: true difference in means is not equal to 0 95 percent confidence 
interval: -18.641557   2.773344 sample estimates:mean in group 1 mean in group 
23.448644   11.382751  t.test(1:6~rep(1:2,each=3))Welch 
Two Sample t-testdata:  1:6 by rep(1:2, each = 3) t = -3.6742, df = 4, p-value 
= 0.02131alternative hypothesis: true difference in means is not equal to 0 95 
percent confidence interval: -5.266958 -0.733042 sample estimates:mean in group 
1 mean in group 2   2   5 
_
Use Messenger to talk to your IM friends, even those on Yahoo!

685ee3e858fe
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] an error message with 't.test' with R under Unix

2006-09-13 Thread Tao Shi
Hi Peter,

Thank you for the reply!

Really sorry for the formating (forgot to change to plain text).  Here is 
basically what I'm talking about:

 R.version
 _   
platform x86_64-unknown-linux-gnu
arch x86_64  
os   linux-gnu   
system   x86_64, linux-gnu   
status   
major2   
minor1.1 
year 2005
month06  
day  20  
language R   
 t.test(1:6~rep(1:2,each=3))
Error in terms.formula(formula[-3]) : invalid model formula in ExtractVars
 

Again, I don't see the error in R under Windows (R 2.3.0) or Unix (R2.3.1).  Is 
this the bug you were talking about?

...Tao





 To: [EMAIL PROTECTED]
 CC: r-help@stat.math.ethz.ch
 Subject: Re: [R] an error message with 't.test' with R under Unix
 From: [EMAIL PROTECTED]
 Date: Wed, 13 Sep 2006 23:52:04 +0200
 
 Tao Shi [EMAIL PROTECTED] writes:
 
  Hi list,Could you please help me to explain the following error
  messages with 't.test' in R Unix 2.1.1? 
 
 This is completely unreadable! However, yes, there was at some point a
 bug where the LHS of model formulas was checked more rigorously than
 need be, using the same rules that apply to the RHS. This fact can be
 found in a recent NEWS file.
 
 
 
  I don't see it in R under Windows (R 2.3.0) or Unix (R2.3.1).  Is it really 
  due to the different R versions?Thanks,...TaoUnix session: 
  (R.2.1.1) R.version _  
   platform x86_64-unknown-linux-gnuarch x86_64  os   
  linux-gnu   system   x86_64, linux-gnu   status 
major2   minor1.1 
  year 2005month06  day   
 20  language Rt.test(extra 
  ~ group, data = sleep)Welch Two Sample t-testdata:  extra by group 
  t = -1.8608, df = 17.776, p-value = 0.0794alternative hypothesis: true 
  difference in means is not equal to 0 95 percent confidence interval: 
  -3.3654832  0.2054832 sample estimates:mean in group 1 mean in group 2  
!
   0.752.33  t.test((1:6)~rep(1:2,each=3))Error in 
  terms.formula(formula[-3]) : invalid model formula in ExtractVars 
  t.test(2^(1:6)~rep(1:2,each=3))Error in terms.formula(formula[-3]) : 
  invalid power in formula t.test(2^extra ~ group, data = sleep)Error in 
  terms.formula(formula[-3]) : invalid power in formulaUnix session: (R 
  2.3.1) R.version   _   
platform   x86_64-unknown-linux-gnu  arch   x86_64
  os linux-gnu system 
  x86_64, linux-gnu status   major
2 minor  3.1   
  year   2006  month  06  
day01svn rev38247 
  language   R version.string Version 
  2.3.1 (2006-06-01) t.test(1:6~rep(1:2,each
  =!
   3))Welch Two Sample t-testdata:  1:6 by rep(1:2, each = 3) t =
   -3.6742, df = 4, p-value = 0.02131alternative hypothesis: true difference 
  in means is not equal to 0 95 percent confidence interval: -5.266958 
  -0.733042 sample estimates:mean in group 1 mean in group 2   2  
   5 Windows session:=== R.version   
  _ platform   i386-pc-mingw32   
  arch   i386  os mingw32 
system i386, mingw32 status   
  major  2 minor  3.0 
year   2006  month  
  04day24svn rev  
37909 language   R 
  version.string Version 2.3.0 (2006-04-24) help(t.test) t.test(extra ~ 
  group, data = sleep)Welch Two Sample t-testdata:  extra by group t 
  = -1.8608, df = 17.
  7!
   76, p-value = 0.0794alternative hypothesis: true difference in means is 
  not equal to 0 95 percent confidence interval: -3.3654832  0.2054832 sample 
  estimates:mean in group 1 mean in group 20.752.33  
  t.test(2^extra ~ group, data = sleep)Welch Two Sample t-testdata:  
  2^extra by group t = -1.6362, df = 10.718, p-value = 0.1308alternative 
  hypothesis: true difference in means is not equal to 0 95 percent 
  confidence interval: -18.641557   2.773344 sample

[R] a problem 'cor' function

2006-05-31 Thread Tao Shi
Hi list,

One of my co-workers found this problem with 'cor' in his code and I confirm it 
too (see below).  He's using R 2.2.1 under Win 2K and I'm using R 2.3.0 under 
Win XP.

===
 R.Version()
$platform
[1] i386-pc-mingw32

$arch
[1] i386

$os
[1] mingw32

$system
[1] i386, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 3.0

$year
[1] 2006

$month
[1] 04

$day
[1] 24

$`svn rev`
[1] 37909

$language
[1] R

$version.string
[1] Version 2.3.0 (2006-04-24)
 data(iris)
 cor(iris[1:4])
 Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length   1. -0.1176   0.8718  0.8179
Sepal.Width   -0.1176  1.  -0.4284 -0.3661
Petal.Length   0.8718 -0.4284   1.  0.9629
Petal.Width0.8179 -0.3661   0.9629  1.
 cor(iris[1:4])==1
 Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length TRUE   FALSEFALSE   FALSE
Sepal.Width FALSETRUEFALSE   FALSE
Petal.LengthFALSE   FALSE TRUE   FALSE
Petal.Width FALSE   FALSEFALSETRUE
 cor(iris[1:4], iris[1:4])
 Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length   1. -0.1176   0.8718  0.8179
Sepal.Width   -0.1176  1.  -0.4284 -0.3661
Petal.Length   0.8718 -0.4284   1.  0.9629
Petal.Width0.8179 -0.3661   0.9629  1.
 cor(iris[1:4], iris[1:4])==1
 Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length TRUE   FALSEFALSE   FALSE
Sepal.Width FALSETRUEFALSE   FALSE
Petal.LengthFALSE   FALSEFALSE   FALSE
Petal.Width FALSE   FALSEFALSETRUE
===

The two ways of calculating correlation seem to generate the 'same' results, 
but the second one doesn't appear to be numerically stable (see the 3rd 
diagonal element of the last matrix).

thanks,

...Tao 

_
Join the next generation of Hotmail and you could win the adventure of a 
lifetime

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] a problem 'cor' function

2006-05-31 Thread Tao Shi
Hi Peter,
 
Thank you very much for your quick reply!
 
I'm aware of the accuracy issue of the numbers in R.  I guess the thing I was 
puzzled is how come the same function when used in different way produce 
different results (it's supposed to use the same algorithm).  The only 
explanation for this is when cor(x) is used, the function automatically assign 
all the diagonal elements to 1.  But when cor(x, y) is used, since there is no 
way to check which two vectors are the same, the function gives the 'real' 
results.
 
best,
 
...Tao
 



 Date: Wed, 31 May 2006 16:49:18 -0600 From: [EMAIL PROTECTED] To: [EMAIL 
 PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] a problem 'cor' 
 function  Looks like another case of the most F of all FAQs: FAQ 7.31.  
 See if the following makes sense to you:pl - iris[101:150, 3]   
 all.equal(cor(pl,pl), 1)   [1] TRUE   cor(pl,pl) == 1   [1] FALSE   
 sprintf(%1.22g, cor(pl, pl))   [1] 0.99989   
 sprintf(%1.22g, pl)   [1] 6  5.0996 
 5.9004 etc  Peter Ehlers  Tao Shi wrote:   Hi list,  
   One of my co-workers found this problem with 'cor' in his code and I 
 confirm it too (see below).  He's using R 2.2.1 under Win 2K and I'm using R 
 2.3.0 under Win XP.===   
 R.Version()$platform  [1] i386-pc-mingw32$arch  [1] 
 i386$os  [1] mingw32$system  [1] i386, mingw32   
  $status  [1] $major  [1] 2$minor  [1] 3.0   
  $year  [1] 2006$month  [1] 04$day  [1] 24   
  $`svn rev`  [1] 37909$language  [1] R
 $version.string  [1] Version 2.3.0 (2006-04-24)   data(iris) 
 cor(iris[1:4]) Sepal.Length Sepal.Width Petal.Length 
 Petal.Width  Sepal.Length   1. -0.1176   0.8718  
 0.8179  Sepal.Width   -0.1176  1.  -0.4284 -0.3661  
 Petal.Length   0.8718 -0.4284   1.  0.9629  Petal.Width 
0.8179 -0.3661   0.9629  1.   cor(iris[1:4])==1 
 Sepal.Length Sepal.Width Petal.Length Petal.Width  
 Sepal.Length TRUE   FALSEFALSE   FALSE  Sepal.Width 
 FALSETRUEFALSE   FALSE  Petal.Length
 FALSE   FALSE TRUE   FALSE  Petal.Width FALSE   
 FALSEFALSETRUE   cor(iris[1:4], iris[1:4])   
   Sepal.Length Sepal.Width Petal.Length Petal.Width  Sepal.Length   
 1. -0.1176   0.8718  0.8179  Sepal.Width   -0.1176  
 1.  -0.4284 -0.3661  Petal.Length   0.8718 -0.4284  
  1.  0.9629  Petal.Width0.8179 -0.3661   0.9629 
  1.   cor(iris[1:4], iris[1:4])==1 Sepal.Length 
 Sepal.Width Petal.Length Petal.Width  Sepal.Length TRUE   FALSE 
FALSE   FALSE  Sepal.Width FALSETRUE
 FALSE   FALSE  Petal.LengthFALSE   FALSEFALSE   
 FALSE  Petal.Width FALSE   FALSEFALSETRUE  
 ===The two ways of 
 calculating correlation seem to generate the 'same' results, but the second 
 one doesn't appear to be numerically stable (see the 3rd diagonal element of 
 the last matrix).thanks,...Tao 
 _  Join the 
 next generation of Hotmail and you could win the adventure of a lifetime   
  __  R-help@stat.math.ethz.ch 
 mailing list  https://stat.ethz.ch/mailman/listinfo/r-help  PLEASE do 
 read the posting guide! http://www.R-project.org/posting-guide.html  --  
 Peter Ehlers Chair, Division of Statistics and Actuarial Science Department 
 of Mathematics and Statistics University of Calgary, 2500 University Dr. NW  
  ph: 403-220-3936 Calgary, Alberta  T2N 1N4, CANADA  
 fax: 403-282-5150 email: [EMAIL PROTECTED] 
_
It’s the future of Hotmail: Try Windows Live Mail beta

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] zlim for levelplot

2005-07-01 Thread Tao Shi

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] hclust, centroid

2004-09-10 Thread Tao Shi
Does anyone know how hclust (stats) calculates centroid linkage if only a 
distance matrix can be used as the input?

...Tao
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RE: [Rd] a simple suggestion for the next version of R windows

2004-04-24 Thread Tao Shi
Hi, Andy:

Thanks!  I think it also depends on people's working hobby.

What you suggested is a good way around it.  But I'm still thinking since 
the R window already has the big blue R logo to identify itself, the word R 
console is really redundant and could be replaced by something more 
informative.  Not nesessarly everytime you change to a new diretory, you 
need to change to a new identifier, but at least the every first .RData file 
you loaded.  I don't know...  Something along that line.  It will be 
very helpful when you use Alt+Tab to move between windows, b/c all you see 
are R consoles...

...Tao

Original Message Follows
From: Liaw, Andy [EMAIL PROTECTED]
To: 'Tao Shi' [EMAIL PROTECTED],[EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: RE: [Rd] a simple suggestion for the next version of R windows
Date: Sat, 24 Apr 2004 23:18:06 -0400
I don't see how this can work.  I frequently run only one R session (also in
SDI), but change working directories several times during the session, with
or without loading the workspace files in those directories, depending on
what I need to do.  I don't think the Window title can change every time I
do setwd(somewhereElse); load(.RData).
One possibility that could probably help you is to change the R command
prompt from   to the current working directory plus  .  I believe this
can be done with the taskCallbackManager().
Andy

 From: Tao Shi

 Is it possible to replace the word R Console on the title
 bar (is it what
 it's called? It's the blue area above menu bar) with the name
 of the work
 space file you're using or loaded, so people who are runing multple R
 sessions at same time can identify them immediately.  I'm
 using 1.9.0 in SDI
 mode.

 Thanks,

 ...Tao

 _
 Is your PC infected? Get a FREE online computer virus scan
 from McAfee(r)
 Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] a question regarding 'cor' function

2004-03-04 Thread Tao Shi
I'm a little bit confused with how exactly the 'cor' function handles 
missing values.  Should the last two function calls give the same results?   
Thanks,
...Tao

==
x=rnorm(10)
y=rnorm(10)
x[1]=NA
y[2]=NA
cor(x,y,method=spearman)
[1] -0.006060606

cor(x,y,use=pairwise.complete.obs,method=spearman)
[1] -0.006060606
cor(x[3:10],y[3:10],method=spearman)
[1] 0.167
==
_
Create a Job Alert on MSN Careers and enter for a chance to win $1000! 
http://msn.careerbuilder.com/promo/kaday.htm?siteid=CBMSN_1Ksc_extcmp=JS_JASweep_MSNHotm2

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Why two chisq.test p values differ when the contingency tableis transposed?

2003-07-15 Thread Tao Shi
I'm using R1.7.0 runing with Win XP.  Thanks,

...Tao



x
[,1] [,2]
[1,]  149  151
[2,]18
t(x)
[,1] [,2]
[1,]  1491
[2,]  1518
chisq.test(x, simulate.p.value=T, B=10)
   Pearson's Chi-squared test with simulated p-value (based on 1e+05 
replicates)

data:  x
X-squared = 5.2001, df = NA, p-value = 0.03774
chisq.test(t(x), simulate.p.value=T, B=10)
   Pearson's Chi-squared test with simulated p-value (based on 1e+05 
replicates)

data:  t(x)
X-squared = 5.2001, df = NA, p-value = 0.01642
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help