Re: [R] NAs introduced by coercion in dist()

2007-05-03 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 02.05.2007 16:47:55:

 
 It was suggested that the 'NAs introduced by coercion' message might be
 warning me that my data are not what they should be.  I checked this 
using
 str(PeaksMatrix), as suggested, and the data seem to be what I thought 
they
 were: 
 
 'data.frame':   335 obs. of  127 variables:
  $ Code   : Factor w/ 335 levels A1MR,A1MU,..: 1 2 3 4 5 6 7 8 9 10 
...
  $ P3.70  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P3.97  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P4.29  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P4.90  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P6.30  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P6.45  : num  7.73 0 0 0 0 0 4.03 0 0 0 ...
  $ P6.55  : num  0 0 0 0 0 0 0 0 0 0 ...
 
 ...
 
 I do have 335 observations, 127 variables that are named P3.70, 3.97, 
P4.29,
 etc..  This was a relief, but I still don't know whether the distance 
matrix
 is what it should be.  I tried 'str(dist.PxMx)', which is the name of my
 distance matrix, but I get something that has not much meaning to me, an
 unexperienced R user:
 
 Class 'dist'  atomic [1:55945] 329.6 194.9 130.1  70.7 116.9 ...
   ..- attr(*, Size)= int 335
   ..- attr(*, Labels)= chr [1:335] 1 2 3 4 ...
   ..- attr(*, Diag)= logi FALSE
   ..- attr(*, Upper)= logi FALSE
   ..- attr(*, method)= chr euclidean
   ..- attr(*, call)= language dist(x = PeaksMatrix, method = 
euclidean,
 diag = FALSE, upper = FALSE,  p = 2)
 
 Any more suggestions, please?

Well, it seems that you have the data which you want but why you do not 
see them is not clear for me.

I tried:

x-sample(0:2, 100, replace=T)
dim(x)-c(10,10)
x
  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]010011110 1
 [2,]010210200 2
 [3,]020001101 2
...
[10,]120012021 0
xx-data.frame(var=c(a, b),x)
xx
   var X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
1a  0  1  0  0  1  1  1  1  0   1
2b  0  1  0  2  1  0  2  0  0   2

9a  1  1  0  1  1  0  0  2  2   0
10   b  1  2  0  0  1  2  0  2  1   0

dist(xx, method='euclidean', diag=F,upper=F)
  12345678 
   9
2  2.966479  
3  2.345208 3.146427  
4  3.633180 3.633180 4.571652  
5  4.195235 5.549775 4.571652 4.195235  
6  4.195235 4.195235 4.062019 3.924283 3.924283  
7  1.816590 3.781534 3.316625 3.781534 3.781534 4.806246  
8  2.774887 4.571652 3.633180 4.062019 4.062019 4.806246 3.316625  
9  3.316625 4.449719 4.062019 4.449719 3.316625 4.449719 2.774887 3.146427 
 
10 2.774887 5.029911 3.633180 4.324350 3.146427 4.324350 2.569047 2.966479 
2.774887

xxx-dist(xx, method='euclidean', diag=F,upper=F)
Warning message:
NAs introduced by coercion 
str(xxx)
Class 'dist'  atomic [1:45] 2.97 2.35 3.63 4.20 4.20 ...
  ..- attr(*, Size)= int 10
  ..- attr(*, Diag)= logi FALSE
  ..- attr(*, Upper)= logi FALSE
  ..- attr(*, method)= chr euclidean
  ..- attr(*, call)= language dist(x = xx, method = euclidean, diag = 
F, upper = F)

seems to be similar to what you get. So I wonder why you do not see you 
matrix. Try dist.PxMx[1:50] or head(dist.PxMx) to see if you can get 
something from it.

Regards
Petr

 
 
 
 Silvia Lomascolo wrote:
  
  I work with Windows and use R version 2.4.1. I am JUST starting to 
learn
  this program...
  
  I get this warning message 'NAs introduced by coercion' while trying 
to
  build a distance matrix (to be analyzed with NMDS later) from a 336 x 
100
  data matrix.  The original matrix has lots of zeros and no missing 
values,
  but I don't think this should matter.
  
  I searched this forum and people have suggested that the warning 
should be
  ignored but when I try to print the distance matrix I only get the row
  numbers (the matrix seems to be 'empty') and I'm not being able to 
judge
  whether the matrix worked or not.
  
  To get the distance matrix I wrote:
  dist.PxMx - dist (PeaksMatrix, method='euclidean', diag=FALSE,
  upper=FALSE)
  
  I tried including the p argument (included in the help for dist()) and
  leaving it out, but that didn't seem to change anything.  I think 
that's
  required for one distance measure though, not for euclidean dist. 
  
  Should I really ignore this warning? If so, why am I not being able to 
see
  the distance matrix?
  
 
 -- 
 View this message in context: http://www.nabble.com/NAs-introduced-by-
 coercion-in-dist%28%29-tf3680727.html#a10286882
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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 

[R] Odp: about using read.table

2007-05-03 Thread Petr PIKAL
Hi

Did you see FAQ 2.16?

Try file.choose()

Regards

Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 03.05.2007 02:26:27:

 Hi,Dear R users, I have a file text nommed chif which contains 16 
lines and 
 4 columns in the disc dur. I have a difficulty to read this file in R 
console 
 I have used the following command
 chif - read.table(c:/chif.txt, header=T, sep= )
 I have obtained from R console:undefined file! Can you please help 
me.Thank 
 you in advance.
[[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.

__
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] Problem with the installation of install R on Sun Solaris

2007-05-03 Thread Vipin Singhal
Hi All,

First we install sun studio 11 on the server and then tried to install
R

This time I am getting the different errors.

 

Please find attached the config.log files

 

1. old_config: before installation of sun studio

2. new_config:   after installation of sun studio

 

Thanks,

Vipin



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 01, 2007 8:27 PM
To: Vipin Singhal
Subject: Re: [R] Problem with the installation of install R on Sun
Solaris




Here is my config.site file that I used to compile R-2.4.1 on Solaris 10
for amd64 arch.  You will need to install sun studio 11 which you can
get at http://developers.sun.com/sunstudio/.  For building documentation
I used tetex but the guy who developed it has decided to call it quits
so you may want to go with a different tex implementation.  I am not
sure what architecture you are using so you will need to vary your
-xarch flag accordingly.  You can find more information on xarch at
http://docs.sun.com/source/819-3688/cc_ops.app.html 
Good luck! 




#!/bin/sh 

PATH=/opt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/ucb:/usr/local/teTeX/
bin/i386-pc-solaris2.10 

#Assembler and archiver 
AR=/usr/ccs/bin/ar 
AS=/usr/ccs/bin/as 

#Tools for building documentation 
TEX=/usr/local/teTeX/bin/i386-pc-solaris2.10/tex 
LATEX=/usr/local/teTeX/bin/i386-pc-solaris2.10/latex 
PDFTEX=/usr/local/teTeX/bin/i386-pc-solaris2.10/pdftex 
PDFLATEX=/usr/local/teTeX/bin/i386-pc-solaris2.10/pdflatex 
DVIPS=/usr/local/teTeX/bin/i386-pc-solaris2.10/dvips 
MAKEINFO=/usr/local/teTeX/bin/i386-pc-solaris2.10/makeinfo 

#Compiler commands 
CC=/opt/SUNWspro/bin/cc 
CXX=/opt/SUNWspro/bin/CC 
F77=/opt/SUNWspro/bin/f95 
FC=/opt/SUNWspro/bin/f95 

#Compiler flags (if you do not what to build in 64 bit then remove
-xarch=amd64) 
CFLAGS=-xO5 -xlibmil -xarch=amd64 -xmodel=medium -xlibmieee -xc99=%all

CXXFLAGS=-xO5 -xlibmil -xarch=amd64 -xmodel=medium -xlibmieee
xlang=f95 
FCFLAGS=-xO5 -xlibmil -xarch=amd64 -xmodel=medium -fsimple=0
-ftrap=%all 
FFLAGS=-xO5  -xlibmil -xarch=amd64 -xmodel=medium -fsimple=0
-ftrap=%all 

#Linker (if you do not want to build in 64 bit then use /usr/ccs/bin/ld
and remove the 64 off the end of each linked pat) 
LD=/usr/ccs/bin/amd64/ld 
LDFLAGS=-xarch=amd64 -xmodel=medium -L/usr/local/lib/64
-L/usr/sfw/lib/64 -L/lib/amd64 -L/opt/SUNWspro/lib/amd64
-L/usr/openwin/lib/64 -R/usr/local/lib/64 -R/usr/sfw/lib/64 -R/lib/amd64
-R/opt/SUNWspro/lib/amd64 

R_BROWSER=/usr/sfw/bin/mozilla 
MAKE=/usr/local/bin/make 

##LIBnn=amd64 
##r_arch=amd64 

MAIN_LD=/opt/SUNWspro/bin/cc -xarch=amd64 




Vipin Singhal [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 

05/01/2007 06:09 AM 

To

R-help@stat.math.ethz.ch 

cc



Subject

[R] Problem with the installation of install R on Sun Solaris










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



“This email and any files transmitted with it contain confidential, 
proprietary, privileged information of Symphony Services Corp (India) Pvt. Ltd. 
and are intended solely for the use of the recipient/s to whom it is addressed. 
Any unauthorized notifying, copying or distributing of this e-mail, directly or 
indirectly, and the contents therein in full or part is prohibited by any 
entity who is not a recipient. Any email received inadvertently or by mistake 
should be deleted by the entity who is not a recipient thereof. You may be 
pleased to notify the sender immediately by email and the email should be 
deleted from your system”.

 

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by R configure 2.4.1, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure 

## - ##
## Platform. ##
## - ##

hostname = ardsass1d
uname -m = i86pc
uname -r = 5.10
uname -s = SunOS
uname -v = Generic_118855-36

/usr/bin/uname -p = i386
/bin/uname -X = System = SunOS
Node = ardsass1d
Release = 5.10
KernelID = Generic_118855-36
Machine = i86pc
BusType = unknown
Serial = unknown
Users = unknown
OEM# = 0
Origin# = 1
NumCPU = 3

/bin/arch  = i86pc
/usr/bin/arch -k   = i86pc
/usr/convex/getsysinfo = unknown
hostinfo   = unknown
/bin/machine   = unknown
/usr/bin/oslevel   = unknown
/bin/universe  = unknown

PATH: /usr/sbin
PATH: /usr/bin
PATH: /opt/sfw/bin
PATH: /usr/openwin/bin


## --- ##
## Core tests. ##
## --- ##

configure:1805: checking build system type
configure:1823: result: i386-pc-solaris2.10
configure:1831: checking host system type
configure:1845: result: i386-pc-solaris2.10
configure:2397: checking for pwd
configure:2415: found /usr/bin/pwd
configure:2428: 

[R] Sharpe-Ratio

2007-05-03 Thread Soare Marcian-Alin
Hello,

Is there any possibility how i can calculate the Sharpe Ratio of a ts?

KR,
Alin Soare

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


[R] Bayesian logistic regression with a beta prior (MCMClogit)

2007-05-03 Thread francogrex

Dear all, 
I am trying to use the logistic regression with MCMClogit (package:
MCMCpack/Coda) and I want to put a beta prior on the parameters, but it's
giving me error message (please see output below) no matter what shape 1 or
2 I use. It works perfect with the cauchy or normal priors. Do you know if
there is a catch there somewhere? Thanks

logpriorfun - function(beta,shape1,shape2){ 
sum(dbeta(beta,shape1,shape2, log=T)) } 

posterior - MCMClogit(nausea~nsaid*diuretic, data=w,
verbose=2000,burnin = 1000, mcmc = 1,
user.prior.density=logpriorfun,shape1=1,shape2=1)

user.prior.density(beta.start) == -Inf.
Error in MCMClogit(nausea ~ nsaid * diuretic, data = w, verbose = 2000,  : 
Respecify and call MCMClogit() again. 

-- 
View this message in context: 
http://www.nabble.com/Bayesian-logistic-regression-with-a-beta-prior-%28MCMClogit%29-tf3684970.html#a10300145
Sent from the R help mailing list archive at Nabble.com.

__
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] Single Title for the Multiple plot page

2007-05-03 Thread Mohammad Ehsanul Karim
Dear List, 

In R we can plot multiple graphs in same page using
par(mfrow = c(*,*)). In each plot we can set title
using main and sub commands. 

However, is there any way that we can place an
universal title above the set of plots placed in the
same page (not individual plot titles, all i need is a
title of the whole graph page) as well as sib-titles?
Do I need any package to do so?

Thank you for your time.

Mohammad Ehsanul Karim (R - 2.3.1 on windows)
Institute of Statistical Research and Training
University of Dhaka

__
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] searching for special variables

2007-05-03 Thread Schmitt, Corinna
Dear R-Experts,

in my program I have a big workspace. Now I want to look for all
variables which have the letters 777 in their name (e.g. ask777first)
and afterwards I need to delete those variables. How can I reach this
aim? 

Any ideas, Corinna

__
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] Query about RODBC to access MySQL from Windows

2007-05-03 Thread Bruno C\.
First, try this kind of connection string
channel - odbcConnect(mysqldsn,uname;Password=pwd;Database=default_db) 

If it doesn't work, in order to understand if it's a permission issue, try to 
connect with another client (still using the RODBC!!if you use the mysql 
client, you will not use ODBC but the mysql driver!!!).

If it dooesn't solve the problem, give us more details on how you retrieve the 
data...

 Hi
 I am trying to use RODBC in R installed on Windows to
 access MySQL database (on a linux box).
 I set up a DSN and specified this DSN in R as follows
 library(RODBC);
 channel - odbcConnect(mysqldsn);
 RODB Connection 5
 Details:
   case=nochange
   PORT=3306
 
 Although this seems to connect properly, running any
 command yields NO results.
 i.e. sqlQuery(channel, show tables) yields 0 rows
 when there are close to 500 tables in the database.
 Ditto with any other query. It does not cause an
 error, but it returns 0 rows.
 
 The USER DSN mysqldsn is set up as follows :-
 host : zion.xxx.xxx.xxx
 default database : default_db
 port : 3306
 username : uname
 password : pwd
 
 Running  use default_db; show tables; command from
 the command prompt on the db server returns 500 rows.
 
 I find this problem while running any query. 
 Running select * from tname limit 100 returns 0 rows
 whereas tname has around a million records.
 
 In the past, I have used MySQL clients for Windows to
 access  the database without encountering any such
 problem
 
 I even tried setting up the mysqldsn DSN as a system
 DSN instead of a user DSN.
 
 I would like to know
 a) whether this is a permissions issue at some level
 b) whether there is any solution for this problem in R
 
 
 
 Thanks
 Lalitha
 
 __
 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.
 


--
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada

__
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] searching for special variables

2007-05-03 Thread Dimitris Rizopoulos
one option is use something like the following:

a - 1:10
b777 - rnorm(10)
c777 - letters[1:6]
fit - lm(b777 ~ a)
a777d777 - 5
##
lis - ls()
rm(list = c(lis[grep(777, lis)], lis))
ls()


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: Schmitt, Corinna [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Cc: Schmitt, Corinna [EMAIL PROTECTED]
Sent: Thursday, May 03, 2007 9:58 AM
Subject: [R] searching for special variables


 Dear R-Experts,

 in my program I have a big workspace. Now I want to look for all
 variables which have the letters 777 in their name (e.g. 
 ask777first)
 and afterwards I need to delete those variables. How can I reach 
 this
 aim?

 Any ideas, Corinna

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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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 with plot axis

2007-05-03 Thread Rina Miehs
Hello
 
i have a plot, and want the axis too be with larger writing, i found some 
functions but they didnt work
 
this is my plot, and if the axis can be with bigger writing can the legend 
inside the plot be in same the size??
 
plot(femsplot, xlab='Indeks',ylab='Kødprocent', pch=22)
abline(lm(femsplot), lwd=1)
points(firsplot, col='green', pch=2)
abline(lm(firsplot), lwd=1, col='green')
points(fjersplot, col='red', pch=8)
abline(lm(fjersplot), lwd=1, col='red')
legend(locator(1),legend=c('90 kg','80 kg','70 kg'),pch=c(22,2,8),lwd=1, 
col=c('black','green','red'))
i have attached the plot, so you can se it...
 
Thank you
 
Rina
__
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] searching for special variables

2007-05-03 Thread Vladimir Eremeev

ls(pattern=.*777.*)


Schmitt, Corinna wrote:
 
 Dear R-Experts,
 
 in my program I have a big workspace. Now I want to look for all
 variables which have the letters 777 in their name (e.g. ask777first)
 and afterwards I need to delete those variables. How can I reach this
 aim? 
 

-- 
View this message in context: 
http://www.nabble.com/searching-for-special-variables-tf3685103.html#a10300943
Sent from the R help mailing list archive at Nabble.com.

__
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] Single Title for the Multiple plot page

2007-05-03 Thread Chuck Cleland
Mohammad Ehsanul Karim wrote:
 Dear List, 
 
 In R we can plot multiple graphs in same page using
 par(mfrow = c(*,*)). In each plot we can set title
 using main and sub commands. 
 
 However, is there any way that we can place an
 universal title above the set of plots placed in the
 same page (not individual plot titles, all i need is a
 title of the whole graph page) as well as sib-titles?
 Do I need any package to do so?
 
 Thank you for your time.

  This is covered in a number of places in the archives and
RSiteSearch(Overall Title) points you to relevant posts. I'm not sure
there is an example of having both a title and subtitle, but that is
easy enough:

 par(mfrow=c(1,2), oma=c(2,0,2,0))
 plot(1:10)
 plot(1:10)
 title(Centered Overall Title, outer=TRUE)
 mtext(side=1, Centered Subtitle, outer=TRUE)

  You might consider upgrading to a more recent version of R.

 Mohammad Ehsanul Karim (R - 2.3.1 on windows)
 Institute of Statistical Research and Training
 University of Dhaka 
 __
 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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] Query about RODBC to access MySQL from Windows

2007-05-03 Thread Prof Brian Ripley
On Thu, 3 May 2007, Bruno C. wrote:

 First, try this kind of connection string
 channel - odbcConnect(mysqldsn,uname;Password=pwd;Database=default_db)

I presume the DSN was set up in a dialog box under Windows, and tested 
there (which provides a different client).

This makes me suspect the DSN is valid, but pointing at the wrong 
database.  I noticed (s)he did not use 'use default_db; show tables;
when running from RODBC, which would have been a fairer test.

Simple diagnostic output like that from odbcGetInfo() is missing from the 
report.

 If it doesn't work, in order to understand if it's a permission issue, 
 try to connect with another client (still using the RODBC!!if you use 
 the mysql client, you will not use ODBC but the mysql driver!!!).

 If it dooesn't solve the problem, give us more details on how you 
 retrieve the data...

(And read the posting guide and try to ask a question that we have some 
hope of answering, for example, one about R!)

 Hi
 I am trying to use RODBC in R installed on Windows to
 access MySQL database (on a linux box).
 I set up a DSN and specified this DSN in R as follows
 library(RODBC);
 channel - odbcConnect(mysqldsn);
 RODB Connection 5
 Details:
   case=nochange
   PORT=3306
 
 Although this seems to connect properly, running any
 command yields NO results.
 i.e. sqlQuery(channel, show tables) yields 0 rows
 when there are close to 500 tables in the database.
 Ditto with any other query. It does not cause an
 error, but it returns 0 rows.

 The USER DSN mysqldsn is set up as follows :-
 host : zion.xxx.xxx.xxx
 default database : default_db
 port : 3306
 username : uname
 password : pwd

 Running  use default_db; show tables; command from
 the command prompt on the db server returns 500 rows.

 I find this problem while running any query.
 Running select * from tname limit 100 returns 0 rows
 whereas tname has around a million records.

 In the past, I have used MySQL clients for Windows to
 access  the database without encountering any such
 problem

 I even tried setting up the mysqldsn DSN as a system
 DSN instead of a user DSN.

 I would like to know
 a) whether this is a permissions issue at some level
 b) whether there is any solution for this problem in R



 Thanks
 Lalitha

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Odp: help with plot axis

2007-05-03 Thread Petr PIKAL
Hi
[EMAIL PROTECTED] napsal dne 03.05.2007 10:33:22:

 Hello
 
 i have a plot, and want the axis too be with larger writing, i found 
some 
 functions but they didnt work
 
 this is my plot, and if the axis can be with bigger writing can the 
legend 
 inside the plot be in same the size??
 
 plot(femsplot, xlab='Indeks',ylab='Kødprocent', pch=22)
 abline(lm(femsplot), lwd=1)
 points(firsplot, col='green', pch=2)
 abline(lm(firsplot), lwd=1, col='green')
 points(fjersplot, col='red', pch=8)
 abline(lm(fjersplot), lwd=1, col='red')
 legend(locator(1),legend=c('90 kg','80 kg','70 
kg'),pch=c(22,2,8),lwd=1, 
 col=c('black','green','red'))
 i have attached the plot, so you can se it...

I would recommend you to:
read help pages

?plot
?axis
?par
?legend

with special attention to cex and its companion parameters

Regards
Petr

 
 Thank you
 
 Rina
 __
 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.


Re: [R] Install SciView under Windows Vista

2007-05-03 Thread Uwe Ligges
I guess you have an outdated version of R2HTML. Please run 
update.packages(checkBuilt=TRUE) and try again. If it still does not 
work, please notify its package maintainer and tell him the package's 
version number.

Uwe Ligges



Tim Sippel wrote:
 Hello-
 I have been trying to install SciView under Windows Vista (Home Premium
 version,
 32 bit OS, Intel Core Duo 2.13GHz, 2Gig RAM).
 
 I am getting an error, apparently related to the R2HTML package (version
 1.54)
 as you will see in the R information below my signature.
 
 I have tried to email directly to [EMAIL PROTECTED] for support but have
 had my message returned as undeliverable.
 
 Your help is very much appreciated!
 
 Tim
 
 R version 2.5.0 (2007-04-23)
 Copyright (C) 2007 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.
 
   Natural language support but running in an English locale
 
 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.
 
 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.
 
 [Previously saved workspace restored]
 
 Loading required package: datasets
 Loading required package: utils
 Loading required package: grDevices
 Loading required package: graphics
 Loading required package: stats
 Loading required package: tcltk
 Loading Tcl/Tk interface ... done
 Loading required package: R2HTML
 Error in `parent.env-`(`*tmp*`, value = NULL) :
 use of NULL environment is defunct
 In addition: Warning message:
 'Sys.putenv' is deprecated.
 Use 'Sys.setenv' instead.
 See help(Deprecated)
 Error: package 'R2HTML' could not be loaded
 local({pkg - select.list(sort(.packages(all.available = TRUE)))
 + if(nchar(pkg)) library(pkg, character.only=TRUE)})
 Error in `parent.env-`(`*tmp*`, value = NULL) :
 use of NULL environment is defunct
 Error: package/namespace load failed for 'R2HTML'
 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)
 
 search()
  [1] .GlobalEnvpackage:tcltk package:stats
  [4] package:graphics  package:grDevices package:utils
  [7] package:datasets  package:methods   Autoloads
 [10] package:base
 capabilities(tcltk)
 tcltk
  TRUE
 
   [[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.

__
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] Nested ANOVA in R

2007-05-03 Thread Majid Iravani
Dear R users,

I installed an experiment as following setup:

- Four plant species
- Seed addition as main factor with two levels: control and seed addition.
- Four replicates (sites)
- 8 plots in each site arranged as two rows (each rows 4 plots) one meter 
far from each other
- Four sub-plots in each plot (therefore 32 sub-plots in each site)
- In the four plots in each site (first row of plots) seeds of each of four 
plant species were sowed onto one sub-plot by random (therefore 4 sub-plots 
sown by a plant species in four different plots in each site).
In the other four plots (second row of plots) one sub-plot selected by 
random as control for each of four plant species (therefore 4 sub-plots in 
four different plots in each site as control for a plant species).

Now, my first question is about the name of this design. I thought this is 
a 3-factor split-plot arrangement.

My second question is about data analysis for this experiment in R. I would 
like to test the effect of seed addition and sites on the seedling 
emergence of each plant species separately using a three- way ANOVA (??). 
Because of the hierarchical experimental design, the experiment must be 
analyzed by nested ANOVA but I do not know how I must arrange dataset and 
then how to write ANOVA model in R.

I would greatly appreciate if somebody gives me some comments on these cases

Thank you very much in advance,

Majid

  Majid Iravani
  PhD Student
  Swiss Federal Research Institute WSL
  Research Group of Vegetation Ecology
  Zürcherstrasse 111  CH-8903 Birmensdorf  Switzerland
  Phone: +41-1-739-2693
  Fax: +41-1-739-2215
  Email: [EMAIL PROTECTED]
http://www.wsl.ch/staff/majid.iravani/

__
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] Install SciView under Windows Vista

2007-05-03 Thread Prof Brian Ripley
Are you sure your version of R2HTML is up-to-date and built under R 2.5.0?
Use update.packages(checkBuilt=TRUE) if you have not already done so.

That got me R2HTML 1.58, not 1.54.

On Thu, 3 May 2007, Tim Sippel wrote:

 Hello-
 I have been trying to install SciView under Windows Vista (Home Premium
 version,
 32 bit OS, Intel Core Duo 2.13GHz, 2Gig RAM).

 I am getting an error, apparently related to the R2HTML package (version
 1.54)
 as you will see in the R information below my signature.

 I have tried to email directly to [EMAIL PROTECTED] for support but have
() had my message returned as undeliverable.

 Your help is very much appreciated!

 Tim

 R version 2.5.0 (2007-04-23)
 Copyright (C) 2007 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0

 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.

 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.

 [Previously saved workspace restored]

 Loading required package: datasets
 Loading required package: utils
 Loading required package: grDevices
 Loading required package: graphics
 Loading required package: stats
 Loading required package: tcltk
 Loading Tcl/Tk interface ... done
 Loading required package: R2HTML
 Error in `parent.env-`(`*tmp*`, value = NULL) :
use of NULL environment is defunct
 In addition: Warning message:
 'Sys.putenv' is deprecated.
 Use 'Sys.setenv' instead.
 See help(Deprecated)
 Error: package 'R2HTML' could not be loaded
 local({pkg - select.list(sort(.packages(all.available = TRUE)))
 + if(nchar(pkg)) library(pkg, character.only=TRUE)})
 Error in `parent.env-`(`*tmp*`, value = NULL) :
use of NULL environment is defunct
 Error: package/namespace load failed for 'R2HTML'
 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)

 search()
 [1] .GlobalEnvpackage:tcltk package:stats
 [4] package:graphics  package:grDevices package:utils
 [7] package:datasets  package:methods   Autoloads
 [10] package:base
 capabilities(tcltk)
 tcltk
 TRUE

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Filling array: No recycling

2007-05-03 Thread Felix Wave
Hello,
is it possible to fill an array with no using of the recycling rule?
My problem. I want to fill an array but my values have not always
the same length.
My aim. I want to fill the array only ONE TIME. All vacent places
should be written with NA.



Thank's a lot.
Felix


Example:


#Write 1 to 3 only one time. The last
#5 place should be NA.

dim(as.array(letters))
array(1:3, c(2,4) )

#na.strings = NA

__
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] Filling array: No recycling

2007-05-03 Thread Petr Klasterecky
First make your vectors to have the same length and then put them to the 
array.

  x - c(1,2)
  x
[1] 1 2
  length(x) - 5
  x
[1]  1  2 NA NA NA


Petr


Felix Wave napsal(a):
 Hello,
 is it possible to fill an array with no using of the recycling rule?
 My problem. I want to fill an array but my values have not always
 the same length.
 My aim. I want to fill the array only ONE TIME. All vacent places
 should be written with NA.
 
 
 
 Thank's a lot.
 Felix
 
 
 Example:
 
 
 #Write 1 to 3 only one time. The last
 #5 place should be NA.
 
 dim(as.array(letters))
 array(1:3, c(2,4) )
 
 #na.strings = NA
 
 __
 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.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
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] Problem with the installation of install R on Sun Solaris

2007-05-03 Thread Jomy Jose
*** Error code 1
make: Fatal error: Command failed for target `R.bin'
Current working directory /opt/dev/R/R-2.4.1/src/main
*** Error code 1
The following command caused the error:
make install-bin-local
make: Fatal error: Command failed for target `R'
Current working directory /opt/dev/R/R-2.4.1/src/main
*** Error code 1
The following command caused the error:
for d in scripts include extra appl nmath unix main modules library; do \
  (cd ${d}  make R) || exit 1; \
done
make: Fatal error: Command failed for target `R'
Current working directory /opt/dev/R/R-2.4.1/src
*** Error code 1
The following command caused the error:
for d in m4 tools doc etc share src tests  po; do \
  (cd ${d}  make R) || exit 1; \
done
make: Fatal error: Command failed for target `R'

[[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] Filling array: No recycling

2007-05-03 Thread Prof Brian Ripley
How about

A - array(NA, c(2,4) )
x - 1:3
A[seq_along(x)] - x

?

On Thu, 3 May 2007, Felix Wave wrote:

 Hello,
 is it possible to fill an array with no using of the recycling rule?
 My problem. I want to fill an array but my values have not always
 the same length.
 My aim. I want to fill the array only ONE TIME. All vacent places
 should be written with NA.



 Thank's a lot.
 Felix


 Example:
 

 #Write 1 to 3 only one time. The last
 #5 place should be NA.

 dim(as.array(letters))
 array(1:3, c(2,4) )

 #na.strings = NA

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Filling array: No recycling

2007-05-03 Thread Robin Hankin
Felix

I'm not quite sure I understand your example, but try:

a - array(NA,c(2,2,3))
jj - c(12,33,22)
a[1:length(jj)] - jj
a

which will fill only the first three elemens of array a


HTH

rksh



On 3 May 2007, at 10:41, Felix Wave wrote:

 Hello,
 is it possible to fill an array with no using of the recycling rule?
 My problem. I want to fill an array but my values have not always
 the same length.
 My aim. I want to fill the array only ONE TIME. All vacent places
 should be written with NA.



 Thank's a lot.
 Felix


 Example:
 

 #Write 1 to 3 only one time. The last
 #5 place should be NA.

 dim(as.array(letters))
 array(1:3, c(2,4) )

 #na.strings = NA

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

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

__
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] searching for special variables

2007-05-03 Thread Vladimir Eremeev

sorry, forgot to delete objects.

rm(list=ls(pattern=.*777.*))


Vladimir Eremeev wrote:
 
 ls(pattern=.*777.*)
 
 
 Schmitt, Corinna wrote:
 
 in my program I have a big workspace. Now I want to look for all
 variables which have the letters 777 in their name (e.g. ask777first)
 and afterwards I need to delete those variables. How can I reach this
 aim? 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/searching-for-special-variables-tf3685103.html#a10302565
Sent from the R help mailing list archive at Nabble.com.

__
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] Plotting more errorbar-functions in one plot

2007-05-03 Thread Hedwig Franziska Maria Zimmerer
Hello,

it´s new for me tu use R for my statistics analysis, so I need some help.

The problem is:
I want to plot errorbar-functions from two measurements in one 
coordinate-system. For that I use the following code:
library(sfsmisc)
errbar(XAchse,Means,Mins,Maxs,xlab=,ylab=,xlim=range(0,100)) 
lines(XAchse,Means)
par(new=TRUE)   
errbar(XAchse,MeansN,MinsN,MaxsN,xlab=,ylab=,xlim=range(0,100))  
lines(XAchse,MeansN)

My problem is, that I want to have the same scaling on the x-axis, but I don´t 
know, what I have to do for that.

If I say:
errbar(XAchse,MeansN,MinsN,MaxsN,xlab=,ylab=,xlim=range(0,100), ylim= 
yrange(0,1))  
I get the following error:
Error in plot.default(x, y, ylim = range(y, yplus, yminus), xlab = 
xlab,  :
formal argument ylim matched by multiple actual arguments

I tried a lot of things, but nothing helped.

__
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] searching for special variables

2007-05-03 Thread Gabor Grothendieck
Try:

rm(list = ls(patt = 777))


On 5/3/07, Schmitt, Corinna [EMAIL PROTECTED] wrote:
 Dear R-Experts,

 in my program I have a big workspace. Now I want to look for all
 variables which have the letters 777 in their name (e.g. ask777first)
 and afterwards I need to delete those variables. How can I reach this
 aim?

 Any ideas, Corinna

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


Re: [R] Single Title for the Multiple plot page

2007-05-03 Thread Stephen Tucker
Sometimes I just overlay a blank plot and annotate with text.

par(mfrow=c(1,2), oma=c(2,0,2,0))
plot(1:10)
plot(1:10)
oldpar - par()
par(mfrow=c(1,1),new=TRUE,mar=rep(0,4),oma=rep(0,4))
plot.window(xlim=c(0,1),ylim=c(0,1),mar=rep(0,4))
text(0.5,c(0.98,0.02),c(Centered Overall Title,Centered Subtitle),
 cex=c(1.4,1))
par(oldpar)


--- Chuck Cleland [EMAIL PROTECTED] wrote:

 Mohammad Ehsanul Karim wrote:
  Dear List, 
  
  In R we can plot multiple graphs in same page using
  par(mfrow = c(*,*)). In each plot we can set title
  using main and sub commands. 
  
  However, is there any way that we can place an
  universal title above the set of plots placed in the
  same page (not individual plot titles, all i need is a
  title of the whole graph page) as well as sib-titles?
  Do I need any package to do so?
  
  Thank you for your time.
 
   This is covered in a number of places in the archives and
 RSiteSearch(Overall Title) points you to relevant posts. I'm not sure
 there is an example of having both a title and subtitle, but that is
 easy enough:
 
  par(mfrow=c(1,2), oma=c(2,0,2,0))
  plot(1:10)
  plot(1:10)
  title(Centered Overall Title, outer=TRUE)
  mtext(side=1, Centered Subtitle, outer=TRUE)
 
   You might consider upgrading to a more recent version of R.
 
  Mohammad Ehsanul Karim (R - 2.3.1 on windows)
  Institute of Statistical Research and Training
  University of Dhaka 
  __
  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. 
 
 -- 
 Chuck Cleland, Ph.D.
 NDRI, Inc.
 71 West 23rd Street, 8th floor
 New York, NY 10010
 tel: (212) 845-4495 (Tu, Th)
 tel: (732) 512-0171 (M, W, F)
 fax: (917) 438-0894
 
 __
 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.


Re: [R] Single Title for the Multiple plot page

2007-05-03 Thread jim holtman
Here is a way of putting  a title in the outer margin:

par(mfrow=c(2,2), oma=c(0,0,3,0))  # leave space in outer margin
plot(1)
plot(2)
plot(3)
plot(4)
mtext('Outer Title', adj=0.5, side=3, outer=TRUE)

On 5/3/07, Mohammad Ehsanul Karim [EMAIL PROTECTED] wrote:
 Dear List,

 In R we can plot multiple graphs in same page using
 par(mfrow = c(*,*)). In each plot we can set title
 using main and sub commands.

 However, is there any way that we can place an
 universal title above the set of plots placed in the
 same page (not individual plot titles, all i need is a
 title of the whole graph page) as well as sib-titles?
 Do I need any package to do so?

 Thank you for your time.

 Mohammad Ehsanul Karim (R - 2.3.1 on windows)
 Institute of Statistical Research and Training
 University of Dhaka

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



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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] hi

2007-05-03 Thread elyakhlifi mustapha
hi,
I have a problem to use union function because one of the elements is a 
character and the others are numeric 

 for(j in 1:length(I)) {
+ C1 - levels(factor(subset(donParEssai, Id_Essai == 1006961  Id_Cara == 
I[j], select = Date_O)[,1]))
+ C2 - as.numeric(levels(factor(subset(donParEssai, Id_Essai == 1006961  
Id_Cara == I[j], select = Stade_O)[,1])))
+ C3 - length(as.numeric(levels(factor(subset(donParEssai, Id_Essai == 1006961 
 Id_Cara == I[j], select = Id_Geno)[,1]
+ C4 - length(levels(factor(subset(donParEssai, Id_Essai == 1006961  Id_Cara 
== I[j], select = Id_Rep)[,1])))
+ C5 - mean(as.numeric(as.character(subset(donParEssai, Id_Essai == 1006961  
Id_Cara == I[j], select = Val_O)[,1])))
+ C6 - range(as.numeric(as.character(subset(donParEssai, Id_Essai == 1006961  
Id_Cara == I[j], select = Val_O)[,1])))
+ C7 - sd(as.numeric(as.character(subset(donParEssai, Id_Essai == 1006961  
Id_Cara == I[j], select = Val_O)[,1])))
+ RecapCara[j,] - 
union(C1,union(C2,union(C3,union(C4,union(C5,union(C6,C7))
+ }
Erreur dans RecapCara[j, ] - union(C1, union(C2, union(C3, union(C4, union(C5, 
 : 
le nombre d'objets à remplacer n'est pas multiple de la taille du 
remplacement
 print(RecapCara)
 [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]   NA   213  7.66129  5.2 17.1 2.318801
[2,]   NA   213 50.56774 47.3 53.9 1.469222

 C1
[1] 29/08/2005

I can't paste C1 with others values how could I do to paste C1 with others 
please?


  
___





[[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] Odp: about using read.table

2007-05-03 Thread John Kane
I believe you mean R for Windows 2.16 ?
--- Petr PIKAL [EMAIL PROTECTED] wrote:

 Hi
 
 Did you see FAQ 2.16?
 
 Try file.choose()
 
 Regards
 
 Petr
 [EMAIL PROTECTED]
 
 [EMAIL PROTECTED] napsal dne
 03.05.2007 02:26:27:
 
  Hi,Dear R users, I have a file text nommed chif
 which contains 16 
 lines and 
  4 columns in the disc dur. I have a difficulty to
 read this file in R 
 console 
  I have used the following command
  chif - read.table(c:/chif.txt, header=T, sep=
 )
  I have obtained from R console:undefined file! Can
 you please help 
 me.Thank 
  you in advance.
 [[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.
 
 __
 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.


Re: [R] Multiple scatterplots

2007-05-03 Thread John Kane

--- Bert Gunter [EMAIL PROTECTED] wrote:

 Please note: in R you can specify (some of the)
 graphics parameters as the
 appropriate length vectors. So your plot example
 below can also be done as,
 for example:
 
 plot(

rep.int(aa,3),c(cc,bb,dd),col=rep(c(red,blue,green),e=length(aa)))
 
 However, this doesn't seem to fit the posted
 request, where maybe something
 like a trellis plot of the different distributions
 is what is wanted?? --
 but I may well misunderstand.

Thanks, that's a nice way to do things.  

I, too, am not sure what the OP wanted.  The subject
and the text differed so I went with the text.  You
may well be right or simple par(mfrow=3) might do it. 

  
 Bert Gunter
 Genentech Nonclinical Statistics
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf
 Of John Kane
 Sent: Wednesday, May 02, 2007 11:06 AM
 To: Kostadin Cholakov; r-help@stat.math.ethz.ch
 Subject: Re: [R] Multiple scatterplots
 
 Your title and your posting do not say the same
 thing.
  
 
 Assuming you want all three distributions on one
 scatter plot does this help?
 
 aa - 1:10
 bb - 11:2
 cc  - bb^2
 dd - c(3,4,7,9,11,32,11,14,5,9)
 
 plot(aa,cc, col=red)
 points(aa,bb, col=blue)
 points(aa,dd, col=green)
 
 Also in plotting it is a good idea to look at all
 the
 variations etc that you can get with par()
 
 Type  ?par 
 
 --- Kostadin Cholakov [EMAIL PROTECTED] wrote:
 
  Hi,
  
  I have to plot three Ziph distributions for three
  languages where the
  x value represents the rank of a given word and
 the
  y value represents
  the relative frequency of this word in the corpus.
  Is there some way
  so that I can plot all three distributions on a
  single scatterplot,
  preferably with different colours :) I tried to
 find
  something in the
  R manual but there are no such examples :( Thank
  you!
  
  __
  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-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] Odp: hi

2007-05-03 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 03.05.2007 14:01:27:

 hi,
 I have a problem to use union function because one of the elements is a 
 character and the others are numeric 
 
  for(j in 1:length(I)) {
 + C1 - levels(factor(subset(donParEssai, Id_Essai == 1006961  Id_Cara 
== 
 I[j], select = Date_O)[,1]))
 + C2 - as.numeric(levels(factor(subset(donParEssai, Id_Essai == 1006961 
 
 Id_Cara == I[j], select = Stade_O)[,1])))
 + C3 - length(as.numeric(levels(factor(subset(donParEssai, Id_Essai == 
 1006961  Id_Cara == I[j], select = Id_Geno)[,1]
 + C4 - length(levels(factor(subset(donParEssai, Id_Essai == 1006961  
Id_Cara
 == I[j], select = Id_Rep)[,1])))
 + C5 - mean(as.numeric(as.character(subset(donParEssai, Id_Essai == 
1006961 
 Id_Cara == I[j], select = Val_O)[,1])))
 + C6 - range(as.numeric(as.character(subset(donParEssai, Id_Essai == 
1006961 
  Id_Cara == I[j], select = Val_O)[,1])))
 + C7 - sd(as.numeric(as.character(subset(donParEssai, Id_Essai == 
1006961  
 Id_Cara == I[j], select = Val_O)[,1])))
 + RecapCara[j,] - 
union(C1,union(C2,union(C3,union(C4,union(C5,union(C6,C7))
 + }
 Erreur dans RecapCara[j, ] - union(C1, union(C2, union(C3, union(C4, 
union(C5,  : 
 le nombre d'objets ŕ remplacer n'est pas multiple de la taille 
du remplacement
  print(RecapCara)
  [,1] [,2] [,3] [,4] [,5] [,6] [,7]
 [1,]   NA   213  7.66129  5.2 17.1 2.318801
 [2,]   NA   213 50.56774 47.3 53.9 1.469222
 
  C1
 [1] 29/08/2005
 
 I can't paste C1 with others values how could I do to paste C1 with 
others please?

Change it to numeric?

Regards
Petr

 
 
 
 
___
 
 
 
 
 
[[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.

__
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] upgrade to 2.5

2007-05-03 Thread bogdan romocea
I find it easier to install all the packages again:

#---run in previous version
packages - installed.packages()[,Package]
save(packages, file=Rpackages)

#---run in new version
load(Rpackages)
for (p in setdiff(packages, installed.packages()[,Package]))
install.packages(p)


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Robert
 A LaBudde
 Sent: Wednesday, May 02, 2007 5:39 PM
 To: R-help@stat.math.ethz.ch
 Subject: Re: [R] upgrade to 2.5

 At 01:41 PM 5/2/2007, you wrote:
 On 5/2/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote:
  
  
   Iasonas Lamprianou said the following on 5/2/2007 8:25 AM:
Hi I am using R version 2.4.1. How can I upgrade to version 2.5
  without having to install all the packages again?
Thanks
Jason
   
  
   You may find the following link relevant.
  
   http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359.html
  
 
 if you use Windows XP.

 This link was useful to me, as I am new to R. (Win2000, R-2.5.0)

 What I have been doing is using a file compare utility (Beyond
 Compare in my case) to move files in the old library directory to
 the new one, if the files are missing in the new one. Then I perform
 an update.packages command.

 This procedure appears to work without problem.

 It would seem much preferable to have all packages saved in an
 installation-independent directory, instead of a library directory
 under R's installation directory. Then, of course, no update would be
 necessary.

 I can't find how this option is settable in R, other than a direct
 argument to library() or install.package().

 How does one shift the R default libraries location to a
 particular directory?

 Thanks.

 
 Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
 Least Cost Formulations, Ltd.URL: http://lcfltd.com/
 824 Timberlake Drive Tel: 757-467-0954
 Virginia Beach, VA 23464-3239Fax: 757-467-2947

 Vere scire est per causas scire

 __
 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] convert text to exprission good for lm arguments

2007-05-03 Thread Vadim Ogranovich
Hi, 

I ran into a problem of converting a text representation of an expression into 
parsed expression to be further evaluated inside lm (). 

 n - 100 
 data - data.frame(x= rnorm (n), y= rnorm (n)) 
 data. lm - lm (y ~ x, data=data) 
 
 ## this works 
 update(data. lm , subset=x0) 

Call: 
lm (formula = y ~ x, data = data, subset = x  0) 

Coefficients: 
(Intercept) x 
-0.07864094193322170023 -0.14596982635007796358 

 
 ## this doesn't work 
 ## text representation of subset 
 subset - x0 
 update(data. lm , subset=parse(text=subset)) 
Error in `[.data.frame`(list(y = c(-0.601925958140825, -0.111931189071517, : 
invalid subscript type 

What is the correct way to convert x0 into a valid subset argument? 

Thanks, 
Vadim 

[[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] Sharpe-Ratio

2007-05-03 Thread John Kane
http://finzi.psych.upenn.edu/R/library/tseries/html/sharpe.html
--- Soare Marcian-Alin [EMAIL PROTECTED] wrote:

 Hello,
 
 Is there any possibility how i can calculate the
 Sharpe Ratio of a ts?
 
 KR,
 Alin Soare
 
   [[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.


__
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] adding a column to a matrix

2007-05-03 Thread Vladimir Eremeev
Hello,

Please, consider the functions pmin and pmax.

Tuesday, May 1, 2007, 3:29:54 PM, you wrote:

rc thanks for the previous advice it seems to have worked what about the 
following
  
rc l have the following dataset and would like to calculate the actual 
survival time by
rc  if censoring time  survival time then actual survival time
rc =survival time else its= censoring time.
rc    treatmentgrp strata  censoringTime    survivalTime     censoring   
actualsurvivaltim
rc     [1,]     1  1   1.012159   
1137.80922    0
rc   [2,]     2  2  32.971439   247.21786          
   0
rc   [3,]     2  1  85.758253   797.04949          
   0
rc   [4,]     1  1  16.999171    
78.92309  0
  
rc  l used matrix to genarate the data
rc  thanks in advance
rc Vladimir Eremeev [EMAIL PROTECTED] wrote:  
rc m-cbind(m,0)
m[m[,3]m[,4],5]-1
rc colnames(m)[5]-censoring


rc raymond chiruka wrote:
 
 i would like to add a variable to an existing matrix by manipulating 2
 previous variables eg for the data
   m
  treat strata  censti survTime
 [1,] 1  2  284.684074  690.4961005
 [2,] 1  1  172.764515   32.3990335
 [3,] 1  1 2393.195400   24.6145279
 [4,] 2  1   30.3647718.0272267
 [5,] 1  1  523.182282  554.7659501
 
   l would want to add a new column censoring by comparing ( if censti 
 survtime then censoring=1) how do l go about it
   thanks
 
   the code l used to generate the data is
n=100
m=matrix(nrow=n,ncol=4)
colnames(m)=c(treat,  strata, censti, survTime)
for(i in 1:100)
 m[i,]=c(sample(c(1,2),1,replace=TRUE),sample(c(1,2),1,replace=TRUE),rexp(1,.002),rexp(1,.005))
m
 
   l know its ugly but it seems to work 
   any suggestions l still new at this
   thanks

-- 
Best regards,
 Vladimirmailto:[EMAIL PROTECTED]


--SevinMail--

__
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] convert text to exprission good for lm arguments

2007-05-03 Thread Gabor Grothendieck
Try:

do.call(update, list(data.lm, subset = parse(text = subset)))

On 5/3/07, Vadim Ogranovich [EMAIL PROTECTED] wrote:
 Hi,

 I ran into a problem of converting a text representation of an expression 
 into parsed expression to be further evaluated inside lm ().

  n - 100
  data - data.frame(x= rnorm (n), y= rnorm (n))
  data. lm - lm (y ~ x, data=data)
 
  ## this works
  update(data. lm , subset=x0)

 Call:
 lm (formula = y ~ x, data = data, subset = x  0)

 Coefficients:
 (Intercept) x
 -0.07864094193322170023 -0.14596982635007796358

 
  ## this doesn't work
  ## text representation of subset
  subset - x0
  update(data. lm , subset=parse(text=subset))
 Error in `[.data.frame`(list(y = c(-0.601925958140825, -0.111931189071517, :
 invalid subscript type

 What is the correct way to convert x0 into a valid subset argument?

 Thanks,
 Vadim

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


__
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] convert text to exprission good for lm arguments

2007-05-03 Thread Vladimir Eremeev


Vadim Ogranovich wrote:
 
 Hi, 
 
 I ran into a problem of converting a text representation of an expression
 into parsed expression to be further evaluated inside lm (). 
 
 n - 100 
 data - data.frame(x= rnorm (n), y= rnorm (n)) 
 data. lm - lm (y ~ x, data=data) 
 
 ## this works 
 update(data. lm , subset=x0) 
 
 Call: 
 lm (formula = y ~ x, data = data, subset = x  0) 
 
 Coefficients: 
 (Intercept) x 
 -0.07864094193322170023 -0.14596982635007796358 
 
 
 ## this doesn't work 
 ## text representation of subset 
 subset - x0 
 update(data. lm , subset=parse(text=subset)) 
 Error in `[.data.frame`(list(y = c(-0.601925958140825, -0.111931189071517,
 : 
 invalid subscript type 
 
 What is the correct way to convert x0 into a valid subset argument? 
 

update(data.lm,subset=eval(parse(text=subset)))
-- 
View this message in context: 
http://www.nabble.com/convert-text-to-exprission-good-for-lm-arguments-tf3686309.html#a10304608
Sent from the R help mailing list archive at Nabble.com.

__
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] factanal AIC?

2007-05-03 Thread Jens Oehlschlägel
Dear list members,

Could any expert on factor analysis be so kind to explain how to calculate AIC 
on the output of factanal. Do I calculate AIC wrong or is 
factanal$criteria[objective] not a negative log-likelihood?

Best regards


Jens Oehlschlägel



The AIC calculated using summary.factanal below don't appear correct to me:

  n items factors total.df rest.df model.df   LL   AIC  
AICc   BIC
1  100020   1  210 170   40 -5.192975386  90.38595  
93.80618  286.6962
2  100020   2  210 151   59 -3.474172303 124.94834 
132.48026  414.5059
3  100020   3  210 133   77 -1.745821627 157.49164 
170.51984  535.3888
4  100020   4  210 116   94 -0.120505369 188.24101 
207.97582  649.5700
5  100020   5  210 100  110 -0.099209921 220.19842 
247.66749  760.0515
6  100020   6  210  85  125 -0.072272695 250.14455 
286.18574  863.6140
7  100020   7  210  71  139 -0.054668588 278.10934 
323.36515  960.2873
8  100020   8  210  58  152 -0.041708051 304.08342 
358.99723 1050.0622
9  100020   9  210  46  164 -0.028686298 328.05737 
392.87174 1132.9292
10 100020  10  210  35  175 -0.015742783 350.03149 
424.78877 1208.8887
11 100020  11  210  25  185 -0.007007901 370.01402 
454.55947 1277.9487
12 100020  12  210  16  194 -0.005090725 388.01018 
481.99776 1340.1147


summary.factanal - function(object, ...){
  if (inherits(object, try-error)){
c(n=NA, items=NA, factors=NA, total.df=NA, rest.df=NA, model.df=NA, LL=NA, 
AIC=NA, AICc=NA, BIC=NA)
  }else{
n - object$n.obs
p - length(object$uniquenesses)
m - object$factors
model.df - (p*m) + (m*(m+1))/2 + p - m^2
total.df - p*(p+1)/2
rest.df - total.df - model.df # = object$dof
LL - -as.vector(object$criteria[objective])
k - model.df
aic - 2*k - 2*LL
aicc - aic + (2*k*(k+1))/(n-k-1)
bic  - k*log(n) - 2*LL
c(n=n, items=p, factors=m, total.df=total.df, rest.df=rest.df, 
model.df=model.df, LL=LL, AIC=aic, AICc=aicc, BIC=bic)
  }
}

multifactanal - function(factors=1:3, ...){
  names(factors) - factors
  ret - lapply(factors, function(factors){
try(factanal(factors=factors, ...))
  })
  class(ret) - multifactanal
  ret
}

summary.multifactanal - function(object,...){
  do.call(rbind, lapply(object, summary.factanal))
}

print.multifactanal - function(x,...){
  ret - summary.multifactanal(x)
  print(ret, ...)
  invisible(ret)
}

# simulate a true 4-factor model
n - 1000
ktrue - 4
kfac - 5
true - matrix(rnorm(n*ktrue), ncol=ktrue)
x - matrix(rep(true, kfac)+rnorm(n*ktrue*kfac), ncol=ktrue*kfac)
dimnames(x) - list(NULL, paste(rep(letters[1:ktrue], kfac), rep(1:kfac, 
rep(ktrue, kfac)), sep=))
covmat - cov.wt(x)
# run factanal for several numbers of factors
mf - multifactanal(factors=1:12, covmat=covmat)
mf


version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  5.0 
year   2007
month  04  
day23  
svn rev41293   
language   R   
version.string R version 2.5.0 (2007-04-23)
-- 
Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
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] upgrade to 2.5

2007-05-03 Thread Vladimir Eremeev

I usually install a new version over the old one (in the same directory). 
I did this since R 1.xx, using windows 2000 and then windows XP.
No bugs were found, everything always works fine.


Iasonas Lamprianou wrote:
 
 Hi I am using R version 2.4.1. How can I upgrade to version 2.5 without
 having to install all the packages again? 
 Thanks
 Jason
  
 

-- 
View this message in context: 
http://www.nabble.com/upgrade-to-2.5-tf3681336.html#a10304613
Sent from the R help mailing list archive at Nabble.com.

__
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] Problem with GARCH models in R compared to S-PLUS

2007-05-03 Thread Shubha Karanth
Hi R,

 I have three queries regarding handling GARCH functions in R. Below I
document the same:



Unlike S-Plus, R doesn't handle Multivariate GARCH models.
R has a package for BEKK GARCH model but not for DVEC GARCH models.
The GARCH function in S-PLUS has the capability of fixing some model
parameters at certain values to evaluate the fit of a particular model. But
the same optionality is not provided by the GARCH models in R.


So, how can I overcome these difficulties which I am facing in R? Are these
procedures in the development stage of R? (I mean the packages are yet to be
built?)..Any developmental work going on with this?

Thank a lot for your help,

Shubha

[[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] convert text to exprission good for lm arguments

2007-05-03 Thread Gabor Grothendieck
On 5/3/07, Vladimir Eremeev [EMAIL PROTECTED] wrote:


 Vadim Ogranovich wrote:
 
  Hi,
 
  I ran into a problem of converting a text representation of an expression
  into parsed expression to be further evaluated inside lm ().
 
  n - 100
  data - data.frame(x= rnorm (n), y= rnorm (n))
  data. lm - lm (y ~ x, data=data)
 
  ## this works
  update(data. lm , subset=x0)
 
  Call:
  lm (formula = y ~ x, data = data, subset = x  0)
 
  Coefficients:
  (Intercept) x
  -0.07864094193322170023 -0.14596982635007796358
 
 
  ## this doesn't work
  ## text representation of subset
  subset - x0
  update(data. lm , subset=parse(text=subset))
  Error in `[.data.frame`(list(y = c(-0.601925958140825, -0.111931189071517,
  :
  invalid subscript type
 
  What is the correct way to convert x0 into a valid subset argument?
 

 update(data.lm,subset=eval(parse(text=subset)))

Just wanted to point out one difference.  Using eval
is not quite the same as using do.call since the
Call: part does not come out as desired if you use eval but if you
use do.call it comes out good enough that you can tell what was
intended to be subset from the output:

 update(data.lm,subset=eval(parse(text=subset)))

Call:
lm(formula = y ~ x, data = data, subset = eval(parse(text = subset)))

Coefficients:
(Intercept)x
-0.1335  -0.1248


 do.call(update, list(data.lm, subset = parse(text = subset)))

Call:
lm(formula = y ~ x, data = data, subset = expression(x  0))

Coefficients:
(Intercept)x
-0.1335  -0.1248

__
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] Sharpe-Ratio

2007-05-03 Thread AA
have a look at Rmetrics
www.rmetrics.org for R in finance in general

and the taskview
http://cran.r-project.org/src/contrib/Views/

I hope that helps.
AA.
- Original Message - 
From: Soare Marcian-Alin [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Wednesday, May 02, 2007 6:32 PM
Subject: [R] Sharpe-Ratio


 Hello,

 Is there any possibility how i can calculate the Sharpe Ratio of a ts?

 KR,
 Alin Soare

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

__
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 install previous packages after upgrading to R 2.5.0?

2007-05-03 Thread Don MacQueen
I use a script, i.e., place a few lines of R code in a file:

## create a vector of package names
my.packages - c('pkgname1','pkgname2','pkgname3')

## install them (check whether other args to install.packages() need 
to be specified)
install.packages(pkgs=my.packages)

and then source the script. Keep the script around, then on every 
upgrade to R, just source it again.

-Don

At 2:12 PM -0700 5/2/07, Jeffrey Wood wrote:
Hello,




I have just upgraded from R-2.4.1 to R-2.5.0 for Windows.

I had installed a large number of add-on packages under 2.4.1. Is 
there an easy way to install (or load, if that's the easier way) 
those packages under 2.5.0, without having to install each package 
by hand?

Thanks,
Jeff

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


-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

__
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] [R-pkgs] randomSurvivalForest 2.1.0 now available

2007-05-03 Thread K. B. Udaya
Dear useRs:

Release 2.1.0 of the randomSurvivalForest package is now available.
--
CHANGES TO RELEASE 2.1.0

Release 2.1.0 represents a minor upgrade of the product, and will not affect
most users of the prior version of the product.  Key changes are as follows:

o R 2.5.0 compliance issues and necessitated modifications.

o Modification of PMML representation of RSF forest output.  The RSF custom
extension has been moved from the DataDictionary node to a new
MiningBuildTask node.  Note that forests produced with Release 2.0.0 will
have to be regenerated using Release 2.1.0.  We apologize for the
inconvenience.

o Fast processing of data involving large numbers of predictors (as in
many genomic examples) by using the option big.data=TRUE.  This
option bypasses the huge overhead needed by R in creating design
matrices and parsing formula.  However, users should be aware of
some side effects.  See the RSF help file for more details.  Thanks
to Steven (Xi) Chen for pointing out the problem.

o Only the top 100 predictors are now printed to the terminal when
calling plot.error().  This deals with settings as above when one
might have thousands of predictors.

o Introduced a new wrapper find.interaction() for testing for
pairwise interactions between predictors.

-

[EMAIL PROTECTED]

Udaya B. Kogalur, Ph.D.
Kogalur Shear Corporation
5425 Nestleway Drive, Suite L1
Clemmons, NC 27012

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] reshape question

2007-05-03 Thread GOUACHE David
Hello all,

A quick question concerning a behavior of reshape I fail tu understand, 
probably something obvious but I just can't see it.

With the following data frame further referred to as tab :

Variete;Semis.Date;Date_Mesure.1;Variable_Mesure.1;Valeur_Mesure.1;Date_Mesure.2;Variable_Mesure.2;Valeur_Mesure.2;Date_Mesure.3;Variable_Mesure.3;Valeur_Mesure.3;Date_Mesure.4;Variable_Mesure.4;Valeur_Mesure.4;Date_Mesure.5;Variable_Mesure.5;Valeur_Mesure.5;Date_Mesure.6;Variable_Mesure.6;Valeur_Mesure.6;Date_Mesure.7;Variable_Mesure.7;Valeur_Mesure.7;Date_Mesure.8;Variable_Mesure.8;Valeur_Mesure.8;Date_Mesure.9;Variable_Mesure.9;Valeur_Mesure.9;Date_Mesure.10;Variable_Mesure.10;Valeur_Mesure.10
A;22/10/2004;38527;Partie 
aérienne.Verse;3.23;38516;Grain.Humidité;0.71;38523;Grain.Humidité;0.67;38526;Grain.Humidité;0.61;38530;Grain.Humidité;0.56;38532;Grain.Humidité;0.53;38537;Grain.Humidité;0.47;38539;Grain.Humidité;0.45;38544;Grain.Humidité;0.44;38551;Grain.Humidité;0.17
B;22/10/2004;38527;Partie 
aérienne.Verse;3.45;38516;Grain.Humidité;0.76;38523;Grain.Humidité;0.68;38526;Grain.Humidité;0.63;38530;Grain.Humidité;0.59;38532;Grain.Humidité;0.54;38537;Grain.Humidité;0.49;38539;Grain.Humidité;0.48;38544;Grain.Humidité;0.46;38551;Grain.Humidité;0.15

I execute the following command :

reshape(tab,direction=long,varying=grep(Mesure,colnames(tab)))

This gives me what I need except for a small glitch : I end up with the column 
Variable_Mesure containing the numerical values which were contained in the 
Valeur_Mesure.number columns of the wide data frame and conversely I have in 
the column Valeurs_Mesure column of my long dataframe the factor levels 
contained in the Variable_Mesure.number columns of the original wide dataframe.

What is this inversion due to ? If it is an error on my part, which I suppose 
it is, how do I correct this ?

Thanls in advance.

PS - I am running R 2.3.1 on a Windows platform

David Gouache
Arvalis - Institut du Végétal
Station de La Minière
78280 Guyancourt
Tel: 01.30.12.96.22 / Port: 06.86.08.94.32

__
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] [R-pkgs] Ryacas now on CRAN

2007-05-03 Thread Gabor Grothendieck
Ryacas is now available on CRAN.  (Previously it was
available on the Omegahat repository.)

Ryacas is an R package that provides an interface from R to
the yacas computer algebra system.   It can be used for
computer algebra, exact arithmetic, ASCII pretty printing
and R to TeX output. R, yacas and Ryacas are all free
software packages distributed under the GPL version 2.

Ryacas is written in R. It uses a recursive decent
R-to-yacas translator and an XML-based OpenMath yacas-to-R
translator. yacas is run as a second process to which
R communicates via a socket interface.

There are 8 different user level interfaces
(yacas.character, yacas.expression, yacas.function,
yacas.formula, Sym objects, Expr objects, yacmode and
runYacas).  Most users will primarily use Sym objects.

NEW INSTALLATION FOR WINDOWS USERS

A key change in moving to CRAN is that yacas.exe is no longer
part of the Ryacas distribution so that Windows users must
separately install yacas 1.0.63. :(  Non-windows users always
had to separately install yacas.  To simplify this somewhat
the yacasInstall() R command will download and install yacas from
within R on Windows:

# Windows installation procedure
install.packages(Ryacas, dep = TRUE)
library(Ryacas)
yacasInstall()

For non-windows users the installation procedure is the same as
before; namely, install yacas and then install the Ryacas R package.
yacasInstall is not available on non-Windows systems.  More
installation information is available on the Ryacas home page.

LINKS

Home Page (Overview, News, Installation, Sample Session, Links, SVN)
http://code.google.com/p/ryacas/

News (on source changes; not entirely same as home page news)
http://ryacas.googlecode.com/svn/trunk/inst/NEWS

Vignette (includes many examples)
http://ryacas.googlecode.com/svn/trunk/inst/doc/Ryacas.pdf


SAMPLE SESSION
(need fixed font email viewer to view correctly)

 library(Ryacas)


 # algebra

 library(Ryacas)
 x - Sym('x')
 (x+1) * (x-1)
expression((x + 1) * (x - 1))
 Simplify(%)
expression(x^2 - 1)
 PrettyForm(%)
 2
x  - 1


 # calculus

 Integrate(x+tan(x), x)
expression(x^2/2 - log(cos(x)))


 # exact arithmetic

 yacas('12/24')
expression(1/2)


 # ASCII pretty printing

 exp(-x^2)/(cos(x)+exp(x))
expression(exp(-x^2)/(cos(x) + exp(x)))
 PrettyForm(%)
 /  /  2 \ \
  Exp\ -\ x  / /
---
Cos( x ) + Exp( x )


 # matrix - yacas matrices are row-wise


 List(List(1,2),List(x,6))
expression(list(list(1, 2), list(x, 6)))
 PrettyForm(%)
/  \
| ( 1 ) ( 2 )  |
|  |
| ( x ) ( 6 )  |
\  /


 # output TeX

 k - Sym('k')
 yacas(TeXForm((x+1)^2 + k^3), retclass = 'unquote')
$\left( x + 1\right)  ^{2} + k ^{3}$


 detach()


yacas was developed by Ayal Pinkus and other contributors.

Ryacas was developed by Rob Goedman, Gabor Grothendieck,
Søren Højsgaard and Ayal Pinkus.   Contact Rob for Mac
issues and Gabor for all other issues.

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] R Wiki down?

2007-05-03 Thread Talbot Katz
Hi.

I can't access the site http://wiki.r-project.org/.  I didn't find any 
notice about this on http://www.r-project.org/.  Does anyone have any more 
information about the R Wiki status?  Thanks!

--  TMK  --
212-460-5430home
917-656-5351cell

__
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] reshape question

2007-05-03 Thread Gabor Grothendieck
Try this:

cn - names(tab)
nm - list(Date = grep(Date_, cn, value = TRUE),
   Variable = grep(Variable, cn, value = TRUE),
   Valeur = grep(Valeur, cn, value = TRUE)
)
reshape(tab, direction = long, varying = nm)


On 5/3/07, GOUACHE David [EMAIL PROTECTED] wrote:
 Hello all,

 A quick question concerning a behavior of reshape I fail tu understand, 
 probably something obvious but I just can't see it.

 With the following data frame further referred to as tab :

 Variete;Semis.Date;Date_Mesure.1;Variable_Mesure.1;Valeur_Mesure.1;Date_Mesure.2;Variable_Mesure.2;Valeur_Mesure.2;Date_Mesure.3;Variable_Mesure.3;Valeur_Mesure.3;Date_Mesure.4;Variable_Mesure.4;Valeur_Mesure.4;Date_Mesure.5;Variable_Mesure.5;Valeur_Mesure.5;Date_Mesure.6;Variable_Mesure.6;Valeur_Mesure.6;Date_Mesure.7;Variable_Mesure.7;Valeur_Mesure.7;Date_Mesure.8;Variable_Mesure.8;Valeur_Mesure.8;Date_Mesure.9;Variable_Mesure.9;Valeur_Mesure.9;Date_Mesure.10;Variable_Mesure.10;Valeur_Mesure.10
 A;22/10/2004;38527;Partie 
 aérienne.Verse;3.23;38516;Grain.Humidité;0.71;38523;Grain.Humidité;0.67;38526;Grain.Humidité;0.61;38530;Grain.Humidité;0.56;38532;Grain.Humidité;0.53;38537;Grain.Humidité;0.47;38539;Grain.Humidité;0.45;38544;Grain.Humidité;0.44;38551;Grain.Humidité;0.17
 B;22/10/2004;38527;Partie 
 aérienne.Verse;3.45;38516;Grain.Humidité;0.76;38523;Grain.Humidité;0.68;38526;Grain.Humidité;0.63;38530;Grain.Humidité;0.59;38532;Grain.Humidité;0.54;38537;Grain.Humidité;0.49;38539;Grain.Humidité;0.48;38544;Grain.Humidité;0.46;38551;Grain.Humidité;0.15

 I execute the following command :

 reshape(tab,direction=long,varying=grep(Mesure,colnames(tab)))

 This gives me what I need except for a small glitch : I end up with the 
 column Variable_Mesure containing the numerical values which were contained 
 in the Valeur_Mesure.number columns of the wide data frame and conversely I 
 have in the column Valeurs_Mesure column of my long dataframe the factor 
 levels contained in the Variable_Mesure.number columns of the original wide 
 dataframe.

 What is this inversion due to ? If it is an error on my part, which I 
 suppose it is, how do I correct this ?

 Thanls in advance.

 PS - I am running R 2.3.1 on a Windows platform

 David Gouache
 Arvalis - Institut du Végétal
 Station de La Minière
 78280 Guyancourt
 Tel: 01.30.12.96.22 / Port: 06.86.08.94.32

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


Re: [R] the Surv function

2007-05-03 Thread Armin Goralczyk
2007/5/2, Jennifer Dillon [EMAIL PROTECTED]:
 Hi,

 I'm trying to do a simple survival analysis on some data, and I'm having the
 following problem (here's my code and the error message):

 out - Surv(fup,event=status)
 Error in Surv(fup, event = status) : argument time2 is missing, with no
 default


I am not very familiar with this, but shouldn' t it be:

out - Surv(fup, status==1)

where fup is your vector of time differences and status your vector to
denote censored events (e.g. 1 is an uncensored event and 2 for a
censored events). Have a look at section 12.2 of introductory
statistics with R by P. Dalgaard
-- 
A. Goralczyk
Göttingen, Ger.

__
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] Off topic? Geographic data

2007-05-03 Thread Alberto Vieira Ferreira Monteiro
Sorry if this is off-topic, but since there are so many data sets in R,
I wonder if there is any data set with Geographic data, like 
(latitude,longitude) lists of the contour of the continents and
countries.

Alberto Monteiro

__
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] Package contrast error

2007-05-03 Thread Ken Nussear
Trying to use contrast to look at differences within an lme

lme.fnl.REML - lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID,  
method = REML)

I have three levels of Tr I'm trying to contrast among different  
years (R, T97, T98), years = 1997-1999, so I'm interested in  
contrasts of the interaction term.

  anova(lme.fnl.REML)
 numDF denDF   F-value p-value
(Intercept) 1   168 19255.389  .0001
S   1   168 5.912  0.0161
Tr  2   11615.919  .0001
Yr  1   16877.837  .0001
Tr:Yr   2   16847.584  .0001
  summary(lme.fnl.REML)
Linear mixed-effects model fit by REML
Data: NULL
AIC  BIClogLik
   580.6991 613.5399 -281.3496

Random effects:
Formula: ~1 | TID
 (Intercept)  Residual
StdDev:   0.3697006 0.5316062

Fixed effects: Max ~ S + Tr + Yr + Tr:Yr
 Value Std.Error  DF   t-value p-value
(Intercept)  -13.5681  113.2623 168 -0.119793  0.9048
SM 0.21870.0957 168  2.284605  0.0236
TrT97   1375.5897  164.0060 116  8.387434  0.
TrT98   2890.9462  455.3497 116  6.348848  0.
Yr 0.00990.0567 168  0.174005  0.8621
TrT97:Yr  -0.68830.0821 168 -8.384798  0.
TrT98:Yr  -1.44630.2279 168 -6.347310  0.
Correlation:
  (Intr) SM TrT97  TrT98  Yr TT97:Y
SM0.067
TrT97-0.691 -0.049
TrT98-0.248 -0.001  0.171
Yr   -1.000 -0.067  0.691  0.248
TrT97:Yr  0.691  0.048 -1.000 -0.171 -0.691
TrT98:Yr  0.248  0.001 -0.171 -1.000 -0.248  0.171

Standardized Within-Group Residuals:
 Min  Q1 Med  Q3 Max
-2.19017911 -0.58108001 -0.04983642  0.57323031  2.39811353

Number of Observations: 291
Number of Groups: 119
 

When I try to get the contrast I get one of two errors each time.

Trying for a paired contrast...

tst - contrast(lme.fnl.REML, a=list(Yr=levels(Yr), Tr=R), b=list 
(Yr=levels(Yr, Tr=T97)))
Error in gendata.default(fit = list(modelStruct = list(reStruct = list 
( :
not enough factors

Trying to include the other factor to make R happy

  tst - contrast(lme.fnl.REML, a=list(Yr=levels(Yr), Tr=R), b=list 
(Yr=levels(Yr, Tr=T97)), c=list(Yr=levels(Yr, Tr=T98))
+ )
Error in contrastCalc(fit, ...) : argument 4 matches multiple formal  
arguments

Can anyone help with the syntax here?

Thanks

Ken




[[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] reshape question

2007-05-03 Thread Gabor Grothendieck
Here is a minor improvement (cn and nm as before):

reshape(tab, direction = long, varying = nm, v.names = names(nm))




On 5/3/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Try this:

 cn - names(tab)
 nm - list(Date = grep(Date_, cn, value = TRUE),
   Variable = grep(Variable, cn, value = TRUE),
   Valeur = grep(Valeur, cn, value = TRUE)
 )
 reshape(tab, direction = long, varying = nm)


 On 5/3/07, GOUACHE David [EMAIL PROTECTED] wrote:
  Hello all,
 
  A quick question concerning a behavior of reshape I fail tu understand, 
  probably something obvious but I just can't see it.
 
  With the following data frame further referred to as tab :
 
  Variete;Semis.Date;Date_Mesure.1;Variable_Mesure.1;Valeur_Mesure.1;Date_Mesure.2;Variable_Mesure.2;Valeur_Mesure.2;Date_Mesure.3;Variable_Mesure.3;Valeur_Mesure.3;Date_Mesure.4;Variable_Mesure.4;Valeur_Mesure.4;Date_Mesure.5;Variable_Mesure.5;Valeur_Mesure.5;Date_Mesure.6;Variable_Mesure.6;Valeur_Mesure.6;Date_Mesure.7;Variable_Mesure.7;Valeur_Mesure.7;Date_Mesure.8;Variable_Mesure.8;Valeur_Mesure.8;Date_Mesure.9;Variable_Mesure.9;Valeur_Mesure.9;Date_Mesure.10;Variable_Mesure.10;Valeur_Mesure.10
  A;22/10/2004;38527;Partie 
  aérienne.Verse;3.23;38516;Grain.Humidité;0.71;38523;Grain.Humidité;0.67;38526;Grain.Humidité;0.61;38530;Grain.Humidité;0.56;38532;Grain.Humidité;0.53;38537;Grain.Humidité;0.47;38539;Grain.Humidité;0.45;38544;Grain.Humidité;0.44;38551;Grain.Humidité;0.17
  B;22/10/2004;38527;Partie 
  aérienne.Verse;3.45;38516;Grain.Humidité;0.76;38523;Grain.Humidité;0.68;38526;Grain.Humidité;0.63;38530;Grain.Humidité;0.59;38532;Grain.Humidité;0.54;38537;Grain.Humidité;0.49;38539;Grain.Humidité;0.48;38544;Grain.Humidité;0.46;38551;Grain.Humidité;0.15
 
  I execute the following command :
 
  reshape(tab,direction=long,varying=grep(Mesure,colnames(tab)))
 
  This gives me what I need except for a small glitch : I end up with the 
  column Variable_Mesure containing the numerical values which were contained 
  in the Valeur_Mesure.number columns of the wide data frame and conversely I 
  have in the column Valeurs_Mesure column of my long dataframe the factor 
  levels contained in the Variable_Mesure.number columns of the original wide 
  dataframe.
 
  What is this inversion due to ? If it is an error on my part, which I 
  suppose it is, how do I correct this ?
 
  Thanls in advance.
 
  PS - I am running R 2.3.1 on a Windows platform
 
  David Gouache
  Arvalis - Institut du Végétal
  Station de La Minière
  78280 Guyancourt
  Tel: 01.30.12.96.22 / Port: 06.86.08.94.32
 
  __
  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] nlme fixed effects specification

2007-05-03 Thread ivo welch
dear R experts:

sorry, I have to ask this again.  I know that the answer is in section
7.2 of S Programming, but I don't have the book (and I plan to buy
the next edition---which I hope will be titled S/R programming ;-) ).

I believe the following yields a standard fixed-effects estimation:

fixed.effects = as.factor( as.integer( runif(100)*10 ) )
y=rnorm(100); x=rnorm(100);
print(summary(lm( Y ~ X + fe)))

I would like to know how to get the same coefficient on X using nlme.
(I cannot use this ordinary lm method in my real application, simply
because I have 10,000 fixed effects.)  I tried a variety of arguments
to the fixed nlme parameter (e.g., fixed=list(fmid)), but did not
get the syntax right.  could someone please tell me the magic spell?

may I also suggest that such an example be added to the nlme examples
documentation, too, please?

help appreciated.

regards,

/ivo

__
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] Package contrast error

2007-05-03 Thread Chuck Cleland
Ken Nussear wrote:
 Trying to use contrast to look at differences within an lme
 
 lme.fnl.REML - lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID,  
 method = REML)
 
 I have three levels of Tr I'm trying to contrast among different  
 years (R, T97, T98), years = 1997-1999, so I'm interested in  
 contrasts of the interaction term.
 
   anova(lme.fnl.REML)
  numDF denDF   F-value p-value
 (Intercept) 1   168 19255.389  .0001
 S   1   168 5.912  0.0161
 Tr  2   11615.919  .0001
 Yr  1   16877.837  .0001
 Tr:Yr   2   16847.584  .0001
   summary(lme.fnl.REML)
 Linear mixed-effects model fit by REML
 Data: NULL
 AIC  BIClogLik
580.6991 613.5399 -281.3496
 
 Random effects:
 Formula: ~1 | TID
  (Intercept)  Residual
 StdDev:   0.3697006 0.5316062
 
 Fixed effects: Max ~ S + Tr + Yr + Tr:Yr
  Value Std.Error  DF   t-value p-value
 (Intercept)  -13.5681  113.2623 168 -0.119793  0.9048
 SM 0.21870.0957 168  2.284605  0.0236
 TrT97   1375.5897  164.0060 116  8.387434  0.
 TrT98   2890.9462  455.3497 116  6.348848  0.
 Yr 0.00990.0567 168  0.174005  0.8621
 TrT97:Yr  -0.68830.0821 168 -8.384798  0.
 TrT98:Yr  -1.44630.2279 168 -6.347310  0.
 Correlation:
   (Intr) SM TrT97  TrT98  Yr TT97:Y
 SM0.067
 TrT97-0.691 -0.049
 TrT98-0.248 -0.001  0.171
 Yr   -1.000 -0.067  0.691  0.248
 TrT97:Yr  0.691  0.048 -1.000 -0.171 -0.691
 TrT98:Yr  0.248  0.001 -0.171 -1.000 -0.248  0.171
 
 Standardized Within-Group Residuals:
  Min  Q1 Med  Q3 Max
 -2.19017911 -0.58108001 -0.04983642  0.57323031  2.39811353
 
 Number of Observations: 291
 Number of Groups: 119
  
 
 When I try to get the contrast I get one of two errors each time.
 
 Trying for a paired contrast...
 
 tst - contrast(lme.fnl.REML, a=list(Yr=levels(Yr), Tr=R), b=list 
 (Yr=levels(Yr, Tr=T97)))
 Error in gendata.default(fit = list(modelStruct = list(reStruct = list 
 ( :
   not enough factors
 
 Trying to include the other factor to make R happy
 
   tst - contrast(lme.fnl.REML, a=list(Yr=levels(Yr), Tr=R), b=list 
 (Yr=levels(Yr, Tr=T97)), c=list(Yr=levels(Yr, Tr=T98))
 + )
 Error in contrastCalc(fit, ...) : argument 4 matches multiple formal  
 arguments
 
 Can anyone help with the syntax here?

  I believe you need to include one or more values S at which to
contrast the treatments in each of the lists.  So you might try
something like this:

contrast(lme.fnl.REML,
 a=list(Yr=levels(Yr), Tr=R, S=M),
 b=list(Yr=levels(Yr), Tr=T97, S=M))

or

contrast(lme.fnl.REML,
 a=list(Yr=levels(Yr), Tr=R, S=levels(S)),
 b=list(Yr=levels(Yr), Tr=T97, S=levels(S)))

 Thanks
 
 Ken
 
 
 
 
   [[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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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] Bayesian logistic regression with a beta prior (MCMClogit)

2007-05-03 Thread Cody_Hamilton

Dear Franco,

Have you tried using the beta.start option in MCMClogit?  (The problem may
be where you are starting your chain.)

Regards,
   -Cody



   
 francogrex
 [EMAIL PROTECTED] 
 com   To 
 Sent by:  r-help@stat.math.ethz.ch
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Bayesian logistic regression
 05/03/2007 12:21  with a beta prior (MCMClogit)   
 AM
   
   
   
   
   





Dear all,
I am trying to use the logistic regression with MCMClogit (package:
MCMCpack/Coda) and I want to put a beta prior on the parameters, but it's
giving me error message (please see output below) no matter what shape 1 or
2 I use. It works perfect with the cauchy or normal priors. Do you know if
there is a catch there somewhere? Thanks

logpriorfun - function(beta,shape1,shape2){
sum(dbeta(beta,shape1,shape2, log=T)) }

posterior - MCMClogit(nausea~nsaid*diuretic, data=w,
verbose=2000,burnin = 1000, mcmc = 1,
user.prior.density=logpriorfun,shape1=1,shape2=1)

user.prior.density(beta.start) == -Inf.
Error in MCMClogit(nausea ~ nsaid * diuretic, data = w, verbose = 2000,  :
Respecify and call MCMClogit() again.

--
View this message in context:
http://www.nabble.com/Bayesian-logistic-regression-with-a-beta-prior-%28MCMClogit%29-tf3684970.html#a10300145

Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Off topic? Geographic data

2007-05-03 Thread Duncan Murdoch
On 5/3/2007 1:19 PM, Alberto Vieira Ferreira Monteiro wrote:
 Sorry if this is off-topic, but since there are so many data sets in R,
 I wonder if there is any data set with Geographic data, like 
 (latitude,longitude) lists of the contour of the continents and
 countries.

The maps and mapdata packages have this.  (They work together; mapdata 
has more detail than maps).

Duncan Murdoch

__
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] R package development in windows

2007-05-03 Thread Doran, Harold
I'm attempting to build an R package for distribution and am working
from the directions found at
http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#Wi
n-Win

I've read through Writing R Extensions and various other helpful web
sites. I've installed all relevant software (perl, cygwin, mingwin,
hhc.exe). Here is what I have done so far:

1) Sourced data and functions into R
2) Used package.skeleton
3) Edited Description file
4) Edited my windows path to ensure the new programs (e.g., perl) are in
the path
5) Then, I open DOS and do the following in the script below

C:\Program Files\R\R-2.4.1\binRcmd build  --force --binary g:\foo
* checking for file 'g:\foo/DESCRIPTION' ... OK
* preparing 'g:\foo':
* checking DESCRIPTION meta-information ...'sh' is not recognized as an
internal
 or external command,
operable program or batch file.
 OK
* removing junk files
'sh' is not recognized as an internal or external command,
operable program or batch file.
'sh' is not recognized as an internal or external command,
operable program or batch file.
'sh' is not recognized as an internal or external command,
operable program or batch file.
Error: cannot open file 'foo/DESCRIPTION' for reading

I'ver read through about as much documentation as I can find, and I'm
just not sure what I should do from here. I admit that I have reached a
point of frustration and must apologize if the problem would be evident
if I read documentation further, but I'm about tapped out after a few
days of experimentation.

Can anyone suggest how I could resolve this and what the next steps
would be?

Thanks:

I'm using Windows XP and R 2.4.1

Harold

[[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] Package contrast error

2007-05-03 Thread Kuhn, Max
Ken,


 lme.fnl.REML - lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID,  
 method = REML)
 

You have three variables in the model: S, Tr and Yr.


 tst - contrast(lme.fnl.REML, a=list(Yr=levels(Yr), Tr=R), b=list 
 (Yr=levels(Yr, Tr=T97)))
 Error in gendata.default(fit = list(modelStruct = list(reStruct = list

 ( :
   not enough factors
 

I think that you need to specify a value for S in the lists for a and b.
Also, I think that there is a typo:

  b=list(Yr=levels(Yr), Tr=T97)
 
instead of 

  b=list(Yr=levels(Yr, Tr=T97))


 Trying to include the other factor to make R happy
 
  tst - contrast(lme.fnl.REML, a=list(Yr=levels(Yr), Tr=R), b=list 
 (Yr=levels(Yr, Tr=T97)), c=list(Yr=levels(Yr, Tr=T98))
 + )
 Error in contrastCalc(fit, ...) : argument 4 matches multiple formal  
 arguments


Max

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

__
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] R package development in windows

2007-05-03 Thread Sundar Dorai-Raj


Doran, Harold said the following on 5/3/2007 11:32 AM:
 I'm attempting to build an R package for distribution and am working
 from the directions found at
 http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#Wi
 n-Win
 
 I've read through Writing R Extensions and various other helpful web
 sites. I've installed all relevant software (perl, cygwin, mingwin,
 hhc.exe). Here is what I have done so far:
 
 1) Sourced data and functions into R
 2) Used package.skeleton
 3) Edited Description file
 4) Edited my windows path to ensure the new programs (e.g., perl) are in
 the path
 5) Then, I open DOS and do the following in the script below
 
 C:\Program Files\R\R-2.4.1\binRcmd build  --force --binary g:\foo
 * checking for file 'g:\foo/DESCRIPTION' ... OK
 * preparing 'g:\foo':
 * checking DESCRIPTION meta-information ...'sh' is not recognized as an
 internal
  or external command,
 operable program or batch file.
  OK
 * removing junk files
 'sh' is not recognized as an internal or external command,
 operable program or batch file.
 'sh' is not recognized as an internal or external command,
 operable program or batch file.
 'sh' is not recognized as an internal or external command,
 operable program or batch file.
 Error: cannot open file 'foo/DESCRIPTION' for reading
 
 I'ver read through about as much documentation as I can find, and I'm
 just not sure what I should do from here. I admit that I have reached a
 point of frustration and must apologize if the problem would be evident
 if I read documentation further, but I'm about tapped out after a few
 days of experimentation.
 
 Can anyone suggest how I could resolve this and what the next steps
 would be?
 
 Thanks:
 
 I'm using Windows XP and R 2.4.1
 
 Harold
 


Do you have Rtools installed and in your system path? You should read 
all the documentation on that page.

http://www.murdoch-sutherland.com/Rtools/

HTH,

--sundar

__
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] R package development in windows

2007-05-03 Thread Gabor Grothendieck
It can find sh.exe so you haven't installed Rtools.

There are several HowTo's listed in the links section here that include
pointers to R manuals and other step by step instructions:

http://code.google.com/p/batchfiles/

On 5/3/07, Doran, Harold [EMAIL PROTECTED] wrote:
 I'm attempting to build an R package for distribution and am working
 from the directions found at
 http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#Wi
 n-Win

 I've read through Writing R Extensions and various other helpful web
 sites. I've installed all relevant software (perl, cygwin, mingwin,
 hhc.exe). Here is what I have done so far:

 1) Sourced data and functions into R
 2) Used package.skeleton
 3) Edited Description file
 4) Edited my windows path to ensure the new programs (e.g., perl) are in
 the path
 5) Then, I open DOS and do the following in the script below

 C:\Program Files\R\R-2.4.1\binRcmd build  --force --binary g:\foo
 * checking for file 'g:\foo/DESCRIPTION' ... OK
 * preparing 'g:\foo':
 * checking DESCRIPTION meta-information ...'sh' is not recognized as an
 internal
  or external command,
 operable program or batch file.
  OK
 * removing junk files
 'sh' is not recognized as an internal or external command,
 operable program or batch file.
 'sh' is not recognized as an internal or external command,
 operable program or batch file.
 'sh' is not recognized as an internal or external command,
 operable program or batch file.
 Error: cannot open file 'foo/DESCRIPTION' for reading

 I'ver read through about as much documentation as I can find, and I'm
 just not sure what I should do from here. I admit that I have reached a
 point of frustration and must apologize if the problem would be evident
 if I read documentation further, but I'm about tapped out after a few
 days of experimentation.

 Can anyone suggest how I could resolve this and what the next steps
 would be?

 Thanks:

 I'm using Windows XP and R 2.4.1

 Harold

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


__
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] Truncating trailing digits

2007-05-03 Thread Pietrzykowski, Matthew \(GE, Research\)
Hello,

I am relatively new to R and have a rudimentary question, I think.  How
does one
truncate the number of digits displayed after the decimal when viewing
the results
of analyses?

My apologies if this question has been answered previously, I was not
able to find
references very easily.

Thank you in advance,

Matt



[[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] R package development in windows

2007-05-03 Thread Doran, Harold
Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the
path. With that resolved, and another 10 minute windows restart, I get
the following below. The log suggests that hhc is not installed. It is,
and, according to the directions I am following, I have placed it in the
c:\cygwin directory.

BTW, package.skeleton() doesn't seem to create the correct DESCRIPTION
template. I had to add the DEPENDS line. Without this, I get another
error.


C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo
* checking for file 'g:\foo/DESCRIPTION' ... OK
* preparing 'g:\foo':
* checking DESCRIPTION meta-information ... OK
* removing junk files
* checking for LF line-endings in source files
* checking for empty or unneeded directories
* building binary distribution
 WARNING
* some HTML links may not be found
installing R.css in c:/TEMP/Rinst40061099

Using auto-selected zip options ''
latex: not found
latex: not found
latex: not found

-- Making package foo 
latex: not found
  adding build stamp to DESCRIPTION
latex: not found
latex: not found
latex: not found
  installing R files
latex: not found
  installing data files
latex: not found
  installing man source files
  installing indices
latex: not found
  not zipping data
  installing help
Warning: \alias{foo} already in foo-package.Rd -- skipping the one in
foo.Rd
  Building/Updating help pages for package 'foo'
 Formats: text html latex example chm
  foo-package   texthtmllatex   example chm
  foo   texthtmllatex   example chm
  mydatatexthtmllatex   example chm
hhc: not found
cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm': No such file
or direct
ory
make[1]: *** [chm-foo] Error 1
make: *** [pkg-foo] Error 2
*** Installation of foo failed ***

Removing 'c:/TEMP/Rinst40061099/foo'
 ERROR
* installation failed


C:\Program Files\R\R-2.4.1\bin 

 -Original Message-
 From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 03, 2007 2:50 PM
 To: Doran, Harold
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] R package development in windows
 
 It can find sh.exe so you haven't installed Rtools.
 
 There are several HowTo's listed in the links section here 
 that include pointers to R manuals and other step by step 
 instructions:
 
 http://code.google.com/p/batchfiles/
 
 On 5/3/07, Doran, Harold [EMAIL PROTECTED] wrote:
  I'm attempting to build an R package for distribution and 
 am working 
  from the directions found at 
  
 http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#
  Wi
  n-Win
 
  I've read through Writing R Extensions and various other 
 helpful web 
  sites. I've installed all relevant software (perl, cygwin, mingwin, 
  hhc.exe). Here is what I have done so far:
 
  1) Sourced data and functions into R
  2) Used package.skeleton
  3) Edited Description file
  4) Edited my windows path to ensure the new programs (e.g., 
 perl) are 
  in the path
  5) Then, I open DOS and do the following in the script below
 
  C:\Program Files\R\R-2.4.1\binRcmd build  --force --binary g:\foo
  * checking for file 'g:\foo/DESCRIPTION' ... OK
  * preparing 'g:\foo':
  * checking DESCRIPTION meta-information ...'sh' is not 
 recognized as 
  an internal  or external command, operable program or batch file.
   OK
  * removing junk files
  'sh' is not recognized as an internal or external command, operable 
  program or batch file.
  'sh' is not recognized as an internal or external command, operable 
  program or batch file.
  'sh' is not recognized as an internal or external command, operable 
  program or batch file.
  Error: cannot open file 'foo/DESCRIPTION' for reading
 
  I'ver read through about as much documentation as I can 
 find, and I'm 
  just not sure what I should do from here. I admit that I 
 have reached 
  a point of frustration and must apologize if the problem would be 
  evident if I read documentation further, but I'm about tapped out 
  after a few days of experimentation.
 
  Can anyone suggest how I could resolve this and what the next steps 
  would be?
 
  Thanks:
 
  I'm using Windows XP and R 2.4.1
 
  Harold
 
 [[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.
 


__
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] Parsing data with an uneven number of delimiters

2007-05-03 Thread Kevin Burke
I have a list of data that is delimited by a / and, as long as there is an 
equal number of delimiters, I can parse the data and put it into a data frame:

 t1-c(a/a/a,b/bb/bbb,ccc/cc/c)
 t2-strsplit(t1,/)
 t3-data.frame(t2)
 t3
  c..aaa.. c..bbbbbb.. c..cccccc..
1a   b ccc
2a  bb  cc
3a bbb   c

However, if I don't have an equal number of delimiters, this technique doesn't 
work:

 l1-c(a/a/a,b/bb/bbb,cc/c)
 l2-strsplit(l1,/)
 l3-data.frame(l2)
Error in data.frame(c(a, a, a), c(b, bb, bbb), c(cc, c : 
arguments imply differing number of rows: 3, 2

Is there an easy way to get this into a data frame with NA's (or something 
else) where the missing data would be?

Thanks in advance.

Kevin Burke

__
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] Off topic? Geographic data

2007-05-03 Thread Roger Bivand
On Thu, 3 May 2007, Alberto Vieira Ferreira Monteiro wrote:

 Sorry if this is off-topic, but since there are so many data sets in R,
 I wonder if there is any data set with Geographic data, like 
 (latitude,longitude) lists of the contour of the continents and
 countries.

Please see the Spatial Task View on CRAN. In general, position data is 
heavily protected outside the US, so that existing and available data is 
limited for other countries. The maps and mapdata packages have some 
databases, some of which are also up to date, but others still feature the 
Soviet Union and Yugoslavia, which is only of historical interest. 

There is an interface to more recent shorelines in the maptools package,
which will handle all the levels of detail in GSHHS. The CDC has a set of
shapefiles covering many countries with borders from about 1997, but sadly
these are restricted. Some enlightened countries are releasing data;
Canada has recently decided to do so: http://www.geogratis.gc.ca/, an
initiative other countries could with benefit follow. The US has by far
the most developed geographical data service sector, because the data are
free like beer but hard to use, creating opportunties for service
providers. Most of these data formats can be read by functions in maptools
or rgdal.

Roger

 
 Alberto Monteiro
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

__
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] R package development in windows

2007-05-03 Thread Duncan Murdoch
On 5/3/2007 3:04 PM, Doran, Harold wrote:
 Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the
 path. With that resolved, and another 10 minute windows restart, I get
 the following below. The log suggests that hhc is not installed. It is,
 and, according to the directions I am following, I have placed it in the
 c:\cygwin directory.

I think the problem is that you are following a real mix of 
instructions, and they don't make sense.

It would be nice if folks would submit patches to the R Admin manual (or 
to the Rtools web site) rather than putting together web sites with 
advice that is bad from day one, and quickly gets worse when it is not 
updated.

 BTW, package.skeleton() doesn't seem to create the correct DESCRIPTION
 template. I had to add the DEPENDS line. Without this, I get another
 error.
 
 
 C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo

R 2.4.1 is no longer current; the package building instructions in R 
2.5.0 have been simplified a bit.  You might want to try those.

Duncan Murdoch

 * checking for file 'g:\foo/DESCRIPTION' ... OK
 * preparing 'g:\foo':
 * checking DESCRIPTION meta-information ... OK
 * removing junk files
 * checking for LF line-endings in source files
 * checking for empty or unneeded directories
 * building binary distribution
  WARNING
 * some HTML links may not be found
 installing R.css in c:/TEMP/Rinst40061099
 
 Using auto-selected zip options ''
 latex: not found
 latex: not found
 latex: not found
 
 -- Making package foo 
 latex: not found
   adding build stamp to DESCRIPTION
 latex: not found
 latex: not found
 latex: not found
   installing R files
 latex: not found
   installing data files
 latex: not found
   installing man source files
   installing indices
 latex: not found
   not zipping data
   installing help
 Warning: \alias{foo} already in foo-package.Rd -- skipping the one in
 foo.Rd
   Building/Updating help pages for package 'foo'
  Formats: text html latex example chm
   foo-package   texthtmllatex   example chm
   foo   texthtmllatex   example chm
   mydatatexthtmllatex   example chm
 hhc: not found
 cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm': No such file
 or direct
 ory
 make[1]: *** [chm-foo] Error 1
 make: *** [pkg-foo] Error 2
 *** Installation of foo failed ***
 
 Removing 'c:/TEMP/Rinst40061099/foo'
  ERROR
 * installation failed
 
 
 C:\Program Files\R\R-2.4.1\bin 
 
 -Original Message-
 From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 03, 2007 2:50 PM
 To: Doran, Harold
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] R package development in windows
 
 It can find sh.exe so you haven't installed Rtools.
 
 There are several HowTo's listed in the links section here 
 that include pointers to R manuals and other step by step 
 instructions:
 
 http://code.google.com/p/batchfiles/
 
 On 5/3/07, Doran, Harold [EMAIL PROTECTED] wrote:
  I'm attempting to build an R package for distribution and 
 am working 
  from the directions found at 
  
 http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html#
  Wi
  n-Win
 
  I've read through Writing R Extensions and various other 
 helpful web 
  sites. I've installed all relevant software (perl, cygwin, mingwin, 
  hhc.exe). Here is what I have done so far:
 
  1) Sourced data and functions into R
  2) Used package.skeleton
  3) Edited Description file
  4) Edited my windows path to ensure the new programs (e.g., 
 perl) are 
  in the path
  5) Then, I open DOS and do the following in the script below
 
  C:\Program Files\R\R-2.4.1\binRcmd build  --force --binary g:\foo
  * checking for file 'g:\foo/DESCRIPTION' ... OK
  * preparing 'g:\foo':
  * checking DESCRIPTION meta-information ...'sh' is not 
 recognized as 
  an internal  or external command, operable program or batch file.
   OK
  * removing junk files
  'sh' is not recognized as an internal or external command, operable 
  program or batch file.
  'sh' is not recognized as an internal or external command, operable 
  program or batch file.
  'sh' is not recognized as an internal or external command, operable 
  program or batch file.
  Error: cannot open file 'foo/DESCRIPTION' for reading
 
  I'ver read through about as much documentation as I can 
 find, and I'm 
  just not sure what I should do from here. I admit that I 
 have reached 
  a point of frustration and must apologize if the problem would be 
  evident if I read documentation further, but I'm about tapped out 
  after a few days of experimentation.
 
  Can anyone suggest how I could resolve this and what the next steps 
  would be?
 
  Thanks:
 
  I'm using Windows XP and R 2.4.1
 
  Harold
 
 [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  

Re: [R] [SPAM] - Re: R package development in windows - Bayesian Filter detected spam

2007-05-03 Thread Doran, Harold
Thanks, Duncan. I'll look into that. Is there an authoritative document
that codifies the new package development procedures for 2.5.0
(windows-specific), or is that Writing R Extensions? In this thread
alone I've received multiple emails pointing to multiple web sites with
instructions for windows. Inasmuch as its appreciated, I'm a bit
confused as to which I should consider authoritative.

I do hope I can resolve this and appreciate the help I've received.
However, I feel a bit compelled to note how very difficult this process
is. 

Harold


 -Original Message-
 From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 03, 2007 3:24 PM
 To: Doran, Harold
 Cc: Gabor Grothendieck; r-help@stat.math.ethz.ch
 Subject: [SPAM] - Re: [R] R package development in windows - 
 Bayesian Filter detected spam
 
 On 5/3/2007 3:04 PM, Doran, Harold wrote:
  Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the 
  path. With that resolved, and another 10 minute windows 
 restart, I get 
  the following below. The log suggests that hhc is not installed. It 
  is, and, according to the directions I am following, I have 
 placed it 
  in the c:\cygwin directory.
 
 I think the problem is that you are following a real mix of 
 instructions, and they don't make sense.
 
 It would be nice if folks would submit patches to the R Admin 
 manual (or to the Rtools web site) rather than putting 
 together web sites with advice that is bad from day one, and 
 quickly gets worse when it is not updated.
 
  BTW, package.skeleton() doesn't seem to create the correct 
 DESCRIPTION 
  template. I had to add the DEPENDS line. Without this, I 
 get another 
  error.
  
  
  C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo
 
 R 2.4.1 is no longer current; the package building 
 instructions in R 2.5.0 have been simplified a bit.  You 
 might want to try those.
 
 Duncan Murdoch
 
  * checking for file 'g:\foo/DESCRIPTION' ... OK
  * preparing 'g:\foo':
  * checking DESCRIPTION meta-information ... OK
  * removing junk files
  * checking for LF line-endings in source files
  * checking for empty or unneeded directories
  * building binary distribution
   WARNING
  * some HTML links may not be found
  installing R.css in c:/TEMP/Rinst40061099
  
  Using auto-selected zip options ''
  latex: not found
  latex: not found
  latex: not found
  
  -- Making package foo 
  latex: not found
adding build stamp to DESCRIPTION
  latex: not found
  latex: not found
  latex: not found
installing R files
  latex: not found
installing data files
  latex: not found
installing man source files
installing indices
  latex: not found
not zipping data
installing help
  Warning: \alias{foo} already in foo-package.Rd -- skipping 
 the one in 
  foo.Rd   Building/Updating help pages for package 'foo'
   Formats: text html latex example chm
foo-package   texthtmllatex   
 example chm
foo   texthtmllatex   
 example chm
mydatatexthtmllatex   
 example chm
  hhc: not found
  cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm': 
 No such file 
  or direct ory
  make[1]: *** [chm-foo] Error 1
  make: *** [pkg-foo] Error 2
  *** Installation of foo failed ***
  
  Removing 'c:/TEMP/Rinst40061099/foo'
   ERROR
  * installation failed
  
  
  C:\Program Files\R\R-2.4.1\bin
  
  -Original Message-
  From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
  Sent: Thursday, May 03, 2007 2:50 PM
  To: Doran, Harold
  Cc: r-help@stat.math.ethz.ch
  Subject: Re: [R] R package development in windows
  
  It can find sh.exe so you haven't installed Rtools.
  
  There are several HowTo's listed in the links section here that 
  include pointers to R manuals and other step by step
  instructions:
  
  http://code.google.com/p/batchfiles/
  
  On 5/3/07, Doran, Harold [EMAIL PROTECTED] wrote:
   I'm attempting to build an R package for distribution and
  am working
   from the directions found at
   
  
 http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html
  #
   Wi
   n-Win
  
   I've read through Writing R Extensions and various other
  helpful web
   sites. I've installed all relevant software (perl, 
 cygwin, mingwin, 
   hhc.exe). Here is what I have done so far:
  
   1) Sourced data and functions into R
   2) Used package.skeleton
   3) Edited Description file
   4) Edited my windows path to ensure the new programs (e.g.,
  perl) are
   in the path
   5) Then, I open DOS and do the following in the script below
  
   C:\Program Files\R\R-2.4.1\binRcmd build  --force 
 --binary g:\foo
   * checking for file 'g:\foo/DESCRIPTION' ... OK
   * preparing 'g:\foo':
   * checking DESCRIPTION meta-information ...'sh' is not
  recognized as
   an internal  or external command, operable program or batch file.
OK
   * removing junk files
   'sh' is 

Re: [R] Truncating trailing digits

2007-05-03 Thread Marc Schwartz
On Thu, 2007-05-03 at 12:14 -0400, Pietrzykowski, Matthew (GE, Research)
wrote:
 Hello,
 
 I am relatively new to R and have a rudimentary question, I think.  How
 does one
 truncate the number of digits displayed after the decimal when viewing
 the results
 of analyses?
 
 My apologies if this question has been answered previously, I was not
 able to find
 references very easily.
 
 Thank you in advance,
 
 Matt

The answer is it depends.

There are user configurable options in R that determine how default
output is displayed, relative to the number of significant digits and
the use of scientific notation.

See ?options for more information, specifically 'digits' and 'scipen'.
These don't necessarily guarantee a fixed number of digits after the
decimal however.

If you are creating your own output functions and want greater control
over the formatting (ie. column alignment, etc.), including specifically
the number of digits after the decimal, then see ?formatC and ?sprintf
which allow for this.  Also see ?cat which is how much of standard R
console output is generated.

HTH,

Marc Schwartz

__
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] Truncating trailing digits

2007-05-03 Thread Charles Annis, P.E.
Perhaps format is what you are looking for:

?format



Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pietrzykowski,
Matthew (GE, Research)
Sent: Thursday, May 03, 2007 12:14 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Truncating trailing digits

Hello,

I am relatively new to R and have a rudimentary question, I think.  How
does one
truncate the number of digits displayed after the decimal when viewing
the results
of analyses?

My apologies if this question has been answered previously, I was not
able to find
references very easily.

Thank you in advance,

Matt



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

__
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] [SPAM] - Re: R package development in windows - Bayesian Filter detected spam

2007-05-03 Thread Duncan Murdoch
On 5/3/2007 3:33 PM, Doran, Harold wrote:
 Thanks, Duncan. I'll look into that. Is there an authoritative document
 that codifies the new package development procedures for 2.5.0
 (windows-specific), or is that Writing R Extensions? In this thread
 alone I've received multiple emails pointing to multiple web sites with
 instructions for windows. Inasmuch as its appreciated, I'm a bit
 confused as to which I should consider authoritative.
 
 I do hope I can resolve this and appreciate the help I've received.
 However, I feel a bit compelled to note how very difficult this process
 is. 

The manuals are the authoritative reference.  Writing R Extensions tells 
you what to do to set up a package.  The R Administration and 
Installation manual tells you how to set up your system so those 
instructions will work.  On Windows, you want to pay particular 
attention to the appendix of the Admin manual called The Windows 
Toolset. This is Appendix E in the distributed .pdf; an HTML version is 
available here:

  http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset

We realize that these instructions are not easy to follow, there's no 
need to tell us that.  However, specific corrections or improvements 
would be welcome.

Duncan Murdoch


 Harold
 
 
 -Original Message-
 From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 03, 2007 3:24 PM
 To: Doran, Harold
 Cc: Gabor Grothendieck; r-help@stat.math.ethz.ch
 Subject: [SPAM] - Re: [R] R package development in windows - 
 Bayesian Filter detected spam
 
 On 5/3/2007 3:04 PM, Doran, Harold wrote:
  Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the 
  path. With that resolved, and another 10 minute windows 
 restart, I get 
  the following below. The log suggests that hhc is not installed. It 
  is, and, according to the directions I am following, I have 
 placed it 
  in the c:\cygwin directory.
 
 I think the problem is that you are following a real mix of 
 instructions, and they don't make sense.
 
 It would be nice if folks would submit patches to the R Admin 
 manual (or to the Rtools web site) rather than putting 
 together web sites with advice that is bad from day one, and 
 quickly gets worse when it is not updated.
 
  BTW, package.skeleton() doesn't seem to create the correct 
 DESCRIPTION 
  template. I had to add the DEPENDS line. Without this, I 
 get another 
  error.
  
  
  C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo
 
 R 2.4.1 is no longer current; the package building 
 instructions in R 2.5.0 have been simplified a bit.  You 
 might want to try those.
 
 Duncan Murdoch
 
  * checking for file 'g:\foo/DESCRIPTION' ... OK
  * preparing 'g:\foo':
  * checking DESCRIPTION meta-information ... OK
  * removing junk files
  * checking for LF line-endings in source files
  * checking for empty or unneeded directories
  * building binary distribution
   WARNING
  * some HTML links may not be found
  installing R.css in c:/TEMP/Rinst40061099
  
  Using auto-selected zip options ''
  latex: not found
  latex: not found
  latex: not found
  
  -- Making package foo 
  latex: not found
adding build stamp to DESCRIPTION
  latex: not found
  latex: not found
  latex: not found
installing R files
  latex: not found
installing data files
  latex: not found
installing man source files
installing indices
  latex: not found
not zipping data
installing help
  Warning: \alias{foo} already in foo-package.Rd -- skipping 
 the one in 
  foo.Rd   Building/Updating help pages for package 'foo'
   Formats: text html latex example chm
foo-package   texthtmllatex   
 example chm
foo   texthtmllatex   
 example chm
mydatatexthtmllatex   
 example chm
  hhc: not found
  cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm': 
 No such file 
  or direct ory
  make[1]: *** [chm-foo] Error 1
  make: *** [pkg-foo] Error 2
  *** Installation of foo failed ***
  
  Removing 'c:/TEMP/Rinst40061099/foo'
   ERROR
  * installation failed
  
  
  C:\Program Files\R\R-2.4.1\bin
  
  -Original Message-
  From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
  Sent: Thursday, May 03, 2007 2:50 PM
  To: Doran, Harold
  Cc: r-help@stat.math.ethz.ch
  Subject: Re: [R] R package development in windows
  
  It can find sh.exe so you haven't installed Rtools.
  
  There are several HowTo's listed in the links section here that 
  include pointers to R manuals and other step by step
  instructions:
  
  http://code.google.com/p/batchfiles/
  
  On 5/3/07, Doran, Harold [EMAIL PROTECTED] wrote:
   I'm attempting to build an R package for distribution and
  am working
   from the directions found at
   
  
 http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html
  #
   Wi
   n-Win
  
   I've read through Writing R Extensions and various 

Re: [R] [SPAM] - Re: R package development in windows - BayesianFilter detected spam

2007-05-03 Thread Ravi Varadhan
Harold,

I totally echo your sentiments on the difficulty of creating an R package in
Windows.  I really wish that this process could be made a bit less painful.

Ravi.  


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold
Sent: Thursday, May 03, 2007 3:33 PM
To: Duncan Murdoch
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] [SPAM] - Re: R package development in windows -
BayesianFilter detected spam

Thanks, Duncan. I'll look into that. Is there an authoritative document
that codifies the new package development procedures for 2.5.0
(windows-specific), or is that Writing R Extensions? In this thread
alone I've received multiple emails pointing to multiple web sites with
instructions for windows. Inasmuch as its appreciated, I'm a bit
confused as to which I should consider authoritative.

I do hope I can resolve this and appreciate the help I've received.
However, I feel a bit compelled to note how very difficult this process
is. 

Harold


 -Original Message-
 From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 03, 2007 3:24 PM
 To: Doran, Harold
 Cc: Gabor Grothendieck; r-help@stat.math.ethz.ch
 Subject: [SPAM] - Re: [R] R package development in windows - 
 Bayesian Filter detected spam
 
 On 5/3/2007 3:04 PM, Doran, Harold wrote:
  Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the 
  path. With that resolved, and another 10 minute windows 
 restart, I get 
  the following below. The log suggests that hhc is not installed. It 
  is, and, according to the directions I am following, I have 
 placed it 
  in the c:\cygwin directory.
 
 I think the problem is that you are following a real mix of 
 instructions, and they don't make sense.
 
 It would be nice if folks would submit patches to the R Admin 
 manual (or to the Rtools web site) rather than putting 
 together web sites with advice that is bad from day one, and 
 quickly gets worse when it is not updated.
 
  BTW, package.skeleton() doesn't seem to create the correct 
 DESCRIPTION 
  template. I had to add the DEPENDS line. Without this, I 
 get another 
  error.
  
  
  C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo
 
 R 2.4.1 is no longer current; the package building 
 instructions in R 2.5.0 have been simplified a bit.  You 
 might want to try those.
 
 Duncan Murdoch
 
  * checking for file 'g:\foo/DESCRIPTION' ... OK
  * preparing 'g:\foo':
  * checking DESCRIPTION meta-information ... OK
  * removing junk files
  * checking for LF line-endings in source files
  * checking for empty or unneeded directories
  * building binary distribution
   WARNING
  * some HTML links may not be found
  installing R.css in c:/TEMP/Rinst40061099
  
  Using auto-selected zip options ''
  latex: not found
  latex: not found
  latex: not found
  
  -- Making package foo 
  latex: not found
adding build stamp to DESCRIPTION
  latex: not found
  latex: not found
  latex: not found
installing R files
  latex: not found
installing data files
  latex: not found
installing man source files
installing indices
  latex: not found
not zipping data
installing help
  Warning: \alias{foo} already in foo-package.Rd -- skipping 
 the one in 
  foo.Rd   Building/Updating help pages for package 'foo'
   Formats: text html latex example chm
foo-package   texthtmllatex   
 example chm
foo   texthtmllatex   
 example chm
mydatatexthtmllatex   
 example chm
  hhc: not found
  cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm': 
 No such file 
  or direct ory
  make[1]: *** [chm-foo] Error 1
  make: *** [pkg-foo] Error 2
  *** Installation of foo failed ***
  
  Removing 'c:/TEMP/Rinst40061099/foo'
   ERROR
  * installation failed
  
  
  C:\Program Files\R\R-2.4.1\bin
  
  -Original Message-
  From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
  Sent: Thursday, May 03, 2007 2:50 PM
  To: Doran, Harold
  Cc: r-help@stat.math.ethz.ch
  Subject: Re: [R] R package development in windows
  
  It can find sh.exe so you haven't installed Rtools.
  
  There are several HowTo's listed in the links section here that 
  include pointers to R manuals and other step by step
  instructions:
  
  http://code.google.com/p/batchfiles/
  
  On 5/3/07, Doran, Harold [EMAIL PROTECTED] wrote:
   I'm attempting to build an R package for distribution and
  am 

Re: [R] Parsing data with an uneven number of delimiters

2007-05-03 Thread jim holtman
Try this:

 l1-c(a/a/a,b/bb/bbb,cc/c)
 l2-strsplit(l1,/)
 # determine maximum length
 maxLen - max(sapply(l2, length))
 # pad to maximum length
 do.call('data.frame', lapply(l2, function(x)c(x, rep(NA, maxLen-length(x)
  c..aaa.. c..bbbbbb.. c..ccc...NA.
1a   b   cc
2a  bbc
3a bbb NA





On 5/3/07, Kevin Burke [EMAIL PROTECTED] wrote:
 I have a list of data that is delimited by a / and, as long as there is an 
 equal number of delimiters, I can parse the data and put it into a data frame:

  t1-c(a/a/a,b/bb/bbb,ccc/cc/c)
  t2-strsplit(t1,/)
  t3-data.frame(t2)
  t3
  c..aaa.. c..bbbbbb.. c..cccccc..
 1a   b ccc
 2a  bb  cc
 3a bbb   c

 However, if I don't have an equal number of delimiters, this technique 
 doesn't work:

  l1-c(a/a/a,b/bb/bbb,cc/c)
  l2-strsplit(l1,/)
  l3-data.frame(l2)
 Error in data.frame(c(a, a, a), c(b, bb, bbb), c(cc, c :
arguments imply differing number of rows: 3, 2

 Is there an easy way to get this into a data frame with NA's (or something 
 else) where the missing data would be?

 Thanks in advance.

 Kevin Burke

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



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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] Parsing data with an uneven number of delimiters

2007-05-03 Thread Gabor Grothendieck
Try:

read.table(textConnection(l1), sep = /, fill = TRUE)


On 5/3/07, Kevin Burke [EMAIL PROTECTED] wrote:
 I have a list of data that is delimited by a / and, as long as there is an 
 equal number of delimiters, I can parse the data and put it into a data frame:

  t1-c(a/a/a,b/bb/bbb,ccc/cc/c)
  t2-strsplit(t1,/)
  t3-data.frame(t2)
  t3
  c..aaa.. c..bbbbbb.. c..cccccc..
 1a   b ccc
 2a  bb  cc
 3a bbb   c

 However, if I don't have an equal number of delimiters, this technique 
 doesn't work:

  l1-c(a/a/a,b/bb/bbb,cc/c)
  l2-strsplit(l1,/)
  l3-data.frame(l2)
 Error in data.frame(c(a, a, a), c(b, bb, bbb), c(cc, c :
arguments imply differing number of rows: 3, 2

 Is there an easy way to get this into a data frame with NA's (or something 
 else) where the missing data would be?

 Thanks in advance.

 Kevin Burke

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


Re: [R] [SPAM] - Re: R package development in windows - BayesianFilter detected spam

2007-05-03 Thread Gabor Grothendieck
Suggest you try following the advice I already gave, viz. reading the
relevant HowTo links on the batchfiles home page.
One gives pointers to the authoritative sources (the manuals)
and the other gives step by step instructions.  These do answer
both of the subsequent questions the poster had.


On 5/3/07, Ravi Varadhan [EMAIL PROTECTED] wrote:
 Harold,

 I totally echo your sentiments on the difficulty of creating an R package in
 Windows.  I really wish that this process could be made a bit less painful.

 Ravi.

 
 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

 Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html



 
 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold
 Sent: Thursday, May 03, 2007 3:33 PM
 To: Duncan Murdoch
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] [SPAM] - Re: R package development in windows -
 BayesianFilter detected spam

 Thanks, Duncan. I'll look into that. Is there an authoritative document
 that codifies the new package development procedures for 2.5.0
 (windows-specific), or is that Writing R Extensions? In this thread
 alone I've received multiple emails pointing to multiple web sites with
 instructions for windows. Inasmuch as its appreciated, I'm a bit
 confused as to which I should consider authoritative.

 I do hope I can resolve this and appreciate the help I've received.
 However, I feel a bit compelled to note how very difficult this process
 is.

 Harold


  -Original Message-
  From: Duncan Murdoch [mailto:[EMAIL PROTECTED]
  Sent: Thursday, May 03, 2007 3:24 PM
  To: Doran, Harold
  Cc: Gabor Grothendieck; r-help@stat.math.ethz.ch
  Subject: [SPAM] - Re: [R] R package development in windows -
  Bayesian Filter detected spam
 
  On 5/3/2007 3:04 PM, Doran, Harold wrote:
   Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the
   path. With that resolved, and another 10 minute windows
  restart, I get
   the following below. The log suggests that hhc is not installed. It
   is, and, according to the directions I am following, I have
  placed it
   in the c:\cygwin directory.
 
  I think the problem is that you are following a real mix of
  instructions, and they don't make sense.
 
  It would be nice if folks would submit patches to the R Admin
  manual (or to the Rtools web site) rather than putting
  together web sites with advice that is bad from day one, and
  quickly gets worse when it is not updated.
 
   BTW, package.skeleton() doesn't seem to create the correct
  DESCRIPTION
   template. I had to add the DEPENDS line. Without this, I
  get another
   error.
  
  
   C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo
 
  R 2.4.1 is no longer current; the package building
  instructions in R 2.5.0 have been simplified a bit.  You
  might want to try those.
 
  Duncan Murdoch
 
   * checking for file 'g:\foo/DESCRIPTION' ... OK
   * preparing 'g:\foo':
   * checking DESCRIPTION meta-information ... OK
   * removing junk files
   * checking for LF line-endings in source files
   * checking for empty or unneeded directories
   * building binary distribution
WARNING
   * some HTML links may not be found
   installing R.css in c:/TEMP/Rinst40061099
  
   Using auto-selected zip options ''
   latex: not found
   latex: not found
   latex: not found
  
   -- Making package foo 
   latex: not found
 adding build stamp to DESCRIPTION
   latex: not found
   latex: not found
   latex: not found
 installing R files
   latex: not found
 installing data files
   latex: not found
 installing man source files
 installing indices
   latex: not found
 not zipping data
 installing help
   Warning: \alias{foo} already in foo-package.Rd -- skipping
  the one in
   foo.Rd   Building/Updating help pages for package 'foo'
Formats: text html latex example chm
 foo-package   texthtmllatex
  example chm
 foo   texthtmllatex
  example chm
 mydatatexthtmllatex
  example chm
   hhc: not found
   cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm':
  No such file
   or direct ory
   make[1]: *** [chm-foo] Error 1
   make: *** [pkg-foo] Error 2
   *** Installation of foo failed ***
  
   Removing 'c:/TEMP/Rinst40061099/foo'
ERROR
   * installation failed
  
  
   C:\Program Files\R\R-2.4.1\bin
  
   -Original Message-
   From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
   Sent: Thursday, May 03, 2007 2:50 PM
   To: Doran, Harold
   Cc: 

[R] Calculate sums in Matrixes

2007-05-03 Thread Pedro Sobral

Dear R-users,

The data that I want to treat refer to claims and a glm have been adjusted
to the it.

Now there are some calculations that I wanrt to do with the residuals and
estimations from the model. The glm model has variables that refer to the
fleet to wich the vehicle refers to and variables that refer to the vehicle
(CC, type of vehicle, weight, etc).

In that sense I need to calculate sums, like the ones that I attached again.

I am following the paper:*

Experience Rating Schemes for Fleets of Vehicles from Denise Desjardins,
Georges Dionne and Jean Pinquet
*
Thanks
Pedro


sums[1].pdf
Description: Adobe PDF document
__
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] the Surv function

2007-05-03 Thread R. Villegas
2007/5/2, Jennifer Dillon [EMAIL PROTECTED]:
 Hi,

 I'm trying to do a simple survival analysis on some data, and I'm having the
 following problem (here's my code and the error message):

 out - Surv(fup,event=status)
 Error in Surv(fup, event = status) : argument time2 is missing, with no
 default

 From reading the documentation, it seems that I should be able to simply
 write:  Surv(time1, event)  if my data is right-censored, which it is.
 Help!

 Thanks a million,

 Jen



 --
 Jennifer Dillon
 Doctoral Student
 Harvard Biostatistics
 Room 414B, Building 1

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


Read this page about Applied Survival Analysis:
http://www.ats.ucla.edu/stat/r/examples/asa/default.htm

Rod.

__
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] R Wiki down?

2007-05-03 Thread Martin Maechler
 Talbot == Talbot Katz [EMAIL PROTECTED]
 on Thu, 03 May 2007 12:35:27 -0400 writes:

Talbot Hi.  I can't access the site
Talbot http://wiki.r-project.org/.  I didn't find any
Talbot notice about this on http://www.r-project.org/.
Talbot Does anyone have any more information about the R
Talbot Wiki status?  Thanks!

Yes, it is currently down.
Thanks for the note.

It's maintainer has hereby __ CC __ be notified as well.

Regards, 
Martin Maechler ETH Zurich

__
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 about POSIXct

2007-05-03 Thread Jacques Smith
Dear List:

I have a simple two-column data set in .csv format, with the first column
being the date and second column being some value.  I use read.csv() to
import the data as follows:



x - read.csv(myfile.csv,header=T, dec=., colClasses=c(Date=POSIXct))



The structure of x is:



 str(x)

`data.frame':   2959 obs. of  2 variables:

 $ Date:'POSIXct', format: chr  1998-01-01 1998-01-01 1998-01-01
1998-01-01 ...

 $ Value: num  0.07379 0.07181 0.01555 0.00630 0.00688 ...



This is not what I want.  Instead, I want the structure to be the same as
that of the following data set:



 str(danish)

 atomic [1:2167] 1.68 2.09 1.73 1.78 4.61 ...

 - attr(*, times)='POSIXct', format: chr [1:2167] 1980-01-02 18:00:00
1980-01-03 18:00:00 1980-01-04 18:00:00 1980-01-06 18:00:00 ...



danish is a data set that the package evir comes with.


Any help would be appreciated.

[[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] [SPAM] - Re: R package development in windows - BayesianFilter detected spam

2007-05-03 Thread Duncan Murdoch
On 5/3/2007 3:51 PM, Ravi Varadhan wrote:
 Harold,
 
 I totally echo your sentiments on the difficulty of creating an R package in
 Windows.  I really wish that this process could be made a bit less painful.

As mentioned below, version 2.5.0 makes it a bit less painful.  Your 
wish has come true!

The only problem is that there are a lot more bits still to go...

Duncan Murdoch

 
 Ravi.  
 
 
 ---
 
 Ravi Varadhan, Ph.D.
 
 Assistant Professor, The Center on Aging and Health
 
 Division of Geriatric Medicine and Gerontology 
 
 Johns Hopkins University
 
 Ph: (410) 502-2619
 
 Fax: (410) 614-9625
 
 Email: [EMAIL PROTECTED]
 
 Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
 
  
 
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold
 Sent: Thursday, May 03, 2007 3:33 PM
 To: Duncan Murdoch
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] [SPAM] - Re: R package development in windows -
 BayesianFilter detected spam
 
 Thanks, Duncan. I'll look into that. Is there an authoritative document
 that codifies the new package development procedures for 2.5.0
 (windows-specific), or is that Writing R Extensions? In this thread
 alone I've received multiple emails pointing to multiple web sites with
 instructions for windows. Inasmuch as its appreciated, I'm a bit
 confused as to which I should consider authoritative.
 
 I do hope I can resolve this and appreciate the help I've received.
 However, I feel a bit compelled to note how very difficult this process
 is. 
 
 Harold
 
 
 -Original Message-
 From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 03, 2007 3:24 PM
 To: Doran, Harold
 Cc: Gabor Grothendieck; r-help@stat.math.ethz.ch
 Subject: [SPAM] - Re: [R] R package development in windows - 
 Bayesian Filter detected spam
 
 On 5/3/2007 3:04 PM, Doran, Harold wrote:
  Thanks Gabor, Sundar, and Tony. Indeed, Rtools was missing from the 
  path. With that resolved, and another 10 minute windows 
 restart, I get 
  the following below. The log suggests that hhc is not installed. It 
  is, and, according to the directions I am following, I have 
 placed it 
  in the c:\cygwin directory.
 
 I think the problem is that you are following a real mix of 
 instructions, and they don't make sense.
 
 It would be nice if folks would submit patches to the R Admin 
 manual (or to the Rtools web site) rather than putting 
 together web sites with advice that is bad from day one, and 
 quickly gets worse when it is not updated.
 
  BTW, package.skeleton() doesn't seem to create the correct 
 DESCRIPTION 
  template. I had to add the DEPENDS line. Without this, I 
 get another 
  error.
  
  
  C:\Program Files\R\R-2.4.1\binRcmd build --force --binary g:\foo
 
 R 2.4.1 is no longer current; the package building 
 instructions in R 2.5.0 have been simplified a bit.  You 
 might want to try those.
 
 Duncan Murdoch
 
  * checking for file 'g:\foo/DESCRIPTION' ... OK
  * preparing 'g:\foo':
  * checking DESCRIPTION meta-information ... OK
  * removing junk files
  * checking for LF line-endings in source files
  * checking for empty or unneeded directories
  * building binary distribution
   WARNING
  * some HTML links may not be found
  installing R.css in c:/TEMP/Rinst40061099
  
  Using auto-selected zip options ''
  latex: not found
  latex: not found
  latex: not found
  
  -- Making package foo 
  latex: not found
adding build stamp to DESCRIPTION
  latex: not found
  latex: not found
  latex: not found
installing R files
  latex: not found
installing data files
  latex: not found
installing man source files
installing indices
  latex: not found
not zipping data
installing help
  Warning: \alias{foo} already in foo-package.Rd -- skipping 
 the one in 
  foo.Rd   Building/Updating help pages for package 'foo'
   Formats: text html latex example chm
foo-package   texthtmllatex   
 example chm
foo   texthtmllatex   
 example chm
mydatatexthtmllatex   
 example chm
  hhc: not found
  cp: cannot stat `c:/TEMP/Rbuild40048815/foo/chm/foo.chm': 
 No such file 
  or direct ory
  make[1]: *** [chm-foo] Error 1
  make: *** [pkg-foo] Error 2
  *** Installation of foo failed ***
  
  Removing 'c:/TEMP/Rinst40061099/foo'
   ERROR
  * installation failed
  
  
  C:\Program Files\R\R-2.4.1\bin
  
  -Original Message-
  From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
  Sent: Thursday, May 03, 2007 2:50 PM
  To: Doran, Harold
  Cc: r-help@stat.math.ethz.ch
  Subject: Re: [R] R package development in windows
  
  It can find sh.exe so you haven't installed Rtools.
  
  There are several HowTo's 

Re: [R] A question about POSIXct

2007-05-03 Thread Jacques Wagnor
A follow-up question:  The example in ?attr uses a character string of
dim.  Besides dim and times, what other character strings are
available or can be used?

On 5/3/07, Michael Sumner [EMAIL PROTECTED] wrote:

 Hello,

 It seems that danish is a numeric vector with attributes attached -
 the attribute vector is POSIXct and is the same length as danish.

 You can create this from a data frame like this:

 x - data.frame(Date = ISOdate(2007, 5, 1:10), Value = rnorm(10))
 str(x)
 'data.frame':   10 obs. of  2 variables:
 $ Date :'POSIXct', format: chr  2007-05-01 12:00:00 2007-05-02
 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...
 $ Value: num   1.891  0.741 -0.368  1.701 -0.660 ...

 xx - x$Value
 attr(xx, times) - x$Date
 str(xx)
 atomic [1:10]  0.0414 -0.7124 -1.2976  0.3101  0.4343 ...
 - attr(*, times)='POSIXct', format: chr [1:10] 2007-05-01 12:00:00
 2007-05-02 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...


 HTH

 Cheers, Mike.

  Dear List:
 
  I have a simple two-column data set in .csv format, with the first
 column
  being the date and second column being some value.  I use read.csv() to
  import the data as follows:
 
 
 
  x - read.csv(myfile.csv,header=T, dec=.,
 colClasses=c(Date=POSIXct))
 
 
 
  The structure of x is:
 
 
 
   str(x)
 
  `data.frame':   2959 obs. of  2 variables:
 
   $ Date:'POSIXct', format: chr  1998-01-01 1998-01-01 1998-01-01
  1998-01-01 ...
 
   $ Value: num  0.07379 0.07181 0.01555 0.00630 0.00688 ...
 
 
 
  This is not what I want.  Instead, I want the structure to be the same
 as
  that of the following data set:
 
 
 
   str(danish)
 
   atomic [1:2167] 1.68 2.09 1.73 1.78 4.61 ...
 
   - attr(*, times)='POSIXct', format: chr [1:2167] 1980-01-02
 18:00:00
  1980-01-03 18:00:00 1980-01-04 18:00:00 1980-01-06 18:00:00 ...
 
 
 
  danish is a data set that the package evir comes with.
 
 
  Any help would be appreciated.
 
[[alternative HTML version deleted]]
 
 




[[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] A question about POSIXct

2007-05-03 Thread Michael Sumner
Hello,

It seems that danish is a numeric vector with attributes attached - 
the attribute vector is POSIXct and is the same length as danish.

You can create this from a data frame like this:

 x - data.frame(Date = ISOdate(2007, 5, 1:10), Value = rnorm(10))
str(x)
'data.frame':   10 obs. of  2 variables:
 $ Date :'POSIXct', format: chr  2007-05-01 12:00:00 2007-05-02 
12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...
 $ Value: num   1.891  0.741 -0.368  1.701 -0.660 ...

 xx - x$Value
attr(xx, times) - x$Date
str(xx)
 atomic [1:10]  0.0414 -0.7124 -1.2976  0.3101  0.4343 ...
 - attr(*, times)='POSIXct', format: chr [1:10] 2007-05-01 12:00:00 
2007-05-02 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...


HTH

Cheers, Mike.

 Dear List:

 I have a simple two-column data set in .csv format, with the first column
 being the date and second column being some value.  I use read.csv() to
 import the data as follows:



 x - read.csv(myfile.csv,header=T, dec=., colClasses=c(Date=POSIXct))



 The structure of x is:



  str(x)

 `data.frame':   2959 obs. of  2 variables:

  $ Date:'POSIXct', format: chr  1998-01-01 1998-01-01 1998-01-01
 1998-01-01 ...

  $ Value: num  0.07379 0.07181 0.01555 0.00630 0.00688 ...



 This is not what I want.  Instead, I want the structure to be the same as
 that of the following data set:



  str(danish)

  atomic [1:2167] 1.68 2.09 1.73 1.78 4.61 ...

  - attr(*, times)='POSIXct', format: chr [1:2167] 1980-01-02 18:00:00
 1980-01-03 18:00:00 1980-01-04 18:00:00 1980-01-06 18:00:00 ...



 danish is a data set that the package evir comes with.


 Any help would be appreciated.

   [[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] Bayesian logistic regression with a beta prior (MCMClogit)

2007-05-03 Thread francogrex

Hi, yes but I realized afterwards that it's the logfun argument that had to
be put to logfun=F and the logpriorfun function had to be log=F
logpriorfun - function(beta,shape1,shape2){
sum(dbeta(beta,shape1,shape2,log=F)) }

But that's just for that particular example. I find I am having problems
still even after adjusting for that. Using other data it is not accepting
the estimation of beta.start with maximum likelihood
(user.prior.density(beta.start) = 0) and it is obliging me to specify it
giving me a very narrow range, and hence the acceptance rate of the output
is very mediocre (0.01)... I don't know I am missing something here maybe.
As much as I was excited about the MCMCpack, I am finding that it is no
substitute for BUGS/Brugs.


Cody_Hamilton wrote:
 
 Dear Franco,
 
 Have you tried using the beta.start option in MCMClogit?  (The problem may
 be where you are starting your chain.)
 
 Regards,
-Cody
 

-- 
View this message in context: 
http://www.nabble.com/Bayesian-logistic-regression-with-a-beta-prior-%28MCMClogit%29-tf3684970.html#a10312824
Sent from the R help mailing list archive at Nabble.com.

__
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] A question about POSIXct

2007-05-03 Thread Jacques Wagnor
Thank you, Mike!

On 5/3/07, Michael Sumner [EMAIL PROTECTED] wrote:

 Hello,

 It seems that danish is a numeric vector with attributes attached -
 the attribute vector is POSIXct and is the same length as danish.

 You can create this from a data frame like this:

 x - data.frame(Date = ISOdate(2007, 5, 1:10), Value = rnorm(10))
 str(x)
 'data.frame':   10 obs. of  2 variables:
 $ Date :'POSIXct', format: chr  2007-05-01 12:00:00 2007-05-02
 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...
 $ Value: num   1.891  0.741 -0.368  1.701 -0.660 ...

 xx - x$Value
 attr(xx, times) - x$Date
 str(xx)
 atomic [1:10]  0.0414 -0.7124 -1.2976  0.3101  0.4343 ...
 - attr(*, times)='POSIXct', format: chr [1:10] 2007-05-01 12:00:00
 2007-05-02 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...


 HTH

 Cheers, Mike.

  Dear List:
 
  I have a simple two-column data set in .csv format, with the first
 column
  being the date and second column being some value.  I use read.csv() to
  import the data as follows:
 
 
 
  x - read.csv(myfile.csv,header=T, dec=.,
 colClasses=c(Date=POSIXct))
 
 
 
  The structure of x is:
 
 
 
   str(x)
 
  `data.frame':   2959 obs. of  2 variables:
 
   $ Date:'POSIXct', format: chr  1998-01-01 1998-01-01 1998-01-01
  1998-01-01 ...
 
   $ Value: num  0.07379 0.07181 0.01555 0.00630 0.00688 ...
 
 
 
  This is not what I want.  Instead, I want the structure to be the same
 as
  that of the following data set:
 
 
 
   str(danish)
 
   atomic [1:2167] 1.68 2.09 1.73 1.78 4.61 ...
 
   - attr(*, times)='POSIXct', format: chr [1:2167] 1980-01-02
 18:00:00
  1980-01-03 18:00:00 1980-01-04 18:00:00 1980-01-06 18:00:00 ...
 
 
 
  danish is a data set that the package evir comes with.
 
 
  Any help would be appreciated.
 
[[alternative HTML version deleted]]
 
 




[[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] Install SciView under Windows Vista

2007-05-03 Thread Tim Sippel
Thanks for your advice.  Seems to have been a quirk in the installation of
R2HTML which is now resolved.  

Tim
 

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: 03 May 2007 21:29
To: Tim Sippel
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Install SciView under Windows Vista

Are you sure your version of R2HTML is up-to-date and built under R 2.5.0?
Use update.packages(checkBuilt=TRUE) if you have not already done so.

That got me R2HTML 1.58, not 1.54.

On Thu, 3 May 2007, Tim Sippel wrote:

 Hello-
 I have been trying to install SciView under Windows Vista (Home Premium
 version,
 32 bit OS, Intel Core Duo 2.13GHz, 2Gig RAM).

 I am getting an error, apparently related to the R2HTML package (version
 1.54)
 as you will see in the R information below my signature.

 I have tried to email directly to [EMAIL PROTECTED] for support but
have
() had my message returned as undeliverable.

 Your help is very much appreciated!

 Tim

 R version 2.5.0 (2007-04-23)
 Copyright (C) 2007 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0

 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
 Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

 R is a collaborative project with many contributors.
 Type 'contributors()' for more information and
 'citation()' on how to cite R or R packages in publications.

 Type 'demo()' for some demos, 'help()' for on-line help, or
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.

 [Previously saved workspace restored]

 Loading required package: datasets
 Loading required package: utils
 Loading required package: grDevices
 Loading required package: graphics
 Loading required package: stats
 Loading required package: tcltk
 Loading Tcl/Tk interface ... done
 Loading required package: R2HTML
 Error in `parent.env-`(`*tmp*`, value = NULL) :
use of NULL environment is defunct
 In addition: Warning message:
 'Sys.putenv' is deprecated.
 Use 'Sys.setenv' instead.
 See help(Deprecated)
 Error: package 'R2HTML' could not be loaded
 local({pkg - select.list(sort(.packages(all.available = TRUE)))
 + if(nchar(pkg)) library(pkg, character.only=TRUE)})
 Error in `parent.env-`(`*tmp*`, value = NULL) :
use of NULL environment is defunct
 Error: package/namespace load failed for 'R2HTML'
 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)

 search()
 [1] .GlobalEnvpackage:tcltk package:stats
 [4] package:graphics  package:grDevices package:utils
 [7] package:datasets  package:methods   Autoloads
 [10] package:base
 capabilities(tcltk)
 tcltk
 TRUE

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Issue with the Matrix package

2007-05-03 Thread Tony Chiang
Hi all,

I am wondering if this is a bug in the Matrix package or if it something
that I am just getting wrong...here is an example:

 m = matrix(0,4,4)
 dimnames(m) = list(letters[1:4], letters[5:8])
 r = c(a,b,a,d)
 m[r,2] = 1
 m
  e f g h
a 0 1 0 0
b 0 1 0 0
c 0 0 0 0
d 0 1 0 0

 M = Matrix(0,4,4)
 dimnames(M) = list(letters[1:4], letters[5:8])
 M[r,2] = 1
 M
4 x 4 sparse Matrix of class dgCMatrix

a . 2 . .
b . 1 . .
c . . . .
d . 1 . .


The documentation reads:

 Most of the time, the function works via a traditional (_full_)
 'matrix'.  However, 'Matrix(0, nrow,ncol)' directly constructs an
 empty sparseMatrix, as does 'Matrix(FALSE, *)'.

So is this when an exception comes, and if so can someone explain to me why
we get the 2? It would seem that it should just reassign the 1 to a 1 not
add the number of times it is assigning a 1.

Cheers,
--Tony

[[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] A question about POSIXct

2007-05-03 Thread Michael Sumner
Jacques Wagnor wrote:
 A follow-up question:  The example in ?attr uses a character string of
 dim.  Besides dim and times, what other character strings are
 available or can be used?
Ah, it's not limited to those. Any character string would do (guru 
caveats aside).  
I suspect my narrow answer to your question might lead you astray, 
perhaps you should cut to the chase and ask how to get your data file 
into which  function in evir . . .

Cheers, Mike.

 On 5/3/07, Michael Sumner [EMAIL PROTECTED] wrote:

 Hello,

 It seems that danish is a numeric vector with attributes attached -
 the attribute vector is POSIXct and is the same length as danish.

 You can create this from a data frame like this:

 x - data.frame(Date = ISOdate(2007, 5, 1:10), Value = rnorm(10))
 str(x)
 'data.frame':   10 obs. of  2 variables:
 $ Date :'POSIXct', format: chr  2007-05-01 12:00:00 2007-05-02
 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...
 $ Value: num   1.891  0.741 -0.368  1.701 -0.660 ...

 xx - x$Value
 attr(xx, times) - x$Date
 str(xx)
 atomic [1:10]  0.0414 -0.7124 -1.2976  0.3101  0.4343 ...
 - attr(*, times)='POSIXct', format: chr [1:10] 2007-05-01 12:00:00
 2007-05-02 12:00:00 2007-05-03 12:00:00 2007-05-04 12:00:00 ...


 HTH

 Cheers, Mike.

__
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] Library Package for Tobit regression

2007-05-03 Thread Abdus Sattar
Hello R-Users:
 
I am want to use tobit regression for left censored panel/longitudinal data. 
Could you please provide me the name of library and/or package that will 
give me option of fitting tobit regression model for longitudinal data? 
 
Thank you. 
 
Sattar

__



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


[R] reodering factor

2007-05-03 Thread John Sorkin
R 2.4.1 
Windows XP

How does one reorder a factor?


I have the following data:
 factor(data$Group)
 [1] ZZ ZT ZT ZZ ZZ ZT ZZ ZZ ZT ZT ZT ZT ZZ ZT ZT ZZ ZT ZZ ZT ZZ ZT ZT ZZ ZZ ZT 
ZZ ZT ZZ ZT ZZ ZZ ZT ZZ ZT
Levels: ZT ZZ

In my regression (i.e. lm(y~data$Group) ZT is taken as the reference category 
and I get an estimate for ZZ. I would like ZZ to be the reference category and 
obtain an estimate for ZT.

Thank,
John

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for the so...{{dropped}}

__
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] [R-pkgs] new package: RSVGTipsDevice: create SVG plots with tooltips hyperlinks

2007-05-03 Thread Tony Plate
the DESCRIPTION file:

Package: RSVGTipsDevice
Version: 0.7.0
Date:04/30/2007
Title:   An R SVG graphics device with dynamic tips and hyperlinks
Author:  Tony Plate [EMAIL PROTECTED], based on RSvgDevice by T Jake 
Luciani [EMAIL PROTECTED]
Maintainer: Tony Plate [EMAIL PROTECTED]
Depends: R (= 1.4)
Description: A graphics device for R that uses the w3.org xml standard
 for Scalable Vector Graphics.  This version supports
 tooltips with 1 to 3 lines, hyperlinks, and line styles.
License: GPL version 2 or newer. http://www.gnu.org/copyleft/gpl.html

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] reodering factor

2007-05-03 Thread Steven McKinney

One way to reorder a factor is to define a new
factor and specify the order of levels using
the levels argument of the factor() function.

The first category specified for the levels
argument will be the reference category in
model fits such as with lm().


 mydata - data.frame(y = c(runif(10), runif(10) + 10), grp = c(rep(A, 10), 
 rep(B, 10)))
 mydata
y grp
1   0.0808684   A
2   0.2930649   A
3   0.4671063   A
4   0.7815386   A
5   0.5360262   A
6   0.8092338   A
7   0.9965648   A
8   0.3549031   A
9   0.3426956   A
10  0.2988377   A
11 10.6528479   B
12 10.7118101   B
13 10.4484731   B
14 10.9638309   B
15 10.7650812   B
16 10.6355089   B
17 10.7003755   B
18 10.2147930   B
19 10.8901356   B
20 10.6319798   B
 lm(y ~ grp, data = mydata)

Call:
lm(formula = y ~ grp, data = mydata)

Coefficients:
(Intercept) grpB  
 0.4961  10.1654  

 mydata$grp2 - factor(mydata$grp, levels = c(B, A))
 mydata
y grp grp2
1   0.0808684   AA
2   0.2930649   AA
3   0.4671063   AA
4   0.7815386   AA
5   0.5360262   AA
6   0.8092338   AA
7   0.9965648   AA
8   0.3549031   AA
9   0.3426956   AA
10  0.2988377   AA
11 10.6528479   BB
12 10.7118101   BB
13 10.4484731   BB
14 10.9638309   BB
15 10.7650812   BB
16 10.6355089   BB
17 10.7003755   BB
18 10.2147930   BB
19 10.8901356   BB
20 10.6319798   BB
 lm(y ~ grp2, data = mydata)

Call:
lm(formula = y ~ grp2, data = mydata)

Coefficients:
(Intercept)grp2A  
  10.66   -10.17  

 



Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: [EMAIL PROTECTED]

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3
Canada




-Original Message-
From: [EMAIL PROTECTED] on behalf of John Sorkin
Sent: Thu 5/3/2007 7:10 PM
To: r-help@stat.math.ethz.ch
Subject: [R] reodering factor
 
R 2.4.1 
Windows XP

How does one reorder a factor?


I have the following data:
 factor(data$Group)
 [1] ZZ ZT ZT ZZ ZZ ZT ZZ ZZ ZT ZT ZT ZT ZZ ZT ZT ZZ ZT ZZ ZT ZZ ZT ZT ZZ ZZ ZT 
ZZ ZT ZZ ZT ZZ ZZ ZT ZZ ZT
Levels: ZT ZZ

In my regression (i.e. lm(y~data$Group) ZT is taken as the reference category 
and I get an estimate for ZZ. I would like ZZ to be the reference category and 
obtain an estimate for ZT.

Thank,
John

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for the so...{{dropped}}

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


Re: [R] reodering factor

2007-05-03 Thread Seyed Reza Jafarzadeh
Hi John,

You should use (http://rweb.stat.umn.edu/R/library/stats/html/relevel.html), so

newGroup - relevel (data$Group, ref = ZZ)



Reza


On 5/3/07, John Sorkin [EMAIL PROTECTED] wrote:
 R 2.4.1
 Windows XP

 How does one reorder a factor?


 I have the following data:
  factor(data$Group)
  [1] ZZ ZT ZT ZZ ZZ ZT ZZ ZZ ZT ZT ZT ZT ZZ ZT ZT ZZ ZT ZZ ZT ZZ ZT ZT ZZ ZZ 
 ZT ZZ ZT ZZ ZT ZZ ZZ ZT ZZ ZT
 Levels: ZT ZZ

 In my regression (i.e. lm(y~data$Group) ZT is taken as the reference category 
 and I get an estimate for ZZ. I would like ZZ to be the reference category 
 and obtain an estimate for ZT.

 Thank,
 John

 John Sorkin M.D., Ph.D.
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)

 Confidentiality Statement:
 This email message, including any attachments, is for the so...{{dropped}}

 __
 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] Problem with the installation of install R on Sun Solaris

2007-05-03 Thread Jomy Jose
./configure
hecking whether stripping libraries is possible... no
configure: WARNING: you cannot build info or html versions of the R manuals
checking for cos in -lm... yes
checking for sin in -lm... yes
checking for dlopen in -ldl... yes
checking readline/history.h usability... no
checking readline/history.h presence... no
checking for readline/history.h... no
checking readline/readline.h usability... no
checking readline/readline.h presence... no
checking for readline/readline.h... no
checking for rl_callback_read_char in -lreadline... no
checking for main in -lncurses... no
checking for main in -ltermcap... yes
checking for rl_callback_read_char in -lreadline... no
checking for history_truncate_file... no
configure: error: --with-readline=yes (default) and headers/libs are not
available


Plase help me for the same
Regards
Jomy

[[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] Problem with the installation of install R on Sun Solaris

2007-05-03 Thread Prof Brian Ripley
Please do read the 'R Installation and Administration' manual, which 
answers this and all your other questions.

I make this your sixth post on the subject line (and someone using a 
different address has posted with the identical line).  You are still 
sending HTML, so please do study the posting guide (as mentioned in the 
only reply to those posts I see in the list archives).  As it says

   If it is clear that you have done basic background research, you are far
   more likely to get an informative response.


On Fri, 4 May 2007, Jomy Jose wrote:

 ./configure
 hecking whether stripping libraries is possible... no
 configure: WARNING: you cannot build info or html versions of the R manuals
 checking for cos in -lm... yes
 checking for sin in -lm... yes
 checking for dlopen in -ldl... yes
 checking readline/history.h usability... no
 checking readline/history.h presence... no
 checking for readline/history.h... no
 checking readline/readline.h usability... no
 checking readline/readline.h presence... no
 checking for readline/readline.h... no
 checking for rl_callback_read_char in -lreadline... no
 checking for main in -lncurses... no
 checking for main in -ltermcap... yes
 checking for rl_callback_read_char in -lreadline... no
 checking for history_truncate_file... no
 configure: error: --with-readline=yes (default) and headers/libs are not
 available


 Plase help me for the same
 Regards
 Jomy

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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