Re: [R] how to make a data file

2006-10-31 Thread Petr Pikal
Hi

well probably the best approach for you is to read some introductory 
documents. I would recommend this sequence

R-intro
R-lang
R-data
Posting guide

or you can try to go through some documents from CRAN, in many of 
them you can find introductory chapters.

And leas but not last when starting with R I found usefull Paul 
Johnson's Rtips (StatsRUs).

At least for more concise help you need to provide R version, OS, and 
what exactly you did and how you failed - as recommended in posting 
guide ;-)

HTH
Petr
 

On 31 Oct 2006 at 11:31, amna khan wrote:

Date sent:  Tue, 31 Oct 2006 11:31:08 +0500
From:   amna khan [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Subject:[R] how to make a data file

 Sir after importing data from excel to R, I am not understanding how
 to make this data file. So that I can use it in extRemeToolkit and
 other packages. Thank you
 
 -- 
 AMINA SHAHZADI
 Department of Statistics
 GC University Lahore, Pakistan.
 Email:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
  [[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.

Petr Pikal
[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] problem in intallasation

2006-10-31 Thread Petr Pikal
Hi

you are Windows user? I guess yes. So you probably downloaded file 
for compilation or for other OSses. You need to download R-2.4.0-
win32.exe.

HTH
Petr

On 31 Oct 2006 at 11:19, amna khan wrote:

Date sent:  Tue, 31 Oct 2006 11:19:29 +0500
From:   amna khan [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Subject:[R] problem in intallasation

 Sir I have downloaded new release of R  2.4.0. But there is no
 R.2.4.0.exefile for installing it.
 I request you to please guid me.
 
 
 Regards
 
 -- 
 AMINA SHAHZADI
 Department of Statistics
 GC University Lahore, Pakistan.
 Email:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
  [[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.

Petr Pikal
[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] Problem mit den Spracheinstellungen nach Installation von R

2006-10-31 Thread Uwe Ligges
Dirk Hüser wrote:
 Hallo,
 ich habe ein Problem mit R. Ich hoffe hier auf die freundliche Hilfe der 
 Community.
 
 Schilderung des Problems: 
 Ich habe R 2.4.0 auf einem Rechner (1) installiert.
 - Am Anfang der Installation klickte ich auf Setup Deutsch.
 - Dann führte ich die Installation weiter mit den Grundeinstellungen fort.
 - Das Ergebnis: Nach der Installation hatte ich wie erhofft eine 
 deutschsprachige Bedienoberfläche.
 
 Ich habe R 2.4.0. auf einem weiteren Rechner (2) installiert.
 - Am Anfang der Installation klickte ich auf Setup Deutsch.
 - Dann führte ich die Installation weiter mit den Grundeinstellungen fort.
 - Das Ergebnis: Nach der Installation hatte ich eine englischsprachige 
 Bedienoberfläche.

[This mailing list is in English.]
Selecting the language in the installer only applies to the installer 
itself, not to the R GUI nor the error messages.


 Ich hätte jetzt gerne auf Rechner (2) gerne eine deutschsprachige 
 Bedienoberfläche.
 Wie kann ich das bewerkstelligen? Ich habe bisher für dieses Problem kein 
 Lösung gefunden.
 Zusatz: Auf Rechner (2) war vorher R 2.3.0. mit englischer Bedienoberfläche 
 installiert.
 Es wurde vor der Installation komplett deinstallier und auch der 
 Programmordner gelöscht.

This depends on the locales for that machine. Probably, your second 
machine is configured for some different locale.
You can set the environment variable
LANGUAGE=de
in order to get messages in german language.

Uwe Ligges


 Ich hoffe, dass mir irgendjemand helfen kann. Über hilfreiche Tipps per Mail 
 würde ich mich sehr freuen.
 
 MfG DIRK
 
 __
 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] Which executable is associated with R CMD INSTALL?

2006-10-31 Thread Patrick Connolly
On Mon, 30-Oct-2006 at 04:44PM -0500, Duncan Murdoch wrote:

 
| Try R CMD printenv R_HOME and you'll find which R home directory it is 
| using.  You can see a lot more with R CMD printenv or various options 
| to R CMD config.

Thanks for that information.  It knocks my theory on the head.  Pity
that, because I might have been able to do something about it if that
was the problem.  Now I'm at a loss to work out why lme4 installation
cannot find Matrix, and more strangely, why nothing else gave a
similar problem.  I think I've tried every version of lme4 and Matrix
that has emerged since R-2.4.0 has been released.

The fact that no other Red hat user has a problem indicates the
problem is this end; but I'm short of ideas about where to look.
Looks like it's back to versions 6 months old -- like proprietary
software users have to put up with. :-(

(This is not a complaint)

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~} Great minds discuss ideas
 _( Y )_Middle minds discuss events 
(:_~*~_:)Small minds discuss people  
 (_)-(_)   . Anon
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
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] POSIXct time zone and daylight savings issues

2006-10-31 Thread Prof Brian Ripley
On Mon, 30 Oct 2006, Sebastian P. Luque wrote:

 Hi again,

 A related issue I can't quite understand is:


 R tt - as.POSIXct(2006-05-24, tz=EEST)
 R tt
 [1] 2006-05-24 EEST
 R seq(tt, length=12, by=months)
 [1] 2006-05-24 EEST 2006-06-24 EEST 2006-07-24 EEST 2006-08-24 EEST
 [5] 2006-09-24 EEST 2006-10-24 EEST 2006-11-24 EEST 2006-12-24 EEST
 [9] 2007-01-24 EEST 2007-02-24 EEST 2007-03-24 EEST 2007-04-24 EEST
 R tt - as.POSIXct(2006-05-24, tz=EET)
 R seq(tt, length=12, by=months)
 [1] 2006-05-24 EEST 2006-06-24 EEST 2006-07-24 EEST 2006-08-24 EEST
 [5] 2006-09-24 EEST 2006-10-24 EEST 2006-11-24 EET  2006-12-24 EET
 [9] 2007-01-24 EET  2007-02-24 EET  2007-03-24 EET  2007-04-24 EEST
 R sessionInfo()
 R version 2.4.0 (2006-10-03)
 x86_64-pc-linux-gnu

 locale:
 LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C

 attached base packages:
 [1] methods   stats graphics  grDevices utils datasets
 [7] base

 other attached packages:
 lattice
 0.14-9


 i.e. daylight savings 'tzone' attribute gets adjusted automatically when
 providing the standard time attribute, but not when providing the daylight
 savings time.  Does this behaviour depend on the OS/locale?  Should the
 'tz' argument supplied when creating POSIXct objects always be the
 standard time version?

No, it should be a timezone, and the timezone specification includes when 
DST is in effect.  See ?as.POSIXct for details and references of 
timezones.  For example, EST is a timezone without DST and EST5EDT is a 
timezone with DST (and they agree in winter). It looks like Linux is 
interpreting EEST as UTC+3 throughout the year (which appears not to be 
used anywhere as an actual timezone).  So the behaviour is clear: EEST 
does not have DST, and $isdst == 0 in that 'timezone', whereas EET does 
have DST.

-- 
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] match lists

2006-10-31 Thread Gabor Grothendieck
Try this:

A - list(matrix(c(2,3,3,1,2,2), 3, dimnames = list(NULL, letters[1:2])),
  matrix(c(3,3,2,5,1,3), 3, dimnames = list(NULL, letters[3:4])))

B - list(matrix(c(1:5, 20*(1:5), 10+20*(1:5)), 5,
 dimnames = list(NULL, letters[5:7])),
  matrix(c(1:5, 10*(1:5), 10+10*(1:5)), 5,
 dimnames = list(NULL, letters[8:10])))

lapply(1:2, function(i) lapply(1:2, function(j) B[[i]][A[[i]][,j],]))



On 10/29/06, Heymans, MW [EMAIL PROTECTED] wrote:
 Dear list,

 I have this problem, please your advice.

 I have list A that contains two matrix elements:
 [[1]]
 a b
 [1,] 2 1
 [2,] 3 2
 [3,] 3 2
 [[2]]
 c d
 [1,] 3 5
 [2,] 3 1
 [3,] 2 3

 and list B, that also contains 2 matrices:
 [[1]]
 e   f   g
 [1,] 1  20  30
 [2,] 2  40  50
 [3,] 3  60  70
 [4,] 4  80  90
 [5,] 5 100 110
 [[2]]
 h  i  j
 [1,] 1 10 20
 [2,] 2 20 30
 [3,] 3 30 40
 [4,] 4 40 50
 [5,] 5 50 60

 Now I want to match each column of list A with each row of list B in such a 
 way that element 1 of list A corresponds to element 1 of list B (and element 
 2 of A with 2 of B).
 So, in total there will be 4 new matrices, 1 for each column of list A. For 
 example, for column a of list A the new matrix will be:

 2  40  50
 3  60  70
 3  60  70

 thanks,
 Martijn
 VUmc
 Amsterdam


[[alternative HTML version deleted]]

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


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


[R] [ggplot] controlling axis and major/minor tick marks

2006-10-31 Thread Sebastian Weber
Hello there!

I'm starting with ggplot and was wondering how I could control the axis
of a plot. I would like the axis of the plot to be drawn black which I
thought to acheive with the option axis.colour=black. However, this
had no real effect on the plot. Then I found grid.colour which I changed
to black as well. Now I got my axis as I wanted them, but ggplot now
draws the grid inside the plot with black lines as well, which definetly
do not want to appear. So how can I get a black border around my plots?
Furthermore, I would like to indicate positions of major and minor ticks
in my plots. Where can I do this?

Thanks in advance.

Greetings,

Sebastian

Ah, I use R 2.3.1 and ggplot 0.4.0, if that is important ...

__
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] read.fwf and header

2006-10-31 Thread Gregor Gorjanc
Martin Maechler wrote:
 Gregor == Gregor Gorjanc [EMAIL PROTECTED]
 on Mon, 30 Oct 2006 23:33:21 +0100 writes:
 
 Gregor Daniel Nordlund wrote:
  Gregor,
  
  According to the help for read.fwf, sep needs to be set
  to a value that occurs only in the header record.  I
  changed the spaces to commas in the header record of your
  example and used the following syntax and was able to
  read the file just fine.
  
  new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3,
  2, 2, 2, 2, 11, 19), header=TRUE, sep=',')
  
  Hope this is helpful,
  
  Dan
 
 Gregor Thanks Dan! But I have to modfy file first. Not that
 Gregor much of work but still.
 
 Yes, but I think it shows read.fwf() should not be extended for
 even more special cases:
 
 In my (and probably R-core's) view, read.fwf() should only have
 to be used for ``legacy data files'' (those times when people used *no*
 separators in order to save disk space), since nowadays, such
 data files should automatically have correct separators. 
 
 -- Fix the file producing process rather than make read.fwf()
 unnecessarily more complicated.

Thank you for this explanation of your (and probably R-core's) view! I
really appreciate such feedback. I do agree that read.fwf is a bit
archaic way to import data, but sometimes you can not fix file
producing process.

Perhaps above explanation and code examples from this thread could be
added to read.fwf help page. I can provide a patch if my proposal is sane.

Regards, Gregor

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


Re: [R] Problem setting TMPDIR on the fly

2006-10-31 Thread Benjamin Lloyd-Hughes
Sorted - sort of...

I've simply wrapped the invocation of R in a shell script along with the 
necessary environment variables.  However, this is precisely the solution that 
I was hoping to avoid!  

I can see why it would be inadvisable to switch TMPDIR mid way through a 
session, but wouldn't it be useful to able switch it on the way in?

As ever thanks for the help, cheers, Ben


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: 30 October 2006 17:08
To: Benjamin Lloyd-Hughes
Cc: Peter Dalgaard
Subject: Re: [R] Problem setting TMPDIR on the fly

Benjamin Lloyd-Hughes [EMAIL PROTECTED] writes:

 Hi Peter,
 
 Thanks for the swift response!
 
 The problem is arising because I'm running R in batch mode through cron.  As 
 such I'd rather set all such environment variables explicitly and not make 
 any assumptions about what variables maybe getting set on the way in.  A 
 typical call looks like this

 
 /usr/bin/R CMD BATCH --vanilla foo.R bar.Rout
 
 The first few lines of foo.R might run
 
 .libPaths(c(/usr/lib/R/library, /eurotempest/software/src/R/packages))
 Sys.putenv(TMPDIR = /eurotempest/tmp/R/)
 
 Hence the problem.
 
 Is there a more sensible way to go?

I'd just set it on the command line, as in

TMPDIR=/eurotempest/tmp/R/ R

 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
 Sent: 30 October 2006 16:33
 To: Benjamin Lloyd-Hughes
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Problem setting TMPDIR on the fly
 
 Benjamin Lloyd-Hughes [EMAIL PROTECTED] writes:
 
  Hi folks,
  
   
  
  I'm having a spot of bother with tempdir().  If I set the environment
  variable TMPDIR in my shell prior to invoking R it works as expected:
  
   
  
   Sys.getenv(TMPDIR)
  
TMPDIR 
  
  /eurotempest/tmp/R 
  
   tempdir()
  
  [1] /eurotempest/tmp/R/Rtmp0xY4XD
  
   
  
  However if I don't set it prior to entry, but attempt to set it from
  within the current session, the change is not detected/respected:
  
   
  
   Sys.getenv(TMPDIR)
  
  TMPDIR 
  
   
  
   Sys.putenv(TMPDIR = /eurotempest/tmp/R/)
  
   Sys.getenv(TMPDIR)
  
 TMPDIR 
  
  /eurotempest/tmp/R/ 
  
   tempdir()
  
  [1] /tmp/Rtmp9chsNX
  
   
  
  Any ideas?
 
 You're not supposed to do that. There is one and only one tempdir per
 R session. This is used for storing stuff which R expects to be able to
 find again later, so it would be a bad thing just to switch it out.
 
 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907
 
 
 --
 This e-mail and its contents are intended for the use of the addressee(s) and 
 may be confidential/privileged. No-one else may review, copy, disclose or 
 otherwise use it or its contents. If you receive this e-mail in error, please 
 contact the originator and delete it as soon as possible.
 Benfield Limited is authorised by the Financial Services Authority under the 
 reference number 311884. Registered in England no 1170753. Registered office 
 55 Bishopsgate.
 
 Please refer to Benfield Limited's terms and conditions 
 (www.benfieldgroup.com/terms) for a description of our services, duties and 
 points of contact. Please review these terms and conditions at inception and 
 renewal of all reinsurance and insurance contracts.  
 
 Please note that our terms and conditions and interests in other companies 
 may change over time and these changes will be reflected on the Benfield 
 Limited website. The latest version of our terms and conditions supersedes 
 all previous versions.
 ==
 
 

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907


--
This e-mail and its contents are intended for the use of the addressee(s) and 
may be confidential/privileged. No-one else may review, copy, disclose or 
otherwise use it or its contents. If you receive this e-mail in error, please 
contact the originator and delete it as soon as possible.
Benfield Limited is authorised by the Financial Services Authority under the 
reference number 311884. Registered in England no 1170753. Registered office 55 
Bishopsgate.

Please refer to Benfield Limited's terms and conditions 
(www.benfieldgroup.com/terms) for a description of our services, duties and 
points of contact. Please review these 

[R] generic pasting of strings

2006-10-31 Thread Robert Lischke
Hi there,

is there a way to make the following code generic, so that i can paste()
the columns in tmp1 depending on the dimensions given in embed()?

 tmp1 - embed(as.vector(shrinkTable$AOIname), dimension = 2);
 tmp1
   [,1]   [,2]
 [1,] AOI4 AOI1
 [2,] AOI6 AOI4
 [3,] AOI4 AOI6
 tmp2 - paste(tmp1[, 2], tmp1[, 1], sep = );
 tmp2
 [1] AOI1AOI4 AOI4AOI6 AOI6AOI4

for dimension = 3 this would look like this:

 tmp1 - embed(as.vector(shrinkTable$AOIname), dimension = 3);
 tmp1
  [,1]   [,2]   [,3]
 [1,] AOI6 AOI4 AOI1
 [2,] AOI4 AOI6 AOI4
 tmp2 - paste(tmp1[ ,3], tmp1[, 2], tmp1[, 1], sep = );
 tmp2
 [1] AOI1AOI4AOI6 AOI4AOI6AOI4

Any ideas?

Thanks for your help,


Robert Lischke

__
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 crashing during batch file formatting

2006-10-31 Thread Jon Minton
Hi R users:

 

I have the British Household Panel Survey (BHPS) in .tab format. I want to
feed it through the Amelia package (which will be an ‘interesting’ job in
itself)..

But first I need to convert the various types of missing value (from about
-9 to -1) to a more generic ‘NA’ code.

 

I’ve written the following function to do this:

 

BHPS.converter - function(from=D:/Data/BHPS/UKDA-5151-tab/tab/,
to=D:/BHPS/NA/, ext=tab ) {

from.files - dir(from, pattern=paste(.,ext,$,sep=) ) 

existing.to.files - dir(to,
pattern=paste(.,ext,$,sep=) )

still.to.do.index - 1:length(from.files)

still.to.do.index -
still.to.do.index[-match(existing.to.files, from.files)]

obs.to.do - length(still.to.do.index)

for (i in 1:obs.to.do){

temp.table -
read.delim(paste(from,from.files[still.to.do.index[i]], sep=))

print(paste(read:,
from.files[still.to.do.index[i]]))

temp.table[temp.table  0 ] - NA

write.table(temp.table,
file=paste(to,from.files[still.to.do.index[i]], sep=))

print(paste(written:,
from.files[still.to.do.index[i]]))

}

 

 

rm(i, from.files, existing.to.files, still.to.do.index,
obs.to.do, temp.table)

}

 

It checks for existing files in the ‘to’ directory (where files which have
been modified with R- - NA) because when I tried to do this conversion
operation previously it got about ½ way through then crashed.

 

The problem is that it crashes *this time* too, without displaying a prompt
to say it’s read a single file. 

 

The file it gets stuck on is about 75mb in size. 

 

I am using a dual-core 3.2Ghz Pentium D processor with 2 Gb memory ( 2Gb
virtual memory), and (unfortunately) Windows XP.

 

Questions:

 1) Any general tips on how to increase the amount of memory available to
process the file?

2) Can you see a more efficient way of doing what I’m doing?

3) What’s the best way of coding for multiple forms of NA? – the BHPS code
‘-8’ (meaning ‘inapplicable’, not routed for this respondent) should really
be distinguished from other forms of nonresponse...

 

 

Thanks,

 

Jon

 

 

p.s. Apologies if this is slightly too vague/long winded...

 

 

Jon Minton

 

 


[[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] generic pasting of strings

2006-10-31 Thread Dimitris Rizopoulos
try something like:

apply(tmp1[, ncol(tmp1):1], 1, paste, sep = )


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: Robert Lischke [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Tuesday, October 31, 2006 12:36 PM
Subject: [R] generic pasting of strings


 Hi there,

 is there a way to make the following code generic, so that i can 
 paste()
 the columns in tmp1 depending on the dimensions given in embed()?

 tmp1 - embed(as.vector(shrinkTable$AOIname), dimension = 2);
 tmp1
   [,1]   [,2]
 [1,] AOI4 AOI1
 [2,] AOI6 AOI4
 [3,] AOI4 AOI6
 tmp2 - paste(tmp1[, 2], tmp1[, 1], sep = );
 tmp2
 [1] AOI1AOI4 AOI4AOI6 AOI6AOI4

 for dimension = 3 this would look like this:

 tmp1 - embed(as.vector(shrinkTable$AOIname), dimension = 3);
 tmp1
  [,1]   [,2]   [,3]
 [1,] AOI6 AOI4 AOI1
 [2,] AOI4 AOI6 AOI4
 tmp2 - paste(tmp1[ ,3], tmp1[, 2], tmp1[, 1], sep = );
 tmp2
 [1] AOI1AOI4AOI6 AOI4AOI6AOI4

 Any ideas?

 Thanks for your help,


 Robert Lischke

 __
 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] R crashing during batch file formatting

2006-10-31 Thread Duncan Murdoch
On 10/31/2006 6:43 AM, Jon Minton wrote:
  
 It checks for existing files in the ‘to’ directory (where files which have
 been modified with R- - NA) because when I tried to do this conversion
 operation previously it got about ½ way through then crashed.
 
  
 
 The problem is that it crashes *this time* too, without displaying a prompt
 to say it’s read a single file. 

When you say crash, do you mean it displays an R error (like unable 
to allocate vector of length ) or a real crash with a Windows popup?

Which version are you using?  There were some fixes to the memory 
management after the 2.3.1 release, but I haven't heard of any problems 
in 2.4.0 before this.

Duncan Murdoch

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


Re: [R] R crashing during batch file formatting

2006-10-31 Thread Petr Pikal
Hi

you shall probably provide more information (OS, R version).
I cannot help you much with crash but here is some opinion.
I would try to do conversion interactively before I transferred it to 
a function.

However, if you want different types of NA and your data is numeric, 
you probably could make a distinction by using -Inf, Inf, NaN and NA, 
but then you need to be careful when doing analysis, as these values 
can be treated differently.

HTH
Petr



On 31 Oct 2006 at 11:43, Jon Minton wrote:

From:   Jon Minton [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Tue, 31 Oct 2006 11:43:22 -
Subject:[R] R crashing during batch file formatting

 Hi R users:
 
 
 
 I have the British Household Panel Survey (BHPS) in .tab format. I
 want to feed it through the Amelia package (which will be an
 ‘interesting’ job in itself)..
 
 But first I need to convert the various types of missing value (from
 about -9 to -1) to a more generic ‘NA’ code.
 
 
 
 I’ve written the following function to do this:
 
 
 
 BHPS.converter - function(from=D:/Data/BHPS/UKDA-5151-tab/tab/,
 to=D:/BHPS/NA/, ext=tab ) {
 
 from.files - dir(from,
 pattern=paste(.,ext,$,sep=) ) 
 
 existing.to.files - dir(to,
 pattern=paste(.,ext,$,sep=) )
 
 still.to.do.index - 1:length(from.files)
 
 still.to.do.index -
 still.to.do.index[-match(existing.to.files, from.files)]
 
 obs.to.do - length(still.to.do.index)
 
 for (i in 1:obs.to.do){
 
 temp.table -
 read.delim(paste(from,from.files[still.to.do.index[i]], sep=))
 
 print(paste(read:,
 from.files[still.to.do.index[i]]))
 
 temp.table[temp.table  0 ] - NA
 
 write.table(temp.table,
 file=paste(to,from.files[still.to.do.index[i]], sep=))
 
 print(paste(written:,
 from.files[still.to.do.index[i]]))
 
 }
 
 
 
 
 
 rm(i, from.files, existing.to.files,
 still.to.do.index,
 obs.to.do, temp.table)
 
 }
 
 
 
 It checks for existing files in the ‘to’ directory (where files which
 have been modified with R- - NA) because when I tried to do this
 conversion operation previously it got about ˝ way through then
 crashed.
 
 
 
 The problem is that it crashes *this time* too, without displaying a
 prompt to say it’s read a single file. 
 
 
 
 The file it gets stuck on is about 75mb in size. 
 
 
 
 I am using a dual-core 3.2Ghz Pentium D processor with 2 Gb memory (
 2Gb virtual memory), and (unfortunately) Windows XP.
 
 
 
 Questions:
 
  1) Any general tips on how to increase the amount of memory available
  to
 process the file?
 
 2) Can you see a more efficient way of doing what I’m doing?
 
 3) What’s the best way of coding for multiple forms of NA? – the BHPS
 code ‘-8’ (meaning ‘inapplicable’, not routed for this respondent)
 should really be distinguished from other forms of nonresponse...
 
 
 
 
 
 Thanks,
 
 
 
 Jon
 
 
 
 
 
 p.s. Apologies if this is slightly too vague/long winded...
 
 
 
 
 
 Jon Minton
 
 
 
 
 
 
  [[alternative HTML version deleted]]
 
 

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] R crashing during batch file formatting

2006-10-31 Thread Jon Minton
Hi - i mean a 'real crash' (out of the R application) rather than an error.
I'm using 2.3.1: is it worth upgrading? 
Jon

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: 31 October 2006 12:05
To: Jon Minton
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] R crashing during batch file formatting

On 10/31/2006 6:43 AM, Jon Minton wrote:
  
 It checks for existing files in the ‘to’ directory (where files which have
 been modified with R- - NA) because when I tried to do this conversion
 operation previously it got about ½ way through then crashed.
 
  
 
 The problem is that it crashes *this time* too, without displaying a
prompt
 to say it’s read a single file. 

When you say crash, do you mean it displays an R error (like unable 
to allocate vector of length ) or a real crash with a Windows popup?

Which version are you using?  There were some fixes to the memory 
management after the 2.3.1 release, but I haven't heard of any problems 
in 2.4.0 before this.

Duncan Murdoch

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


Re: [R] R crashing during batch file formatting

2006-10-31 Thread Jon Minton
Thanks,

Windows XP Media Centre Edition (!) Version 2002 Service Pack 2
R version 2.3.1 (already heard that 2.4.0 has better memory handling?)

I think I'll use NaN for 'not applicable' and NA for 'missing': does anyone
know how Amelia handles and distinguishes between these two (only the
latter, of course, need imputing), and so if this can be done without
further formatting?

Jon

-Original Message-
From: Petr Pikal [mailto:[EMAIL PROTECTED] 
Sent: 31 October 2006 12:15
To: Jon Minton; r-help@stat.math.ethz.ch
Subject: Re: [R] R crashing during batch file formatting

Hi

you shall probably provide more information (OS, R version).
I cannot help you much with crash but here is some opinion.
I would try to do conversion interactively before I transferred it to 
a function.

However, if you want different types of NA and your data is numeric, 
you probably could make a distinction by using -Inf, Inf, NaN and NA, 
but then you need to be careful when doing analysis, as these values 
can be treated differently.

HTH
Petr



On 31 Oct 2006 at 11:43, Jon Minton wrote:

From:   Jon Minton [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Tue, 31 Oct 2006 11:43:22 -
Subject:[R] R crashing during batch file formatting

 Hi R users:
 
 
 
 I have the British Household Panel Survey (BHPS) in .tab format. I
 want to feed it through the Amelia package (which will be an
 'interesting' job in itself)..
 
 But first I need to convert the various types of missing value (from
 about -9 to -1) to a more generic 'NA' code.
 
 
 
 I've written the following function to do this:
 
 
 
 BHPS.converter - function(from=D:/Data/BHPS/UKDA-5151-tab/tab/,
 to=D:/BHPS/NA/, ext=tab ) {
 
 from.files - dir(from,
 pattern=paste(.,ext,$,sep=) ) 
 
 existing.to.files - dir(to,
 pattern=paste(.,ext,$,sep=) )
 
 still.to.do.index - 1:length(from.files)
 
 still.to.do.index -
 still.to.do.index[-match(existing.to.files, from.files)]
 
 obs.to.do - length(still.to.do.index)
 
 for (i in 1:obs.to.do){
 
 temp.table -
 read.delim(paste(from,from.files[still.to.do.index[i]], sep=))
 
 print(paste(read:,
 from.files[still.to.do.index[i]]))
 
 temp.table[temp.table  0 ] - NA
 
 write.table(temp.table,
 file=paste(to,from.files[still.to.do.index[i]], sep=))
 
 print(paste(written:,
 from.files[still.to.do.index[i]]))
 
 }
 
 
 
 
 
 rm(i, from.files, existing.to.files,
 still.to.do.index,
 obs.to.do, temp.table)
 
 }
 
 
 
 It checks for existing files in the 'to' directory (where files which
 have been modified with R- - NA) because when I tried to do this
 conversion operation previously it got about ˝ way through then
 crashed.
 
 
 
 The problem is that it crashes *this time* too, without displaying a
 prompt to say it's read a single file. 
 
 
 
 The file it gets stuck on is about 75mb in size. 
 
 
 
 I am using a dual-core 3.2Ghz Pentium D processor with 2 Gb memory (
 2Gb virtual memory), and (unfortunately) Windows XP.
 
 
 
 Questions:
 
  1) Any general tips on how to increase the amount of memory available
  to
 process the file?
 
 2) Can you see a more efficient way of doing what I'm doing?
 
 3) What's the best way of coding for multiple forms of NA? - the BHPS
 code '-8' (meaning 'inapplicable', not routed for this respondent)
 should really be distinguished from other forms of nonresponse...
 
 
 
 
 
 Thanks,
 
 
 
 Jon
 
 
 
 
 
 p.s. Apologies if this is slightly too vague/long winded...
 
 
 
 
 
 Jon Minton
 
 
 
 
 
 
  [[alternative HTML version deleted]]
 
 

Petr Pikal
[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] [ggplot] controlling axis and major/minor tick marks

2006-10-31 Thread hadley wickham
Hi Sebastian,

axis.colour should control the colour of the tickmarks, the axis
labels, and the line which the ticks attach to.  What is not working
in your case?  grid.colour only effects the grid lines inside the
plot.

Currently, ggplot has no notion of major and minor tick marks (mainly
because I don't have a good algorithim to generate them), but it is on
my to do list.

Regards,

Hadley

On 10/31/06, Sebastian Weber [EMAIL PROTECTED] wrote:
 Hello there!

 I'm starting with ggplot and was wondering how I could control the axis
 of a plot. I would like the axis of the plot to be drawn black which I
 thought to acheive with the option axis.colour=black. However, this
 had no real effect on the plot. Then I found grid.colour which I changed
 to black as well. Now I got my axis as I wanted them, but ggplot now
 draws the grid inside the plot with black lines as well, which definetly
 do not want to appear. So how can I get a black border around my plots?
 Furthermore, I would like to indicate positions of major and minor ticks
 in my plots. Where can I do this?

 Thanks in advance.

 Greetings,

 Sebastian

 Ah, I use R 2.3.1 and ggplot 0.4.0, if that is important ...

 __
 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] Compiling R packages on Ubuntu

2006-10-31 Thread Vikas Rawal
I am unable to compile R packages from source on Ubuntu
dapper/edgy. Does anybody have an experience?


When I do install.packages(nlme,depend=TRUE), I get following error messages. 
Can someone help?

I get similar messages for any package I try to compile.

VR

-

* Installing *source* package 'nlme' ...
** libs
gcc -I/usr/share/R/include -I/usr/share/R/include-fvisibility=hidden -fpic  
-g -O2 -std=gnu99 -c corStruct.c -o corStruct.o
In file included from base.h:29,
 from matrix.h:27,
 from corStruct.c:27:
/usr/share/R/include/S.h:37:20: error: stdlib.h: No such file or directory
/usr/share/R/include/S.h:38:19: error: stdio.h: No such file or directory
In file included from /usr/lib/gcc/i486-linux-gnu/4.1.2/include/syslimits.h:7,
 from /usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:11,
 from /usr/share/R/include/S.h:39,
 from base.h:29,
 from matrix.h:27,
 from corStruct.c:27:
/usr/lib/gcc/i486-linux-gnu/4.1.2/include/limits.h:122:61: error: limits.h: No 
such file or directory
In file included from base.h:29,
 from matrix.h:27,
 from corStruct.c:27:
/usr/share/R/include/S.h:41:19: error: math.h: No such file or directory
In file included from /usr/share/R/include/S.h:55,
 from base.h:29,
 from matrix.h:27,
 from corStruct.c:27:
/usr/share/R/include/R_ext/RS.h:23:38: error: string.h: No such file or 
directory
In file included from base.h:34,
 from matrix.h:27,
 from corStruct.c:27:
/usr/share/R/include/Rinternals.h:36:19: error: errno.h: No such file or 
directory
/usr/share/R/include/Rinternals.h:44:19: error: ctype.h: No such file or 
directory
In file included from base.h:34,
 from matrix.h:27,
 from corStruct.c:27:
/usr/share/R/include/Rinternals.h:767: error: expected declaration specifiers 
or $(B!F(B...$(B!G(B before $(B!F(BFILE$(B!G
(B/usr/share/R/include/Rinternals.h:770: error: expected declaration 
specifiers or $(B!F(B...$(B!G(B before $(B!F(BFILE$(B!G
(BIn file included from matrix.h:27,
 from corStruct.c:27:
base.h:38:21: error: libintl.h: No such file or directory
corStruct.c: In function $(B!F(BcorStruct_factList$(B!G(B:
corStruct.c:58: warning: implicit declaration of function $(B!F(Blog$(B!G
(BcorStruct.c:58: warning: incompatible implicit declaration of built-in 
function $(B!F(Blog$(B!G
(BcorStruct.c:58: warning: implicit declaration of function $(B!F(Bfabs$(B!G
(BcorStruct.c:58: warning: incompatible implicit declaration of built-in 
function $(B!F(Bfabs$(B!G
(BcorStruct.c:60: warning: implicit declaration of function 
$(B!F(Bmemcpy$(B!G
(BcorStruct.c:60: warning: incompatible implicit declaration of built-in 
function $(B!F(Bmemcpy$(B!G
(BcorStruct.c: In function $(B!F(Bsymm_fullCorr$(B!G(B:
corStruct.c:93: warning: implicit declaration of function $(B!F(Bexp$(B!G
(BcorStruct.c:93: warning: incompatible implicit declaration of built-in 
function $(B!F(Bexp$(B!G
(BcorStruct.c:95: warning: implicit declaration of function $(B!F(Bcos$(B!G
(BcorStruct.c:95: warning: incompatible implicit declaration of built-in 
function $(B!F(Bcos$(B!G
(BcorStruct.c:96: warning: implicit declaration of function $(B!F(Bsin$(B!G
(BcorStruct.c:96: warning: incompatible implicit declaration of built-in 
function $(B!F(Bsin$(B!G
(BcorStruct.c: In function $(B!F(Bsymm_fact$(B!G(B:
corStruct.c:166: warning: incompatible implicit declaration of built-in 
function $(B!F(Blog$(B!G
(BcorStruct.c:166: warning: incompatible implicit declaration of built-in 
function $(B!F(Bfabs$(B!G
(BcorStruct.c:168: warning: incompatible implicit declaration of built-in 
function $(B!F(Bmemcpy$(B!G
(BcorStruct.c: In function $(B!F(Bnat_fullCorr$(B!G(B:
corStruct.c:216: warning: incompatible implicit declaration of built-in 
function $(B!F(Bexp$(B!G
(BcorStruct.c: In function $(B!F(BAR1_mat$(B!G(B:
corStruct.c:281: warning: implicit declaration of function $(B!F(Bpow$(B!G
(BcorStruct.c:281: warning: incompatible implicit declaration of built-in 
function $(B!F(Bpow$(B!G
(BcorStruct.c: In function $(B!F(Bsafe_phi$(B!G(B:
corStruct.c:292: warning: incompatible implicit declaration of built-in 
function $(B!F(Bexp$(B!G
(BcorStruct.c:295: warning: incompatible implicit declaration of built-in 
function $(B!F(Bexp$(B!G
(BcorStruct.c: In function $(B!F(BAR1_fact$(B!G(B:
corStruct.c:316: warning: implicit declaration of function $(B!F(Bsqrt$(B!G
(BcorStruct.c:316: warning: incompatible implicit declaration of built-in 
function $(B!F(Bsqrt$(B!G
(BcorStruct.c:318: warning: incompatible implicit declaration of built-in 
function $(B!F(Blog$(B!G
(BcorStruct.c: In function $(B!F(BCAR1_mat$(B!G(B:
corStruct.c:369: 

Re: [R] plotting multiple groups (newbie Q)

2006-10-31 Thread hadley wickham
 Now I want to do some plotting:

   plot(kSum$F2[group==N],kSum$DP_Level.mean[group==N],type=l)
 # This works fine
   plot(kSum$F2[group==SN],kSum$DP_Level.mean[group==SN],type=l)
 # This plots both N and SN in one line sequentially
   plot(kSum$F2[group==Y],kSum$DP_Level.mean[group==Y],type=l)
 # This gives the following error messages.


What is group?  I suspect it is not the kSum$group that you think it is.

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] R crashing during batch file formatting

2006-10-31 Thread Duncan Murdoch
On 10/31/2006 7:29 AM, Jon Minton wrote:
 Hi - i mean a 'real crash' (out of the R application) rather than an error.
 I'm using 2.3.1: is it worth upgrading? 

Yes, though it might just convert that crash into an R error.

Duncan Murdoch

 Jon
 
 -Original Message-
 From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
 Sent: 31 October 2006 12:05
 To: Jon Minton
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] R crashing during batch file formatting
 
 On 10/31/2006 6:43 AM, Jon Minton wrote:
   
 It checks for existing files in the ‘to’ directory (where files which have
 been modified with R- - NA) because when I tried to do this conversion
 operation previously it got about ½ way through then crashed.
 
  
 
 The problem is that it crashes *this time* too, without displaying a
 prompt
 to say it’s read a single file. 
 
 When you say crash, do you mean it displays an R error (like unable 
 to allocate vector of length ) or a real crash with a Windows popup?
 
 Which version are you using?  There were some fixes to the memory 
 management after the 2.3.1 release, but I haven't heard of any problems 
 in 2.4.0 before this.
 
 Duncan Murdoch
 
 


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


Re: [R] write to clipboard under Linux

2006-10-31 Thread Prof Brian Ripley

On Sun, 29 Oct 2006, Johannes Hüsing wrote:


Dear all,
I am trying to use the clipboard when writing a table.
Typing:

write.table(object, file=clipboard)

leads to the message:

Fehler in file(file, ifelse(append, a, w)) :
'mode' für die Zwischenablage muss unter Unix 'r' sein

My interpretation is that I am not allowed to write into the
clipboard from a program called from R. Is there a way to
change this behaviour?


Linux does not have a clipboard but an X11 session has primary and 
secondary selections.  ?file says


Clipboard:

 'file' can also be used with 'description = clipboard' in mode
 'r' only.  It reads the X11 primary selection, which can also be
 specified as 'X11_primary' and the secondary selection as
 'X11_secondary'.

 When the clipboard is opened for reading, the contents are
 immediately copied to internal storage in the connection.

 Unix users wishing to _write_ to the primary selection may be able
 to do so via 'xclip' (URL:
 http://people.debian.org/~kims/xclip/), for example by
 'pipe(xclip -i, w)'.

so RTFM applied.  Writing to an X11 selection needs multiple threads and I 
did not think it worth the very considerable effort of implementing 
(unlike for Windows).


Note that window managers may have other clipboards, and for example the 
RGtk2 package has interfaces to gtk clipboards.


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] one problem about how to hold graphic with R

2006-10-31 Thread yang baohua
Sorry to disturb you, but can you help me to solve one little problem?
I want to draw a graphic after another with R
but I cannot find the first one after that.
Do you know the command to hold the graphic with R?
I remember with Matlab you may use hold on.
Thanks.


-- 
Baohua Yang

Email:[EMAIL PROTECTED]

[[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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Richard . Cotton
I've just found some behaviour which strikes me as odd, but I'm not sure 
whether it's a bug or a feature.  If you don't mind, I'd like to explain 
via a couple of examples.

Let x = 1:10.
Then intuitively, to me at least, the command x[-integer(0)] should leave 
x untouched.  However the actual output under R2.4.0 is integer(0).

A slightly more involved example demonstrates why I think this behaviour 
is back to front.
First we define a data frame, in this case some people, with their 
heights.
peoples.heights = data.frame(names = c(Alice, Bob, Carol), heights = 
c(1.67, 1.85, 175))

To make sure the heights are sensible, we define a filter out impossibly 
tall people.
dubious.records = which(peoples.heights$heights  2.5)  #3
peoples.heights = peoples.heights[-dubious.records,]

This all works fine since dubious.records is not empty.  However, if all 
the records had been entered properly, then we would get
#dubious.records = integer(0)

Then the command peoples.heights = peoples.heights[-dubious.records,] 
strips all the rows to give
#[1] names   heights
#0 rows (or 0-length row.names)

i.e. instead of removing the bad records, I've lost everything.
I know that it's possible to recode this so problems don't occur, but the 
point is that the answer is unexpected.

Can anybody explain if this behaviour is intentional or useful in some 
way, or is it an oversight?

Regards,
Richie.

Mathematical Sciences Unit
HSL
Buxton
SK17 9JN
01298 21(x8672)



ATTENTION:

This message contains privileged and confidential informatio...{{dropped}}

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


Re: [R] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Richard . Cotton
Thanks for the reply Peter, though I'm not quite convinced.

  #dubious.records = integer(0)
  identical(dubious.records, -dubious.records)
 [1] TRUE

 how can peoples.heights[-dubious.records,] be different from
 peoples.heights[dubious.records,]? 

Tell me if I'm being willfully ignorant here, but I'm sure they should be 
different.  In the first case, the minus sign represents subtraction, so 
it is correct that dubious.records and -dubious.records are identical.

However, in the second case, inside the square brackets, the minus sign 
represents set complement, not subtraction, so dubious.records and -
dubious.records are not the same.

If x = runif(10), then x[-c(2,3,5)] means remove from x the values at the 
second, third and fifth position.

By extension x[-integer(0)] should mean remove from x no values, and not 
remove from x all values, which is the current behaviour.

Regards,
Richie.

Mathematical Sciences Unit
HSL
Buxton
SK17 9JN
01298 21(x8672)


[EMAIL PROTECTED] wrote on 31/10/2006 14:27:05:

 [EMAIL PROTECTED] writes:
 
  I've just found some behaviour which strikes me as odd, but I'm not 
sure 
  whether it's a bug or a feature.  If you don't mind, I'd like to 
explain 
  via a couple of examples.
  
  Let x = 1:10.
  Then intuitively, to me at least, the command x[-integer(0)] should 
leave 
  x untouched.  However the actual output under R2.4.0 is integer(0).
  
  A slightly more involved example demonstrates why I think this 
behaviour 
  is back to front.
  First we define a data frame, in this case some people, with their 
  heights.
  peoples.heights = data.frame(names = c(Alice, Bob, Carol), 
heights = 
  c(1.67, 1.85, 175))
  
  To make sure the heights are sensible, we define a filter out 
impossibly 
  tall people.
  dubious.records = which(peoples.heights$heights  2.5)  #3
  peoples.heights = peoples.heights[-dubious.records,]
  
  This all works fine since dubious.records is not empty.  However, if 
all 
  the records had been entered properly, then we would get
  #dubious.records = integer(0)
  
  Then the command peoples.heights = peoples.heights[-dubious.records,] 
  strips all the rows to give
  #[1] names   heights
  #0 rows (or 0-length row.names)
  
  i.e. instead of removing the bad records, I've lost everything.
  I know that it's possible to recode this so problems don't occur, but 
the 
  point is that the answer is unexpected.
  
  Can anybody explain if this behaviour is intentional or useful in some 

  way, or is it an oversight?
 
 Consistency! It's not particularly useful, but it follows from general
 principles, which it in the long run doesn't pay to depart from.
 
 The issue is that the result of using an indexing operator ([)
 should depend only on the _value_ of its argument, not the expression
 used to compute it. Just like you most likely expect log(2+2) not to be
 different from log(4). And since
 
  dubious.records - integer(0)
  identical(dubious.records, -dubious.records)
 [1] TRUE
 
 how can peoples.heights[-dubious.records,] be different from
 peoples.heights[dubious.records,]? 
 
 R could actually look at the expression and act on the minus sign, but
 that way lies madness. Consider
 
 keep - -dubious.records
 drop - dubious.records
 
 peoples.heights[keep,]
 peoples.heights[-dubious.records,]
 peoples.heights[-keep,]
 
 etc... I think you'll get the picture.
 
 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 
35327918
 ~~ - ([EMAIL PROTECTED])  FAX: (+45) 
35327907


ATTENTION:

This message contains privileged and confidential informatio...{{dropped}}

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


[R] getMethod(s) and var.test

2006-10-31 Thread Benjamin Otto
Hi,

 

How do I retrieve the var.test() function code? I had a similar problem once
before with another function but getMethods() solved the problem then. Now I
tried several combinations for var.test() without success.

 

Regards

 

benjamin

 

--
Benjamin Otto
Universitaetsklinikum Eppendorf Hamburg
Institut fuer Klinische Chemie
Martinistrasse 52
20246 Hamburg

 


[[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] getMethod(s) and var.test

2006-10-31 Thread Jeff Miller
On second thought, sometimes you need the .default (as in your case and for
t.test) but not always...for aov you just need getAnywhere(aov)

Not sure why...

It seems the best choices to get package code are

1. body()
2. methods()
3. methods(packagename,default)
4. methods(packagename,mod)
5. getAnywhere(packagename)
6. getAnywhere(packagename.default)

Jeff 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Otto
Sent: Tuesday, October 31, 2006 10:15 AM
To: R-Help
Subject: [R] getMethod(s) and var.test

Hi,

 

How do I retrieve the var.test() function code? I had a similar problem once
before with another function but getMethods() solved the problem then. Now I
tried several combinations for var.test() without success.

 

Regards

 

benjamin

 

--
Benjamin Otto
Universitaetsklinikum Eppendorf Hamburg
Institut fuer Klinische Chemie
Martinistrasse 52
20246 Hamburg

 


[[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] [ggplot] controlling axis and major/minor tick marks

2006-10-31 Thread hadley wickham
Hi Sebastian,

 Then I plot my stuff with

 p2 - ggplot(knn, . ~ power ,  aes=list(y=log10(k2m/(degree*kSize)),
 x=log10(degree), shape=alpha))
 p2 - ggpoint(p2)
 p2

 and I do not see any axis at all. The tick marks are there, they are
 black as they should.

I don't think I understand what you mean by axis - do you mean you
want a line running along side the plot next to the tick marks?

 By the way, I already wondered why I can not change the shapes of the
 symbols in use. I figured that they are set statically in map_shapes.
 How about introducing an option for this somewhere?

I mean to overhaul the options system to provide a lot more
flexibility, but I have yet to get around to this unfortunately.

 I definetly need minor tick marks and will hack my way through ggplot to
 acheive this if it does not seem to difficult to me. May you give me a
 tip where to start / where should I have to modify things.

I am planning on rewriting a lot of the scales system, but again, when
I have time.  It would be useful if you could provide a specification
of what minor tickmarks are: how are they different from major tick
marks? what do they look like? when do you want to see them?  do you
generate them using the same principle as major tick marks?

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.


[R] ANNOUNCEMENT: 20% Discount on the Latest R Books from Chapman Hall/CRC Press

2006-10-31 Thread Calver, Rob
Take advantage of a 20% discount on the most recent R books from Chapman  
Hall/CRC!

Chapman and Hall/CRC is pleased to offer the latest books on R - all available 
through our website at a 20% discount to users of the software. To take 
advantage of this offer that is valid across the board for all of our R books, 
simply visit http://www.crcpress.com/, choose your titles, and insert the 
online discount code - 585HH - in the 'Promotion Code' field at checkout.

** OWN THESE LATEST R TITLES! **

A Handbook of Statistical Analyses Using R
Brian S. Everitt, Institute of Psychiatry, King's College, London, UK
Torsten Hothorn, Institut für Medizininformatik, Biometrie und Epidemiologie, 
Erlangen, Germany

From simple inference to recursive partitioning and cluster analysis, this 
book methodically leads readers through the necessary steps, commands, and 
interpretation of results - addressing theory and statistical background only 
when useful or necessary. Beginning with an introduction to R, it discusses 
the syntax, general operators, and basic data manipulation while summarizing 
the most important features. Numerous figures highlight R's strong graphical 
capabilities and exercises at the end of each chapter reinforce the techniques 
and concepts presented. All data sets and code used in the book are available 
as a downloadable package from CRAN, the R online archive.

Discounted Price: $39.95 / £23.99

For more details and to order:
http://www.crcpress.com/shopping_cart/products/product_detail.asp?sku=C5394parent_id=pc

***

Generalized Additive Models: An Introduction with R
Simon N. Wood, University of Bath, UK

This book provides a thorough understanding of the theory and practical 
applications of GAMs and related advanced models. The author bases his approach 
on a framework of penalized regression splines, and builds a well-grounded 
foundation through motivating chapters on linear and generalized linear models. 
While firmly focused on the practical aspects of GAMs, discussions include 
fairly full explanations of the theory underlying the methods. Use of the 
freely available R software helps explain the theory and illustrates the 
practicalities of linear, generalized linear, and generalized additive models, 
as well as their mixed effect extensions.

Discounted Price: $63.95 / £31.99

For more details and to order:
http://www.crcpress.com/shopping_cart/products/product_detail.asp?sku=C4746parent_id=pc

*** ACQUIRE THESE ADDITIONAL R TITLES! ***

Linear Models with R
Julian J. Faraway, University of Bath, UK 

Focusing on the practice of regression and analysis of variance, this book 
clearly demonstrates the different methods available and in which situations 
each one applies. It covers all of the standard topics, from the basics of 
estimation to missing data, factorial designs, and block designs, but it also 
includes discussion of topics, such as model uncertainty, rarely addressed in 
books of this type. The presentation incorporates numerous examples that 
clarify both the use of each technique and the conclusions one can draw from 
the results. 

Discounted Price: $55.96/£31.99

For more details and to order:
http://www.crcpress.com/shopping_cart/products/product_detail.asp?sku=C4258parent_id=pc

***

Extending Linear Models with R: Generalized Linear, Mixed Effects and 
Nonparametric Regression Models
Julian J. Faraway, University of Bath, UK 

This book surveys the techniques that grow from the regression model, 
presenting three extensions to that framework: generalized linear models 
(GLMs), mixed effect models, and nonparametric regression models. The author's 
treatment is thoroughly modern and covers topics that include GLM diagnostics, 
generalized linear mixed models, trees, and even the use of neural networks in 
statistics. To demonstrate the interplay of theory and practice, throughout the 
book the author weaves the use of the R software environment to analyze the 
data of real examples, providing all of the R commands necessary to reproduce 
the analyses.

Discounted Price: $63.96/£31.99

For more details and to order:
http://www.crcpress.com/shopping_cart/products/product_detail.asp?sku=C424Xparent_id=pc

***

R Graphics
Paul Murrell, The University of Auckland, New Zealand 

Considered the leading expert on the use of R graphics, Murrell gives 
statisticians the first complete reference on the R graphical system. An 
in-depth text that takes nothing for granted, it helps both neophytes and 
seasoned statisticians master the intricacies of R. No other published volume 
contains information on R's grid graphics, and much of the information the 
author provides is original material not to be found anywhere else. Ahead of 
the curve, this volume defines the direction for the future of statistical 
graphical development.

Discounted Price: $55.96/£31.99

For more details and to order:

Re: [R] read.fwf and header

2006-10-31 Thread davidr
Archaic it may be, but I still have to deal with fixed format data
files on a daily basis.

David L. Reiner
Rho Trading Securities, LLC
Chicago  IL  60605
312-362-4963

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Maechler
Sent: Tuesday, October 31, 2006 1:52 AM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] read.fwf and header

snip

In my (and probably R-core's) view, read.fwf() should only have
to be used for ``legacy data files'' (those times when people used *no*
separators in order to save disk space), since nowadays, such
data files should automatically have correct separators. 

-- Fix the file producing process rather than make read.fwf()
unnecessarily more complicated.

Martin Maechler, ETH Zurich

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

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


[R] Convert Lift Tables to Gain Tables

2006-10-31 Thread Marco LO
Hello All,
   
  I wonder is there any existing R routine to convert a lift table (say from 
the object of class performance) into a gain table through a profit / loss 
missclassification matrix.
   
  Thanks!
  marco
   
   
   

 __



[[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] 2.4.0 and lattice 0.14-9: Changed behaviour of scales-argumenttck

2006-10-31 Thread Deepayan Sarkar
On 10/31/06, Gerrit Eichner [EMAIL PROTECTED] wrote:
 Dear list,

 I have observed a change in the behaviour of the scales-argument tck of
 xyplot() after having installed R 2.4.0 (for version info see below).

 The help page of xyplot() says about the scales-argument tck:

 'tck' numeric to control length of tick marks. Can be a vector
of length 2, to control left/bottom and right/top separately.

 But if I issue

 xyplot( y ~ x, scales= list( tck= c( 1, 0)))

 (with suitable numeric vectors x and y, of course) the plot shows
 alternating tick mark lengths *on every side* of the plot (i.e., the
 length of every second tick mark is zero). I wanted to see tick marks only
 on the left and bottom side of the coordinate system (as I did see before
 with R 2.2.0 and lattice version 0.12-9).

It's a bug that I had a fix for but forgot to include in the last
update. A new version of lattice should be available in a day or two.

 Has anybody a workaround to get back the original (documented)
 behaviour?

Since you are on linux, you could simply check out the svn version
from https://svn.r-project.org/R-packages/trunk/lattice and compile
it.

-Deepayan

 Thanks a lot!

   Best regards  --  Gerrit

 PS: My system:

  version
 _
 platform   x86_64-unknown-linux-gnu
 arch   x86_64
 os linux-gnu
 system x86_64, linux-gnu
 status
 major  2
 minor  4.0
 year   2006
 month  10
 day03
 svn rev39566
 language   R
 version.string R version 2.4.0 (2006-10-03)

__
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] Confidence interval calculation in prop.test

2006-10-31 Thread Douglas Bates
On 10/30/06, Richard Johnston [EMAIL PROTECTED] wrote:
 The confidence interval calculation in prop.test appears to be
 incorrect when alternative=greater.  The upper limit is always set
 to 1.000.  Am I missing something?

Like the t.test function the prop.test function returns a one-sided
interval when the alternative is greater or less.  The output
indicates that the 95% lower confidence bound on the proportion is
0.0369.  If you choose alternative = less you will get a 95% upper
confidence bound (and the lower bound will always be given as 0).
Only when you use the default value, two-sided, for the alternative
parameter will you get both the upper and lower bounds calculated.

   total=c(250,250)
   success=c(55,31)
   prop.test(success,total,alternative=greater,correct=TRUE)

 2-sample test for equality of proportions with continuity correction

 data:  success out of total
 X-squared = 7.4289, df = 1, p-value = 0.003209
 alternative hypothesis: greater
 95 percent confidence interval:
 0.03693065 1.
 sample estimates:
 prop 1 prop 2
 0.220  0.124


 [[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] getMethod(s) and var.test

2006-10-31 Thread Jeff Miller

I have found that you need this to see the stats package code

getAnywhere(var.test.default)

Jeff

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Otto
Sent: Tuesday, October 31, 2006 10:15 AM
To: R-Help
Subject: [R] getMethod(s) and var.test

Hi,

 

How do I retrieve the var.test() function code? I had a similar problem once
before with another function but getMethods() solved the problem then. Now I
tried several combinations for var.test() without success.

 

Regards

 

benjamin

 

--
Benjamin Otto
Universitaetsklinikum Eppendorf Hamburg
Institut fuer Klinische Chemie
Martinistrasse 52
20246 Hamburg

 


[[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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 Thanks for the reply Peter, though I'm not quite convinced.
 
   #dubious.records = integer(0)
   identical(dubious.records, -dubious.records)
  [1] TRUE
 
  how can peoples.heights[-dubious.records,] be different from
  peoples.heights[dubious.records,]? 
 
 Tell me if I'm being willfully ignorant here, but I'm sure they should be 
 different.  In the first case, the minus sign represents subtraction, so 
 it is correct that dubious.records and -dubious.records are identical.
 
 However, in the second case, inside the square brackets, the minus sign 
 represents set complement, not subtraction, so dubious.records and -
 dubious.records are not the same.

Nono, that is the point: Minus is minus, no matter where it occurs.
Changing what it means depending on context leads to inconsistent
behaviour. E.g., you shouldn't get different behaviour from assigning
an index expression to an intermediate variable, as in

  peoples.heights[-dubious.records,]
  keep - -dubious.records
  peoples.heights[keep,]

However, that would happen if the minus was interpreted differently
within []: There is no way for R to realize that the sign change in
the assignment has anything to do with indexing (OK, there is, but
then the value of keep later on would depend on what it had been
used for! Things quickly get really nasty).



-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] generic pasting of strings

2006-10-31 Thread Gabor Grothendieck
On 10/31/06, Robert Lischke [EMAIL PROTECTED] wrote:
 Hi there,

 is there a way to make the following code generic, so that i can paste()
 the columns in tmp1 depending on the dimensions given in embed()?

  tmp1 - embed(as.vector(shrinkTable$AOIname), dimension = 2);
  tmp1
   [,1]   [,2]
  [1,] AOI4 AOI1
  [2,] AOI6 AOI4
  [3,] AOI4 AOI6
  tmp2 - paste(tmp1[, 2], tmp1[, 1], sep = );
  tmp2
  [1] AOI1AOI4 AOI4AOI6 AOI6AOI4

 for dimension = 3 this would look like this:

  tmp1 - embed(as.vector(shrinkTable$AOIname), dimension = 3);
  tmp1
  [,1]   [,2]   [,3]
  [1,] AOI6 AOI4 AOI1
  [2,] AOI4 AOI6 AOI4
  tmp2 - paste(tmp1[ ,3], tmp1[, 2], tmp1[, 1], sep = );
  tmp2
  [1] AOI1AOI4AOI6 AOI4AOI6AOI4


Try do.call like this:

do.call(paste, c(as.data.frame(tmp1), sep = ))

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


[R] plotting question

2006-10-31 Thread Leeds, Mark \(IED\)
i have the following code below and at the end there are some plotting
statements.
it actualy looks quite nice when you run it but there is just one
strange thing  happening that
don't know how to fix.
 
the three things being plotted are
 
aggfxdata[,logbidask] which has its own set of times ( it's a zoo object
).
rollmeanlogbidask which has a subset of the times that aggfxdata has.
basically it starts later than aggfxdata[,logbidask] and when the plot
is done, it works in the
sense that rollmeanlogbidask gets plotted later.
 
then, i plot the variable lt on the same plot witrh it's vertical axis
on the right side and this works nicely also.
 
the only that doesn't quite work is that lt, time wise, lt,  starting at
the same time as the aggfxdata[,logbidask] when it should be starting a
few minutes after
rollmeanlogbidask. the times in it are correct and i don't think it has
to do with the fact that things are zoo ( but i could be wrong ? ).
i must be doing something wrong in my commands. the weird thing is that
rollmeanlogbidask starts at the appropriate place ?
 
maybe i have to give lt a different frequency but when i do the dput , i
don'ts ee freequency as part of it ?
 
this probably sounds way more confusing than it actually is but, if you
run below, you will see exactly what io mean. 
thanks a lot to anyone who can be bothered pasitng below. as usual, you
would need zoo and chron.
 
 
aggfxdata-structure(c(114.834516129032, 114.7922, 114.820808080808,
114.838260869565, 
114.837560975610, 114.776697247706, 114.7969, 114.745714285714, 
114.734923076923, 114.661939393939, 114.646574074074, 114.703486238532, 
114.646453900709, 114.651948051948, 114.742671755725, 114.721132075472, 
114.828647058824, 114.885978260870, 114.936860465116, 114.94, 
114.967763157895, 114.935107526882, 114.92225, 115.015606060606, 
115.077261146497, 115.034248366013, 114.961923076923, 114.976463414634, 
115.063468208092, 115.085882352941, 115.166847826087, 115.153306451613, 
115.137719298246, 115.080735294118, 115.074090909091, 115.021134751773, 
114.903450292398, 114.916153846154, 114.888306451613, 114.937469879518, 
114.890943396226, 114.849747899160, 114.926912751678, 114.874567901235, 
114.837980769231, 114.797538461538, 114.746707317073, 114.696013071895, 
114.67645833, 114.852184466019, 114.848548387097, 114.8078, 
114.835050505051, 114.851304347826, 114.852439024390, 114.792844036697, 
114.8117, 114.759206349206, 114.748307692308, 114.675939393939, 
114.661296296296, 114.717889908257, 114.660921985816, 114.665779220779, 
114.756870229008, 114.735471698113, 114.841941176471, 114.899184782609, 
114.949186046512, 114.953990384615, 114.982280701754, 114.948924731183, 
114.9368, 115.028863636364, 115.091592356688, 115.0478, 
114.975576923077, 114.990365853659, 115.078381502890, 115.099705882353, 
115.180326086957, 115.166370967742, 115.151052631579, 115.095147058824, 
115.088522727273, 115.035390070922, 114.917894736842, 114.930128205128, 
114.903790322581, 114.952409638554, 114.906226415094, 114.863865546218, 
114.940939597315, 114.890370370370, 114.852211538462, 114.812307692308, 
114.760548780488, 114.710326797386, 114.69020833, 114.866213592233, 
4.74355319771057, 4.74319148388547, 4.74343474081987, 4.74358150022944, 
4.74358339314172, 4.74305881517423, 4.74322922997911, 4.74277728938584, 
4.7426822736, 4.74204918880485, 4.7419183321792, 4.74241320264843, 
4.74191617575789, 4.74196131670693, 4.74275385322944, 4.74256674074965, 
4.74349887668465, 4.74399761812053, 4.74443655563793, 4.74447111073972, 
4.74471490416156, 4.74442779363424, 4.74431911442163, 4.74512545618279, 
4.74566600467616, 4.74528870019174, 4.74466035230505, 4.74478789738982, 
4.74554867613244, 4.74573870836097, 4.74644044208183, 4.74632106516708, 
4.74618687097407, 4.74569654200703, 4.74563889435559, 4.74517785826786, 
4.74415506578588, 4.74426356601777, 4.74402779250609, 4.74445322900522, 
4.74404986890124, 4.74368619357562, 4.7443574082389, 4.74390959824271, 
4.74358423039023, 4.7432343669113, 4.74278746542368, 4.74234766049834, 
4.74217470698038, 4.7437070219583), .Dim = c(50, 3), .Dimnames = list(
NULL, c(bid, ask, logbidask)), index = structure(c(1152058200,

1152058800, 1152059400, 115206, 1152060600, 1152061200, 1152061800, 
1152062400, 1152063000, 1152063600, 1152064200, 1152064800, 1152065400, 
1152066000, 1152066600, 1152067200, 1152067800, 1152068400, 1152069000, 
1152069600, 1152070200, 1152070800, 1152071400, 1152072000, 1152072600, 
1152073200, 1152073800, 1152074400, 1152075000, 1152075600, 1152076200, 
1152076800, 1152077400, 1152078000, 1152078600, 1152079200, 1152079800, 
1152080400, 1152081000, 1152081600, 1152082200, 1152082800, 1152083400, 
1152084000, 1152084600, 1152085200, 1152085800, 1152086400, 1152087000, 
1152087600), class = c(POSIXt, POSIXct)), class = zoo)

 
rollmeanlogbidask-structure(c(4.74371176689231, 4.74380800837135,
4.7439123277474, 
4.74400406541921, 4.7440745668118, 

Re: [R] plotting question

2006-10-31 Thread Gabor Grothendieck
I think you will have to ensure that lt has the same set of times as
the prior plot to do it that way.  Since time(lt) is a subset of
time(aggfxdata) it would be good enough to do this:

par(new = TRUE)
lt2 - merge(zoo(, time(aggfxdata)), lt)
plot(lt2, type = l, lty = 2)

On 10/31/06, Leeds, Mark (IED) [EMAIL PROTECTED] wrote:
 i have the following code below and at the end there are some plotting
 statements.
 it actualy looks quite nice when you run it but there is just one
 strange thing  happening that
 don't know how to fix.

 the three things being plotted are

 aggfxdata[,logbidask] which has its own set of times ( it's a zoo object
 ).
 rollmeanlogbidask which has a subset of the times that aggfxdata has.
 basically it starts later than aggfxdata[,logbidask] and when the plot
 is done, it works in the
 sense that rollmeanlogbidask gets plotted later.

 then, i plot the variable lt on the same plot witrh it's vertical axis
 on the right side and this works nicely also.

 the only that doesn't quite work is that lt, time wise, lt,  starting at
 the same time as the aggfxdata[,logbidask] when it should be starting a
 few minutes after
 rollmeanlogbidask. the times in it are correct and i don't think it has
 to do with the fact that things are zoo ( but i could be wrong ? ).
 i must be doing something wrong in my commands. the weird thing is that
 rollmeanlogbidask starts at the appropriate place ?

 maybe i have to give lt a different frequency but when i do the dput , i
 don'ts ee freequency as part of it ?

 this probably sounds way more confusing than it actually is but, if you
 run below, you will see exactly what io mean.
 thanks a lot to anyone who can be bothered pasitng below. as usual, you
 would need zoo and chron.


 aggfxdata-structure(c(114.834516129032, 114.7922, 114.820808080808,
 114.838260869565,
 114.837560975610, 114.776697247706, 114.7969, 114.745714285714,
 114.734923076923, 114.661939393939, 114.646574074074, 114.703486238532,
 114.646453900709, 114.651948051948, 114.742671755725, 114.721132075472,
 114.828647058824, 114.885978260870, 114.936860465116, 114.94,
 114.967763157895, 114.935107526882, 114.92225, 115.015606060606,
 115.077261146497, 115.034248366013, 114.961923076923, 114.976463414634,
 115.063468208092, 115.085882352941, 115.166847826087, 115.153306451613,
 115.137719298246, 115.080735294118, 115.074090909091, 115.021134751773,
 114.903450292398, 114.916153846154, 114.888306451613, 114.937469879518,
 114.890943396226, 114.849747899160, 114.926912751678, 114.874567901235,
 114.837980769231, 114.797538461538, 114.746707317073, 114.696013071895,
 114.67645833, 114.852184466019, 114.848548387097, 114.8078,
 114.835050505051, 114.851304347826, 114.852439024390, 114.792844036697,
 114.8117, 114.759206349206, 114.748307692308, 114.675939393939,
 114.661296296296, 114.717889908257, 114.660921985816, 114.665779220779,
 114.756870229008, 114.735471698113, 114.841941176471, 114.899184782609,
 114.949186046512, 114.953990384615, 114.982280701754, 114.948924731183,
 114.9368, 115.028863636364, 115.091592356688, 115.0478,
 114.975576923077, 114.990365853659, 115.078381502890, 115.099705882353,
 115.180326086957, 115.166370967742, 115.151052631579, 115.095147058824,
 115.088522727273, 115.035390070922, 114.917894736842, 114.930128205128,
 114.903790322581, 114.952409638554, 114.906226415094, 114.863865546218,
 114.940939597315, 114.890370370370, 114.852211538462, 114.812307692308,
 114.760548780488, 114.710326797386, 114.69020833, 114.866213592233,
 4.74355319771057, 4.74319148388547, 4.74343474081987, 4.74358150022944,
 4.74358339314172, 4.74305881517423, 4.74322922997911, 4.74277728938584,
 4.7426822736, 4.74204918880485, 4.7419183321792, 4.74241320264843,
 4.74191617575789, 4.74196131670693, 4.74275385322944, 4.74256674074965,
 4.74349887668465, 4.74399761812053, 4.74443655563793, 4.74447111073972,
 4.74471490416156, 4.74442779363424, 4.74431911442163, 4.74512545618279,
 4.74566600467616, 4.74528870019174, 4.74466035230505, 4.74478789738982,
 4.74554867613244, 4.74573870836097, 4.74644044208183, 4.74632106516708,
 4.74618687097407, 4.74569654200703, 4.74563889435559, 4.74517785826786,
 4.74415506578588, 4.74426356601777, 4.74402779250609, 4.74445322900522,
 4.74404986890124, 4.74368619357562, 4.7443574082389, 4.74390959824271,
 4.74358423039023, 4.7432343669113, 4.74278746542368, 4.74234766049834,
 4.74217470698038, 4.7437070219583), .Dim = c(50, 3), .Dimnames = list(
NULL, c(bid, ask, logbidask)), index = structure(c(1152058200,

 1152058800, 1152059400, 115206, 1152060600, 1152061200, 1152061800,
 1152062400, 1152063000, 1152063600, 1152064200, 1152064800, 1152065400,
 1152066000, 1152066600, 1152067200, 1152067800, 1152068400, 1152069000,
 1152069600, 1152070200, 1152070800, 1152071400, 1152072000, 1152072600,
 1152073200, 1152073800, 1152074400, 1152075000, 1152075600, 1152076200,
 1152076800, 1152077400, 1152078000, 1152078600, 

Re: [R] Missing data analysis in R

2006-10-31 Thread Leeds, Mark \(IED\)
there is a green book by joe shafer ( I forget the name but it's
probsably on amazon ). I also
Can't say it's in the same format as faraday's book but I think it's
fairly popular for multiple
Imputation techniques etc.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Inman, Brant A.
M.D.
Sent: Tuesday, October 31, 2006 12:18 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Missing data analysis in R


I am looking for a book that discusses the theory of multiple imputation
(and other methods of dealing with missing data) and, just as
importantly, how to implement these methods in R or S-Plus.  Ideally,
the book would have a structure similar to Faraway (Regression),
PinheiroBates (Mixed Effects) and Wood (GAMs) and would be very modern
(i.e. published within the last couple of years).  

Any ideas?  If such a book does not exist, one of the experts on this
help list should write it! (I will gladly buy the first copy.)

Brant Inman
Mayo Clinic

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


This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}

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


Re: [R] Missing data analysis in R

2006-10-31 Thread Berton Gunter
Have a look at J.L Schafer: ANALYSIS OF INCOMPLETE MULTIVARIATE DATA (1997).


R already has several packages that deal with missing data imputation, I
believe. Search around (please excuse my laziness). 

Don't know if you can get exactly what you want (an R/S -centric text),
though.


Bert Gunter
Nonclinical Statistics
7-7374

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Inman, Brant A. M.D.
Sent: Tuesday, October 31, 2006 9:18 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Missing data analysis in R


I am looking for a book that discusses the theory of multiple imputation
(and other methods of dealing with missing data) and, just as
importantly, how to implement these methods in R or S-Plus.  Ideally,
the book would have a structure similar to Faraway (Regression),
PinheiroBates (Mixed Effects) and Wood (GAMs) and would be very modern
(i.e. published within the last couple of years).  

Any ideas?  If such a book does not exist, one of the experts on this
help list should write it! (I will gladly buy the first copy.)

Brant Inman
Mayo Clinic

[[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] Hmisc or Lattice plot with error bars, Depth (independent variable) on Y axis

2006-10-31 Thread Mike Bock
I just  discovered that using the xYplot (Hmisc) and rotating the grid
viewport (and the labels etc) given me exactly what I need. I wish I had
thought of that much sooner

 


-Original Message-
From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 30, 2006 6:04 PM
To: Mike Bock
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Hmisc or Lattice plot with error bars, Depth
(independent variable) on Y axis

On 10/30/06, Mike Bock [EMAIL PROTECTED] wrote:
 I am trying to create some plots of concentration versus depth.  I
want Depth on the Y axis and the concentrations on the X axis. I also
need to plot error bars.

 The xYplot function in Hmisc is very nearly ideal but I have to put
depth on the x-axis to get it to work.  When I transpose the X and Y
axes in the xYplot command, the error bars disappear (no surprise given
the help file).  It there a way to get the plot command to flip the
axes? That would be ideal as I could use the grouping functions in
xYplot and save a bunch of work.

 If no such command exists any other ideas?

See

demo(intervals)

The untruncated code can be seen with

file.show(system.file(demo/intervals.R, package = lattice))

There was a recent thread dealing with extensions (grouping and
switching axes):

[1] https://stat.ethz.ch/pipermail/r-help/2006-October/114883.html

-Deepayan



This message contains information that may be confidential, ...{{dropped}}

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


Re: [R] getMethod(s) and var.test

2006-10-31 Thread Dimitris Rizopoulos
you may try something like this:

body.fun - lapply(methods(var.test), get, envir = 
environment(var.test), mode = function)
names(body.fun) - methods(var.test)
body.fun


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: Benjamin Otto [EMAIL PROTECTED]
To: R-Help r-help@stat.math.ethz.ch
Sent: Tuesday, October 31, 2006 4:15 PM
Subject: [R] getMethod(s) and var.test


 Hi,



 How do I retrieve the var.test() function code? I had a similar 
 problem once
 before with another function but getMethods() solved the problem 
 then. Now I
 tried several combinations for var.test() without success.



 Regards



 benjamin



 --
 Benjamin Otto
 Universitaetsklinikum Eppendorf Hamburg
 Institut fuer Klinische Chemie
 Martinistrasse 52
 20246 Hamburg




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


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] information about sna packages

2006-10-31 Thread David Barron
I don't think so, but you should email the package's author, Carter
Butts for help on this package.  His email is [EMAIL PROTECTED]

On 31/10/06, Bagatti Davide [EMAIL PROTECTED] wrote:
 Hello,

 I'm a student who want to use the R social network analysis package. I have
 a question: can this package analyse dynamical networks (network changing
 over time)? I didn't find this functionality in the package's user manual.

 Thank you

 Davide

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



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

__
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] Put a normal curve on plot

2006-10-31 Thread Doran, Harold
I would like to be able to place a normal distribution surrounding the
predicted values at various places on a plot. Below is some toy code
that creates a scatterplot and plots a regression line through the data.

library(MASS)
mu - c(0,1)
Sigma - matrix(c(1,.8,.8,1), ncol=2)
set.seed(123)
x - mvrnorm(50,mu,Sigma)
plot(x)
abline(lm(x[,2] ~ x[,1]))

Say I want to add a normal distribution surrounding the predicted values
at the x-values of -1, 0, and 1. That is, at the points

\hat{y} = \mu + \beta_1(-1)
\hat{y} = \mu + \beta_1(0)
\hat{y} = \mu + \beta_1(1)

How might I go about doing this?

Harold

 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.0 
year   2006
month  10  
day03  
svn rev39566   
language   R   
version.string R version 2.4.0 (2006-10-03)

[[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] read.fwf and header

2006-10-31 Thread Gabor Grothendieck
I also have to deal with fixed format files from time to time.
Generally I have no control over the format in those cases.

On 10/31/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Archaic it may be, but I still have to deal with fixed format data
 files on a daily basis.

 David L. Reiner
 Rho Trading Securities, LLC
 Chicago  IL  60605
 312-362-4963

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Martin Maechler
 Sent: Tuesday, October 31, 2006 1:52 AM
 To: [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] read.fwf and header

 snip

 In my (and probably R-core's) view, read.fwf() should only have
 to be used for ``legacy data files'' (those times when people used *no*
 separators in order to save disk space), since nowadays, such
 data files should automatically have correct separators.

 -- Fix the file producing process rather than make read.fwf()
 unnecessarily more complicated.

 Martin Maechler, ETH Zurich

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

 __
 R-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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread hadley wickham
 As Peter said, it's the value that counts, not the way you calculated
 it.  If you print -c(2,3,5) you get three negative numbers.  If you
 print -integer(0), you don't get any.  The first case is asking for
 elements to be left out, the second isn't.

 The moral of the story is to use logical indices rather than negative ones:

 dubious.records - peoples.heights$heights  2.5
 peoples.heights = peoples.heights[!dubious.records,]

Unfortunately, there are some matching functions that return numeric
indices, not logical vectors (eg. grep).  For this case I created an
unwhich function - but is there a better way to proceed?

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] Compiling R packages on Ubuntu

2006-10-31 Thread Dirk Eddelbuettel

On 31 October 2006 at 18:30, Vikas Rawal wrote:
| I am unable to compile R packages from source on Ubuntu
| dapper/edgy. Does anybody have an experience?

Please note that CRAN actually pre-builds binaries of R 2.4.0 thanks to
untiring efforts of Christian Steigies.

This *is* mentioned in the R FAQ.

| When I do install.packages(nlme,depend=TRUE), I get following error 
messages. Can someone help?
| 
| I get similar messages for any package I try to compile.

Yo do no seem to have a development environment installed.  Please do

$ sudo apt-get install r-base-dev

and try again.  Longer term, consider investing in one of the books
discussing the GNU compiler toolchain as the compiler was fairly explicit in
its eror message, and it pays off to listen to the compiler.

r-base-dev is also mentioned in the R FAQ.

Dirk

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

__
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] one problem about how to hold graphic with R

2006-10-31 Thread Ben Bolker
Gavin Simpson gavin.simpson at ucl.ac.uk writes:

 
 On Tue, 2006-10-31 at 21:36 +0800, yang baohua wrote:
  Sorry to disturb you, but can you help me to solve one little problem?
  I want to draw a graphic after another with R
  but I cannot find the first one after that.
  Do you know the command to hold the graphic with R?
  I remember with Matlab you may use hold on.
  Thanks.
  
  
 
[snip]
 
 Is this what you were looking for?
 
 HTH
 
 G

  Actually, it sounds more like what yang wants is

par(new=TRUE)

  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.


[R] Missing data analysis in R

2006-10-31 Thread Inman, Brant A. M.D.

I am looking for a book that discusses the theory of multiple imputation
(and other methods of dealing with missing data) and, just as
importantly, how to implement these methods in R or S-Plus.  Ideally,
the book would have a structure similar to Faraway (Regression),
PinheiroBates (Mixed Effects) and Wood (GAMs) and would be very modern
(i.e. published within the last couple of years).  

Any ideas?  If such a book does not exist, one of the experts on this
help list should write it! (I will gladly buy the first copy.)

Brant Inman
Mayo Clinic

[[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] graphics ignore tabs in text

2006-10-31 Thread Liaw, Andy
Dear R-help,

I seem to recall that I can use \t to get tab in a string on a
graphics device, but it doesn't seem to work.  Try:

lab - a\tb\tc
cat(lab, \n)   # works in the console output
plot(1:5, main=lab)  # no tabs in the title
text(3, 3, lab)  # no tabs in the text

I get the same result both in the windows() and pdf() devices.  Any
ideas?

This is R-patched Windows binary just downloaded from CRAN.
R version 2.4.0 Patched (2006-10-29 r39744)

Best,
Andy

Andy Liaw, PhD
Biometrics ResearchPO Box 2000 RY33-300
Merck Research LabsRahway, NJ 07065
andy_liaw(a)merck.com  732-594-0820



--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

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


Re: [R] Put a normal curve on plot

2006-10-31 Thread David Barron
Something like this?

library(MASS)
mu - c(0,1)
Sigma - matrix(c(1,.8,.8,1), ncol=2)
set.seed(123)
x - mvrnorm(50,mu,Sigma)
dta - data.frame(x=x[,1],y=x[,2])
plot(x)

fit - lm(y~x, data=dta)
sfit - summary(fit)
se - sfit$sigma
abline(fit)

yhat - predict(fit,data.frame(x=c(-1,0,1)),se.fit=TRUE)

x1 - seq(-2,0,length=50)
x2 - x1 + 1
x3 - x2 + 1
lines(x1,yhat$fit[1]+dnorm(x1,-1,se))
lines(x2,yhat$fit[2]+dnorm(x2,0,se))
lines(x3,yhat$fit[3]+dnorm(x3,1,se))


On 31/10/06, Doran, Harold [EMAIL PROTECTED] wrote:
 I would like to be able to place a normal distribution surrounding the
 predicted values at various places on a plot. Below is some toy code
 that creates a scatterplot and plots a regression line through the data.

 library(MASS)
 mu - c(0,1)
 Sigma - matrix(c(1,.8,.8,1), ncol=2)
 set.seed(123)
 x - mvrnorm(50,mu,Sigma)
 plot(x)
 abline(lm(x[,2] ~ x[,1]))

 Say I want to add a normal distribution surrounding the predicted values
 at the x-values of -1, 0, and 1. That is, at the points

 \hat{y} = \mu + \beta_1(-1)
 \hat{y} = \mu + \beta_1(0)
 \hat{y} = \mu + \beta_1(1)

 How might I go about doing this?

 Harold

  version
_
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  4.0
 year   2006
 month  10
 day03
 svn rev39566
 language   R
 version.string R version 2.4.0 (2006-10-03)

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



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

__
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] [ggplot] controlling axis and major/minor tick marks

2006-10-31 Thread Gabor Grothendieck
If you are willing to use grid you can set the color of the tick marks,
labels and place a box around the chart like this:

x - 1:10
y - x*x

# create box around plot
library(ggplot)
qplot(x, y)

# black border around plot
grid.edit(grill-border, height = unit(.99, npc),
   width = unit(.99, npc), gp = gpar(col = black))

# black tick marks and labels
grid.edit(yaxis1, gp = gpar(col = black))


If you play around with

str(grid.get(grill-border)) and the other names on this list:

plot-surrounds
background
plot
grid1-1
grill-background
grill-vertical
grill-horizontal
grill-border
xaxis1
axis-ticks
axis-labels
yaxis1
border1-1
border
ylabel
xlabel
title

and use grid.edit to make changes as in the examples above you can
change quite a bit.


On 10/31/06, Sebastian Weber [EMAIL PROTECTED] wrote:
 Hi Hadley!

  axis.colour should control the colour of the tickmarks, the axis
  labels, and the line which the ticks attach to.  What is not working
  in your case?  grid.colour only effects the grid lines inside the
  plot.

 Well, I used gopt to set the following global defaults for my plots:

  ggopt()
 List of 11
  $ aspect.ratio : num 0.618
  $ axis.colour  : chr black
  $ background.colour: chr black
  $ background.fill  : chr white
  $ grid.colour  : chr white
  $ grid.fill: chr white
  $ legend.position  : chr right
  $ save : logi FALSE
  $ strip.gp :List of 3
  ..$ col : chr white
  ..$ fill: chr grey80
  ..$ lwd : num 3
  ..- attr(*, class)= chr gpar
  $ strip.text   :function (variable, value)
  $ strip.text.gp: list()
  ..- attr(*, class)= chr gpar
  - attr(*, class)= chr options
 

 Then I plot my stuff with

 p2 - ggplot(knn, . ~ power ,  aes=list(y=log10(k2m/(degree*kSize)),
 x=log10(degree), shape=alpha))
 p2 - ggpoint(p2)
 p2

 and I do not see any axis at all. The tick marks are there, they are
 black as they should.

 By the way, I already wondered why I can not change the shapes of the
 symbols in use. I figured that they are set statically in map_shapes.
 How about introducing an option for this somewhere?

 
  Currently, ggplot has no notion of major and minor tick marks (mainly
  because I don't have a good algorithim to generate them), but it is on
  my to do list.

 I definetly need minor tick marks and will hack my way through ggplot to
 acheive this if it does not seem to difficult to me. May you give me a
 tip where to start / where should I have to modify things.


 Regards,

 Sebastian

 
  Regards,
 
  Hadley
 
  On 10/31/06, Sebastian Weber [EMAIL PROTECTED] wrote:
   Hello there!
  
   I'm starting with ggplot and was wondering how I could control the axis
   of a plot. I would like the axis of the plot to be drawn black which I
   thought to acheive with the option axis.colour=black. However, this
   had no real effect on the plot. Then I found grid.colour which I changed
   to black as well. Now I got my axis as I wanted them, but ggplot now
   draws the grid inside the plot with black lines as well, which definetly
   do not want to appear. So how can I get a black border around my plots?
   Furthermore, I would like to indicate positions of major and minor ticks
   in my plots. Where can I do this?
  
   Thanks in advance.
  
   Greetings,
  
   Sebastian
  
   Ah, I use R 2.3.1 and ggplot 0.4.0, if that is important ...
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide 
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
  

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


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


Re: [R] POSIXct time zone and daylight savings issues

2006-10-31 Thread Sebastian P. Luque
On Tue, 31 Oct 2006 09:24:02 + (GMT),
Prof Brian Ripley [EMAIL PROTECTED] wrote:

[...]

 No, it should be a timezone, and the timezone specification includes
 when DST is in effect.  See ?as.POSIXct for details and references of
 timezones.  For example, EST is a timezone without DST and EST5EDT is a
 timezone with DST (and they agree in winter). It looks like Linux is
 interpreting EEST as UTC+3 throughout the year (which appears not to be
 used anywhere as an actual timezone).  So the behaviour is clear: EEST
 does not have DST, and $isdst == 0 in that 'timezone', whereas EET does
 have DST.

Thanks for this explanation.  Very important to check whether the supplied
'tz' is really interpreted as a valid time zone by the OS!


Cheers,

-- 
Seb

__
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] getMethod(s) and var.test

2006-10-31 Thread Jeff Miller
Dimitris,

I like your version better than the one-line commands such as methods(). It
appears that your version gives ALL of the code.

Jeff

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dimitris Rizopoulos
Sent: Tuesday, October 31, 2006 11:12 AM
To: Benjamin Otto
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] getMethod(s) and var.test

you may try something like this:

body.fun - lapply(methods(var.test), get, envir = 
environment(var.test), mode = function)
names(body.fun) - methods(var.test)
body.fun


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: Benjamin Otto [EMAIL PROTECTED]
To: R-Help r-help@stat.math.ethz.ch
Sent: Tuesday, October 31, 2006 4:15 PM
Subject: [R] getMethod(s) and var.test


 Hi,



 How do I retrieve the var.test() function code? I had a similar 
 problem once
 before with another function but getMethods() solved the problem 
 then. Now I
 tried several combinations for var.test() without success.



 Regards



 benjamin



 --
 Benjamin Otto
 Universitaetsklinikum Eppendorf Hamburg
 Institut fuer Klinische Chemie
 Martinistrasse 52
 20246 Hamburg




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


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@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] margins in heatmap.2 and fond size for x-axis

2006-10-31 Thread Weiwei Shi
Hi,

I am using heatmap.2 and have this problem now:

heatmap.2(as.matrix(t7[,4:8]), col=c(green, yellow, red),
margins=c(35,10)+0.1, RowSideColors=class.colors, trace=none,
ylab=drugs, xlab=network signatures, scale=none)#

I put the following line into a function and call that function
(i.heatmap.1) and R complains:
Error in plot.new() : figure margins too large

I have to manually enlarge this empty one and re-call that function
so I can get result. I tried to use par(mar) but it seems it does not
help:

 par(mar=c(25,4,4,4)+0.1)
Warning message:
calling par(new=) with no plot
 i.heatmap.1(t7, non-ox)
Error in plot.new() : figure margins too large
Error in par(op) : invalid value specified for graphical parameter pin
In addition: Warning message:
calling par(new=) with no plot

The reason I need a large margin is my xaxis font is too long, like
ng_sodium_transport. I googled the r-help and found there is no way
to make it smaller since I am using the smallest = 1. Is there other
way around?

Thanks


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

__
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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Peter Dalgaard
hadley wickham [EMAIL PROTECTED] writes:

  As Peter said, it's the value that counts, not the way you calculated
  it.  If you print -c(2,3,5) you get three negative numbers.  If you
  print -integer(0), you don't get any.  The first case is asking for
  elements to be left out, the second isn't.
 
  The moral of the story is to use logical indices rather than negative ones:
 
  dubious.records - peoples.heights$heights  2.5
  peoples.heights = peoples.heights[!dubious.records,]
 
 Unfortunately, there are some matching functions that return numeric
 indices, not logical vectors (eg. grep).  For this case I created an
 unwhich function - but is there a better way to proceed?

How about 

negIndex - function(x) if (length(x)) -x else TRUE
 x - 1:10
 x[negIndex(which(x4))]
[1] 1 2 3 4
 x[negIndex(which(x11))]
 [1]  1  2  3  4  5  6  7  8  9 10

Of course in this case, you can just avoid the which() bit entirely
and do

 x[!(x4)]
[1] 1 2 3 4
 x[!(x11)]
 [1]  1  2  3  4  5  6  7  8  9 10


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Leeds, Mark \(IED\)
I think I had that similar problem at some point in the way past and got
around it by checking the length of dubious records before I
Sent it into the expression. If the length is zero don't send it into
the expression.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, October 31, 2006 9:02 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Odd behaviour of removing 'nothing' from an array or data
frame

I've just found some behaviour which strikes me as odd, but I'm not sure
whether it's a bug or a feature.  If you don't mind, I'd like to explain
via a couple of examples.

Let x = 1:10.
Then intuitively, to me at least, the command x[-integer(0)] should
leave x untouched.  However the actual output under R2.4.0 is
integer(0).

A slightly more involved example demonstrates why I think this behaviour
is back to front.
First we define a data frame, in this case some people, with their
heights.
peoples.heights = data.frame(names = c(Alice, Bob, Carol), heights
= c(1.67, 1.85, 175))

To make sure the heights are sensible, we define a filter out impossibly
tall people.
dubious.records = which(peoples.heights$heights  2.5)  #3
peoples.heights = peoples.heights[-dubious.records,]

This all works fine since dubious.records is not empty.  However, if all
the records had been entered properly, then we would get
#dubious.records = integer(0)

Then the command peoples.heights = peoples.heights[-dubious.records,]
strips all the rows to give
#[1] names   heights
#0 rows (or 0-length row.names)

i.e. instead of removing the bad records, I've lost everything.
I know that it's possible to recode this so problems don't occur, but
the point is that the answer is unexpected.

Can anybody explain if this behaviour is intentional or useful in some
way, or is it an oversight?

Regards,
Richie.

Mathematical Sciences Unit
HSL
Buxton
SK17 9JN
01298 21(x8672)



ATTENTION:

This message contains privileged and confidential\ informati...{{dropped}}

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


Re: [R] Measurements of 3000 criminals

2006-10-31 Thread Martin Maechler
 Jean == Jean lobry [EMAIL PROTECTED]
 on Sat, 28 Oct 2006 13:07:04 +0200 writes:

 Hallo everyone,
 
 excuse me if this is not a genuine R question but I do
 not know where to ask else.
 
 Referring to e.g.
 
 https://stat.ethz.ch/pipermail/r-help/2004-December/062114.html
 
 I wonder if these measurements of 3000 criminals (raw
 data) are available anywhere.  At least I didn't find
 them in the R datasets package or by means of Google.
 What I did find was a table of frequencies of the central
 values for *grouped* classifications (finger lenghts) in
 the Handbook of Small Data Sets.
 
 Thank you in advance.
 
 D. Trenkler

Jean Dietrich,

Jean I'm not sure, but this is perhaps what you want:

Jean crim -
Jean read.table(http://pbil.univ-lyon1.fr/R/donnees/criminals1902.txt;)

May I propose to enhance this to

  cfile - http://pbil.univ-lyon1.fr/R/donnees/criminals1902.txt;
  crimtab - as.table(data.matrix(read.table(cfile, check.names=FALSE)))

  ## and e.g.,
  print(crimtab, zero=.)


Jean, this is really very nice, and given the historic
importance of the data, I'd like to add this to the official R
'datasets'  (the standard data set package),
with tribute to you and Anne-Béatrice, and the references.

If you agree, I'd be happy if you could help me (in private
e-mail exchanges) to easily complete the relevant help page.

Martin Maechler, ETH Zurich

Jean For some R code playing with this dataset, open this
Jean (draft) document:

Jean http://pbil.univ-lyon1.fr/members/lobry/R/convergencet.pdf

Jean and jump to section 4.

Jean HTH,

Jean Jean -- Jean R. Lobry ([EMAIL PROTECTED])
Jean Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON
Jean I, 43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX,
Jean FRANCE allo : +33 472 43 27 56 fax : +33 472 43 13 88
Jean http://pbil.univ-lyon1.fr/members/lobry/

Jean __
Jean R-help@stat.math.ethz.ch mailing list
Jean https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
Jean read the posting guide
Jean http://www.R-project.org/posting-guide.html and
Jean provide commented, minimal, self-contained,
Jean 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] graphics ignore tabs in text

2006-10-31 Thread Marc Schwartz
On Tue, 2006-10-31 at 09:13 -0500, Liaw, Andy wrote:
 Dear R-help,
 
 I seem to recall that I can use \t to get tab in a string on a
 graphics device, but it doesn't seem to work.  Try:
 
 lab - a\tb\tc
 cat(lab, \n)   # works in the console output
 plot(1:5, main=lab)  # no tabs in the title
 text(3, 3, lab)  # no tabs in the text
 
 I get the same result both in the windows() and pdf() devices.  Any
 ideas?
 
 This is R-patched Windows binary just downloaded from CRAN.
 R version 2.4.0 Patched (2006-10-29 r39744)
 
 Best,
 Andy

Andy, 

I don't believe that tab expansion works in plots, though I will stand
to be corrected on that.

Using the X11() device on FC5 (which I recreated using png() and
attached here), you can clearly see the dashed boxes where the tab
character (non-printable 0x9) is being drawn. However, it is one
character, not expanded as is the case in a textual console/GUI.

What are you trying to accomplish? 

Perhaps there is a better way (ie. to do column alignments, etc.) such
as textplot() in the gplots package.

HTH,

Marc Schwartz



Rplot001.png
Description: PNG image
__
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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Duncan Murdoch
On 10/31/2006 9:50 AM, [EMAIL PROTECTED] wrote:
 Thanks for the reply Peter, though I'm not quite convinced.
 
  #dubious.records = integer(0)
  identical(dubious.records, -dubious.records)
 [1] TRUE
 
 how can peoples.heights[-dubious.records,] be different from
 peoples.heights[dubious.records,]? 
 
 Tell me if I'm being willfully ignorant here, but I'm sure they should be 
 different.  In the first case, the minus sign represents subtraction, so 
 it is correct that dubious.records and -dubious.records are identical.
 
 However, in the second case, inside the square brackets, the minus sign 
 represents set complement, not subtraction, so dubious.records and -
 dubious.records are not the same.
 
 If x = runif(10), then x[-c(2,3,5)] means remove from x the values at the 
 second, third and fifth position.
 
 By extension x[-integer(0)] should mean remove from x no values, and not 
 remove from x all values, which is the current behaviour.

As Peter said, it's the value that counts, not the way you calculated 
it.  If you print -c(2,3,5) you get three negative numbers.  If you 
print -integer(0), you don't get any.  The first case is asking for 
elements to be left out, the second isn't.

The moral of the story is to use logical indices rather than negative ones:

dubious.records - peoples.heights$heights  2.5
peoples.heights = peoples.heights[!dubious.records,]

works for any number of dubious records, including zero.

Duncan Murdoch

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


Re: [R] Missing data analysis in R

2006-10-31 Thread Marc Schwartz
On Tue, 2006-10-31 at 11:17 -0600, Inman, Brant A. M.D. wrote:
 I am looking for a book that discusses the theory of multiple imputation
 (and other methods of dealing with missing data) and, just as
 importantly, how to implement these methods in R or S-Plus.  Ideally,
 the book would have a structure similar to Faraway (Regression),
 PinheiroBates (Mixed Effects) and Wood (GAMs) and would be very modern
 (i.e. published within the last couple of years).  
 
 Any ideas?  If such a book does not exist, one of the experts on this
 help list should write it! (I will gladly buy the first copy.)
 
 Brant Inman
 Mayo Clinic

One of the better references is:

Statistical Analysis with Missing Data, Second Edition
by Roderick J. A. Little, Donald B. Rubin
Wiley-Interscience; 2nd edition (September 9, 2002)
ISBN: 0471183865
http://www.amazon.com/Statistical-Analysis-Missing-Data-Second/dp/0471183865


In addition, see Frank Harrell's book Regression Modeling Strategies,
Chapter 3 on Missing Data.  More information here:

  http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/RmS

and see Frank's function 'aregImpute' in the Hmisc package. More
information is here:

  http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc

with function specific help here:

  http://biostat.mc.vanderbilt.edu/s/Hmisc/html/aregImpute.html



Within R, if you use:

  RSiteSearch(Missing Data)

you will also get many hits.



Finally, the Multivariate task view on CRAN has a Missing Data section
about half way down the page:

  http://cran.r-project.org/src/contrib/Views/Multivariate.html

HTH,

Marc Schwartz

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


Re: [R] plotting question

2006-10-31 Thread Gavin Simpson
On Tue, 2006-10-31 at 12:08 -0500, Leeds, Mark (IED) wrote:
 i have the following code below and at the end there are some plotting
 statements.
 it actualy looks quite nice when you run it but there is just one
 strange thing  happening that
 don't know how to fix.

The problem you had, was that par(new = TRUE) # not T! resets the
plotting coordinate system, so even though the axis looks like it
extends the full range of the first data series, it covers the range of
lt, e.g.:

 plot(aggfxdata[,logbidask],main=,col=4)
 lines(rollmeanlogbidask,col=2)
 par(new=T)
 plot(lt,axes=F,type=l,lty=2)
 axis(side = 3) # new coords system

This works:

plot(aggfxdata[,logbidask], main = , col = 4)
lines(rollmeanlogbidask, col = 2)
usr - par(usr)
par(usr = c(usr[1:2], 0.76, 7.24))
lines(lt, lty = 2)
axis(4, at = pretty(range(lt)), tck = -0.02)

..., I think. But I cheat, because, here:

par(usr = c(usr[1:2], 0.76, 7.24))

I got the last two numbers by doing the following

 plot(lt)
 par(usr)[3:4]
[1] 0.76 7.24

A question then arises, how to process lt such that we end up with the
same numbers that R would have used to plot lt, i.e. which function or
bit of code will give:

 what.R.would.give(lt)
[1] 1.152076e+09 1.152088e+09 7.60e-01 7.24e+00

Without doing the plotting?

HTH

G

  
 the three things being plotted are
  
 aggfxdata[,logbidask] which has its own set of times ( it's a zoo object
 ).
 rollmeanlogbidask which has a subset of the times that aggfxdata has.
 basically it starts later than aggfxdata[,logbidask] and when the plot
 is done, it works in the
 sense that rollmeanlogbidask gets plotted later.
  
 then, i plot the variable lt on the same plot witrh it's vertical axis
 on the right side and this works nicely also.
  
 the only that doesn't quite work is that lt, time wise, lt,  starting at
 the same time as the aggfxdata[,logbidask] when it should be starting a
 few minutes after
 rollmeanlogbidask. the times in it are correct and i don't think it has
 to do with the fact that things are zoo ( but i could be wrong ? ).
 i must be doing something wrong in my commands. the weird thing is that
 rollmeanlogbidask starts at the appropriate place ?
  
 maybe i have to give lt a different frequency but when i do the dput , i
 don'ts ee freequency as part of it ?
  
 this probably sounds way more confusing than it actually is but, if you
 run below, you will see exactly what io mean. 
 thanks a lot to anyone who can be bothered pasitng below. as usual, you
 would need zoo and chron.
  
 
 aggfxdata-structure(c(114.834516129032, 114.7922, 114.820808080808,
 114.838260869565, 
 114.837560975610, 114.776697247706, 114.7969, 114.745714285714, 
 114.734923076923, 114.661939393939, 114.646574074074, 114.703486238532, 
 114.646453900709, 114.651948051948, 114.742671755725, 114.721132075472, 
 114.828647058824, 114.885978260870, 114.936860465116, 114.94, 
 114.967763157895, 114.935107526882, 114.92225, 115.015606060606, 
 115.077261146497, 115.034248366013, 114.961923076923, 114.976463414634, 
 115.063468208092, 115.085882352941, 115.166847826087, 115.153306451613, 
 115.137719298246, 115.080735294118, 115.074090909091, 115.021134751773, 
 114.903450292398, 114.916153846154, 114.888306451613, 114.937469879518, 
 114.890943396226, 114.849747899160, 114.926912751678, 114.874567901235, 
 114.837980769231, 114.797538461538, 114.746707317073, 114.696013071895, 
 114.67645833, 114.852184466019, 114.848548387097, 114.8078, 
 114.835050505051, 114.851304347826, 114.852439024390, 114.792844036697, 
 114.8117, 114.759206349206, 114.748307692308, 114.675939393939, 
 114.661296296296, 114.717889908257, 114.660921985816, 114.665779220779, 
 114.756870229008, 114.735471698113, 114.841941176471, 114.899184782609, 
 114.949186046512, 114.953990384615, 114.982280701754, 114.948924731183, 
 114.9368, 115.028863636364, 115.091592356688, 115.0478, 
 114.975576923077, 114.990365853659, 115.078381502890, 115.099705882353, 
 115.180326086957, 115.166370967742, 115.151052631579, 115.095147058824, 
 115.088522727273, 115.035390070922, 114.917894736842, 114.930128205128, 
 114.903790322581, 114.952409638554, 114.906226415094, 114.863865546218, 
 114.940939597315, 114.890370370370, 114.852211538462, 114.812307692308, 
 114.760548780488, 114.710326797386, 114.69020833, 114.866213592233, 
 4.74355319771057, 4.74319148388547, 4.74343474081987, 4.74358150022944, 
 4.74358339314172, 4.74305881517423, 4.74322922997911, 4.74277728938584, 
 4.7426822736, 4.74204918880485, 4.7419183321792, 4.74241320264843, 
 4.74191617575789, 4.74196131670693, 4.74275385322944, 4.74256674074965, 
 4.74349887668465, 4.74399761812053, 4.74443655563793, 4.74447111073972, 
 4.74471490416156, 4.74442779363424, 4.74431911442163, 4.74512545618279, 
 4.74566600467616, 4.74528870019174, 4.74466035230505, 4.74478789738982, 
 4.74554867613244, 4.74573870836097, 4.74644044208183, 4.74632106516708, 
 4.74618687097407, 4.74569654200703, 

Re: [R] one problem about how to hold graphic with R

2006-10-31 Thread Gavin Simpson
On Tue, 2006-10-31 at 21:36 +0800, yang baohua wrote:
 Sorry to disturb you, but can you help me to solve one little problem?
 I want to draw a graphic after another with R
 but I cannot find the first one after that.
 Do you know the command to hold the graphic with R?
 I remember with Matlab you may use hold on.
 Thanks.
 
 

You don't say which OS. On MS Windows one can turn on a history of plots
to the graphics device and replay your plots - it is in the menu bar for
example.

In all OSes, you can start up a new device to take the plot - which is
what Matlab does IIRC, so you have two or more plot windows on screen at
any one time. This is done like this:

plot(1:10)
x11()
plot(1:20)
x11()
plot(rnorm(100))

see ?Devices

You can set a device to be active, i.e. switch around between plotting
windows using dev.set(), e.g.:

 dev.cur() # example from above leaves device 4 active
X11
  4
 dev.set(3) # switch to device
 dev.cur() # check
X11
  3
 plot(sort(rnorm(100))) # plot something new on this device

Is this what you were looking for?

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC  ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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] information about sna packages

2006-10-31 Thread Gabor Csardi
Davide,

sna uses adjacency matrices, so one (crude) solution would be to store the
dynamical network as a list of matrices. This is of course not very space
efficient. 

Gabor

On Tue, Oct 31, 2006 at 02:28:28PM +0100, Bagatti Davide wrote:
 Hello,
 
 I'm a student who want to use the R social network analysis package. I have
 a question: can this package analyse dynamical networks (network changing
 over time)? I didn't find this functionality in the package's user manual.
 
 Thank you
 
 Davide
 
   [[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.

-- 
Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK

__
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 News, volume 6, issue 4 is now available

2006-10-31 Thread Paul Murrell
Hi

The October 2006 issue of R News is now available on CRAN under the
Documentation/Newsletter link.

Paul
(on behalf of the R News Editorial Board)
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

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

__
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] 2.4.0 and lattice 0.14-9: Changed behaviour of scales-argumenttck

2006-10-31 Thread Gerrit Eichner
Dear list,

I have observed a change in the behaviour of the scales-argument tck of 
xyplot() after having installed R 2.4.0 (for version info see below).

The help page of xyplot() says about the scales-argument tck:

'tck' numeric to control length of tick marks. Can be a vector
   of length 2, to control left/bottom and right/top separately.

But if I issue

xyplot( y ~ x, scales= list( tck= c( 1, 0)))

(with suitable numeric vectors x and y, of course) the plot shows 
alternating tick mark lengths *on every side* of the plot (i.e., the 
length of every second tick mark is zero). I wanted to see tick marks only 
on the left and bottom side of the coordinate system (as I did see before 
with R 2.2.0 and lattice version 0.12-9).

Has anybody a workaround to get back the original (documented) behaviour?
Thanks a lot!

  Best regards  --  Gerrit

PS: My system:

 version
_
platform   x86_64-unknown-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  2
minor  4.0
year   2006
month  10
day03
svn rev39566
language   R
version.string R version 2.4.0 (2006-10-03)

-
AR Dr. Gerrit Eichner  Mathematical Institute
[EMAIL PROTECTED]   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104  Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32029   http://www.math.uni-giessen.de

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

2006-10-31 Thread Gavin Simpson
On Tue, 2006-10-31 at 18:11 +, Gavin Simpson wrote:
 On Tue, 2006-10-31 at 12:08 -0500, Leeds, Mark (IED) wrote:
  i have the following code below and at the end there are some plotting
  statements.
  it actualy looks quite nice when you run it but there is just one
  strange thing  happening that
  don't know how to fix.
 
 The problem you had, was that par(new = TRUE) # not T! resets the
 plotting coordinate system, so even though the axis looks like it
 extends the full range of the first data series, it covers the range of
 lt, e.g.:
 
  plot(aggfxdata[,logbidask],main=,col=4)
  lines(rollmeanlogbidask,col=2)
  par(new=T)
  plot(lt,axes=F,type=l,lty=2)
  axis(side = 3) # new coords system
 
 This works:
 
 plot(aggfxdata[,logbidask], main = , col = 4)
 lines(rollmeanlogbidask, col = 2)
 usr - par(usr)
 par(usr = c(usr[1:2], 0.76, 7.24))
 lines(lt, lty = 2)
 axis(4, at = pretty(range(lt)), tck = -0.02)

Following off-list emails with Mark, I tracked down how to do this
automatically, for the thread...

It is document in ?par in the section on xaxs and yaxs (x and y axis
styles). This defaults to r, which adds/subtracts 4% to the x/ylims,
so,

plot(aggfxdata[,logbidask], main = , col = 4)
lines(rollmeanlogbidask, col = 2)
usr - par(usr)
# extend range of data by 4%
rany - (max(lt) - min(lt)) * 0.04
par(usr = c(usr[1:2], min(lt) - rany, max(lt) + rany))
lines(lt, lty = 2)
axis(4, at = pretty(range(lt)), tck = -0.02)

the above does exactly as I'd done before, but automagically.

G

 
 ..., I think. But I cheat, because, here:
 
 par(usr = c(usr[1:2], 0.76, 7.24))
 
 I got the last two numbers by doing the following
 
  plot(lt)
  par(usr)[3:4]
 [1] 0.76 7.24
 
 A question then arises, how to process lt such that we end up with the
 same numbers that R would have used to plot lt, i.e. which function or
 bit of code will give:
 
  what.R.would.give(lt)
 [1] 1.152076e+09 1.152088e+09 7.60e-01 7.24e+00
 
 Without doing the plotting?
 
 HTH
 
 G
 
   
  the three things being plotted are
   
  aggfxdata[,logbidask] which has its own set of times ( it's a zoo object
  ).
  rollmeanlogbidask which has a subset of the times that aggfxdata has.
  basically it starts later than aggfxdata[,logbidask] and when the plot
  is done, it works in the
  sense that rollmeanlogbidask gets plotted later.
   
  then, i plot the variable lt on the same plot witrh it's vertical axis
  on the right side and this works nicely also.
   
  the only that doesn't quite work is that lt, time wise, lt,  starting at
  the same time as the aggfxdata[,logbidask] when it should be starting a
  few minutes after
  rollmeanlogbidask. the times in it are correct and i don't think it has
  to do with the fact that things are zoo ( but i could be wrong ? ).
  i must be doing something wrong in my commands. the weird thing is that
  rollmeanlogbidask starts at the appropriate place ?
   
  maybe i have to give lt a different frequency but when i do the dput , i
  don'ts ee freequency as part of it ?
   
  this probably sounds way more confusing than it actually is but, if you
  run below, you will see exactly what io mean. 
  thanks a lot to anyone who can be bothered pasitng below. as usual, you
  would need zoo and chron.
   
  
  aggfxdata-structure(c(114.834516129032, 114.7922, 114.820808080808,
  114.838260869565, 
  114.837560975610, 114.776697247706, 114.7969, 114.745714285714, 
  114.734923076923, 114.661939393939, 114.646574074074, 114.703486238532, 
  114.646453900709, 114.651948051948, 114.742671755725, 114.721132075472, 
  114.828647058824, 114.885978260870, 114.936860465116, 114.94, 
  114.967763157895, 114.935107526882, 114.92225, 115.015606060606, 
  115.077261146497, 115.034248366013, 114.961923076923, 114.976463414634, 
  115.063468208092, 115.085882352941, 115.166847826087, 115.153306451613, 
  115.137719298246, 115.080735294118, 115.074090909091, 115.021134751773, 
  114.903450292398, 114.916153846154, 114.888306451613, 114.937469879518, 
  114.890943396226, 114.849747899160, 114.926912751678, 114.874567901235, 
  114.837980769231, 114.797538461538, 114.746707317073, 114.696013071895, 
  114.67645833, 114.852184466019, 114.848548387097, 114.8078, 
  114.835050505051, 114.851304347826, 114.852439024390, 114.792844036697, 
  114.8117, 114.759206349206, 114.748307692308, 114.675939393939, 
  114.661296296296, 114.717889908257, 114.660921985816, 114.665779220779, 
  114.756870229008, 114.735471698113, 114.841941176471, 114.899184782609, 
  114.949186046512, 114.953990384615, 114.982280701754, 114.948924731183, 
  114.9368, 115.028863636364, 115.091592356688, 115.0478, 
  114.975576923077, 114.990365853659, 115.078381502890, 115.099705882353, 
  115.180326086957, 115.166370967742, 115.151052631579, 115.095147058824, 
  115.088522727273, 115.035390070922, 114.917894736842, 114.930128205128, 
  114.903790322581, 114.952409638554, 114.906226415094, 114.863865546218, 
  114.940939597315, 

[R] savePlot and dev.copy

2006-10-31 Thread Mike Prager
Dear R gurus,

R 2.4.0 under Windows XP.

We have developed several dozen R functions to make and save
specialized plots.  These use savePlot() to optionally save the
plot to files (eps, jpg, png, ...).

The thought has come up of putting the functions into an R
package.  Because savePlot is available only on Windows, we
would instead detect the OS and use dev.copy in place of
savePlot when not running under Windows.

My question is, if this code is rewritten anyway, what are the
pros and cons of using dev.copy under *all* operating systems
vs. using savePlot on Windows and dev.copy on other platforms?

Thanks!

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

__
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] graphics ignore tabs in text

2006-10-31 Thread Paul Murrell
Hi


Marc Schwartz wrote:
 On Tue, 2006-10-31 at 09:13 -0500, Liaw, Andy wrote:
 Dear R-help,

 I seem to recall that I can use \t to get tab in a string on a
 graphics device, but it doesn't seem to work.  Try:

 lab - a\tb\tc
 cat(lab, \n)   # works in the console output
 plot(1:5, main=lab)  # no tabs in the title
 text(3, 3, lab)  # no tabs in the text

 I get the same result both in the windows() and pdf() devices.  Any
 ideas?

 This is R-patched Windows binary just downloaded from CRAN.
 R version 2.4.0 Patched (2006-10-29 r39744)

 Best,
 Andy
 
 Andy, 
 
 I don't believe that tab expansion works in plots, though I will stand
 to be corrected on that.


I'm surprised that this has never come up before, but I know of no
special handling of tabs in the graphics code.  I suspect if we wanted
to do something we would have to add code to detect '\t' and replace it
with a number of spaces (maybe based on a user-settable option).

Paul


 Using the X11() device on FC5 (which I recreated using png() and
 attached here), you can clearly see the dashed boxes where the tab
 character (non-printable 0x9) is being drawn. However, it is one
 character, not expanded as is the case in a textual console/GUI.
 
 What are you trying to accomplish? 
 
 Perhaps there is a better way (ie. to do column alignments, etc.) such
 as textplot() in the gplots package.
 
 HTH,
 
 Marc Schwartz
 
 
 
 
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~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] Multivariate regression

2006-10-31 Thread Ravi Varadhan
Thank you Robin (also thanks to Andris and Bernhard). I did get answers to
my problem using lm as you had suggested. But my main concern is about
getting the appropriate standard errors for \hat{beta}.  

My response is actually preference data, where each individual ranks a list
of k items, assigning them unique ranks from 1 to k.  Since the ranks for
each item are negatively-correlated within an individual, I would like to
take this into consideration.  Although lm gives me correct parameter
estimates, I think that the standard errors are overestimated.

Best,
Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

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

 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robin Hankin
Sent: Monday, October 30, 2006 4:17 AM
To: Andris Jankevics
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Multivariate regression

Hi

I discovered the other day that lm() does some of the work for
you:

library(mvtnorm)

X - matrix(rnorm(60),ncol=3)
beta  - matrix(1:6,ncol=2)
sig - matrix(c(1,0.7,0.7,1),2,2)

Y - X %*% beta + rmvnorm(n=20,sigma=sig)


  lm(Y ~ X-1)

Call:
lm(formula = Y ~ X - 1)

Coefficients:
 [,1]   [,2]
X1  1.015  4.065
X2  2.483  5.366
X3  2.762  5.727


This gives an estimate for beta.

But I don't know of a ready-made R solution for estimating
the covariance of  the elements of beta, or the sig matrix
for the covariance matrix of the observation errors.

Anyone?





On 30 Oct 2006, at 09:01, Andris Jankevics wrote:

 Also you can take a look on Partial Least Squares (PLS) regression.
 http://www.statsoft.com/textbook/stpls.html
 R-package: http://mevik.net/work/software/pls.html

 Andris Jankevics

 On Sestdiena, 28. Oktobris 2006 06:04, Ritwik Sinha wrote:
 You can use gee (
 http://finzi.psych.upenn.edu/R/library/geepack/html/00Index.html)  
 or maybe
 the function gls in nlme.

 Ritwik.

 On 10/27/06, Ravi Varadhan [EMAIL PROTECTED] wrote:
 Hi,



 Suppose I have a multivariate response Y (n x k) obtained at a  
 set of
 predictors X (n x p).  I would like to perform a linear  
 regression taking
 into consideration the covariance structure of Y within each unit  
 - this
 would be represented by a specified matrix V (k x k), assumed to  
 be the
 same
 across units.  How do I use lm to do this?



 One approach that I was thinking of is as follows:



 Flatten Y to a vector, say, Yvec (n*k x 1).  Create Xvec (n*k,  
 p*k) such
 that it is made up of block matrices Bij (k x k), where Bij is a  
 diagonal
 matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p).  Now  
 I can
 use lm in a univariate mode to regress Yvec against Xvec, with
 covariance matrix Vvec (n*k x n*k).  Vvec is a block-diagonal  
 matrix with
 blocks of V along the diagonal.  This seems like a valid  
 approach, but I
 still don't know how to specify the covariance structure to do  
 weighted
 least squares.



 Any help is appreciated.



 Best,

 Ravi.




  
 -
 --- ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

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




  
 -
 --- 




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

--
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-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] savePlot and dev.copy

2006-10-31 Thread Paul Murrell
Hi


Mike Prager wrote:
 Dear R gurus,
 
 R 2.4.0 under Windows XP.
 
 We have developed several dozen R functions to make and save
 specialized plots.  These use savePlot() to optionally save the
 plot to files (eps, jpg, png, ...).
 
 The thought has come up of putting the functions into an R
 package.  Because savePlot is available only on Windows, we
 would instead detect the OS and use dev.copy in place of
 savePlot when not running under Windows.
 
 My question is, if this code is rewritten anyway, what are the
 pros and cons of using dev.copy under *all* operating systems
 vs. using savePlot on Windows and dev.copy on other platforms?


The underlying mechanisms of dev.copy() and savePlot() are identical --
copy the display list from one device to another -- but savePlot() has
some niceties wrapped around the outside.

These boil down to making the copy the same size as the original.  If
you use dev.copy() naively, you can get a copy which is a very different
size from the original.  The function dev.print() does a bit better in
terms of retaining the original size, but there is trouble when you copy
from a device for which the size is specified in inches [like windows(),
x11(), postscript() and pdf()] to a device for which the size is in
pixels [png(), jpeg(), bitmap()].

savePlot() handles all of the sizing problems for you (but only works on
Windows).  dev.copy() works everywhere, but you would have to do a bit
of mucking about yourself to get around the sizing problems -- see the
source for dev.print() for a starting point.

The authors of the Windows device might have more to say.

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~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] VGAM-vglm

2006-10-31 Thread Thomas Yee
  Can somebody explain to me why I get different results using 
multinom(package
  nnet) and vglm(package VGAM)?

The multinom function in the nnet package
uses the first level of the factor as baseline, whereas the last
level of the factor is used with multinomial().
Consequently the estimated regression coefficients differ.
They can be reconciled very easily with some basic maths.

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


Re: [R] [ggplot] controlling axis and major/minor tick marks

2006-10-31 Thread Sebastian Weber
Hi Hadley!

 axis.colour should control the colour of the tickmarks, the axis
 labels, and the line which the ticks attach to.  What is not working
 in your case?  grid.colour only effects the grid lines inside the
 plot.

Well, I used gopt to set the following global defaults for my plots:

 ggopt()
List of 11
 $ aspect.ratio : num 0.618
 $ axis.colour  : chr black
 $ background.colour: chr black
 $ background.fill  : chr white
 $ grid.colour  : chr white
 $ grid.fill: chr white
 $ legend.position  : chr right
 $ save : logi FALSE
 $ strip.gp :List of 3
  ..$ col : chr white
  ..$ fill: chr grey80
  ..$ lwd : num 3
  ..- attr(*, class)= chr gpar
 $ strip.text   :function (variable, value)  
 $ strip.text.gp: list()
  ..- attr(*, class)= chr gpar
 - attr(*, class)= chr options
 

Then I plot my stuff with

p2 - ggplot(knn, . ~ power ,  aes=list(y=log10(k2m/(degree*kSize)),
x=log10(degree), shape=alpha))
p2 - ggpoint(p2)
p2

and I do not see any axis at all. The tick marks are there, they are
black as they should.

By the way, I already wondered why I can not change the shapes of the
symbols in use. I figured that they are set statically in map_shapes.
How about introducing an option for this somewhere?

 
 Currently, ggplot has no notion of major and minor tick marks (mainly
 because I don't have a good algorithim to generate them), but it is on
 my to do list.

I definetly need minor tick marks and will hack my way through ggplot to
acheive this if it does not seem to difficult to me. May you give me a
tip where to start / where should I have to modify things.


Regards,

Sebastian

 
 Regards,
 
 Hadley
 
 On 10/31/06, Sebastian Weber [EMAIL PROTECTED] wrote:
  Hello there!
 
  I'm starting with ggplot and was wondering how I could control the axis
  of a plot. I would like the axis of the plot to be drawn black which I
  thought to acheive with the option axis.colour=black. However, this
  had no real effect on the plot. Then I found grid.colour which I changed
  to black as well. Now I got my axis as I wanted them, but ggplot now
  draws the grid inside the plot with black lines as well, which definetly
  do not want to appear. So how can I get a black border around my plots?
  Furthermore, I would like to indicate positions of major and minor ticks
  in my plots. Where can I do this?
 
  Thanks in advance.
 
  Greetings,
 
  Sebastian
 
  Ah, I use R 2.3.1 and ggplot 0.4.0, if that is important ...
 
  __
  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] [R-pkgs] rcompletion: TAB completion for the R command line

2006-10-31 Thread Alexandre Aguiar
Hi,

I've tried to compile rcompletion and perhaps have detected the reason for 
failures, although I haven't succeeded yet.

Em Ter 31 Out 2006 02:10, Deepayan Sarkar escreveu:
 However, there are known cases
 of false negatives, i.e. installation failing when it shouldn't. If
 this happens to you, any information you can provide to help resolve
 the problem would be appreciated.

From config.lo generated by rcompletion configure
---8
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `tgetnum'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `tgoto'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `tgetflag'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `BC'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `tputs'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `PC'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `tgetent'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `UP'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined 
reference to `tgetstr'
---8

It seems configure can't figure where to find these functions.

From readline5.0 configure script
---8
checking for tgetent... no
checking for tgetent in -ltermcap... no
checking for tgetent in -ltinfo... no
checking for tgetent in -lcurses... yes
checking which library has the termcap functions... using libcurses
---8

The unresolved function calls (and perhaps symbols of other types) may be 
located at libcurses. At least in my system they are.

From termcap.h
---8
#undef  NCURSES_VERSION
#define NCURSES_VERSION 5.5

#include ncurses_dll.h

#ifdef __cplusplus
extern C
{
#endif /* __cplusplus */

#include sys/types.h

#undef  NCURSES_CONST 
#define NCURSES_CONST /*nothing*/ 

#undef  NCURSES_OSPEED 
#define NCURSES_OSPEED short 

extern NCURSES_EXPORT_VAR(char) PC;
extern NCURSES_EXPORT_VAR(char *) UP;
extern NCURSES_EXPORT_VAR(char *) BC;
extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; 

#if !defined(NCURSES_TERM_H_incl)
extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
#endif
---8

May be your configure needs some rewriting to include a check for the location 
of unknown symbols like readline's configure does.

Best wishes,

-- 


Alexandre Aguiar
Independent consultant for medical research
SPS Consultoria
Voice: +55-11-9320-2046
Fax: +55-11-5549-8760

__
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] one problem about how to hold graphic with R

2006-10-31 Thread Liaw, Andy
I'm not familiar with Matlab, but from what I know, hold on is used to
overlay more stuff on the existing plot.  In R such things are
accomplished a bit differently:  One put up a plot, then use things like
lines(), points(), abline(), etc. to add to the existing plot.   The
closest thing to hold on in Matlab, I think, is par(new=TRUE).

Andy

From: Gavin Simpson
 
 On Tue, 2006-10-31 at 21:36 +0800, yang baohua wrote:
  Sorry to disturb you, but can you help me to solve one 
 little problem?
  I want to draw a graphic after another with R but I cannot find the 
  first one after that.
  Do you know the command to hold the graphic with R?
  I remember with Matlab you may use hold on.
  Thanks.
  
  
 
 You don't say which OS. On MS Windows one can turn on a 
 history of plots to the graphics device and replay your plots 
 - it is in the menu bar for example.
 
 In all OSes, you can start up a new device to take the plot - 
 which is what Matlab does IIRC, so you have two or more plot 
 windows on screen at any one time. This is done like this:
 
 plot(1:10)
 x11()
 plot(1:20)
 x11()
 plot(rnorm(100))
 
 see ?Devices
 
 You can set a device to be active, i.e. switch around between 
 plotting windows using dev.set(), e.g.:
 
  dev.cur() # example from above leaves device 4 active
 X11
   4
  dev.set(3) # switch to device
  dev.cur() # check
 X11
   3
  plot(sort(rnorm(100))) # plot something new on this device
 
 Is this what you were looking for?
 
 HTH
 
 G
 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC  ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 
 __
 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.
 
 
 


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

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


[R] plotting question

2006-10-31 Thread Leeds, Mark \(IED\)
i have the axis line of code  below in a plotting command and it works
nicely  but it puts tick values at every 5 of lt and i would like a tick
value at every value of lt. i read about pretty() but that sounded
tricky so instead , since i want a tick mark at every value of lt ( it's
discrete and goes from o to some max value usually arounsd 35 or 40 )
 
i changed the line to  at = seq(1,max(lt) ) but that gave me no
tickmarks ?
 
any help is appreciated. thanks.
 
#---

 
axis(4, at = pretty(range(lt)),line=0.75,tick=TRUE)
 
#---
--


This is not an offer (or solicitation of an offer) to buy/sell the 
securities/instruments mentioned or an official confirmation.  Morgan Stanley 
may deal as principal in or own or act as market maker for 
securities/instruments mentioned or may advise the issuers.  This is not 
research and is not from MS Research but it may refer to a research 
analyst/research report.  Unless indicated, these views are the author's and 
may differ from those of Morgan Stanley research or others in the Firm.  We do 
not represent this is accurate or complete and we may not update this.  Past 
performance is not indicative of future returns.  For additional information, 
research reports and important disclosures, contact me or see 
https://secure.ms.com/servlet/cls.  You should not use e-mail to request, 
authorize or effect the purchase or sale of any security or instrument, to send 
transfer instructions, or to effect any other transactions.  We cannot 
guarantee that any such requests received via !
 e-mail will be processed in a timely manner.  This communication is solely for 
the addressee(s) and may contain confidential information.  We do not waive 
confidentiality by mistransmission.  Contact me if you do not wish to receive 
these communications.  In the UK, this communication is directed in the UK to 
those persons who are market counterparties or intermediate customers (as 
defined in the UK Financial Services Authority's rules).

[[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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 I've just found some behaviour which strikes me as odd, but I'm not sure 
 whether it's a bug or a feature.  If you don't mind, I'd like to explain 
 via a couple of examples.
 
 Let x = 1:10.
 Then intuitively, to me at least, the command x[-integer(0)] should leave 
 x untouched.  However the actual output under R2.4.0 is integer(0).
 
 A slightly more involved example demonstrates why I think this behaviour 
 is back to front.
 First we define a data frame, in this case some people, with their 
 heights.
 peoples.heights = data.frame(names = c(Alice, Bob, Carol), heights = 
 c(1.67, 1.85, 175))
 
 To make sure the heights are sensible, we define a filter out impossibly 
 tall people.
 dubious.records = which(peoples.heights$heights  2.5)  #3
 peoples.heights = peoples.heights[-dubious.records,]
 
 This all works fine since dubious.records is not empty.  However, if all 
 the records had been entered properly, then we would get
 #dubious.records = integer(0)
 
 Then the command peoples.heights = peoples.heights[-dubious.records,] 
 strips all the rows to give
 #[1] names   heights
 #0 rows (or 0-length row.names)
 
 i.e. instead of removing the bad records, I've lost everything.
 I know that it's possible to recode this so problems don't occur, but the 
 point is that the answer is unexpected.
 
 Can anybody explain if this behaviour is intentional or useful in some 
 way, or is it an oversight?

Consistency! It's not particularly useful, but it follows from general
principles, which it in the long run doesn't pay to depart from.

The issue is that the result of using an indexing operator ([)
should depend only on the _value_ of its argument, not the expression
used to compute it. Just like you most likely expect log(2+2) not to be
different from log(4). And since

 dubious.records - integer(0)
 identical(dubious.records, -dubious.records)
[1] TRUE

how can peoples.heights[-dubious.records,] be different from
peoples.heights[dubious.records,]? 

R could actually look at the expression and act on the minus sign, but
that way lies madness. Consider

keep - -dubious.records
drop - dubious.records

peoples.heights[keep,]
peoples.heights[-dubious.records,]
peoples.heights[-keep,]

etc... I think you'll get the picture.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] Put a normal curve on plot

2006-10-31 Thread Greg Snow
Here is some sample code that shows 2 different approaches, which you
want to use depends on what exactly you want to do and which will be
easier for you, the one draws the normal around the 6,7 point, the other
around the 3,4 point, change those values to do your plot:

plot(1:10, 2:11)

xx - seq(-3,3,.1)

lines( 6+dnorm(xx,0,.75), 7+xx )

library(TeachingDemos)
subplot( plot(dnorm(xx),xx, type='l', axes=F,xlab='',ylab=''), 3,4,
hadj=0 )

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 Doran, Harold
Sent: Tuesday, October 31, 2006 6:26 AM
To: R-help@stat.math.ethz.ch
Subject: [R] Put a normal curve on plot

I would like to be able to place a normal distribution surrounding the
predicted values at various places on a plot. Below is some toy code
that creates a scatterplot and plots a regression line through the data.

library(MASS)
mu - c(0,1)
Sigma - matrix(c(1,.8,.8,1), ncol=2)
set.seed(123)
x - mvrnorm(50,mu,Sigma)
plot(x)
abline(lm(x[,2] ~ x[,1]))

Say I want to add a normal distribution surrounding the predicted values
at the x-values of -1, 0, and 1. That is, at the points

\hat{y} = \mu + \beta_1(-1)
\hat{y} = \mu + \beta_1(0)
\hat{y} = \mu + \beta_1(1)

How might I go about doing this?

Harold

 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.0 
year   2006
month  10  
day03  
svn rev39566   
language   R   
version.string R version 2.4.0 (2006-10-03)

[[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] one problem about how to hold graphic with R

2006-10-31 Thread Gavin Simpson
On Tue, 2006-10-31 at 22:12 +0800, yang baohua wrote:
 Thanks 
 your reply is helpful
 but i want to draw two graphics on one window to compare them
 so i want to draw one then draw another with different color on the
 same window
 Can you tell me how to do so
 Waiting for your kind reply

Please reply-all to ensure others on the list see the full thread.

Again, it is not clear exactly (but that's me being dense probably) what
you want. I see two options:

1) Side by side plots

par(mfrow = c(1, 2))
plot(rnorm(100), rnorm(100))
plot(runif(100), rnorm(100), col = red)
par(mfrow = c(1, 1))

or

2) overplotting one set of points on another

plot(rnorm(100), rnorm(100))
points(runif(100), rnorm(100), col = red)

If 1), see ?par (and ?layout and ?split.screen for alternative ways to
splitting up a plotting device into n plotting regions), and if 2),
see ?points and ?lines, and I strongly suggest you read the R manual An
Introduction to R that came with R, especially section 12 on Graphics.

HTH

G

 
  
 2006/10/31, Gavin Simpson [EMAIL PROTECTED]: 
 On Tue, 2006-10-31 at 21:36 +0800, yang baohua wrote:
  Sorry to disturb you, but can you help me to solve one
 little problem? 
  I want to draw a graphic after another with R
  but I cannot find the first one after that.
  Do you know the command to hold the graphic with R?
  I remember with Matlab you may use hold on. 
  Thanks.
 
 
 
 You don't say which OS. On MS Windows one can turn on a
 history of plots
 to the graphics device and replay your plots - it is in the
 menu bar for
 example.
 
 In all OSes, you can start up a new device to take the plot -
 which is 
 what Matlab does IIRC, so you have two or more plot windows on
 screen at
 any one time. This is done like this:
 
 plot(1:10)
 x11()
 plot(1:20)
 x11()
 plot(rnorm(100))
 
 see ?Devices
 
 You can set a device to be active, i.e. switch around between
 plotting
 windows using dev.set(), e.g.:
 
  dev.cur() # example from above leaves device 4 active
 X11
 4
  dev.set(3) # switch to device
  dev.cur() # check
 X11
 3
  plot(sort(rnorm(100))) # plot something new on this device
 
 Is this what you were looking for?
 
 HTH
 
 G
 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~
 %~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522 
 ECRC  ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e]
 gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w]
 http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w]
 http://www.freshwaters.org.uk
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~
 %~%~%~%
 
 
 
 
 -- 
 Baohua Yang
 Department of Automation, Tsinghua University
 228A, Zijing Bldg. No.2, Tsinghua Univ.
 Beijing, 100084, P.R.China 
 Tel. 010-51532228
 Email:[EMAIL PROTECTED] 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC  ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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

2006-10-31 Thread Gavin Simpson
On Tue, 2006-10-31 at 16:52 -0500, Leeds, Mark (IED) wrote:
 i have the axis line of code  below in a plotting command and it works
 nicely  but it puts tick values at every 5 of lt and i would like a tick
 value at every value of lt. i read about pretty() but that sounded
 tricky so instead , since i want a tick mark at every value of lt ( it's
 discrete and goes from o to some max value usually arounsd 35 or 40 )
  
 i changed the line to  at = seq(1,max(lt) ) but that gave me no
 tickmarks ?

?unique

 lt - sample(1:40, 50, replace = TRUE) # dummy data
 lt
 [1] 37 30 38 33 13 19  6 39 15 21  5 11  5  5 32  1 23 20 12 21 35 32
34 26 39
[26] 30 11 36 26 12 37 27 26  9 23  2 24  4 20  3  1  7 27 37 31 25 38
29 29 17
 plot(lt, type = l)
 axis(4, at = unique(lt))

Looks a bit weird because of the number of unique values in lt, but will
look OK with the data series you posted earlier.

Also, 

 plot(lt, type = l)
 axis(4, at = pretty(range(lt)),line=0.75,tick=TRUE)

doesn't look right on my default device, do you really want to move the
axis away from the plot margin?

HTH

G

  
 any help is appreciated. thanks.
  
 #---
 
  
 axis(4, at = pretty(range(lt)),line=0.75,tick=TRUE)
  
 #---
 --
 
 
 This is not an offer (or solicitation of an offer) to buy/sell the 
 securities/instruments mentioned or an official confirmation.  Morgan Stanley 
 may deal as principal in or own or act as market maker for 
 securities/instruments mentioned or may advise the issuers.  This is not 
 research and is not from MS Research but it may refer to a research 
 analyst/research report.  Unless indicated, these views are the author's and 
 may differ from those of Morgan Stanley research or others in the Firm.  We 
 do not represent this is accurate or complete and we may not update this.  
 Past performance is not indicative of future returns.  For additional 
 information, research reports and important disclosures, contact me or see 
 https://secure.ms.com/servlet/cls.  You should not use e-mail to request, 
 authorize or effect the purchase or sale of any security or instrument, to 
 send transfer instructions, or to effect any other transactions.  We cannot 
 guarantee that any such requests received vi!
 a !
  e-mail will be processed in a timely manner.  This communication is solely 
 for the addressee(s) and may contain confidential information.  We do not 
 waive confidentiality by mistransmission.  Contact me if you do not wish to 
 receive these communications.  In the UK, this communication is directed in 
 the UK to those persons who are market counterparties or intermediate 
 customers (as defined in the UK Financial Services Authority's rules).
 
   [[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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC  ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/cv/
 London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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] information about sna packages

2006-10-31 Thread Bagatti Davide
Hello,

I'm a student who want to use the R social network analysis package. I have
a question: can this package analyse dynamical networks (network changing
over time)? I didn't find this functionality in the package's user manual.

Thank you

Davide

[[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] (no subject)

2006-10-31 Thread John Gauss
Dear R users,

Please excuse my inexperience.  I am trying to contrain the coefficients of
my linear regression to equal one when using the -lm(...) command.  I've
searched help(glm) help(model.offset) etc. but I am unable to figure out
where to put this constraint.  Your help would be greatly apprciated.

Thanks.

[[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] did my searching but still couldn't find anything for bayesian dlm

2006-10-31 Thread Leeds, Mark \(IED\)
I familarized myelf with kalmanlike and structts which are approaches
for building and estimating ( and forecasting ) state space models ( or
the equivalent arima models ).
back in 2003, gavin simpson wrote an email describing the west and
harrison apprach to estimate state space models and asked if anything
was out there for
using that approach.  the goals of this approach are the same  as kalman
like and structts but priors
are put on the variances and a bayesian approach is used to estimate the
next state. in this manner, , all numerical optimization is avoided (
but obviously the results are different also so it's not necessarily a
better approach. just different ).
 
i'm dealing with minute by minute data so , for me, it's essential to
avoid computing likelihoods over and over. is it possible, that , since
gavin's email, the west and harrison approach has been built in one of
the many packages out there. i looked really hard but i couldn't find
it.
my guess is that the answer is no. thanks for any input.
 
 
mark


This is not an offer (or solicitation of an offer) to buy/sell the 
securities/instruments mentioned or an official confirmation.  Morgan Stanley 
may deal as principal in or own or act as market maker for 
securities/instruments mentioned or may advise the issuers.  This is not 
research and is not from MS Research but it may refer to a research 
analyst/research report.  Unless indicated, these views are the author's and 
may differ from those of Morgan Stanley research or others in the Firm.  We do 
not represent this is accurate or complete and we may not update this.  Past 
performance is not indicative of future returns.  For additional information, 
research reports and important disclosures, contact me or see 
https://secure.ms.com/servlet/cls.  You should not use e-mail to request, 
authorize or effect the purchase or sale of any security or instrument, to send 
transfer instructions, or to effect any other transactions.  We cannot 
guarantee that any such requests received via !
 e-mail will be processed in a timely manner.  This communication is solely for 
the addressee(s) and may contain confidential information.  We do not waive 
confidentiality by mistransmission.  Contact me if you do not wish to receive 
these communications.  In the UK, this communication is directed in the UK to 
those persons who are market counterparties or intermediate customers (as 
defined in the UK Financial Services Authority's rules).

[[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] coefficient constraints

2006-10-31 Thread John Gauss
Hi,

Thank you for your help.  I'm trying to constrain the coefficients on a
linear regression model, -lm(...), to all equal one, except for the
intercept.  I've searched help(glm), help(model.fit), etc. but I can not
find where to add the constraint.  Your help would be greatly appreciated.

Thanks.

[[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] coefficient constraints

2006-10-31 Thread John Fox
Dear John,

You can subtract the variables in question from the left-hand-side of the
model [e.g., lm(y - x1 - x2 ~ 1)], or use the offset argument to lm [e.g.,
lm(y ~ 1, offset=x1 + x2)], or use offset() in the model formula [e.g., lm(y
~ offset(x1 + x2)]. All of these options are equivalent.

I hope this helps,
 John


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of John Gauss
 Sent: Tuesday, October 31, 2006 7:28 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] coefficient constraints
 
 Hi,
 
 Thank you for your help.  I'm trying to constrain the 
 coefficients on a linear regression model, -lm(...), to all 
 equal one, except for the intercept.  I've searched 
 help(glm), help(model.fit), etc. but I can not find where to 
 add the constraint.  Your help would be greatly appreciated.
 
 Thanks.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] graphics not find source

2006-10-31 Thread Ricardo Arias Brito
Hi, 

The plot function not produces graphics in linux.

The msg:
Error in X11(): it was not possible to find no source
X11 Verifity if the way of sources is correct.

Any ideas? 

Thanks, Ricardo

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


Re: [R] [R-pkgs] rcompletion: TAB completion for the R command line

2006-10-31 Thread Deepayan Sarkar
On 10/31/06, Alexandre Aguiar [EMAIL PROTECTED] wrote:
 Hi,

 I've tried to compile rcompletion and perhaps have detected the reason for
 failures, although I haven't succeeded yet.

Yes, this could very well be the reason. R's configure script has
checks for ncurses with the comment:

## only need ncurses if libreadline is not statically linked against it

I'll try to adapt that and put out a test version tomorrow.

-Deepayan


 Em Ter 31 Out 2006 02:10, Deepayan Sarkar escreveu:
  However, there are known cases
  of false negatives, i.e. installation failing when it shouldn't. If
  this happens to you, any information you can provide to help resolve
  the problem would be appreciated.

 From config.lo generated by rcompletion configure
 ---8
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `tgetnum'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `tgoto'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `tgetflag'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `BC'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `tputs'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `PC'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `tgetent'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `UP'
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../libreadline.so: undefined
 reference to `tgetstr'
 ---8

 It seems configure can't figure where to find these functions.

 From readline5.0 configure script
 ---8
 checking for tgetent... no
 checking for tgetent in -ltermcap... no
 checking for tgetent in -ltinfo... no
 checking for tgetent in -lcurses... yes
 checking which library has the termcap functions... using libcurses
 ---8

 The unresolved function calls (and perhaps symbols of other types) may be
 located at libcurses. At least in my system they are.

 From termcap.h
 ---8
 #undef  NCURSES_VERSION
 #define NCURSES_VERSION 5.5

 #include ncurses_dll.h

 #ifdef __cplusplus
 extern C
 {
 #endif /* __cplusplus */

 #include sys/types.h

 #undef  NCURSES_CONST
 #define NCURSES_CONST /*nothing*/

 #undef  NCURSES_OSPEED
 #define NCURSES_OSPEED short

 extern NCURSES_EXPORT_VAR(char) PC;
 extern NCURSES_EXPORT_VAR(char *) UP;
 extern NCURSES_EXPORT_VAR(char *) BC;
 extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed;

 #if !defined(NCURSES_TERM_H_incl)
 extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
 extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
 extern NCURSES_EXPORT(int) tgetent (char *, const char *);
 extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
 extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
 extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
 #endif
 ---8

 May be your configure needs some rewriting to include a check for the location
 of unknown symbols like readline's configure does.

 Best wishes,

 --


 Alexandre Aguiar
 Independent consultant for medical research
 SPS Consultoria
 Voice: +55-11-9320-2046
 Fax: +55-11-5549-8760

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


Re: [R] [R-pkgs] rcompletion: TAB completion for the R command line

2006-10-31 Thread Alexandre Aguiar
Em Ter 31 Out 2006 19:43, Alexandre Aguiar escreveu:
 I've tried to compile rcompletion and perhaps have detected the reason for
 failures, although I haven't succeeded yet.

The solution is actually trivial:

Options:
1. set the environment variable LIBS to LIBS=-lcurses
$ LIBS=-lcurses
$ R
 install.packages(rcompletion)

2. change the line LIBS=-lreadline  $LIBS in configure script to
LIBS=-lreadline -lcurses  $LIBS
and then regenerate the tar.gz package.
$ R
 install.packages(rcompletion, repos=NULL)

During compilation the -lcurses option does not appear in the command lines, 
it seems necessary only during tests.

Haven't tested thoroughly but rcompletion seems to work fine.

Best wishes.

-- 


Alexandre Aguiar
Independent consultant for medical research
SPS Consultoria
Voice: +55-11-9320-2046
Fax: +55-11-5549-8760

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


[R] Problem with data type recognition and conversion

2006-10-31 Thread tom soyer
Hi,

I have a CSV file with two columns; the first column is date, second column
is numbers. I used read.csv() to load the file into the variable temp.
Somehow, R could not recognize my numbers as double. Instead, it thinks
these numbers are integer even though they all have decimal points (isn't
that strange?). The problem I ran into is that if I tried to convert the
numbers to double using as.double, R doesn't give me the original value; e.g.
9.92 becomes 805 (see below).

 temp[1,2]
[1] 9.92
812 Levels: . 10.00 10.01 10.02 10.03 10.04 10.05 10.06 10.07 10.08
10.09 10.10 10.11 10.12 ... 9.99
 typeof(temp[1,2])
[1] integer
 as.double(temp[1,2])
[1] 805

If I leave the numbers as integer, then I can't do arithmetic operations on
them. Does anyone know what's going on?

Thanks,

Tom

[[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] Hessian matrix

2006-10-31 Thread Arun Kumar Saha
Dear all R users,

Is there any way to calculate hessian matrix of a given function at any
given point?

Regards

[[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] avoiding 'for' loop

2006-10-31 Thread Taka Matzmoto
Hi R users

I have a 1000 * 11 matrix (or data.frame). The first 10 columns consist of 0 
or 1 (i.e., binary data) and the last column consists of real values.

I would like to run a logistic regression with the first binary column as a 
dependent variable, and the second binary column and the last real value 
column as independent variables. After this, I save 'Z' value for the binary 
independent variable. Then, with the first binary column as a dependent 
variable, and the third binary column and the last real value column as 
independent variables. After this, I saved 'Z' value for the binary 
independent variable, keeping doing this ...

Here is my simple R codes

logistic.z.value -c()

for (i in 1:9)
{
for (j in (i+1):10)
{
model - glm(X[,i] ~ X[,11] + X[,j], family=binomial(logit))
logistic.z.value - 
append(logistic.z.value,coef(summary(model))[3,3])
}
}

I would like to avoid using 'for' loop command. Is there any way for me to 
use some fast codes instead of using 'for' loop?

Many thanks

Taka,

_
Stay in touch with old friends and meet new ones with Windows Live Spaces

__
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] Odd behaviour of removing 'nothing' from an array or data frame

2006-10-31 Thread Richard . Cotton
Thanks to all for the swift replies.  I'm willing to concede that changing 
the behaviour of [-integer(0)] is probably going to end in tears, so I'll 
stop arguing.

I've added a quick note on the traps page of the R wiki to explain things; 
feel free to expand upon it.
http://wiki.r-project.org/rwiki/doku.php?id=tips:surprises:traps

Regards,
Richie.

Mathematical Sciences Unit
HSL
Buxton
SK17 9JN
01298 21(x8672)



ATTENTION:

This message contains privileged and confidential informatio...{{dropped}}

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


[R] plot - X11()

2006-10-31 Thread Ricardo Arias Brito
Hi, 

The plot() function not produces graphics in linux. 
Msg: Error in X11(): it was not possible to find no source X11 Verify if
the path of sources is correct.
I hope it helps.

Best,
Ricardo







___ 

o discador agora! 

[[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] How to find further informations on specific options?

2006-10-31 Thread zhijie zhang
Dear friends,
  When i read the R-help , i often find the following case:
e.g.:surf.gls(np, covmod, x, y, z, nx = 1000, ...)  #Package Spatial:

Arguments:

  covmod: function to evaluate covariance or correlation function
   * ...: parameters for 'covmod'*

How should i find the further information on *...: parameters for 'covmod'* ?
 I use the ?covmod, but can't find the information.
Could anybody give me the general method to do so?
-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149   [EMAIL PROTECTED]
Dept. of Epidemiology,school of public health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

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


Re: [R] How to find further informations on specific options?

2006-10-31 Thread Roger Bivand
On Wed, 1 Nov 2006, zhijie zhang wrote:

 Dear friends,
   When i read the R-help , i often find the following case:
 e.g.:surf.gls(np, covmod, x, y, z, nx = 1000, ...)  #Package Spatial:
 
 Arguments:
 
   covmod: function to evaluate covariance or correlation function
* ...: parameters for 'covmod'*
 
 How should i find the further information on *...: parameters for 'covmod'* 
 ?
  I use the ?covmod, but can't find the information.
 Could anybody give me the general method to do so?

The spatial package is documented in full in Venables  Ripley (2002)  
Modern Applied Statistics with S, Chapter 15, section 2, pp. 425-430 (in
the References section of the help page).  However, on ?surf.gls, the See
Also section provides links to help pages describing expcov, gaucov, and
sphercov, so looking at See Also seems to be the general method you need.

 

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

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