[R] fitting an interaction term

2006-08-30 Thread Christian Jones
Hello!
IŽm fitting a model with glm(family binomial). The best model counts 9 
Variables and includes an interaction term that was generated by the product of 
to continuous variables (a*b). All variables are correlated under a value of 
0.7 (Spearman rank order) While the estimates of both main effects are negativ, 
the resulting interaction term is positiv. This change of sign makes it 
difficult to interpret the model and above all, is this perhaps due to a bad 
variable choice ?
Thanks a lot for helping
Christian

__
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] Substring and strsplit

2006-08-30 Thread Dimitris Rizopoulos
you can also use substring(), e.g.,

substring(x3, 1:nchar(x3), 1:nchar(x3))


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: Erin Hodgess [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Wednesday, August 30, 2006 12:25 AM
Subject: [R] Substring and strsplit


 Dear R People:

 I am trying to split a character vector into a set of individual
 letters:

 Ideal:
 x3 - c(dog)
 d o g

 I tried the following:
 strsplit(x3)
 Error in strsplit(x3) : argument split is missing, with no default
 strsplit(x3,1)
 [[1]]
 [1] dog

 I know that this is incredibly simple, but what am I doing wrong?

 Either Windows or Linux 2.3.1

 Thanks in advance!


 Sincerely,
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: [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.
 


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 on apply() function

2006-08-30 Thread DEVAN
Respected Sir/Madam,

I have a problem with apply function. I have to two matrices of dimension of
one column but n rows. I have to check whether one matrix is greater than
other by going thru each row (ie) using if condition to check one matrix
with another matrix. 

I like to use apply() function to this approach. That is apply function
between two matrices. I searched for examples online but I couldn't find
any.

I don't know how to loop thru the matrices.

Please help with this problem.

Any help is appreciated.

My mailid is [EMAIL PROTECTED]

Thanks,
Anusha.

__
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] Installation of SrcStatConnectorSrv on Windows

2006-08-30 Thread gordon . morrison

I am trying to install SrcStatConnectorSrv(2) and rcom from local zip
files.

I have successfully downloaded both files (from CRAN for rcom CRAN Other
for SrcStatConnectorSrv) and installed rcom. However, I get the following
error message when I try to install SrcStatConnectorSrv (the version dated
21-Aug-2006:

 utils:::menuInstallLocal()
Error in gzfile(file, r) : unable to open connection
In addition: Warning message:
cannot open compressed file 'SrcStatConnectorSrv(2)/DESCRIPTION'

I have also run

 RSiteSearch(SrcStatConnectorSrv)

but this failed to yield any results.

I am running Windows XP Professional and

 version
   _
platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  3.1
year   2006
month  06
day01
svn rev38247
language   R
version.string Version 2.3.1 (2006-06-01)

Could anyone shed any light on what I am doing wrong?

Many thanks in anticipation

Gordon


HSBC Bank plc may be solicited in the course of its placement efforts for a
new issue, by investment clients of the firm for whom the Bank as a firm
already provides other services. It may equally decide to allocate to its
own proprietary book or with an associate of HSBC Group. This represents a
potential conflict of interest. HSBC Bank plc has internal arrangements
designed to ensure that the firm would give unbiased and full advice to the
corporate finance client about the valuation and pricing of the offering as
well as internal systems, controls and procedures to identify and manage
conflicts of interest.

HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
Registered in England - Number 14259
Authorised and regulated by the Financial Services Authority.




HSBC Bank plc may be solicited in the course of its placement efforts for a
new issue, by investment clients of the firm for whom the Bank as a firm
already provides other services. It may equally decide to allocate to its
own proprietary book or with an associate of HSBC Group. This represents a
potential conflict of interest. HSBC Bank plc has internal arrangements
designed to ensure that the firm would give unbiased and full advice to the
corporate finance client about the valuation and pricing of the offering as
well as internal systems, controls and procedures to identify and manage
conflicts of interest.

HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
Registered in England - Number 14259
Authorised and regulated by the Financial Services Authority.



-
SAVE PAPER - THINK BEFORE YOU PRINT!

This transmission has been issued by a member of the HSBC Group HSBC
for the information of the addressee only and should not be reproduced
and/or distributed to any other person. Each page attached hereto must
be read in conjunction with any disclaimer which forms part of it.
Unless otherwise stated, this transmission is neither an offer nor the
solicitation of an offer to sell or purchase any investment. Its
contents are based on information obtained from sources believed to be
reliable but HSBC makes no representation and accepts no responsibility
or liability as to its completeness or accuracy.

__
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] Substring and strsplit

2006-08-30 Thread Hans-Joerg Bibiko
If you are using 'only' English then

str - dog
strsplit(str,NULL)[[1]]

works perfectly and it is fast.

But if you also dealing with Unicode character have a look at

http://wiki.r-project.org/rwiki/doku.php?id=tips:data- 
strings:decomposestring

Cheers,

Hans



 you can also use substring(), e.g.,

 substring(x3, 1:nchar(x3), 1:nchar(x3))


 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: Erin Hodgess [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Sent: Wednesday, August 30, 2006 12:25 AM
 Subject: [R] Substring and strsplit



 Dear R People:

 I am trying to split a character vector into a set of individual
 letters:

 Ideal:
 x3 - c(dog)
 d o g

 I tried the following:

 strsplit(x3)

 Error in strsplit(x3) : argument split is missing, with no default

 strsplit(x3,1)

 [[1]]
 [1] dog

 I know that this is incredibly simple, but what am I doing wrong?

 Either Windows or Linux 2.3.1

 Thanks in advance!


 Sincerely,
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: [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.


[R] MCMClogit

2006-08-30 Thread Andras Treszl
Hi,

I am using MCMCpack and the MCMClogit function to create logistic
regression models in a medical (adverse event) study. My question is,
is there a way where I can directly create the estimated probabilities
of the adverse outcome, moreover the confidence interval for the
estimated probabilities?

Thank you for your help!

Andras

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


[R] How to put title Vertically

2006-08-30 Thread stat stat
Dear all R users,

Suppose,


Dear all R users,

Suppose,


pauto.cor = pacf(lh, plot=F)
max.lag = max(pauto.cor$lag)
min.lag = min(pauto.cor$lag)
centre = (max.lag - min.lag)/2
pauto.cor = pauto.cor$acf
pauto.cor = pauto.cor[-1]

par(mar=c(3,0,1,1))
barplot(pauto.cor, axes=F,xlim=c(max(pauto.cor),
min(pauto.cor)), space=0,
col=green4,border=green,horiz=T) 


#This plots PACF vertically

Now I want to put a title of above plot but NOT
horizontally rather Vertically.

Can anyone please tell me how to do that?

Thanks and regards,
stat

thanks in advance

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

2006-08-30 Thread Muhammad Subianto
Dear all,
I have a dataset. I want to make barplot from this data.
Zero1 - 
   V1 V2 V3 V4 V5 V6 V7 V8   V9
1   1  0  0  0  1  0  0  0 Positive
2   0  0  1  0  1  0  1  1 Negative
3   0  0  1  0  0  0  1  1 Positive
4   0  1  0  1  1  1  0  1 Negative
5   0  0  1  0  1  1  0  0 Positive
6   0  1  0  0  1  1  1  1 Negative
7   1  0  1  1  1  1  1  1 Negative
8   0  0  0  0  1  0  0  1 Negative
9   0  1  1  1  1  0  0  1 Negative
10  0  0  0  1  1  0  1  0 Positive
11  0  0  0  0  1  0  0  1 Negative
12  0  0  1  1  1  1  1  0 Positive
13  0  1  1  0  1  1  1  1 Negative

z1 - read.table(textConnection(Zero1), header=TRUE)
z1
str(z1)

A simple way I can use mosaic plot
mosaicplot(table(z1))
library(vcd)
mosaic(table(z1))

I have tried to learn ?xtabs ?table and ?ftable but I can't figure out.
I need a barplot for all variables and the result maybe like

|   |  |   |
|   |   | |   |   ||   |   |
|pos|neg| |pos|neg||pos|neg|
|   |   | |   |   ||   |   |
- --
v1v2v3  v7 v8

Thanks you for any helps.
Regards, Muhammad Subianto

__
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] Installation of SrcStatConnectorSrv on Windows

2006-08-30 Thread Prof Brian Ripley
That is not an R package.

It looks like the sources of the server described on 

http://cran.r-project.org/contrib/extra/dcom/RSrv200.html

which tells you about the approriate mailing list to ask about it.
You probably want to use RSrv200.exe to install the server (and other 
tools and examples).


On Wed, 30 Aug 2006, [EMAIL PROTECTED] wrote:

 
 I am trying to install SrcStatConnectorSrv(2) and rcom from local zip
 files.
 
 I have successfully downloaded both files (from CRAN for rcom CRAN Other
 for SrcStatConnectorSrv) and installed rcom. However, I get the following
 error message when I try to install SrcStatConnectorSrv (the version dated
 21-Aug-2006:
 
  utils:::menuInstallLocal()
 Error in gzfile(file, r) : unable to open connection
 In addition: Warning message:
 cannot open compressed file 'SrcStatConnectorSrv(2)/DESCRIPTION'
 
 I have also run
 
  RSiteSearch(SrcStatConnectorSrv)
 
 but this failed to yield any results.
 
 I am running Windows XP Professional and
 
  version
_
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  3.1
 year   2006
 month  06
 day01
 svn rev38247
 language   R
 version.string Version 2.3.1 (2006-06-01)
 
 Could anyone shed any light on what I am doing wrong?
 
 Many thanks in anticipation
 
 Gordon
 
 
 HSBC Bank plc may be solicited in the course of its placement efforts for a
 new issue, by investment clients of the firm for whom the Bank as a firm
 already provides other services. It may equally decide to allocate to its
 own proprietary book or with an associate of HSBC Group. This represents a
 potential conflict of interest. HSBC Bank plc has internal arrangements
 designed to ensure that the firm would give unbiased and full advice to the
 corporate finance client about the valuation and pricing of the offering as
 well as internal systems, controls and procedures to identify and manage
 conflicts of interest.
 
 HSBC Bank plc
 Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
 Registered in England - Number 14259
 Authorised and regulated by the Financial Services Authority.
 
 
 
 
 HSBC Bank plc may be solicited in the course of its placement efforts for a
 new issue, by investment clients of the firm for whom the Bank as a firm
 already provides other services. It may equally decide to allocate to its
 own proprietary book or with an associate of HSBC Group. This represents a
 potential conflict of interest. HSBC Bank plc has internal arrangements
 designed to ensure that the firm would give unbiased and full advice to the
 corporate finance client about the valuation and pricing of the offering as
 well as internal systems, controls and procedures to identify and manage
 conflicts of interest.
 
 HSBC Bank plc
 Registered Office: 8 Canada Square, London E14 5HQ, United Kingdom
 Registered in England - Number 14259
 Authorised and regulated by the Financial Services Authority.
 
 
 
 -
 SAVE PAPER - THINK BEFORE YOU PRINT!
 
 This transmission has been issued by a member of the HSBC Group HSBC
 for the information of the addressee only and should not be reproduced
 and/or distributed to any other person. Each page attached hereto must
 be read in conjunction with any disclaimer which forms part of it.
 Unless otherwise stated, this transmission is neither an offer nor the
 solicitation of an offer to sell or purchase any investment. Its
 contents are based on information obtained from sources believed to be
 reliable but HSBC makes no representation and accepts no responsibility
 or liability as to its completeness or accuracy.
 
 __
 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] Barplot

2006-08-30 Thread Jacques VESLOT
barplot(t(sapply(split(z1[,1:8], z1$V9),colSums)), beside=T)
---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


Muhammad Subianto a écrit :
 Dear all,
 I have a dataset. I want to make barplot from this data.
 Zero1 - 
V1 V2 V3 V4 V5 V6 V7 V8   V9
 1   1  0  0  0  1  0  0  0 Positive
 2   0  0  1  0  1  0  1  1 Negative
 3   0  0  1  0  0  0  1  1 Positive
 4   0  1  0  1  1  1  0  1 Negative
 5   0  0  1  0  1  1  0  0 Positive
 6   0  1  0  0  1  1  1  1 Negative
 7   1  0  1  1  1  1  1  1 Negative
 8   0  0  0  0  1  0  0  1 Negative
 9   0  1  1  1  1  0  0  1 Negative
 10  0  0  0  1  1  0  1  0 Positive
 11  0  0  0  0  1  0  0  1 Negative
 12  0  0  1  1  1  1  1  0 Positive
 13  0  1  1  0  1  1  1  1 Negative
 
 z1 - read.table(textConnection(Zero1), header=TRUE)
 z1
 str(z1)
 
 A simple way I can use mosaic plot
 mosaicplot(table(z1))
 library(vcd)
 mosaic(table(z1))
 
 I have tried to learn ?xtabs ?table and ?ftable but I can't figure out.
 I need a barplot for all variables and the result maybe like
 
 |   |  |   |
 |   |   | |   |   ||   |   |
 |pos|neg| |pos|neg||pos|neg|
 |   |   | |   |   ||   |   |
 - --
 v1v2v3  v7 v8
 
 Thanks you for any helps.
 Regards, Muhammad Subianto
 
 __
 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] MCMClogit

2006-08-30 Thread Andras Treszl
Hi,

I am using MCMCpack and the MCMClogit function to create logistic
regression models in a medical (adverse event) study. My question is,
is there a way where I can directly create the estimated probabilities
of the adverse outcome, and the confidence interval for the
estimated probabilities? Or is there another package I should use instead?

Thank you for your help!

Andras

__
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] density() with from, to or cut and comparrison of density()

2006-08-30 Thread Rainer M Krug
Hi

the function density() does normally integrate to one - I've checked it
and it works and I also read the previous threads.
But I realised that it does not integrate to one if I use from, to or cut.

My scenario: I simulated densities of a plants originating from an sseed
source at distance zero. Therefore the density of the plants will be
highest close to zero. Is there anything I can do to have this pattern?
If I use 'from' or 'cut', the resulting densities do not integrate to
one which I need as I want to compare different density curves.

Ny second question is concerning the bandwidth. An I correct in saying
that if I want to compare different density estimates that the bandwidth
should be the same for all of them?

Thanks in advance for your help,

Rainer

-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:   +27 - (0)83 9479 042

email:  [EMAIL PROTECTED]
[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] Help on apply() function

2006-08-30 Thread Paul Smith
On 8/30/06, Mark Lyman [EMAIL PROTECTED] wrote:
  I have a problem with apply function. I have to two matrices of dimension of
  one column but n rows. I have to check whether one matrix is greater than
  other by going thru each row (ie) using if condition to check one matrix
  with another matrix.
 
  I like to use apply() function to this approach. That is apply function
  between two matrices. I searched for examples online but I couldn't find
  any.
 
  I don't know how to loop thru the matrices.

 You can use the functions all.equal with the function isTRUE (see ?all.equal) 
 to
 check if two objects are nearly equal (within a certain tolerance). Or you can
 use identical (see ?identical) to check if they are exactly the same. See the
 examples in the help for identical.

A possible solution could be:

 x - 1:5
 x
[1] 1 2 3 4 5
 y - 2:6
 y
[1] 2 3 4 5 6
 all((y-x)0)
[1] TRUE

The result TRUE means that each element of y is greater than the
homologous element in x.

Paul

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

2006-08-30 Thread Jim Lemon
Muhammad Subianto wrote:
 ... 
 I have tried to learn ?xtabs ?table and ?ftable but I can't figure out.
 I need a barplot for all variables and the result maybe like
 
 |   |  |   |
 |   |   | |   |   ||   |   |
 |pos|neg| |pos|neg||pos|neg|
 |   |   | |   |   ||   |   |
 - --
 v1v2v3  v7 v8
 
barplot(sapply(z1[1:8],by,z1[9],sum),beside=TRUE)

Jim

__
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] Firefox extension fo R Site Search

2006-08-30 Thread Robert Mcfadden
May be it's not a bug, but I tried to search for the package rpanel and I
was not find. At the r-project's site that package is available.
How to explain it?
Rob

__
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] Firefox extension fo R Site Search

2006-08-30 Thread Romain Francois
Robert Mcfadden a écrit :
 May be it's not a bug, but I tried to search for the package rpanel and I
 was not find. At the r-project's site that package is available.
 How to explain it?
 Rob   
   
Hi Rob,

If it's not there : http://finzi.psych.upenn.edu/R/library/
it's not on the extension

Cheers,

Romain

__
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 put title Vertically

2006-08-30 Thread Uwe Ligges


stat stat wrote:
 Dear all R users,
 
 Suppose,
 
 
 Dear all R users,
 
 Suppose,
 
 
 pauto.cor = pacf(lh, plot=F)
 max.lag = max(pauto.cor$lag)
 min.lag = min(pauto.cor$lag)
 centre = (max.lag - min.lag)/2
 pauto.cor = pauto.cor$acf
 pauto.cor = pauto.cor[-1]
 
 par(mar=c(3,0,1,1))
 barplot(pauto.cor, axes=F,xlim=c(max(pauto.cor),
 min(pauto.cor)), space=0,
 col=green4,border=green,horiz=T) 
 
 
 #This plots PACF vertically
 
 Now I want to put a title of above plot but NOT
 horizontally rather Vertically.
 
 Can anyone please tell me how to do that?


Use mtext()

Uwe Ligges


 Thanks and regards,
 stat
 
 thanks in advance
 
 __
 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] density() with from, to or cut and comparrison of density()

2006-08-30 Thread Uwe Ligges


Rainer M Krug wrote:
 Hi
 
 the function density() does normally integrate to one - I've checked it
 and it works and I also read the previous threads.
 But I realised that it does not integrate to one if I use from, to or cut.
 
 My scenario: I simulated densities of a plants originating from an sseed
 source at distance zero. Therefore the density of the plants will be
 highest close to zero. Is there anything I can do to have this pattern?
 If I use 'from' or 'cut', the resulting densities do not integrate to
 one which I need as I want to compare different density curves.

The kernel chosen might be not the ideal one for such a restriction. If 
the density outside the cut range is extremely small, you might want 
to do a dirty transformation so that the values sum up to 1 again.

 Ny second question is concerning the bandwidth. An I correct in saying
 that if I want to compare different density estimates that the bandwidth
 should be the same for all of them?

Yes.

Uwe Ligges


 Thanks in advance for your help,
 
 Rainer


__
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] Firefox extension fo R Site Search

2006-08-30 Thread Uwe Ligges


Romain Francois wrote:
 Robert Mcfadden a écrit :
 May be it's not a bug, but I tried to search for the package rpanel and I
 was not find. At the r-project's site that package is available.
 How to explain it?
 Rob   
   
 Hi Rob,
 
 If it's not there : http://finzi.psych.upenn.edu/R/library/
 it's not on the extension


... because that side is update once a month, hence simply wait for a 
couple of days until it will show up.

Uwe Ligges


 Cheers,
 
 Romain
 
 __
 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] Firefox extension fo R Site Search

2006-08-30 Thread Jonathan Baron
On 08/30/06 11:55, Romain Francois wrote:
 Robert Mcfadden a ?crit :
  May be it's not a bug, but I tried to search for the package rpanel and I
  was not find. At the r-project's site that package is available.
  How to explain it?
  Rob
 
 Hi Rob,
 
 If it's not there : http://finzi.psych.upenn.edu/R/library/
 it's not on the extension

The list is updated monthly, and rpanel is new.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

__
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] Barplot - thanks

2006-08-30 Thread Muhammad Subianto
Dear all,
Many Thanks to Jacques VESLOT and Jim Lemon for their helps.

Best, Muhammad Subianto


#Jacques VESLOT
barplot(t(sapply(split(z1[,1:8], z1$V9),colSums)), beside=T)

#Jim Lemon
barplot(sapply(z1[1:8],by,z1[9],sum),beside=TRUE)




On this day 30/08/2006 11:43, Muhammad Subianto wrote:
 Dear all,
 I have a dataset. I want to make barplot from this data.
 Zero1 - 
V1 V2 V3 V4 V5 V6 V7 V8   V9
 1   1  0  0  0  1  0  0  0 Positive
 2   0  0  1  0  1  0  1  1 Negative
 3   0  0  1  0  0  0  1  1 Positive
 4   0  1  0  1  1  1  0  1 Negative
 5   0  0  1  0  1  1  0  0 Positive
 6   0  1  0  0  1  1  1  1 Negative
 7   1  0  1  1  1  1  1  1 Negative
 8   0  0  0  0  1  0  0  1 Negative
 9   0  1  1  1  1  0  0  1 Negative
 10  0  0  0  1  1  0  1  0 Positive
 11  0  0  0  0  1  0  0  1 Negative
 12  0  0  1  1  1  1  1  0 Positive
 13  0  1  1  0  1  1  1  1 Negative
 
 z1 - read.table(textConnection(Zero1), header=TRUE)
 z1
 str(z1)
 
 A simple way I can use mosaic plot
 mosaicplot(table(z1))
 library(vcd)
 mosaic(table(z1))
 
 I have tried to learn ?xtabs ?table and ?ftable but I can't figure out.
 I need a barplot for all variables and the result maybe like
 
 |   |  |   |
 |   |   | |   |   ||   |   |
 |pos|neg| |pos|neg||pos|neg|
 |   |   | |   |   ||   |   |
 - --
 v1v2v3  v7 v8
 
 Thanks you for any helps.
 Regards, Muhammad Subianto


__
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] Version 1.2-0 of the Rcmdr package

2006-08-30 Thread John Fox
I've submitted a new, and substantially enhanced, version (1.2-0) of the
Rcmdr package to CRAN. Some highlights (from the CHANGES) file:

   o  Added ability to import from Excel, Access or dBase files (contributed
by Samir Messad, Renaud Lancelot and Matthieu Lesnoff).

   o  Added ability to read data from the clipboard (suggested by Graham
Smith).

   o  Added Data - Active data set - Stack variables in active data set
(suggested by Richard Heiberger).
   
   o  Added many probability distributions, courtesy of Miroslav Ristic and
G. Jay Kerns, Andy Chang, and Theophilius Boye.
   
   o  Added dialogs to sample from probability distributions; divided
distributions menus into Continuous and Discrete.
   
   o  Added totPercents function. Added total percentages and components of
chi-square to two-way tables (suggested by Richard Heiberger).
  
   o  Added Statistics - Summaries - Count missing observations.
   
   o  Added Statistics - Summaries - Correlation test, contributed by
Stefano Calza.
  
   o  The numerical summaries, table of statistics, frequency distributions,
numeric to factor, and recode dialogs will now process multiple variables in
parallel (suggested by Bo Sommerlund).
   
   o  Added function numSummaries for neater output from Statistics -
Summaries - Numerical summaries (motivated by comments from Bo
Sommerlund).
   
   o  XY conditioning plots dialog added, courtesy of Richard Heiberger.
  
   o  Enhancements to 3D scatterplots.

   o  Small interface improvements (e.g., pressing letter key in a list box
moves to next entry starting with that letter).

   o  New Rcmdr options (etc and etcMenus) determine where the Commander
will look for its configuration and menu files (motivated by a suggestion by
Richard Heiberger).
  
Rcmdr version 1.2-0 includes revised Catalan and Japanese translations
(courtesy of Manel Salamero and Takaharu Araki); as other revised
translations become available, I'll submit updated versions of the package
to CRAN. Version 1.2-1 will also have a revised introductory manual.

As usual, bug reports, comments, and suggestions are welcome.

John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

___
R-packages mailing list
R-packages@stat.math.ethz.ch
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] Datetime

2006-08-30 Thread COMTE Guillaume
Hi all,

I'm getting confused by date handling.

 

I wish to read a date from a file wich is a number of seconds since 1970
(POSIXct).

Then i wish to convert this date to a human readable form (POSIXlt)

 

By example :

 

ctDate-1132963200 #Wed Aug 30 14:24:37 2006

is(ctDate)

[1] numeric vector

 

ctDate isn't a numeric vector, it is a POSIXct... none of the clues
inside the docs has given me the answer, i can't cast it, i can't
converti t to POSIXlt because it is wrong class (as.POSIX** don't want
to work...)

 

What is the trick ??

Any ideas would be great

thks

COMTE Guillaume

 


[[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] Handling realisations in geoRglm

2006-08-30 Thread Ben Bolker
Chris Barker cmbarker at ucdavis.edu writes:

 
However, after reading the packages' documentation and 
 searching the mailing lists and other sources, it seems that the 
 functions in geoRglm do not acknowledge the existence of multiple 
 realisations per site.  I see that the likfit() function in geoR has an 
 argument for realisations, but I cannot find anything similar in 
 geoRglm.  Is it possible to model data with repeated realisations from 
 the same sites using geoRglm?  If so, how can this be done and is there 
 a way to model dependence among the realisations over time?
 
  I don't know; I would be interested in the conclusions you reach.
I, too, found the support for multiple realisations to be relatively
skimpy in geoR (only likfit, and not any of the variogram-based
methods, support realisations); the code for likfit.glsm in the
geoRglm packages also reveals no hint of realisation code.

  Even so, what there is in geoR says quite strongly that realisations
are expected to be independent.  My guess is that for complex space/time
dependence, and wanting an answer to a practical problem, you would be
better off with a GEE approach ...

Writing the package maintainer directly
would probably be more useful.

  Ben Bolker

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

2006-08-30 Thread Andrew D. Martin

Andras,

At this point you need to write your own function to take the  
posterior density sample (stored in a coda mcmc object) and  
covariates of interest to get a Monte Carlo estimate of these  
probabilities.

Best,
ADM

On Aug 30, 2006, at 5:10 AM, Andras Treszl wrote:

 Hi,

 I am using MCMCpack and the MCMClogit function to create logistic
 regression models in a medical (adverse event) study. My question is,
 is there a way where I can directly create the estimated probabilities
 of the adverse outcome, and the confidence interval for the
 estimated probabilities? Or is there another package I should use  
 instead?

 Thank you for your help!

 Andras

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

--
Andrew D. Martin, Ph.D.
Professor and CERL Director, School of Law
Professor, Department of Political Science
Washington University in St. Louis

(314) 935-5863 (Office)
(314) 935-5150 (Fax)

Office: Anheuser-Busch 470
Email: [EMAIL PROTECTED]
WWW: http://adm.wustl.edu

__
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] Create a vector from another vector

2006-08-30 Thread Doran, Harold
Dear list

Suppose I have the following vector:

x -  c(3,4,2,5,6)

Obviously, this sums to 20. Now, I want to have a second vector, call it
x2, that sums to x where 5 = x = 20, but there are constraints.

1) The new vector must be same length as x
2) No element of the new vector can be 0
3) Element x2[i] of the new vector cannot be larger than element x[i] of
the original vector
4) Ordering is not important

The following would be an example of what I would want if the user
wanted the vector x2 to sum to 19

x2 - c(2,4,2,5,6) 

Or, because ordering is not important, this is acceptable

x2 - c(3,3,2,5,6) 

Whereas this would not be appropriate

x3 - c(4, 2,2,5,6)

Because element x3[1] is larger than x[1] even though it sums to 19.

Ideally, the function would take as input the original vector, x, and
the number that the new vector would sum to. In this example, the vector
could sum to any number 5 through 20.

For example,

myFun - function(x, sumto) ... details ...

Is there a preexisiting function that would already do this? I have
spent too much (unsuccessful) time trying to write a function of my own
but can't seem to get this to work properly.

Any hints would be greatly appreciated.

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] Create a vector from another vector

2006-08-30 Thread Robin Hankin
Dear Harold

package partitions does almost this:



  library(partitions)
  x - 1+restrictedparts(15,5)
  x[,1:10]
  [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]   16   15   14   13   12   11   10
[2,]1234567
[3,]1111111
[4,]1111111
[5,]1111111
  [,8] [,9] [,10]
[1,]9   1413
[2,]82 3
[3,]12 2
[4,]11 1
[5,]11 1
 

HTH

Robin


On 30 Aug 2006, at 14:49, Doran, Harold wrote:

 Dear list

 Suppose I have the following vector:

 x -  c(3,4,2,5,6)

 Obviously, this sums to 20. Now, I want to have a second vector,  
 call it
 x2, that sums to x where 5 = x = 20, but there are constraints.

 1) The new vector must be same length as x
 2) No element of the new vector can be 0
 3) Element x2[i] of the new vector cannot be larger than element x 
 [i] of
 the original vector
 4) Ordering is not important

 The following would be an example of what I would want if the user
 wanted the vector x2 to sum to 19

 x2 - c(2,4,2,5,6)

 Or, because ordering is not important, this is acceptable

 x2 - c(3,3,2,5,6)

 Whereas this would not be appropriate

 x3 - c(4, 2,2,5,6)

 Because element x3[1] is larger than x[1] even though it sums to 19.

 Ideally, the function would take as input the original vector, x, and
 the number that the new vector would sum to. In this example, the  
 vector
 could sum to any number 5 through 20.

 For example,

 myFun - function(x, sumto) ... details ...

 Is there a preexisiting function that would already do this? I have
 spent too much (unsuccessful) time trying to write a function of my  
 own
 but can't seem to get this to work properly.

 Any hints would be greatly appreciated.

 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.

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


[R] Optimization

2006-08-30 Thread Simone Vincenzi
Dear R-list,
I'm trying to estimate the relative importance of 6 environmental variables
in determining clam yield. To estimate clam yield a previous work used the
function Yield = (A^a*B^b*C^c...)^1/(a+b+c+...) where A,B,C... are the
values of the environmental variables and the weights a,b,c... have not been
calibrated on data but taken from literature. Now I'd like to estimate the
weights a,b,c... by using a dataset with 110 observations of yield and
values of the environmental variables. I'm wondering if it is feasible or if
the number of observation is too low, if some data transformation is needed
and which R function is the most appropriate to try to estimate the weights.
Any help would be greatly appreciated.

Simone Vincenzi 

_
Simone Vincenzi, PhD Student 
Department of Environmental Sciences
University of Parma
Parco Area delle Scienze, 33/A, 43100 Parma, Italy
Phone: +39 0521 905696
Fax: +39 0521 906611
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.


[R] converting decimal - hexadecimal

2006-08-30 Thread Romain Lorrilliere
Hi,

do you know, a method to convert an decimal value (integer) to the 
corresponding hexadecimal value ?

thinks for help.

Romain

-- 

Lorrillière Romain

 

UMR 8079 Laboratoire Ecologie, Systématique et Evolution

Bât. 362

Université Paris-Sud

91405 Orsay cedex

France

 

tel : 01 69 15 56 85

fax : 01 69 15 56 96

mobile : 06 81 70 90 70

 

email : [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




-- 

Romain Lorrillière

 

UMR 8079 Laboratoire Ecologie, Systématique et Evolution

Bât. 362

Université Paris-Sud

91405 Orsay cedex

France

 

tel : 01 69 15 56 85

fax : 01 69 15 56 96

mobile : 06 81 70 90 70

 

email : [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] Create a vector from another vector

2006-08-30 Thread Duncan Murdoch
On 8/30/2006 9:49 AM, Doran, Harold wrote:
 Dear list
 
 Suppose I have the following vector:
 
 x -  c(3,4,2,5,6)
 
 Obviously, this sums to 20. Now, I want to have a second vector, call it
 x2, that sums to x where 5 = x = 20, but there are constraints.
 
 1) The new vector must be same length as x
 2) No element of the new vector can be 0
 3) Element x2[i] of the new vector cannot be larger than element x[i] of
 the original vector
 4) Ordering is not important
 
 The following would be an example of what I would want if the user
 wanted the vector x2 to sum to 19
 
 x2 - c(2,4,2,5,6) 
 
 Or, because ordering is not important, this is acceptable
 
 x2 - c(3,3,2,5,6) 
 
 Whereas this would not be appropriate
 
 x3 - c(4, 2,2,5,6)
 
 Because element x3[1] is larger than x[1] even though it sums to 19.

I don't think it's really clear what you mean by ordering is not 
important.  Would

x2 - c(6,5,2,4,2)

be acceptable (a re-ordering of your first two examples), even though 
x2[1]  x1[1]?

It's also not clear what result you want in the usual case where there 
are multiple possible answers.  Do you want a randomly chosen one (from 
what distribution?), or would any value satisfying the constraints be 
okay?  (The latter would be easiest:  just start with x1, and decrement 
entries until the desired sum is achieved.  Whether a random value is 
easy or not really depends on the desired distribution.)  Do entries 
need to be integer valued?

 
 Ideally, the function would take as input the original vector, x, and
 the number that the new vector would sum to. In this example, the vector
 could sum to any number 5 through 20.
 
 For example,
 
 myFun - function(x, sumto) ... details ...
 
 Is there a preexisiting function that would already do this? I have
 spent too much (unsuccessful) time trying to write a function of my own
 but can't seem to get this to work properly.

I doubt it, because this doesn't look like a standard problem.

Duncan Murdoch

 
 Any hints would be greatly appreciated.
 
 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.


Re: [R] Create a vector from another vector

2006-08-30 Thread Robin Hankin
I think I've got it now.

If I understand your question,  try:


  x - do.call(cbind,lapply(5:7,function(i){restrictedparts(i, 
5,include.zero=FALSE)}))
  acceptable - function(x){all(x=c(3,4,5,2,6))}
  x[,apply(x,2,acceptable)]
  [,1] [,2] [,3] [,4]
[1,]1232
[2,]1112
[3,]1111
[4,]1111
[5,]1111
 


rksh



On 30 Aug 2006, at 14:49, Doran, Harold wrote:

 Dear list

 Suppose I have the following vector:

 x -  c(3,4,2,5,6)

 Obviously, this sums to 20. Now, I want to have a second vector,  
 call it
 x2, that sums to x where 5 = x = 20, but there are constraints.

 1) The new vector must be same length as x
 2) No element of the new vector can be 0
 3) Element x2[i] of the new vector cannot be larger than element x 
 [i] of
 the original vector
 4) Ordering is not important

 The following would be an example of what I would want if the user
 wanted the vector x2 to sum to 19

 x2 - c(2,4,2,5,6)

 Or, because ordering is not important, this is acceptable

 x2 - c(3,3,2,5,6)

 Whereas this would not be appropriate

 x3 - c(4, 2,2,5,6)

 Because element x3[1] is larger than x[1] even though it sums to 19.

 Ideally, the function would take as input the original vector, x, and
 the number that the new vector would sum to. In this example, the  
 vector
 could sum to any number 5 through 20.

 For example,

 myFun - function(x, sumto) ... details ...

 Is there a preexisiting function that would already do this? I have
 spent too much (unsuccessful) time trying to write a function of my  
 own
 but can't seem to get this to work properly.

 Any hints would be greatly appreciated.

 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.

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

2006-08-30 Thread Gabor Grothendieck
Try this.  First we reduce the data to a frequency matrix and
then plot it using classic and then lattice graphics:

zm - as.matrix(rowsum(z1[-9], z1[,9]))

barplot(zm, beside = TRUE, col = grey.colors(2))
legend(topleft, legend = levels(z1[,9]), fill = grey.colors(2))

library(lattice)
barchart(Freq ~ Var2, as.data.frame.table(zm),
  groups = Var1, origin = 0, auto.key = TRUE)

On 8/30/06, Muhammad Subianto [EMAIL PROTECTED] wrote:
 Dear all,
 I have a dataset. I want to make barplot from this data.
 Zero1 - 
   V1 V2 V3 V4 V5 V6 V7 V8   V9
 1   1  0  0  0  1  0  0  0 Positive
 2   0  0  1  0  1  0  1  1 Negative
 3   0  0  1  0  0  0  1  1 Positive
 4   0  1  0  1  1  1  0  1 Negative
 5   0  0  1  0  1  1  0  0 Positive
 6   0  1  0  0  1  1  1  1 Negative
 7   1  0  1  1  1  1  1  1 Negative
 8   0  0  0  0  1  0  0  1 Negative
 9   0  1  1  1  1  0  0  1 Negative
 10  0  0  0  1  1  0  1  0 Positive
 11  0  0  0  0  1  0  0  1 Negative
 12  0  0  1  1  1  1  1  0 Positive
 13  0  1  1  0  1  1  1  1 Negative

 z1 - read.table(textConnection(Zero1), header=TRUE)
 z1
 str(z1)

 A simple way I can use mosaic plot
 mosaicplot(table(z1))
 library(vcd)
 mosaic(table(z1))

 I have tried to learn ?xtabs ?table and ?ftable but I can't figure out.
 I need a barplot for all variables and the result maybe like

 |   |  |   |
 |   |   | |   |   ||   |   |
 |pos|neg| |pos|neg||pos|neg|
 |   |   | |   |   ||   |   |
 - --
v1v2v3  v7 v8

 Thanks you for any helps.
 Regards, Muhammad Subianto

 __
 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] converting decimal - hexadecimal

2006-08-30 Thread Gabor Grothendieck
Try:

sprintf(%x, 109)


On 9/30/06, Romain Lorrilliere [EMAIL PROTECTED] wrote:
 Hi,

 do you know, a method to convert an decimal value (integer) to the
 corresponding hexadecimal value ?

 thinks for help.

 Romain

 --

 Lorrillière Romain



 UMR 8079 Laboratoire Ecologie, Systématique et Evolution

 Bât. 362

 Université Paris-Sud

 91405 Orsay cedex

 France



 tel : 01 69 15 56 85

 fax : 01 69 15 56 96

 mobile : 06 81 70 90 70



 email : [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




 --

 Romain Lorrillière



 UMR 8079 Laboratoire Ecologie, Systématique et Evolution

 Bât. 362

 Université Paris-Sud

 91405 Orsay cedex

 France



 tel : 01 69 15 56 85

 fax : 01 69 15 56 96

 mobile : 06 81 70 90 70



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


__
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] converting decimal - hexadecimal

2006-08-30 Thread jim holtman
use sprintf

 sprintf(%x,123)
[1] 7b




On 9/30/06, Romain Lorrilliere [EMAIL PROTECTED] wrote:
 Hi,

 do you know, a method to convert an decimal value (integer) to the
 corresponding hexadecimal value ?

 thinks for help.

 Romain

 --

 Lorrillière Romain



 UMR 8079 Laboratoire Ecologie, Systématique et Evolution

 Bât. 362

 Université Paris-Sud

 91405 Orsay cedex

 France



 tel : 01 69 15 56 85

 fax : 01 69 15 56 96

 mobile : 06 81 70 90 70



 email : [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




 --

 Romain Lorrillière



 UMR 8079 Laboratoire Ecologie, Systématique et Evolution

 Bât. 362

 Université Paris-Sud

 91405 Orsay cedex

 France



 tel : 01 69 15 56 85

 fax : 01 69 15 56 96

 mobile : 06 81 70 90 70



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



-- 
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] converting decimal - hexadecimal

2006-08-30 Thread mel
?sprintf

ex :
  sprintf('%X',10)
[1] A

hih

__
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] function which gives the hessian matrix of the log-likelihood of a nonlinear mixed model?

2006-08-30 Thread Olive Yang
Hi,

Can anyone tell me which function in R gives the hessian matrix of the
log-likelihood of a nonlinear mixed model? fdHess is for scarlar function
only.

Thanks in advance!

Hongmei

[[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] converting decimal - hexadecimal

2006-08-30 Thread Stefan Grosse
how about learning to use help.search? (In may you already asked a
similiar question...)

help.search(hexadecimal)

which would lead you to format.hexmode

?format.hexmode



Romain Lorrilliere schrieb:
 Hi,

 do you know, a method to convert an decimal value (integer) to the 
 corresponding hexadecimal value ?

 thinks for help.

 Romain



__
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] working with summarized data

2006-08-30 Thread Rick Bischoff
The data sets I am working with all have a weight variable--e.g.,  
each row doesn't mean 1 observation.

With that in mind, nearly all of the graphs and summary statistics  
are incorrect for my data, because they don't take into account the  
weight.


For example median is incorrect, as the quantiles aren't calculated  
with weights:

sum( weights[X  median(X)] ) / sum(weights)

This should be 0.5... of course it's not.


Unfortunately, it seems that most(all?) of R's graphics and summary  
statistic functions don't take a weight or frequency argument.
(Fortunately the models do...)

Am I completely missing how to do this?  One way would be to  
replicate each row proportional to the weight (e.g. if the weight was  
4, we would 3 additional copies) but this will get prohibitive pretty  
quickly as the dataset grows.


Thanks in advance!

__
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] Create a vector from another vector

2006-08-30 Thread Doran, Harold
Hi Duncan

Here is a bit more detail, this is a bit tough to explain, sorry for not
being clear. Ordering is not important because the vector I am creating
is used as a sufficient statistic in an optimization routine to get some
MLEs. So, any combination of the vector that sums to X is OK. But, the
condition that x2[i] = x[i] must be maintained. So, the example below
would not work because x2[1]  x[1] as you note below.

 I don't think it's really clear what you mean by ordering is 
 not important.  Would
 
 x2 - c(6,5,2,4,2)
 be acceptable (a re-ordering of your first two examples), 
 even though x2[1]  x1[1]?

To be concrete, the following is the optimization function. This is a
psychometric problem where the goal is to get the MLE for a test taker
conditional on their response pattern (i.e., number of points on the
test) and the item parameters.

pcm.max3 - function(score, d){
pcm - function(theta, d, score)
exp(sum(theta-d[1:score]))/sum(exp(cumsum(theta-d)))
opt - function(theta) -sum(log(mapply(pcm, d, theta = theta, score=
score )))
start_val - log(sum(score-1)/(length(score-1)/sum(score-1)))
out - optim(start_val, opt, method = BFGS, hessian = TRUE)
cat('theta is about', round(out$par, 2), ', se',
1/sqrt(out$hes),'\n')
  } 

Suppose we have a three item test. I store the item parameters in a list
as

items - list(c(0,.5,1), c(0,1), c(0, -1, .5, 1))

We can get the total possible number correct as

(x - sapply(items, length))
[1] 3 2 4

But, you cannot actually get the MLE for this because the likelihood is
unbounded in this case. 

So, let's say the student scored in the following categories for each
item:

x2 - c(3,1,4)

By x2[i] = x[i], I mean that there are 3 possible categories for item 1
above. So, a student can only score in categories 1,2 or 3. He cannot
score in category 4. This is why the condition that x2[i] = x[i] is
critical. 

But, because total score is a sufficient statistic, (i.e., ordering is
not important) we could either vector in the function pcm. 

x3 - c(3,2,3)

Using the function 

pcm.max3(x2, items)
pcm.max3(x3, items)

Gives the same MLE.

But, the vector 

X_bad - c(4,1,3)

Would not work. You can see that the elements of this vector actually
serve as indices denoting which category a test taker scored in for each
item in the list items

I hope this is helpful and appreciate your time.

Harold


  
  __
  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] converting decimal - hexadecimal

2006-08-30 Thread Hans-Joerg Bibiko
An other way would be:

a - 123
class(a) - hexmode
a
[1] 7b

On 30 Aug 2006, at 16:26, mel wrote:

 ?sprintf

 ex :
 sprintf('%X',10)
 [1] A

 hih

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



**
Hans-Joerg Bibiko
Max Planck Institute for Evolutionary Anthropology
Department of Linguistics
Deutscher Platz 6 phone:   +49 (0) 341 3550 341
D-04103 Leipzig   fax: +49 (0) 341 3550 333
Germany   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] converting decimal - hexadecimal

2006-08-30 Thread Earl F. Glynn
Romain Lorrilliere [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hi,

do you know, a method to convert an decimal value (integer) to the
corresponding hexadecimal value ?

Starting in R 2.1.0, sprintf can be used:

 x - c(0, 65535, 65536, 305419896, 2^31-1)
 y - sprintf(0x%X, x)
 y
[1] 0x00x 0x10x12345678 0x7FFF
 as.numeric(y)
[1]  0  65535  65536  305419896 2147483647

efg

Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research

__
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] working with summarized data

2006-08-30 Thread Gabor Grothendieck
In each case, look around (help.search,
RSiteSearch) to see if you can find a function
that handles weights.  For the case you mention,
medians, it can be done via quantile regression:

x - w - 1:5
library(quantreg)
coef(rq(x ~ 1, weight = w))

On 8/30/06, Rick Bischoff [EMAIL PROTECTED] wrote:
 The data sets I am working with all have a weight variable--e.g.,
 each row doesn't mean 1 observation.

 With that in mind, nearly all of the graphs and summary statistics
 are incorrect for my data, because they don't take into account the
 weight.

 
 For example median is incorrect, as the quantiles aren't calculated
 with weights:

 sum( weights[X  median(X)] ) / sum(weights)

 This should be 0.5... of course it's not.
 

 Unfortunately, it seems that most(all?) of R's graphics and summary
 statistic functions don't take a weight or frequency argument.
 (Fortunately the models do...)

 Am I completely missing how to do this?  One way would be to
 replicate each row proportional to the weight (e.g. if the weight was
 4, we would 3 additional copies) but this will get prohibitive pretty
 quickly as the dataset grows.


 Thanks in advance!

 __
 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] Create a vector from another vector

2006-08-30 Thread Robin Hankin
OK,

With this extra detail, a
third solution follows, which may be closer in spirit
to your application.
It may or may not be faster than the other two,
depending on the exact parameters used:


library(partitions)
1+blockparts(n=15,y=c(3,4,2,5,6)-1,include.fewer=T)

(720 distinct solutions)


rksh

On 30 Aug 2006, at 15:49, Doran, Harold wrote:

 Hi Duncan

 Here is a bit more detail, this is a bit tough to explain, sorry  
 for not
 being clear. Ordering is not important because the vector I am  
 creating
 is used as a sufficient statistic in an optimization routine to get  
 some
 MLEs. So, any combination of the vector that sums to X is OK. But, the
 condition that x2[i] = x[i] must be maintained. So, the example below
 would not work because x2[1]  x[1] as you note below.

 I don't think it's really clear what you mean by ordering is
 not important.  Would

 x2 - c(6,5,2,4,2)
 be acceptable (a re-ordering of your first two examples),
 even though x2[1]  x1[1]?

 To be concrete, the following is the optimization function. This is a
 psychometric problem where the goal is to get the MLE for a test taker
 conditional on their response pattern (i.e., number of points on the
 test) and the item parameters.

 pcm.max3 - function(score, d){
 pcm - function(theta, d, score)
 exp(sum(theta-d[1:score]))/sum(exp(cumsum(theta-d)))
 opt - function(theta) -sum(log(mapply(pcm, d, theta = theta,  
 score=
 score )))
 start_val - log(sum(score-1)/(length(score-1)/sum(score-1)))
 out - optim(start_val, opt, method = BFGS, hessian = TRUE)
 cat('theta is about', round(out$par, 2), ', se',
 1/sqrt(out$hes),'\n')
   }

 Suppose we have a three item test. I store the item parameters in a  
 list
 as

 items - list(c(0,.5,1), c(0,1), c(0, -1, .5, 1))

 We can get the total possible number correct as

 (x - sapply(items, length))
 [1] 3 2 4

 But, you cannot actually get the MLE for this because the  
 likelihood is
 unbounded in this case.

 So, let's say the student scored in the following categories for each
 item:

 x2 - c(3,1,4)

 By x2[i] = x[i], I mean that there are 3 possible categories for  
 item 1
 above. So, a student can only score in categories 1,2 or 3. He cannot
 score in category 4. This is why the condition that x2[i] = x[i] is
 critical.

 But, because total score is a sufficient statistic, (i.e.,  
 ordering is
 not important) we could either vector in the function pcm.

 x3 - c(3,2,3)

 Using the function

 pcm.max3(x2, items)
 pcm.max3(x3, items)

 Gives the same MLE.

 But, the vector

 X_bad - c(4,1,3)

 Would not work. You can see that the elements of this vector actually
 serve as indices denoting which category a test taker scored in for  
 each
 item in the list items

 I hope this is helpful and appreciate your time.

 Harold



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

--
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] Create a vector from another vector

2006-08-30 Thread Dimitris Rizopoulos
maybe something like this could be of help:

max.score - c(3,4,3) # max score for each item
all.pats - as.matrix(expand.grid(lapply(max.score, :, 1)))
all.pats[rowSums(all.pats) == 5, ]



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: Doran, Harold [EMAIL PROTECTED]
To: Duncan Murdoch [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Wednesday, August 30, 2006 4:49 PM
Subject: Re: [R] Create a vector from another vector


 Hi Duncan

 Here is a bit more detail, this is a bit tough to explain, sorry for 
 not
 being clear. Ordering is not important because the vector I am 
 creating
 is used as a sufficient statistic in an optimization routine to get 
 some
 MLEs. So, any combination of the vector that sums to X is OK. But, 
 the
 condition that x2[i] = x[i] must be maintained. So, the example 
 below
 would not work because x2[1]  x[1] as you note below.

 I don't think it's really clear what you mean by ordering is
 not important.  Would

 x2 - c(6,5,2,4,2)
 be acceptable (a re-ordering of your first two examples),
 even though x2[1]  x1[1]?

 To be concrete, the following is the optimization function. This is 
 a
 psychometric problem where the goal is to get the MLE for a test 
 taker
 conditional on their response pattern (i.e., number of points on the
 test) and the item parameters.

 pcm.max3 - function(score, d){
pcm - function(theta, d, score)
 exp(sum(theta-d[1:score]))/sum(exp(cumsum(theta-d)))
opt - function(theta) -sum(log(mapply(pcm, d, theta = theta, 
 score=
 score )))
start_val - log(sum(score-1)/(length(score-1)/sum(score-1)))
out - optim(start_val, opt, method = BFGS, hessian = TRUE)
cat('theta is about', round(out$par, 2), ', se',
 1/sqrt(out$hes),'\n')
  }

 Suppose we have a three item test. I store the item parameters in a 
 list
 as

 items - list(c(0,.5,1), c(0,1), c(0, -1, .5, 1))

 We can get the total possible number correct as

 (x - sapply(items, length))
 [1] 3 2 4

 But, you cannot actually get the MLE for this because the likelihood 
 is
 unbounded in this case.

 So, let's say the student scored in the following categories for 
 each
 item:

 x2 - c(3,1,4)

 By x2[i] = x[i], I mean that there are 3 possible categories for 
 item 1
 above. So, a student can only score in categories 1,2 or 3. He 
 cannot
 score in category 4. This is why the condition that x2[i] = x[i] is
 critical.

 But, because total score is a sufficient statistic, (i.e., ordering 
 is
 not important) we could either vector in the function pcm.

 x3 - c(3,2,3)

 Using the function

 pcm.max3(x2, items)
 pcm.max3(x3, items)

 Gives the same MLE.

 But, the vector

 X_bad - c(4,1,3)

 Would not work. You can see that the elements of this vector 
 actually
 serve as indices denoting which category a test taker scored in for 
 each
 item in the list items

 I hope this is helpful and appreciate your time.

 Harold


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


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.


Re: [R] working with summarized data

2006-08-30 Thread Rick Bischoff
 Unfortunately, it seems that most(all?) of R's graphics and summary
 statistic functions don't take a weight or frequency argument.
 (Fortunately the models do...)

 I have been been meaning to add this functionality to my graphics
 package ggplot (http://had.co.nz/ggplot), but unfortunately haven't
 had time yet.  I'm guessing you want something like:

 * scatterplot: scale size of point according to weight (can do)
 * bar chart: bars should have height proportional to weight (can do)
 * histogram: area proportion to weighting variable (have some half
 finished code to do)
 * smoothers: should automatically use weights
 * boxplot: use weighted quantiles/letter statistics (is there a
 function for that?)

 What else is there?

densityplot is the only other one I can think of at the moment...  
With the rest of those, I could certainly live without it though!

Thanks!

__
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] working with summarized data

2006-08-30 Thread Thomas Lumley
On Wed, 30 Aug 2006, Rick Bischoff wrote:

 Unfortunately, it seems that most(all?) of R's graphics and summary
 statistic functions don't take a weight or frequency argument.
 (Fortunately the models do...)

 I have been been meaning to add this functionality to my graphics
 package ggplot (http://had.co.nz/ggplot), but unfortunately haven't
 had time yet.  I'm guessing you want something like:

 * scatterplot: scale size of point according to weight (can do)
 * bar chart: bars should have height proportional to weight (can do)
 * histogram: area proportion to weighting variable (have some half
 finished code to do)
 * smoothers: should automatically use weights
 * boxplot: use weighted quantiles/letter statistics (is there a
 function for that?)

 What else is there?

 densityplot is the only other one I can think of at the moment...
 With the rest of those, I could certainly live without it though!


Density plots, scatterplot smoothers, hexbin plots, bubble plots, 
histograms, and boxplots are available in the survey package. These are 
probability-weighted rather than frequency-weighted but it doesn't matter 
for graphics.  You could use them as is (which requires setting up a 
survey design object) or rip the internals out of them.


-thomas

__
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] lmer applied to a wellknown (?) example

2006-08-30 Thread Henrik Parn
Dear all,

During my pre-R era I tried (yes, tried) to understand mixed models by 
working through the 'rat example' in Sokal and Rohlfs Biometry (2000) 
3ed p 288-292. The same example was later used by Crawley (2002) in his 
Statistical Computing p 363-373 and I have seen the same data being used 
elsewhere in the litterature.

Because this example is so thoroughly described, I thought it would be 
very interesting to analyse it also using lmer and to see how the 
different approaches and outputs differs - from the more or less manual 
old-school (?) approach in Sokal, aov in Crawley, and to mixed models by 
lmer.

In the example, three treatments (Treatment) with two rats (Rat) each 
(i.e six unique rats in total). Three liver preparations (Liver) are 
taken from each rat (i.e 18 unique liver preparations), and two glycogen 
readings (Glycogen) are taken from each liver preparation (36 readings).

We want to test if treatments has affected the glycogen levels. The 
readings are nested in preparation and the preparations nested in rats.

The data can be found here (or on p. 289 in Sokal):
http://www.bio.ic.ac.uk/research/mjcraw/statcomp/data/rats.txt
//
I was hoping to use the rat example as some kind of reference on my way 
to understand mixed models and using lmer. However, first I wish someone 
could check my suggested models!

My suggestions:

attach(rats)
rats$Glycogen - as.numeric(Glycogen)
rats$Treatment - as.factor(Treatment)
rats$Rat - as.factor(Rat)
rats$Liver - as.factor(Liver)
str(rats)

model1 - lmer(Glycogen ~ Treatment + (1|Liver) + (1|Rat), data=rats)
summary(model1)

Was that it?

I also tried to make the 'liver-in-rat' nesting explicit  (as suggested 
in 'Examples from...')
 
model2 - lmer(Glycogen ~ Treatment + (1|Rat:Liver) + (1|Rat), data=rats)
summary(model2)

but then the random effects differs from model1.

Does the non-unique coding of rats and preparations in the original data 
set mess things up? Do I need to recode the ids to unique levels...

rats$rat2 - as.factor(rep(1:6, each=6))
rats$liver2 - as.factor(rep(1:18, each=2))
str(rats)

...and then:

model3 - lmer(Glycogen ~ Treatment + (1|liver2) + (1|rat2), data=rats)
# or maybe
model3 - lmer(Glycogen ~ Treatment + (1|rat2:liver2) + (1|rat2), data=rats)
 

Can anyone help me to get this right! Thanks in advance!

P.S.
Thanks to all contributors to lme/lmer topic on the list (yes, I have 
searched for 'lmer nested'...) and also the examples provided by John 
Fox' 'Linear mixed models, Appendix to An R and S-PLUS companion...' and 
Douglas Bates' 'Examples from Multilevel Software...' and R-news 5/1. 
Very helpful, but as usually I bet I missed something...Sorry.

Regards,

Henrik 

-- 

Henrik Pärn
Department of Biology
NTNU
7491 Trondheim
Norway

+47 735 96282 (office)
+47 909 89 255 (mobile)
+47 735 96100 (fax)

__
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] bootstrap for group and subgroup

2006-08-30 Thread Milton Cezar
Dear R-friends,
   
  I have a table data structured by group, subgroups, records and attributes. 
For each group and subgroup I have differente number of records (more than 
200). I need bootstrap 100 records for each group/subgroup combinations and 
repeat it a big number of times.
   
  Could someone of you help me on this hard (almost for me) task.
   
  Kind regards,
   
  miltinho


-

 Música para ver e ouvir: You're Beautiful, do James Blunt
[[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] Bootstraping for groups and subgroups and joing with other table

2006-08-30 Thread Chris Stubben
   I have a table with following collumns: State, SamplePlot, Species and
BodySize. I sampled bird species at
 34 SamplePlots and 5 States (regions) monthly during two years. On each bird
record I measured bodysize
 and identified the species. So I have many records of each species (about 150
species) at each SamplePlot
 and each Region (State). 
 
   Now I would like bootstrap these data, selecting 50 records for each
State/SamplePlot combinations and
 count how many species (richness) were sampled at bootstrap. I need to do this
1.000 times. 
 
   After that and need join the number of species [obtained at each bootstrap
and for each State/SamplePlot
 combination] with a dataframe that have other attributes for SamplePlot (like
Area, Perimeter etc). 



I asked a similar question earlier... IF you have data frame birds and
bird.plots, maybe something like this.

#initialize empty variable 
boot-NULL

for(i in 1:100)
{
   ## split on state and site and create list a
   a -split(birds, paste(birds$State,birds$SampleSite), drop=T)

   # sample 50 rows each OR by number of observations (better?)
   # b-lapply( a, function(x) x[sample(nrow(x), 50, replace=T),])
 b-lapply( a, function(x) x[sample(nrow(x), replace=T),])

   ## count number of unique species or other statistic? 
   ###  and add row to boot matrix
   boot-rbind(boot, unlist( lapply(b, function (x) length(unique(x$Species)) ) 
))
}

## mean

y-apply(boot, 2, mean)


## convert to data frame for merge

y-data.frame(y)

names(y)-boot.count


## add row names to bird.plots for easy join
rownames(bird.plots)-paste(bird.plots$State,bird.plots$SampleSite)

merge(bird.plots,y, by=0)

  Row.names  State SampleSite Area boot.count
1   Bahia Site1  Bahia  Site1   10   1.00
2   Bahia Site2  Bahia  Site2   25   1.96
3   Bahia Site3  Bahia  Site3   70   1.72
4   Bahia Site4  Bahia  Site4   15   1.73
5   Bahia Site5  Bahia  Site55   1.42
6  RioJaneiro Site1 RioJaneiro  Site1   32   2.49
7  RioJaneiro Site2 RioJaneiro  Site2   45   1.63
8  RioJaneiro Site3 RioJaneiro  Site3   10   2.37
9SaoPaulo Site1   SaoPaulo  Site1   23   2.41
10   SaoPaulo Site2   SaoPaulo  Site2   45   2.57


Chris Stubben

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

2006-08-30 Thread Muhammad Subianto
Dear all,

To Gabor Grothendieck,  (again) thanks you very much for your help.
Now, I can play around with lattice package.

Best, Muhammad Subianto

#Gabor
#reduce the data to a frequency matrix and
#then plot it using classic and then lattice graphics:

zm - as.matrix(rowsum(z1[-9], z1[,9]))

barplot(zm, beside = TRUE, col = grey.colors(2))
legend(topleft, legend = levels(z1[,9]), fill = grey.colors(2))

library(lattice)
barchart(Freq ~ Var2, as.data.frame.table(zm),
   groups = Var1, origin = 0, auto.key = TRUE)


On this day 30/08/2006 16:18, Gabor Grothendieck wrote:
 Try this.  First we reduce the data to a frequency matrix and
 then plot it using classic and then lattice graphics:
 
 zm - as.matrix(rowsum(z1[-9], z1[,9]))
 
 barplot(zm, beside = TRUE, col = grey.colors(2))
 legend(topleft, legend = levels(z1[,9]), fill = grey.colors(2))
 
 library(lattice)
 barchart(Freq ~ Var2, as.data.frame.table(zm),
   groups = Var1, origin = 0, auto.key = TRUE)
 
 On 8/30/06, Muhammad Subianto [EMAIL PROTECTED] wrote:
 Dear all,
 I have a dataset. I want to make barplot from this data.
 Zero1 - 
   V1 V2 V3 V4 V5 V6 V7 V8   V9
 1   1  0  0  0  1  0  0  0 Positive
 2   0  0  1  0  1  0  1  1 Negative
 3   0  0  1  0  0  0  1  1 Positive
 4   0  1  0  1  1  1  0  1 Negative
 5   0  0  1  0  1  1  0  0 Positive
 6   0  1  0  0  1  1  1  1 Negative
 7   1  0  1  1  1  1  1  1 Negative
 8   0  0  0  0  1  0  0  1 Negative
 9   0  1  1  1  1  0  0  1 Negative
 10  0  0  0  1  1  0  1  0 Positive
 11  0  0  0  0  1  0  0  1 Negative
 12  0  0  1  1  1  1  1  0 Positive
 13  0  1  1  0  1  1  1  1 Negative

 z1 - read.table(textConnection(Zero1), header=TRUE)
 z1
 str(z1)

 A simple way I can use mosaic plot
 mosaicplot(table(z1))
 library(vcd)
 mosaic(table(z1))

 I have tried to learn ?xtabs ?table and ?ftable but I can't figure out.
 I need a barplot for all variables and the result maybe like

 |   |  |   |
 |   |   | |   |   ||   |   |
 |pos|neg| |pos|neg||pos|neg|
 |   |   | |   |   ||   |   |
 - --
v1v2v3  v7 v8

 Thanks you for any helps.
 Regards, Muhammad Subianto

__
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] Ranking and selection statistical procedure

2006-08-30 Thread Prasanna
Dear R helpers

I would like to know if the Ranking and Selection statistical
procedure has been implemented in R. I made a quick search in the R
packages list but I could not find it.

Thanks in advance
Prasanna

__
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] Producing R demos

2006-08-30 Thread Greg Snow
One option is to use VNC along with vncrec to do the recording (see the
website:  http://www.sodan.org/~penny/vncrec/).  I think there are some
other recorders also available for vnc, so you might try a google
search.


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gregor Gorjanc
Sent: Tuesday, August 29, 2006 3:03 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Producing R demos

Hello!

I have found terrific demo or R package functionality at

http://had.co.nz/reshape/french-fries-demo.html

Author has told me off-list that he is using SnapzProX (on mac), and
ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing.
Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how
such a demo (video + automated typing of a script) could be produced
under either Windows or Linux OS? I would like to create such a demo for
presentation as I will not be able to install R on the machine, but I
could play a movie.

Thanks!

--
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] density() with from, to or cut and comparrison of density()

2006-08-30 Thread Greg Snow
You may want to look at the logspline package, it uses a different
technique than density does, but it estimates densities and allows you
to tell the routine that there is a minimum value and that the density
does not extend beyond there.

Hope this helps, 


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rainer M Krug
Sent: Wednesday, August 30, 2006 4:27 AM
To: R help list
Subject: [R] density() with from, to or cut and comparrison of density()

Hi

the function density() does normally integrate to one - I've checked it
and it works and I also read the previous threads.
But I realised that it does not integrate to one if I use from, to or
cut.

My scenario: I simulated densities of a plants originating from an sseed
source at distance zero. Therefore the density of the plants will be
highest close to zero. Is there anything I can do to have this pattern?
If I use 'from' or 'cut', the resulting densities do not integrate to
one which I need as I want to compare different density curves.

Ny second question is concerning the bandwidth. An I correct in saying
that if I want to compare different density estimates that the bandwidth
should be the same for all of them?

Thanks in advance for your help,

Rainer

--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Department of Conservation Ecology and Entomology University of
Stellenbosch Matieland 7602 South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)21 808 3304
Cell:   +27 - (0)83 9479 042

email:  [EMAIL PROTECTED]
[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.

__
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] working with summarized data

2006-08-30 Thread Greg Snow
There are functions to do weighted summary statistics in the Hmisc
package (wtd.quantile, ...).

For more complicated analyses (but not plots yet) the biglm package has
a bigglm function that expects the data in chunks, you could write a
function that expand parts of the dataset at a time.

Hope this helps, 


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rick Bischoff
Sent: Wednesday, August 30, 2006 8:28 AM
To: r-help@stat.math.ethz.ch
Subject: [R] working with summarized data

The data sets I am working with all have a weight variable--e.g., each
row doesn't mean 1 observation.

With that in mind, nearly all of the graphs and summary statistics are
incorrect for my data, because they don't take into account the weight.


For example median is incorrect, as the quantiles aren't calculated
with weights:

sum( weights[X  median(X)] ) / sum(weights)

This should be 0.5... of course it's not.


Unfortunately, it seems that most(all?) of R's graphics and summary  
statistic functions don't take a weight or frequency argument.
(Fortunately the models do...)

Am I completely missing how to do this?  One way would be to replicate
each row proportional to the weight (e.g. if the weight was 4, we would
3 additional copies) but this will get prohibitive pretty quickly as the
dataset grows.


Thanks in advance!

__
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] Debugging with gdb

2006-08-30 Thread Lee, Han
I tried to run gdb in linux with emacs
But could not even run a simple example in the writing extensions
tutorial.
The execution history is as follows.
Gdb worked fine for other debugging such as C++ codes.

Thanks 
Han



I started R at echo of emacs by typing 
(also tried other methods mentioned in the tutorial both in emacs and
xterm.)
M-x gdb== R -d gdb

(gdb) run
Starting program: /home/gcmio/local.20060808/lib/R/bin/exec/R -cd
/home/a409791/R/R-Test/ -fullname
[Thread debugging using libthread_db enabled]
[New Thread -1218514176 (LWP 11086)]
WARNING: unknown option '-cd'

ARGUMENT '/home/a409791/R/R-Test/' __ignored__

WARNING: unknown option '-fullname'


R : Copyright 2006, The R Foundation for Statistical Computing
Version 2.3.1 (2006-06-01)
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.

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]


Program received signal SIGINT, Interrupt.
[Switching to Thread -1218514176 (LWP 11086)]
0x00366c58 in ___newselect_nocancel () from /lib/tls/libc.so.6
(gdb) b do_get
Breakpoint 1 at 0x80ca4f5: file envir.c, line 1615.
(gdb) signal 0
Continuing with no signal.

 x - 1
 get(x)

Breakpoint 1, do_get (call=0x9443878, op=0x934bd54, args=0x9416408,
rho=0x9417a54)
at envir.c:1615
1615checkArity(op, args);
(gdb) p $1
History has not yet reached $1.
(gdb) p R_PV(x)
No symbol x in current context.
(gdb)

__
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] lattice and several groups

2006-08-30 Thread Laurent Rhelp
hadley wickham a écrit :

  I would like to use the lattice library to show several groups on
 the same graph. Here's my example :

 ## the data
 f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3))
 f1 - rep(f1,3)
 f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3))
 df - data.frame(val=c(4,3,2,5,4,3,6,5,4), 
 x=rep(c(1,2,3),3),f1=f1,f2=f2)


 It's pretty easy to do this with ggplot:

 install.packages(ggplot, repos=http://ggobi.org/r/;)
 library(ggplot)
 qplot(x, val, data=df, shape=f2, colour=f1)

 Hadley


Great, Hadley, but the code was not exactly the good one. The code below 
works fine for me :

install.packages(ggplot, repos=http://ggobi.org/r/;)
library(ggplot)
qplot(x, val, data=df, glyph=f1, col=f2)

In fact, my problem is to fit the data for every level of the f2 factor, 
showing the levels of the f1 factor and that for several surveys . 
Here's an example closer to my actual data :

## the data

n - 18
x1 - seq(1,n)
val1 - -2*x1+50
val2 - (-2*(x1-8)^2)+100
val3 - (-2*(x1-8)^2)+50
y - c(val1,val2,val3)
x - rep(x1,3)
f1 - rep(c(mod1,mod2,mod3),each=n/3)
f1 - rep(f1,3)
f2 - rep(c(g1,g2,g3),each=n)
df - data.frame(x=x,y=y,f1=f1,f2=f2)

surveys - 
factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
df - rbind(df,df,df)
df - data.frame(df,surveys=surveys)
###
library(lattice)

para.liste - trellis.par.get()
superpose.symbol - para.liste$superpose.symbol
superpose.symbol$pch - c(1,2,3)
trellis.par.set(superpose.symbol,superpose.symbol)

xyplot( y~x | surveys,  
data=df,
group=f1,
auto.key=list(space=right)
   )

xyplot( y~x | surveys  ,
data=df,
type=l,
group=f2,
auto.key=list(space=right,points=FALSE,lines=TRUE)
   )

Can I use the ggplot library  ?

__
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] .Rprofile under Windoze.

2006-08-30 Thread Rolf Turner
I am (for my sins) having to do some work using R under Windoze.  I
wanted to set up a .Rprofile to control my set-up.  The docs on
.Rprofile say that it can/should be placed in ``the user's home
directory''.  ``An Introduction to R'' observes lucidly that this
concept needs to be clarified under Windoze.

Following the suggestions in An Introduction to R, I tried
putting a .Rprofile in

C:\Documents and Settings\rolf\My Documents

When that didn't work, I tried putting it in the starting directory
(and confirmed that I'd got that right by checking with getwd() and
list.files(all.files=TRUE) ).

The last invocation indicated that the name of the file was *really*
``.Rprofile.txt'' --- although I'd tried to save it as (simply)
``.Rprofile''.  Is that the problem?  If so, how can I persuade
Windoze NOT to stick that damned .txt tag on the end?  (Gawd, but I
***hate*** Windoze!!!)  If that's not the problem, can you suggest
what *is* the problem?

All that .Rprofile(.txt) has in it at the moment is

options(prompt=Wheee! )

so that I can easily tell whether it's working.  If I
execute

 source(.Rprofile.txt)

the prompt does indeed get changed to ``Wheee! '' as it should.

I would appreciate enlightenment.  Ta.

cheers,

Rolf Turner
[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] lattice and several groups

2006-08-30 Thread Laurent Rhelp
Gabor Grothendieck a écrit :

 Try this:

 xyplot(val ~ x, data = df, type = p,
 col = as.numeric(df$f1), pch = as.numeric(df$f2))

 key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
 points = list(pch = 1:nlevels(df$f1))
 )

 key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
 points = list(pch = 20, col = 1:nlevels(df$f2))
 )

 trellis.focus(panel, 1, 1)
 draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
 draw.key(key2, draw = TRUE, vp = viewport(.75, .9))
 trellis.unfocus()


 On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote:

 Dear R-list,

 I would like to use the lattice library to show several groups on
 the same graph. Here's my example :

 ## the data
 f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3))
 f1 - rep(f1,3)
 f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3))
 df - data.frame(val=c(4,3,2,5,4,3,6,5,4), 
 x=rep(c(1,2,3),3),f1=f1,f2=f2)
 #
 library(lattice)

 para.liste - trellis.par.get()
 superpose.symbol - para.liste$superpose.symbol
 superpose.symbol$pch - c(1,2,3)
 trellis.par.set(superpose.symbol,superpose.symbol)

 # Now I can see the group according to the f1 factor (with a different
 symbol for every modality)
 xyplot( val~x,
data=df,
group=f1,
auto.key=list(space=right)
   )

 # or I can see the group according to the f2 factor
 xyplot( val~x,
data=df,
type=l,
group=f2,
auto.key=list(space=right,points=FALSE,lines=TRUE)
   )

 How can I do to highlight both the f1 and f2 factors on one panel with
 the legends, using the lattice function ?

 Thanks

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



Thank you, Gabor. The way to put the two legends is very interesting. 
For the graphs, in fact, my problem is to fit the data for every level 
of the f2 factor, showing the levels of the f1 factor in each panel and 
that for several surveys . Here's an example closer to my actual data :

## the data

n - 18
x1 - seq(1,n)
val1 - -2*x1+50
val2 - (-2*(x1-8)^2)+100
val3 - (-2*(x1-8)^2)+50
y - c(val1,val2,val3)
x - rep(x1,3)
f1 - rep(c(mod1,mod2,mod3),each=n/3)
f1 - rep(f1,3)
f2 - rep(c(g1,g2,g3),each=n)
df - data.frame(x=x,y=y,f1=f1,f2=f2)

surveys - 
factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
df - rbind(df,df,df)
df - data.frame(df,surveys=surveys)
###
library(lattice)

para.liste - trellis.par.get()
superpose.symbol - para.liste$superpose.symbol
superpose.symbol$pch - c(1,2,3)
trellis.par.set(superpose.symbol,superpose.symbol)

xyplot( y~x | surveys,  
data=df,
group=f1,
auto.key=list(space=right)
   )

xyplot( y~x | surveys  ,
data=df,
type=l,
group=f2,
auto.key=list(space=right,points=FALSE,lines=TRUE)
   )

Certainly, I have to use the panel function but I don't know how to mark 
the f1 factor in each panel !

__
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] lattice and several groups

2006-08-30 Thread Laurent Rhelp
Gabor Grothendieck a écrit :

Note that before entering this you need:

library(lattice)
library(grid) # to access the viewport function

On 8/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  

Try this:

xyplot(val ~ x, data = df, type = p,
   col = as.numeric(df$f1), pch = as.numeric(df$f2))

key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
   points = list(pch = 1:nlevels(df$f1))
)

key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
   points = list(pch = 20, col = 1:nlevels(df$f2))
)

trellis.focus(panel, 1, 1)
draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
draw.key(key2, draw = TRUE, vp = viewport(.75, .9))
trellis.unfocus()


On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote:


Dear R-list,

I would like to use the lattice library to show several groups on
the same graph. Here's my example :

## the data
f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3))
f1 - rep(f1,3)
f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3))
df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2)
#
library(lattice)

para.liste - trellis.par.get()
superpose.symbol - para.liste$superpose.symbol
superpose.symbol$pch - c(1,2,3)
trellis.par.set(superpose.symbol,superpose.symbol)

# Now I can see the group according to the f1 factor (with a different
symbol for every modality)
xyplot( val~x,
   data=df,
   group=f1,
   auto.key=list(space=right)
  )

# or I can see the group according to the f2 factor
xyplot( val~x,
   data=df,
   type=l,
   group=f2,
   auto.key=list(space=right,points=FALSE,lines=TRUE)
  )

How can I do to highlight both the f1 and f2 factors on one panel with
the legends, using the lattice function ?

Thanks

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


  

Thank you, Gabor. The way to put the two legends is very interesting. 
For the graphs, in fact, my problem is to fit the data for every level 
of the f2 factor, showing the levels of the f1 factor in each panel and 
that for several surveys . Here's an example closer to my actual data :

## the data

n - 18
x1 - seq(1,n)
val1 - -2*x1+50
val2 - (-2*(x1-8)2)+100
val3 - (-2*(x1-8)2)+50
y - c(val1,val2,val3)
x - rep(x1,3)
f1 - rep(c(mod1,mod2,mod3),each=n/3)
f1 - rep(f1,3)
f2 - rep(c(g1,g2,g3),each=n)
df - data.frame(x=x,y=y,f1=f1,f2=f2)

surveys - 
factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
df - rbind(df,df,df)
df - data.frame(df,surveys=surveys)
###
library(lattice)

para.liste - trellis.par.get()
superpose.symbol - para.liste$superpose.symbol
superpose.symbol$pch - c(1,2,3)
trellis.par.set(superpose.symbol,superpose.symbol)

xyplot( y~x | surveys, data=df,
   group=f1,
   auto.key=list(space=right)
  )

xyplot( y~x | surveys  ,
   data=df,
   type=l,
   group=f2,
   auto.key=list(space=right,points=FALSE,lines=TRUE)
  )

Certainly, I have to use the panel function but I don't know how to mark 
the f1 factor in each panel (I want to fit the values according to the 
f2 factor) !

__
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] .Rprofile under Windoze.

2006-08-30 Thread Charles Annis, P.E.
Under Windows mine is located here

C:\Program Files\R\R-2.3.1\library\base\R

The file name, however is not .Rprofile, but rather Rprofile


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 Rolf Turner
Sent: Wednesday, August 30, 2006 5:50 PM
To: r-help@stat.math.ethz.ch
Subject: [R] .Rprofile under Windoze.

I am (for my sins) having to do some work using R under Windoze.  I
wanted to set up a .Rprofile to control my set-up.  The docs on
.Rprofile say that it can/should be placed in ``the user's home
directory''.  ``An Introduction to R'' observes lucidly that this
concept needs to be clarified under Windoze.

Following the suggestions in An Introduction to R, I tried
putting a .Rprofile in

C:\Documents and Settings\rolf\My Documents

When that didn't work, I tried putting it in the starting directory
(and confirmed that I'd got that right by checking with getwd() and
list.files(all.files=TRUE) ).

The last invocation indicated that the name of the file was *really*
``.Rprofile.txt'' --- although I'd tried to save it as (simply)
``.Rprofile''.  Is that the problem?  If so, how can I persuade
Windoze NOT to stick that damned .txt tag on the end?  (Gawd, but I
***hate*** Windoze!!!)  If that's not the problem, can you suggest
what *is* the problem?

All that .Rprofile(.txt) has in it at the moment is

options(prompt=Wheee! )

so that I can easily tell whether it's working.  If I
execute

 source(.Rprofile.txt)

the prompt does indeed get changed to ``Wheee! '' as it should.

I would appreciate enlightenment.  Ta.

cheers,

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

__
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] .Rprofile under Windoze.

2006-08-30 Thread BBands
On 8/30/06, Rolf Turner [EMAIL PROTECTED] wrote:
 I am (for my sins) having to do some work using R under Windoze.  I
 wanted to set up a .Rprofile to control my set-up.  The docs on
 .Rprofile say that it can/should be placed in ``the user's home
 directory''.  ``An Introduction to R'' observes lucidly that this
 concept needs to be clarified under Windoze.

Saving .Rprofile to the R root directory works for me.

On my system that is C:\Program Files\R\R-2.3.1\

 jab
-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

__
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] lattice and several groups

2006-08-30 Thread hadley wickham
 In fact, my problem is to fit the data for every level of the f2 factor,
 showing the levels of the f1 factor and that for several surveys .
 Here's an example closer to my actual data :

Then maybe you want:
qplot(x, y, . ~ surveys, data=df, type=line, colour=f1, id=f2, size=f2)

(which doesn't produce a very nice legend)

Or to build up piece by piece
p - ggplot(df, . ~ surveys, aes=list(x=x, y=y, colour=f1, id=f2))
p - ggline(p)
ggpoint(p, aes=list(shape=f2))

(you might want to flip shape and colour around to get what you want)

Hadley

__
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] .Rprofile under Windoze.

2006-08-30 Thread BBands
And... If you have/use shortcuts to R, you may also save an
.Rprofile to whatever directory you name in the Start in: field of
the shortcut. This allows one to have many profiles.

   jab
-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

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


[R] how to read just a column

2006-08-30 Thread Carlo Trimarchi
Hi,
how can I read, using for example read.table() or scan(), just one
column from a text file that has more columns without any header?

Thanks, bye.

__
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] .Rprofile under Windoze.

2006-08-30 Thread Nordlund, Dan (DSHS)
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:r-help-
 [EMAIL PROTECTED] On Behalf Of Rolf Turner
 Sent: Wednesday, August 30, 2006 2:50 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] .Rprofile under Windoze.
 
 I am (for my sins) having to do some work using R under Windoze.  I
 wanted to set up a .Rprofile to control my set-up.  The docs on
 .Rprofile say that it can/should be placed in ``the user's home
 directory''.  ``An Introduction to R'' observes lucidly that this
 concept needs to be clarified under Windoze.
 
 Following the suggestions in An Introduction to R, I tried
 putting a .Rprofile in
 
   C:\Documents and Settings\rolf\My Documents
 
 When that didn't work, I tried putting it in the starting directory
 (and confirmed that I'd got that right by checking with getwd() and
 list.files(all.files=TRUE) ).
 
 The last invocation indicated that the name of the file was *really*
 ``.Rprofile.txt'' --- although I'd tried to save it as (simply)
 ``.Rprofile''.  Is that the problem?  If so, how can I persuade
 Windoze NOT to stick that damned .txt tag on the end?  (Gawd, but I
 ***hate*** Windoze!!!)  If that's not the problem, can you suggest
 what *is* the problem?
 
snip

Rolf,

Whether an extension is automagically added (and if so what) is usually a
function of the program writing the file out.  In MS Windows programs, there
is usually an option in the Save/SaveAs menu called something like Save As
Type.  To save without an extension you want to make sure that the value is
'All Files (*.*)', otherwise the program will usually tag on a default
extension.

Hope this is helpful,

Dan

Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA  98504-5204

__
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] .Rprofile under Windoze.

2006-08-30 Thread Duncan Murdoch
On 8/30/2006 5:49 PM, Rolf Turner wrote:
 I am (for my sins) having to do some work using R under Windoze.  I
 wanted to set up a .Rprofile to control my set-up.  The docs on
 .Rprofile say that it can/should be placed in ``the user's home
 directory''.  ``An Introduction to R'' observes lucidly that this
 concept needs to be clarified under Windoze.
 
 Following the suggestions in An Introduction to R, I tried
 putting a .Rprofile in
 
   C:\Documents and Settings\rolf\My Documents

That's probably the right place.  You can confirm in the R Edit|GUI 
preferences dialog:  it defaults to trying to save or load from the same 
place it would look for .Rprofile.

 
 When that didn't work, I tried putting it in the starting directory
 (and confirmed that I'd got that right by checking with getwd() and
 list.files(all.files=TRUE) ).
 
 The last invocation indicated that the name of the file was *really*
 ``.Rprofile.txt'' --- although I'd tried to save it as (simply)
 ``.Rprofile''.  Is that the problem?  If so, how can I persuade
 Windoze NOT to stick that damned .txt tag on the end?  

You can put it in double quotes.  It's really your editor doing this; 
most reasonable editors (but not the ones that come with Windows) are 
configurable to never add the extension.

Another change to Windows defaults that's essential to maintain sanity 
is to tell it to display full filenames, not to hide the .txt in the 
first place.  You do this in an Explorer window by clicking on 
Tools|Folder options...|View|Hide extensions for known file types 
(where each of the 4 components in that path is a different kind of 
interface element.  I love the rich Windows user interface!)

Duncan Murdoch

(Gawd, but I
 ***hate*** Windoze!!!)  If that's not the problem, can you suggest
 what *is* the problem?
 
 All that .Rprofile(.txt) has in it at the moment is
 
   options(prompt=Wheee! )
 
 so that I can easily tell whether it's working.  If I
 execute
 
source(.Rprofile.txt)
 
 the prompt does indeed get changed to ``Wheee! '' as it should.
 
 I would appreciate enlightenment.  Ta.
 
   cheers,
 
   Rolf Turner
   [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.

__
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 read just a column

2006-08-30 Thread jim holtman
you can read them all in and delete the ones you don't want.  Or check
out 'what' on 'scan' or colClasses on 'read.table'

On 8/30/06, Carlo Trimarchi [EMAIL PROTECTED] wrote:
 Hi,
 how can I read, using for example read.table() or scan(), just one
 column from a text file that has more columns without any header?

 Thanks, bye.

 __
 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] lattice and several groups

2006-08-30 Thread Gabor Grothendieck
To handle conditioning on survey we provide a panel function
that subsets col and pch:

# define test data - df

# note that your val2 and val3 lines had a syntax
# so we have commented them out and
# replaced them as shown.
n - 18
x1 - seq(1,n)
val1 - -2*x1+50
# val2 - (-2*(x1-8)2)+100
val2 - (-2*(x1-8))+100
# val3 - (-2*(x1-8)2)+50
val3 - (-2*(x1-8))+50
y - c(val1,val2,val3)
x - rep(x1,3)
f1 - rep(c(mod1,mod2,mod3),each=n/3)
f1 - rep(f1,3)
f2 - rep(c(g1,g2,g3),each=n)
df - data.frame(x=x,y=y,f1=f1,f2=f2)
surveys -
factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
df - rbind(df,df,df)
df - data.frame(df,surveys=surveys)

# create xyplot

library(lattice)
library(grid)

pnl - function(x, y, groups, subscripts, col, pch, ...)
panel.xyplot(x, y, col = col[subscripts], pch = pch[subscripts], ...)

xyplot(y ~ x | surveys, data = df,
col = as.numeric(df$f1), pch = as.numeric(df$f2), panel = pnl)


key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
   points = list(pch = 1:nlevels(df$f1))
)

key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
   points = list(pch = 20, col = 1:nlevels(df$f2))
)

# add legend

draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
draw.key(key2, draw = TRUE, vp = viewport(.75, .9))


On 8/30/06, Laurent Rhelp [EMAIL PROTECTED] wrote:
 Gabor Grothendieck a écrit :

 Note that before entering this you need:
 
 library(lattice)
 library(grid) # to access the viewport function
 
 On 8/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
 
 Try this:
 
 xyplot(val ~ x, data = df, type = p,
col = as.numeric(df$f1), pch = as.numeric(df$f2))
 
 key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
points = list(pch = 1:nlevels(df$f1))
 )
 
 key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
points = list(pch = 20, col = 1:nlevels(df$f2))
 )
 
 trellis.focus(panel, 1, 1)
 draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
 draw.key(key2, draw = TRUE, vp = viewport(.75, .9))
 trellis.unfocus()
 
 
 On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote:
 
 
 Dear R-list,
 
 I would like to use the lattice library to show several groups on
 the same graph. Here's my example :
 
 ## the data
 f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3))
 f1 - rep(f1,3)
 f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3))
 df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2)
 #
 library(lattice)
 
 para.liste - trellis.par.get()
 superpose.symbol - para.liste$superpose.symbol
 superpose.symbol$pch - c(1,2,3)
 trellis.par.set(superpose.symbol,superpose.symbol)
 
 # Now I can see the group according to the f1 factor (with a different
 symbol for every modality)
 xyplot( val~x,
data=df,
group=f1,
auto.key=list(space=right)
   )
 
 # or I can see the group according to the f2 factor
 xyplot( val~x,
data=df,
type=l,
group=f2,
auto.key=list(space=right,points=FALSE,lines=TRUE)
   )
 
 How can I do to highlight both the f1 and f2 factors on one panel with
 the legends, using the lattice function ?
 
 Thanks
 
 __
 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.
 
 
 
 
 Thank you, Gabor. The way to put the two legends is very interesting.
 For the graphs, in fact, my problem is to fit the data for every level
 of the f2 factor, showing the levels of the f1 factor in each panel and
 that for several surveys . Here's an example closer to my actual data :

 ## the data

 n - 18
 x1 - seq(1,n)
 val1 - -2*x1+50
 val2 - (-2*(x1-8)2)+100
 val3 - (-2*(x1-8)2)+50
 y - c(val1,val2,val3)
 x - rep(x1,3)
 f1 - rep(c(mod1,mod2,mod3),each=n/3)
 f1 - rep(f1,3)
 f2 - rep(c(g1,g2,g3),each=n)
 df - data.frame(x=x,y=y,f1=f1,f2=f2)

 surveys -
 factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
 df - rbind(df,df,df)
 df - data.frame(df,surveys=surveys)
 ###
 library(lattice)

 para.liste - trellis.par.get()
 superpose.symbol - para.liste$superpose.symbol
 superpose.symbol$pch - c(1,2,3)
 trellis.par.set(superpose.symbol,superpose.symbol)

 xyplot( y~x | surveys, data=df,
   group=f1,
   auto.key=list(space=right)
  )

 xyplot( y~x | surveys  ,
   data=df,
   type=l,
   group=f2,
   auto.key=list(space=right,points=FALSE,lines=TRUE)
  )

 

Re: [R] .Rprofile under Windoze.

2006-08-30 Thread Richard M. Heiberger
Rolf

 The last invocation indicated that the name of the file was *really*
 ``.Rprofile.txt'' --- although I'd tried to save it as (simply)
 ``.Rprofile''.  Is that the problem?  If so, how can I persuade
 Windoze NOT to stick that damned .txt tag on the end? 

The easiest way is to use a smarter editor.  Emacs is perfectly
happy to name a file .Rprofile and wouldn't dream of appending
an extension to the filename that you specify.

Rich

__
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] NaN when using dffits, stemming from lm.influence call

2006-08-30 Thread Peter Dunn

Hi all

I'm getting a NaN returned on using dffits, as explained
below.  To me, there seems no obvious (or non-obvious reason
for that matter) reason why a  NaN  appears.

Before I start digging further, can anyone see why  dffits
might be failing?  Is there a problem with the data?


Consider:

# Load data
dep - 
read.table(http://www.sci.usq.edu.au/staff/dunn/Datasets/Books/Hand/Hand-R/factor1-R.dat;,

   header=TRUE)
attach(dep)
dep

# Fit Poisson glm
dep.glm2 - glm( Counts ~ factor(Depression) + factor(SLE) + 
factor(Children) + factor(Depression):factor(SLE),

   family=poisson( link=log) )

# Compute dffits
dffits( dep.glm2 )


This produces the output:
 1  2  3  4  5  6 
 1.4207746 -0.1513808NaN  0.9079142 -0.1032664 -1.0860289

 7  8
0.4853797  3.8560863

NaN exists for Observation 3.  I cannot understand why: there's
nothing grossly unusual or bad about it.  I look a bit closer,
and it falls over in lm.influence when computing the deletion
statistic sigma:



 lm.influence(dep.glm2)$sigma
   12345678
0.914829 2.134279  NaN 2.186707 2.224885 1.934539 2.225115 1.957111

The rest of the results from lm.influence are OK; for example:

 lm.influence(dep.glm2)$wt.res
  1   2   3   4   5   6
 2.62840627 -0.88476903 -1.09492912  0.20247856 -0.23114458 -0.95123387
  7   8
 0.07521515  0.30208051


Use of debug( lm.influence ) indicates the NaN appears in this line
of lm.influence:



res - .Fortran(lminfl, model$qr$qr, n, n, k, as.integer(do.coef),
model$qr$qraux, wt.res = e, hat = double(n), coefficients = if 
(do.coef) matrix(0,
n, k) else double(0), sigma = double(n), tol = 10 * 
.Machine$double.eps,

DUP = FALSE, PACKAGE = base)[c(hat, coefficients, sigma,
wt.res)]


I don't particularly wish to dig around in the Fortran if someone
else can look at it and see my problem easily.  But if I must...



The appearance of the  NaN  seems odd, since (as I understand it)
  lm.influence(dep.glm2)$sigma  computes  sigma  when each observation
is removed in turn.  So if I remove Observation 3 and try fitting the
model, there are no problems or complaints:

dep.glm3 - glm( Counts ~ factor(Depression) + factor(SLE) +
   factor(Children) + factor(Depression):factor(SLE),
   family=poisson( link=log), subset=(-3) )


This produces:


 dep.glm3

Call:  glm(formula = Counts ~ factor(Depression) + factor(SLE) + 
factor(Children) +  factor(Depression):factor(SLE), family = 
poisson(link = log),  subset = (-3))


Coefficients:
 (Intercept)   factor(Depression)1
  5.4389   -4.1392
factor(SLE)1 factor(Children)1
 -0.6503   -2.4036
factor(Depression)1:factor(SLE)1
  3.9513

Degrees of Freedom: 6 Total (i.e. Null);  2 Residual
Null Deviance:  695.9
Residual Deviance: 0.8535   AIC: 41.25


No problems, errors, or any signs of potential problems.


In the changes to R 2.3.0 (in the NEWS file,
eg http://mirror.aarnet.edu.au/pub/CRAN/src/base/NEWS)
I find this:

   oInfluence measures such as rstandard() and cooks.distance()
could return infinite values rather than NaN for a case which
was fitted exactly.  Similarly, plot.lm() could fail on such
examples.  plot.lm(which = 5)  had to be modified to only plot
cases with hat  1.  (PR#8367)

lm.influence() was incorrectly reporting 'coefficients' and
'sigma' as NaN for cases with hat = 1, and on some platforms
not detecting hat = 1 correctly.

The last sentence identifies NaN being reported for sigma, as I
find with my data.  But my data do not have hat = 1, but the hat
diagonals are large.  The troublesome Observation 3 does not have the
largest hat value in the data though:

 hatvalues(dep.glm2)
1 2 3 4 5 6 7 
   8
0.1689061 0.1064651 0.9098542 0.9030814 0.3799079 0.6382790 0.9327408 
0.9607654


And besides, I am using the most recent version of R (see below).  BTW,
the NaNs appear in the previous version of R also.

So I'm flummoxed.

As always, help appreciated.

P.



 version
   _
platform   i386-pc-linux-gnu
arch   i386
os linux-gnu
system i386, linux-gnu
status
major  2
minor  3.1
year   2006
month  06
day01
svn rev38247
language   R
version.string Version 2.3.1 (2006-06-01)


--
Dr Peter Dunn  |  Email:  dunn at usq.edu.au
Faculty of Sciences, University of Southern Queensland
and the Australian Centre for Sustainable Catchments
CRICOS:  QLD 00244B |  NSW 02225M |  VIC 02387D |  WA 02521C
__

Re: [R] lattice and several groups

2006-08-30 Thread Gabor Grothendieck
Or maybe this is what you are looking for where pnl below was
created by modifying source to the panel.plot.default in the zoo
package (there might be a simpler way):


pnl - function (x, y, subscripts, groups, col, pch, type, ...) {
for (g in levels(groups)) {
idx - g == groups[subscripts]
if (any(idx))
panel.xyplot(x[idx], y[idx], ..., col = col[subscripts][idx],
pch = pch[subscripts][idx], type = type)
}
}

xyplot(y ~ x | surveys, data = df, groups = df$f2, type = b,
col = as.numeric(df$f2), pch = as.numeric(df$f1), panel = pnl)


key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
   points = list(pch = 1:nlevels(df$f1))
)

key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
   points = list(pch = 20, col = 1:nlevels(df$f2))
)

draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
draw.key(key2, draw = TRUE, vp = viewport(.75, .9))




On 8/30/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 To handle conditioning on survey we provide a panel function
 that subsets col and pch:

 # define test data - df

 # note that your val2 and val3 lines had a syntax
 # so we have commented them out and
 # replaced them as shown.
 n - 18
 x1 - seq(1,n)
 val1 - -2*x1+50
 # val2 - (-2*(x1-8)2)+100
 val2 - (-2*(x1-8))+100
 # val3 - (-2*(x1-8)2)+50
 val3 - (-2*(x1-8))+50
 y - c(val1,val2,val3)
 x - rep(x1,3)
 f1 - rep(c(mod1,mod2,mod3),each=n/3)
 f1 - rep(f1,3)
 f2 - rep(c(g1,g2,g3),each=n)
 df - data.frame(x=x,y=y,f1=f1,f2=f2)
 surveys -
 factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
 df - rbind(df,df,df)
 df - data.frame(df,surveys=surveys)

 # create xyplot

 library(lattice)
 library(grid)

 pnl - function(x, y, groups, subscripts, col, pch, ...)
panel.xyplot(x, y, col = col[subscripts], pch = pch[subscripts], ...)

 xyplot(y ~ x | surveys, data = df,
col = as.numeric(df$f1), pch = as.numeric(df$f2), panel = pnl)


 key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
   points = list(pch = 1:nlevels(df$f1))
 )

 key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
   points = list(pch = 20, col = 1:nlevels(df$f2))
 )

 # add legend

 draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
 draw.key(key2, draw = TRUE, vp = viewport(.75, .9))


 On 8/30/06, Laurent Rhelp [EMAIL PROTECTED] wrote:
  Gabor Grothendieck a écrit :
 
  Note that before entering this you need:
  
  library(lattice)
  library(grid) # to access the viewport function
  
  On 8/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  
  
  Try this:
  
  xyplot(val ~ x, data = df, type = p,
 col = as.numeric(df$f1), pch = as.numeric(df$f2))
  
  key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
 points = list(pch = 1:nlevels(df$f1))
  )
  
  key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
 points = list(pch = 20, col = 1:nlevels(df$f2))
  )
  
  trellis.focus(panel, 1, 1)
  draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
  draw.key(key2, draw = TRUE, vp = viewport(.75, .9))
  trellis.unfocus()
  
  
  On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote:
  
  
  Dear R-list,
  
  I would like to use the lattice library to show several groups on
  the same graph. Here's my example :
  
  ## the data
  f1 - factor(c(mod1,mod2,mod3),levels=c(mod1,mod2,mod3))
  f1 - rep(f1,3)
  f2 - factor(rep(c(g1,g2,g3),each=3),levels=c(g1,g2,g3))
  df - data.frame(val=c(4,3,2,5,4,3,6,5,4), x=rep(c(1,2,3),3),f1=f1,f2=f2)
  #
  library(lattice)
  
  para.liste - trellis.par.get()
  superpose.symbol - para.liste$superpose.symbol
  superpose.symbol$pch - c(1,2,3)
  trellis.par.set(superpose.symbol,superpose.symbol)
  
  # Now I can see the group according to the f1 factor (with a different
  symbol for every modality)
  xyplot( val~x,
 data=df,
 group=f1,
 auto.key=list(space=right)
)
  
  # or I can see the group according to the f2 factor
  xyplot( val~x,
 data=df,
 type=l,
 group=f2,
 auto.key=list(space=right,points=FALSE,lines=TRUE)
)
  
  How can I do to highlight both the f1 and f2 factors on one panel with
  the legends, using the lattice function ?
  
  Thanks
  
  __
  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.
  
  
  
  
  Thank you, Gabor. The way to put the two legends is very 

Re: [R] lattice and several groups

2006-08-30 Thread Gabor Grothendieck
In thinking about this a bit more we can use
panel.superpose/panel.groups to shorten it:

# define data -- df

# note that your val2 and val3 lines had a syntax
# so we have commented them out and
# replaced them as shown.
n - 18
x1 - seq(1,n)
val1 - -2*x1+50
# val2 - (-2*(x1-8)2)+100
val2 - (-2*(x1-8))+100
# val3 - (-2*(x1-8)2)+50
val3 - (-2*(x1-8))+50
y - c(val1,val2,val3)
x - rep(x1,3)
f1 - rep(c(mod1,mod2,mod3),each=n/3)
f1 - rep(f1,3)
f2 - rep(c(g1,g2,g3),each=n)
df - data.frame(x=x,y=y,f1=f1,f2=f2)
surveys -
factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
df - rbind(df,df,df)
df - data.frame(df,surveys=surveys)

# create xyplot

library(lattice)
library(grid)

# set custom col and pch here
my.col - 1:nlevels(df$f2)
my.pch - 1:nlevels(df$f1)

pnl - function(x, y, subscripts, pch, type, ...)
   panel.xyplot(x, y, type = type, pch = my.pch[df[subscripts, f1]], ...)

xyplot(y ~ x | surveys, data = df, groups = df$f2, type = b,
panel = panel.superpose,
panel.groups = pnl,
par.settings = list(superpose.line = list(col = my.col),
   superpose.symbol = list(col = my.col))
)


key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
   points = list(pch = my.pch)
)

key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
   lines = list(col = my.col)
)

draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
draw.key(key2, draw = TRUE, vp = viewport(.75, .9))



On 8/30/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Or maybe this is what you are looking for where pnl below was
 created by modifying source to the panel.plot.default in the zoo
 package (there might be a simpler way):


 pnl - function (x, y, subscripts, groups, col, pch, type, ...) {
for (g in levels(groups)) {
idx - g == groups[subscripts]
if (any(idx))
panel.xyplot(x[idx], y[idx], ..., col = col[subscripts][idx],
pch = pch[subscripts][idx], type = type)
}
 }

 xyplot(y ~ x | surveys, data = df, groups = df$f2, type = b,
col = as.numeric(df$f2), pch = as.numeric(df$f1), panel = pnl)


 key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
   points = list(pch = 1:nlevels(df$f1))
 )

 key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
   points = list(pch = 20, col = 1:nlevels(df$f2))
 )

 draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
 draw.key(key2, draw = TRUE, vp = viewport(.75, .9))




 On 8/30/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  To handle conditioning on survey we provide a panel function
  that subsets col and pch:
 
  # define test data - df
 
  # note that your val2 and val3 lines had a syntax
  # so we have commented them out and
  # replaced them as shown.
  n - 18
  x1 - seq(1,n)
  val1 - -2*x1+50
  # val2 - (-2*(x1-8)2)+100
  val2 - (-2*(x1-8))+100
  # val3 - (-2*(x1-8)2)+50
  val3 - (-2*(x1-8))+50
  y - c(val1,val2,val3)
  x - rep(x1,3)
  f1 - rep(c(mod1,mod2,mod3),each=n/3)
  f1 - rep(f1,3)
  f2 - rep(c(g1,g2,g3),each=n)
  df - data.frame(x=x,y=y,f1=f1,f2=f2)
  surveys -
  factor(c(rep(survey1,n*3),rep(survey2,n*3),rep(survey3,n*3)))
  df - rbind(df,df,df)
  df - data.frame(df,surveys=surveys)
 
  # create xyplot
 
  library(lattice)
  library(grid)
 
  pnl - function(x, y, groups, subscripts, col, pch, ...)
 panel.xyplot(x, y, col = col[subscripts], pch = pch[subscripts], ...)
 
  xyplot(y ~ x | surveys, data = df,
 col = as.numeric(df$f1), pch = as.numeric(df$f2), panel = pnl)
 
 
  key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
points = list(pch = 1:nlevels(df$f1))
  )
 
  key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
points = list(pch = 20, col = 1:nlevels(df$f2))
  )
 
  # add legend
 
  draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
  draw.key(key2, draw = TRUE, vp = viewport(.75, .9))
 
 
  On 8/30/06, Laurent Rhelp [EMAIL PROTECTED] wrote:
   Gabor Grothendieck a écrit :
  
   Note that before entering this you need:
   
   library(lattice)
   library(grid) # to access the viewport function
   
   On 8/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
   
   
   Try this:
   
   xyplot(val ~ x, data = df, type = p,
  col = as.numeric(df$f1), pch = as.numeric(df$f2))
   
   key1 - list(border = TRUE, colums = 2, text = list(levels(df$f1)),
  points = list(pch = 1:nlevels(df$f1))
   )
   
   key2 - list(border = TRUE, colums = 2, text = list(levels(df$f2)),
  points = list(pch = 20, col = 1:nlevels(df$f2))
   )
   
   trellis.focus(panel, 1, 1)
   draw.key(key1, draw = TRUE, vp = viewport(.9, .9))
   draw.key(key2, draw = TRUE, vp = viewport(.75, .9))
   trellis.unfocus()
   
   
   On 8/29/06, Laurent Rhelp [EMAIL PROTECTED] wrote:
   
   
   Dear R-list,
   
   I would like to use the lattice library to show several groups on
   the same graph. Here's my example :
   
   ## the data
   f1 - 

[R] [R-pkgs] New package 'random' for non-deterministic random number

2006-08-30 Thread Dirk Eddelbuettel

Dear useRs,

A few days ago, the initial version 0.1.0 of a new package 'random' was
uploaded to CRAN.

The random packages provides convenient access to the non-deterministic
random numbers provided by the random.org site created by Mads Haahr
(http://www.random.org).  

While certain hardware and software solutions that provide access to
non-deterministic random-numbers exist, few if any are portable across all
the hardware platforms R supports. Retrieving non-deterministic random
numbers may be beneficial to seed parallel simulations with independent
draws, to obtain portable initializations for other RNGs, to validate
simulation with non-deterministic RNGs, or simply for fun and
experimentations.

The package contains five simple functions 
 randomNumber   (random integeres between min, max w/ duplicates)
 randomSequence (random sequences between min, max w/o duplicates)
 randomBytes(in hex, dec, oct or bin)
 randomBufferStatus (to query the server status)
 sufficientBits (boolean test of randomBufferStats vs rec'ed value)

Also included are two vignettes that can be accessed via
 vignette(random-intro, package = random)
 vignette(random-essay, package = random)

'random-intro' provides some background on the package as well as initial
test results using the dieharder suite by Robert G. Brown. I hope to expand
on these tests in the near future. 'random-essay' is a transcript of the web
essay at http://www.random.org/essay.html and provides some background on the
random.org service.

Some information is / will be at 
 http://dirk.eddelbuettel.com/code/random.html will 

Comments or suggestions are more than welcome!

Regards, Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

___
R-packages mailing list
R-packages@stat.math.ethz.ch
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] Combine 'overlapping' dataframes, respecting row names

2006-08-30 Thread James Howison
Hi,

I've examined the archives and found quite a few questions on  
concatenating dataframes, but none that really addressed my issue,  
I'm afraid.  I've also examined the cbind and rbind documentation but  
nonetheless here I am writing to r-help ;)

This is what I have (the row names are dates used for conversion to  
an irregular time series with the its package):

  cvsFrame
cvsactions
2002-11-15  4
2002-12-15  9
2003-01-15  5
2003-02-15  5

  downloadsFrame
 downloads
2002-09-15  1
2002-10-15  2
2002-11-15 12
2002-12-15  8

(notice how the dates are overlapping?)

The output I'd like is:

cvsaction  downloads
2002-09-15   NA  1
2002-10-15   NA  2
2002-11-15   4  12
2002-12-15   9   8
2003-01-15   5  NA
2003-02-15   5  NA

ie. merge the data.frames, respecting the row.names and inserting NAs  
where a frame didn't contain info for a row in the final frame.

This is the closest I gotten (I'm sure cbind is doing what it's meant  
to do but it's obviously not what I need)

  cbind(downloadsFrame,cvsFrame)
 downloads cvsactions
2002-09-15  1  4
2002-10-15  2  9
2002-11-15 12  5
2002-12-15  8  5

It takes the row.names from the first frame given and then just adds  
the data in rows 1 through 4, regardless of their row.name. And it  
doesn't work at all if the column lengths are different. (Yes, it  
would be nice if the 'its' class had a way to merge 'its' objects,  
but the question seemed general enough to ask on list.)

Thanks,
James

__
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] Combine 'overlapping' dataframes, respecting row names

2006-08-30 Thread Gabor Grothendieck
If you are converting them to 'its' anyways then after the
conversion to 'its' use the 'its' union command.

On 8/31/06, James Howison [EMAIL PROTECTED] wrote:
 Hi,

 I've examined the archives and found quite a few questions on
 concatenating dataframes, but none that really addressed my issue,
 I'm afraid.  I've also examined the cbind and rbind documentation but
 nonetheless here I am writing to r-help ;)

 This is what I have (the row names are dates used for conversion to
 an irregular time series with the its package):

   cvsFrame
cvsactions
 2002-11-15  4
 2002-12-15  9
 2003-01-15  5
 2003-02-15  5

   downloadsFrame
 downloads
 2002-09-15  1
 2002-10-15  2
 2002-11-15 12
 2002-12-15  8

 (notice how the dates are overlapping?)

 The output I'd like is:

cvsaction  downloads
 2002-09-15   NA  1
 2002-10-15   NA  2
 2002-11-15   4  12
 2002-12-15   9   8
 2003-01-15   5  NA
 2003-02-15   5  NA

 ie. merge the data.frames, respecting the row.names and inserting NAs
 where a frame didn't contain info for a row in the final frame.

 This is the closest I gotten (I'm sure cbind is doing what it's meant
 to do but it's obviously not what I need)

   cbind(downloadsFrame,cvsFrame)
 downloads cvsactions
 2002-09-15  1  4
 2002-10-15  2  9
 2002-11-15 12  5
 2002-12-15  8  5

 It takes the row.names from the first frame given and then just adds
 the data in rows 1 through 4, regardless of their row.name. And it
 doesn't work at all if the column lengths are different. (Yes, it
 would be nice if the 'its' class had a way to merge 'its' objects,
 but the question seemed general enough to ask on list.)

 Thanks,
 James

 __
 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] Combine 'overlapping' dataframes, respecting row names

2006-08-30 Thread Prof Brian Ripley
'merge' is the key here.  You say you want to merge, but it seems did not 
try merge()

 (res - merge(cvsFrame, downloadsFrame, by=row.names, all=TRUE))
   Row.names cvsactions downloads
1 2002-11-15  412
2 2002-12-15  9 8
3 2003-01-15  5NA
4 2003-02-15  5NA
5 2002-09-15 NA 1
6 2002-10-15 NA 2

You can sort on Row.names later: say

res[order(as.character(res$Row.names)), ]


On Thu, 31 Aug 2006, James Howison wrote:

 Hi,
 
 I've examined the archives and found quite a few questions on  
 concatenating dataframes, but none that really addressed my issue,  
 I'm afraid.  I've also examined the cbind and rbind documentation but  
 nonetheless here I am writing to r-help ;)
 
 This is what I have (the row names are dates used for conversion to  
 an irregular time series with the its package):
 
   cvsFrame
 cvsactions
 2002-11-15  4
 2002-12-15  9
 2003-01-15  5
 2003-02-15  5
 
   downloadsFrame
  downloads
 2002-09-15  1
 2002-10-15  2
 2002-11-15 12
 2002-12-15  8
 
 (notice how the dates are overlapping?)
 
 The output I'd like is:
 
 cvsaction  downloads
 2002-09-15   NA  1
 2002-10-15   NA  2
 2002-11-15   4  12
 2002-12-15   9   8
 2003-01-15   5  NA
 2003-02-15   5  NA
 
 ie. merge the data.frames, respecting the row.names and inserting NAs  
 where a frame didn't contain info for a row in the final frame.
 
 This is the closest I gotten (I'm sure cbind is doing what it's meant  
 to do but it's obviously not what I need)
 
   cbind(downloadsFrame,cvsFrame)
  downloads cvsactions
 2002-09-15  1  4
 2002-10-15  2  9
 2002-11-15 12  5
 2002-12-15  8  5
 
 It takes the row.names from the first frame given and then just adds  
 the data in rows 1 through 4, regardless of their row.name. And it  
 doesn't work at all if the column lengths are different. (Yes, it  
 would be nice if the 'its' class had a way to merge 'its' objects,  
 but the question seemed general enough to ask on list.)
 
 Thanks,
 James
 
 __
 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] how to read just a column

2006-08-30 Thread mel
Carlo Trimarchi a écrit :

 Hi,
 how can I read, using for example read.table() or scan(), just one
 column from a text file that has more columns without any header?
 Thanks, bye.

afaik, you have to read all the table
and then you select the column you want.
eg read.table(blabla)[3] to get the 3rd column.

You can read partially rows (see nrows) but not columns.
Please somebody correct me if I am wrong.

(Of course a trick could be to transpose your table
before writing it, etc)

hih

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