[R] data formatting: from rows to columns

2007-08-28 Thread Duncan Mackay
At 09:11 29/08/07 Jim Holtman wrote

Here is a way using sprintf:

x - read.table(textConnection( V2  V3
27  2032567  19
28  2035482  19
126 2472826  19
132 2473320  19
136 2035480 135
145 2062458 135
148 2074927 135
151 2102395 142
156 2027252 142
158 2473082 142))

# output the data
cat(sprintf(%d\n%d\n\n, x$V2, x$V3), sep='', file='tempxx.txt')

How about

write.table(x,clipboard,sep=\n,eol=\n\n,col.names = FALSE, row.names 
= FALSE)
2032567
19

2035482
19

2472826
19

2473320
19

2035480
135

2062458
135

2074927
135

2102395
142

2027252
142

2473082
142

Regards

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: [EMAIL PROTECTED]
Ph 02 67729794

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] background color in strip.custom()

2006-12-04 Thread Duncan Mackay
One way is to use the argument par.settings

get the right name

names(trellis.par.get())

or

str(trellis.par.get())

to find the list names to change

then

xyplot(y ~ x | f,
   par.settings = list(strip.background = list(col = c(your colours)) )


Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: [EMAIL PROTECTED]
   home: [EMAIL PROTECTED]
Phone: 02 6772 9794

At 20:01 04/12/06, you wrote:
Hi all,
how can I change the background color in lattice strips according to a
factor level, eg:

library(lattice)
x - rnorm(100)
y - sqrt(x)
f - gl(2, 50, c(A, B))
xyplot(y ~ x | f)

I like to change the background color of the strips according to the
levels in f and tried several things like this with no success:

xyplot(y ~ x | f, strip=strip.custom(bg=c(red, green)))

Is this possible?

Thanks, Sven

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] R2.4 xyplot + panel.number problem

2006-11-28 Thread Duncan Mackay
Hi

Try ?panel.number

As you have not specified R version I cannot be more specific but for 2.4 
there have been changes to lattice
including panel.number to panel.number()

At 14:10 29/11/06, you wrote:
Hi all;
I'm trying to display a 2 panel plot for the Puromycin data from R
with 2 different non-linear models fitted to each group. The problem
is that as far as I know panel.number doesn't work in the latest
version of R. Can anyone give a hint how to solve this?

Here is the code that I used before and now doesn't work

xyplot(rate ~conc| state,Puromycin,
panel=function(x,y,panel.number,...){
panel.xyplot(x,y,...)
x.temp-seq(0, 1.2, len = 101)
if (panel.number==1) {
y.temp-(coef(m2.nls)[1]+coef(m2.nls)[2]) * x.temp/
(coef(m2.nls)[3] + x.temp)
panel.lines(x.temp,y.temp,col=2)}
if (panel.number==2) {
y.temp-coef(m2.nls)[1] * x.temp/
(coef(m2.nls)[3] + x.temp)
panel.lines(x.temp,y.temp,col=2)}
  },
ylab=Rate of reaction,
xlab=Substrate concentration,
main = Puromycin---comparison bt. treated and untreated
  )

thanks for any idea

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

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: [EMAIL PROTECTED]
   home: [EMAIL PROTECTED]
Phone: 02 6772 9794

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] RGui: windows-record and command history

2006-03-23 Thread Duncan Mackay
Hi all,
On the subject of histories, how about changing the default value of
max.show from 25 to Inf? I find that the line of code I'm looking for is
ALWAYS on the 26th line back from the end of the default history!! Also, re
changing the amount of history saved, Prof Ripley replied to an earlier
query of mine on this list (04 Mar 2005) with info about the R_HISTSIZE
environment variable that can be changed to save more or less history. And
it wouldn't it be great if the history mechanism had the option of storing
the session date??!!

Cheers,
Duncan



*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.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


[R] Justification of dendrogram labels

2006-01-26 Thread Duncan Mackay
Hi all,
Can someone tell me how to justify (right or left) the labels on the
branches of a dendrogram tree? I have produced a dendrogram via agnes and
plotted it with pltree. The dendrogram terminal branch labels seem to be
centre-justified by default and I was hoping to change this to left
justification. Thanks,
Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.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


[R] [Rd] bug in windows GUI/script editor (PR#8288)

2005-11-09 Thread Duncan Mackay
Here's how I can reproduce this bug, running under MDI under WinXP

1) start Rgui
2) open a script window using FileNew script
3) click back in the console window and open a help window (e.g. by typing
?merge) in the console window
4) click in the close box of the help window
5) click in the close box of the script window (which was visible even
though the script window was largely behind the console window)
6) click on the File menu ..CRASH!!! R for Windows GUI front-end
has encountered a problem and needs to close.  We are sorry for the
inconvenience.


Cheers,
Duncan



 version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor2.0
year 2005   
month10 
day  06 
svn rev  35749  
language R  


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


[R] [Rd] bug in windows GUI/script editor (PR#8288)

2005-11-09 Thread Duncan Mackay
P.S.  I should have added that this crash occurred when the MDI toolbar was
OFF.

Here's how I can reproduce this bug, running under MDI under WinXP

1) start Rgui
2) open a script window using FileNew script
3) click back in the console window and open a help window (e.g. by typing
?merge) in the console window
4) click in the close box of the help window
5) click in the close box of the script window (which was visible even
though the script window was largely behind the console window)
6) click on the File menu ..CRASH!!! R for Windows GUI front-end
has encountered a problem and needs to close.  We are sorry for the
inconvenience.


Cheers,
Duncan



 version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor2.0
year 2005   
month10 
day  06 
svn rev  35749  
language R  


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


Re: [R] Stacked Area chart

2005-08-16 Thread Duncan Mackay
At 16:03 16/08/05, Mike Saunders wrote:
I wish to do a stacked area chart to show how relative proportions of 
species within a stand have changed over time.

I know this is simple, but can someone point me to the right function (if 
it exists).  I have not had any luck finding it in the R-help, but maybe I 
am searching using the wrong keywords.

Thanks,
Mike


Mike Saunders
Research Assistant
Forest Ecosystem Research Program
Department of Forest Ecosystem Sciences
University of Maine
Orono, ME  04469
207-581-2763 (O)
207-581-4257 (F)

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

I recently did some graphs using xyplot in lattice where I had the data 
ordered by days,
the groups argument and possibly by condition.

I have slightly reduced the code for general  use and re run it

The process is to create a matrix of cumulative data (xy) and to make a 
filled polygon for each of the
groups using the previous group value as the lower limit of the polygon.
For the first group there has to be a dummy lower limit in these cases of zero
ie rep(0,5) in the single panel graph in the rbind sequence
Plotting of a group line is referred to as j+1 row due to the fact that 
there is a dummy
line for the lower polygon of the first group

The first script is for a single graph where there were the groups (codeno) 
were 4 species.
The days were 1,2,4,6,9 and the y values (comp ) were percentages.

All groupings and conditions are numeric for both datasets
Any NAs were converted to 0s so as not to give error messages etc.

The second script is for a conditioned graph of similar data
but is generalised.

The maximum y limit can cause problems in setting.
In these cases I had a good idea of what they would be.
For count data it would be necessary to first do a calculation to find it.

#  Single panel
xyplot(comp ~ days, data = stackln,
as.table = T,
groups = codeno,
subscripts = T,
panel= function(x,y,subscripts,groups)
{
  xy - rbind(rep(0,5), apply(sapply(1:4, function(j) 
y[groups[subscripts]==j]),1,cumsum))
  for(j in 1:4){
  grid.polygon(x = c(c(1,2,4,6,9), rev(c(1,2,4,6,9)) ),
   y = c(xy[(j+1),],rev(xy[(j),]) ),
   gp = gpar(col = 0, fill = c(1,2,6,8)[j]),
   default.units = native)

  }
}

)

# Conditioned panel
xyplot(comp ~ days|grps3, data = in1,
as.table = T,
groups = codeno,
subscripts = T,
panel = function(x,y,subscripts,groups,panel.number)
{
   grp.no - sort(unique(groups[subscripts]) )

   x.vals - sort(unique(x))

   xy - rbind(rep(0,length(x.vals) ), 
apply(sapply(1:length(grp.no), function(j) 
y[groups[subscripts]==grp.no[j]]),1,cumsum))

   for (j in 1:length(grp.no))
   {
 grid.polygon(x = c(x.vals, rev(x.vals) ),
  y = c(xy[(j+1),], rev(xy[(j),]) ),
  gp = gpar(col = 0, fill = c(6,1,2,5,3,4,7,8)[j]),
  default.units = native)
   }  # for (j in 1:length(grp.no))

} # panel
)


Regards

Duncan Mackay
(The other Duncan Mackay)


Duncan Mackay
Dept of Agronomy and Soil Science
University of New England
ARMIDALE  NSW 2351
Email: [EMAIL PROTECTED]

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


[R] RGUI crash when opening script in XP Home enviroment

2005-08-09 Thread Duncan Mackay
I can duplicate this problem under WinXP Professional 5.1.2600 Service Pack
2 Build 2600 on a Toshiba Satellite A10. Thanks to Knut for identifying just
what was causing this problem - I was having this error repeatedly but
couldn't track down the cause.
Duncan


 version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.1
year 2005   
month06 
day  20 
language R  


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.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


[R] Digest reading is tedious

2005-08-09 Thread Duncan Mackay
Any prospects of getting R-news delivered as an RSS feed???
Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.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


[R] RGUI crash when opening script in XP Home enviroment

2005-08-09 Thread Duncan Mackay

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


[R] Digest reading is tedious

2005-08-09 Thread Duncan Mackay

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


[R] RGUI crash when opening script in XP Home enviroment

2005-08-09 Thread Duncan Mackay
I can duplicate this problem under WinXP Professional 5.1.2600 Service Pack
2 Build 2600 on a Toshiba Satellite A10. Thanks to Knut for identifying just
what was causing this problem - I was having this error repeatedly but
couldn't track down the cause.
Duncan


 version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.1
year 2005   
month06 
day  20 
language R  


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


[R] Digest reading is tedious

2005-08-09 Thread Duncan Mackay
Any prospects of getting R-news delivered as an RSS feed???
Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


[R] Rconsole wishlist

2005-03-03 Thread Duncan Mackay
Hi all,
Wouldn't it be nice (??!!) if R automatically issued a warning message when
the R console buffer was about to fill so that you could save all your
output into a text file? (I know about sink(), but I think it would be good
to have an easier mechanism to save a complete record of messages and
function output). And on a similar vein, wouldn't it also be nice if R
automatically entered a date stamp into the history file??

Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.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


RE: [R] Rconsole wishlist

2005-03-03 Thread Duncan Mackay
Sorry, yes, Rgui under WinXP (SP2). But while Windows date stamps the
history file

 file.info(.Rhistory)
  size isdir mode   mtime   ctime
.Rhistory 5377 FALSE  666 2005-03-04 10:37:52 2005-03-04 10:37:52
atime
.Rhistory 2005-03-04 13:54:11

the problem is that there can be multiple sessions stored in .Rhistory and
the session dates aren't stored there. Moreover, it seems to me that the
history buffer can also overflow without warning after long sessions or many
repeated sessions and so that you can inadvertently lose parts of your
command log. (Is this right, anyone?) Perhaps it would be preferable for R
to save each session's command history in a separate history file, along the
lines of 

.Last - function() {
savefilename - paste(Rhistory,date())
savefilename - gsub( ,_,savefilename)
savefilename - gsub(:,.,savefilename)
savefilename - paste(savefilename,.txt,sep=)
if(interactive())  try(savehistory(savefilename))
cat(Current history saved in file: ,savefilename,\n)
}

but this doesn't address any overflow issues.

Duncan


-Original Message-
From: Liaw, Andy [mailto:[EMAIL PROTECTED] 
Sent: Friday, 4 March 2005 11:14 AM
To: 'Duncan Mackay'; R-news
Subject: RE: [R] Rconsole wishlist


I'm guessing you're talking about Rgui on Windows, but please don't leave us
guessing.

If you run R under Ess/(X)Emacs, you have the entire session that can be
saved in a (transcript) file.

Does your OS not put date stamps on file?

 file.info(.Rhistory)
  size isdir mode   mtime   ctime
.Rhistory 1025 FALSE  666 2005-03-03 19:27:31 2004-08-13 10:45:09
atime
.Rhistory 2005-03-03 19:27:31

Andy


 From: Duncan Mackay
 
 Hi all,
 Wouldn't it be nice (??!!) if R automatically issued a
 warning message when
 the R console buffer was about to fill so that you could save all your
 output into a text file? (I know about sink(), but I think it 
 would be good
 to have an easier mechanism to save a complete record of messages and
 function output). And on a similar vein, wouldn't it also be nice if R
 automatically entered a date stamp into the history file??
 
 Duncan
 
 
 *
 Dr. Duncan Mackay
 School of Biological Sciences
 Flinders University
 GPO Box 2100
 Adelaide
 S.A.5001
 AUSTRALIA
 
 Ph (08) 8201 2627FAX (08) 8201 3015
 
http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.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






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


[R] package dependency error on loading lme4

2005-01-24 Thread duncan . mackay


Hi all,
I recently (today) updated the Matrix package and installed the latticeExtra
package, but then when I tried to load the lme4 package, I got the following
error message:-

 library(lme4)
Loading required package: Matrix 
Loading required package: latticeExtra 
Error in importIntoEnv(impenv, impnames, ns, impvars) : 
object(s) '.__C__lmeRep' are not exported by 'namespace:Matrix' Error in
library(lme4) : package/namespace load failed for 'lme4'
 

???

I'm running R 2.0.1 under WinXP as follows
 R.Version()
$platform
[1] i386-pc-mingw32

$arch
[1] i386

$os
[1] mingw32

$system
[1] i386, mingw32

$status
[1] 

$major
[1] 2

$minor
[1] 0.1

$year
[1] 2004

$month
[1] 11

$day
[1] 15

$language
[1] R

Cheers, Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


[R] RGUI Console settings

2004-08-03 Thread Duncan Mackay
Hi all,
Would someone like to comment on the relation between the buffer bytes
and lines settings in the console settings? Are they interdependent?
If so, how? And why allow both to be tweaked? If not, what is the effect
of changing lines, but leaving buffer bytes the same? 

I wanted to be able to see more of some large outputs in my console, as
I was losing the beginning of the outputs under the default console
settings. I changed the lines setting from 8000 to 16000, but that
didn't seem to change the no. of lines that would display (checked with
for(i in 1:9000) print(i)). So then I changed the buffer bytes
setting to 13 and now the console will display what I want. But
clearly I don't really understand what is going on here 
Thanks, Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


RE: [R] Generate a sequence of random integer values

2004-05-27 Thread Duncan Mackay
Hello,
Have a look at the sample command.

E.g.
 sample(20)
 [1]  3  2 18  6 10  5  9 20 19 13  8 15 17  7  4 14 11  1 12 16


Duncan

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Davenhall
Sent: Friday, 28 May 2004 10:24 AM
To: [EMAIL PROTECTED]
Subject: [R] Generate a sequence of random integer values


I'm trying to generate a sequence of random integer values.  I've tried
to combine the random (r) and the sequence (seq) functions but this
approach does not work.  For example, if I use the following command:

 a - seq(1:100)
 a
  [1]   1   2   3   4   5   6   7   8   9  etc.

This is a good start, but what I really want is something that would
look like this instead

 [1]  3 96 45 67 8 24 99 63 8, etc.

where the integer numbers between 1 and 100 are randomly chosen.

Any help would be great, I've found workarounds in other stat packages,
but would prefer to do this in R.

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

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


[R] se.contrast ....too hard??? .... Too easy????? .....too trivial???? ...... Too boring.....too????????

2004-02-29 Thread Duncan Mackay
Hi all,
Regular and avid readers of this column will know that Don Driscoll and
I have recently posted two messages requesting assistance concerning an
apparent failure of se.contrast to produce an se for a contrast. So
far, an ominous silence rings in our ears, but read on Gentle Reader,
and see if even the machinations of debug doesn't stimulate you to
respond with a revelatory epistle.

Thanks!!!
Duncan



Here is my first message :-

Just to follow up Don Driscoll's earlier post, can anyone please explain
why se.contrast fails here??

 shp-factor(rep(c(reserve,strip),each=96))
 
 

site-factor(rep(c(1g,1p,1t,2g,2p,2t,3g,3p,3t,4g,4p
,4t),each=16))
 
 pit-factor(rep(1:16,12))
 

reptsp-c(4,5,6,4,6,6,6,7,3,5,2,2,4,8,5,4,2,4,2,2,4,5,2,4,4,4,3,2,3,2,5,
3,5,3,4,4,4,3,4,
+
3,4,4,4,3,4,3,6,3,3,5,4,6,4,4,2,4,2,6,5,5,5,7,4,4,5,1,4,5,6,5,5,2,6,3,5,
6,4,5,
+
4,8,2,4,2,4,2,4,3,3,4,4,3,2,1,3,4,4,2,2,3,2,4,1,2,2,3,4,5,5,3,5,5,4,1,1,
2,1,3,
+
1,4,1,6,1,2,3,2,2,2,1,1,2,2,6,5,3,2,3,5,3,2,3,2,1,3,2,4,4,3,3,3,1,2,4,3,
4,5,6,
+
5,2,3,2,2,5,5,5,2,2,5,2,4,4,3,2,2,3,2,2,2,2,5,4,3,3,5,2,5,4,3,2,2,2,1,2)
 
 ddata-data.frame(shp,pit,site,reptsp)
 
 repmod2-aov(reptsp~shp/site+ Error(shp/site))
 summary(repmod2)

Error: shp
Df Sum Sq Mean Sq
shp  1  53.13   53.13

Error: shp:site
 Df Sum Sq Mean Sq
shp:site 10 61.885   6.189

Error: Within
   Df Sum Sq Mean Sq F value Pr(F)
Residuals 180 318.561.77   
 
 table(ddata$shp)

reserve   strip 
 96  96 
 
 se.contrast(repmod2, list(shp==strip, shp==reserve),data=ddata)
Error in qr.qty(strata$qr, scontrast) : qr and y must have the same
number of rows
 
?


Thanks,
Duncan


...and here is what debug says:-

 debug(qr.qty)
 se.contrast(repmod2, list(shp==strip, shp==reserve),data=ddata)
debugging in: qr.qty(e.qr, contrast)
debug: {
if (!is.qr(qr)) 
stop(argument is not a QR decomposition)
if (is.complex(qr$qr)) {
y - as.matrix(y)
if (!is.complex(y)) 
y[] - as.complex(y)
return(.Call(qr_qy_cmplx, qr, y, 1, PACKAGE = base))
}
a - attr(qr, useLAPACK)
if (!is.null(a)  is.logical(a)  a) 
return(.Call(qr_qy_real, qr, as.matrix(y), 1, PACKAGE =
base))
n - nrow(qr$qr)
k - as.integer(qr$rank)
ny - NCOL(y)
if (NROW(y) != n) 
stop(qr and y must have the same number of rows)
storage.mode(y) - double
.Fortran(dqrqty, as.double(qr$qr), n, k, as.double(qr$qraux), 
y, ny, qty = y, PACKAGE = base)$qty
}
Browse[1] 
debug: if (!is.qr(qr)) stop(argument is not a QR decomposition)
Browse[1] 
debug: if (is.complex(qr$qr)) {
y - as.matrix(y)
if (!is.complex(y)) 
y[] - as.complex(y)
return(.Call(qr_qy_cmplx, qr, y, 1, PACKAGE = base))
}
Browse[1] 
debug: a - attr(qr, useLAPACK)
Browse[1] 
debug: if (!is.null(a)  is.logical(a)  a) return(.Call(qr_qy_real,

qr, as.matrix(y), 1, PACKAGE = base))
Browse[1] 
debug: n - nrow(qr$qr)
Browse[1] 
debug: k - as.integer(qr$rank)
Browse[1] 
debug: ny - NCOL(y)
Browse[1] 
debug: if (NROW(y) != n) stop(qr and y must have the same number of
rows) Browse[1] ny [1] 1 Browse[1] NCOL(y) [1] 1 Browse[1]
nrow(qr$qr) [1] 192 Browse[1] print(n) [1] 192 Browse[1] dim(qr$qr)
[1] 192  24 Browse[1] NROW(y) [1] 192 Browse[1] NROW(y)==n [1] TRUE
Browse[1] Q

So, if NROW(y)==n, why do I get the message qr and y must have the same
number of rows

Any help gratefully appreciated
Duncan

**

R, me bucko

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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

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


[R] se.contrast ???????????

2004-02-25 Thread Duncan Mackay

Hi all,

Just to follow up Don Driscoll's earlier post, can anyone please explain
why se.contrast fails here??

 shp-factor(rep(c(reserve,strip),each=96))
 
 

site-factor(rep(c(1g,1p,1t,2g,2p,2t,3g,3p,3t,4g,4p
,4t),each=16))
 
 pit-factor(rep(1:16,12))
 

reptsp-c(4,5,6,4,6,6,6,7,3,5,2,2,4,8,5,4,2,4,2,2,4,5,2,4,4,4,3,2,3,2,5,
3,5,3,4,4,4,3,4,
+
3,4,4,4,3,4,3,6,3,3,5,4,6,4,4,2,4,2,6,5,5,5,7,4,4,5,1,4,5,6,5,5,2,6,3,5,
6,4,5,
+
4,8,2,4,2,4,2,4,3,3,4,4,3,2,1,3,4,4,2,2,3,2,4,1,2,2,3,4,5,5,3,5,5,4,1,1,
2,1,3,
+
1,4,1,6,1,2,3,2,2,2,1,1,2,2,6,5,3,2,3,5,3,2,3,2,1,3,2,4,4,3,3,3,1,2,4,3,
4,5,6,
+
5,2,3,2,2,5,5,5,2,2,5,2,4,4,3,2,2,3,2,2,2,2,5,4,3,3,5,2,5,4,3,2,2,2,1,2)
 
 ddata-data.frame(shp,pit,site,reptsp)
 
 repmod2-aov(reptsp~shp/site+ Error(shp/site))
 summary(repmod2)

Error: shp
Df Sum Sq Mean Sq
shp  1  53.13   53.13

Error: shp:site
 Df Sum Sq Mean Sq
shp:site 10 61.885   6.189

Error: Within
   Df Sum Sq Mean Sq F value Pr(F)
Residuals 180 318.561.77   
 
 table(ddata$shp)

reserve   strip 
 96  96 
 
 se.contrast(repmod2, list(shp==strip, shp==reserve),data=ddata)
Error in qr.qty(strata$qr, scontrast) : qr and y must have the same
number of rows
 
?

Thanks,
Duncan

**

R, me bucko

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


RE: [R] plot mean + S.E. over time

2003-11-25 Thread Duncan Mackay
check out plotCI and plotmeans in the gregmisc library.
Duncan

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Jan Wantia
Sent: Wednesday, 26 November 2003 12:34 AM
To: [EMAIL PROTECTED]
Subject: [R] plot mean + S.E. over time


Hi, there!

I finally became a disciple of 'R', after having lost years of my life
handling data with a popular, rather wide-spread spreadsheet-software.

Now I want to plot the results of many runs of my simulation over time,
so that the means +/- Standard error are on the y-axis, and time on the
x-axis.

I have tried 'boxplot', with timesteps as the grouping variable, but did
not manage to replace quartils by S.E.
Then, with 'plot' I do not know how to handle the data of 100 runs for a
given time to produce the mean and S.E.

Are there any suggestions? Any help would be appreciated!

Cheers, Jan

--

__

Jan Wantia
Dept. of Information Technology, University of Zürich
Andreasstr. 15
CH 8050 Zürich
Switzerland

Tel.: +41 (0) 1 635 4315
Fax: +41 (0) 1 635 45 07
email: [EMAIL PROTECTED]

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

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


RE: [R] Calculating great circle distances

2003-11-25 Thread Duncan Mackay
Have you seen Online calculations  Downloadable spreadsheets to perform
Geodetic Calculations.
at http://www.ga.gov.au/nmd/geodesy/datums/calcs.jsp ?
Duncan

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, 26 November 2003 2:55 PM
To: [EMAIL PROTECTED]
Subject: [R] Calculating great circle distances


Hi,
Has anyone got any R code (or are there any packages) that calculates
the great circle distance between two geographical (lat, lon) positions?


Cheers

Toby Patterson
Pelagic Ecosystems Research Group
CSIRO Marine Research
Email: [EMAIL PROTECTED]

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

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


RE: [R] kruskal wallis for manova?

2003-11-24 Thread Duncan Mackay
Hi,
you may also be interested in Marti Anderson's NPMANOVA program, described
at http://www.stat.auckland.ac.nz/~mja/Programs.htm

Cheers, Duncan

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Torsten Hothorn
Sent: Monday, 24 November 2003 6:54 PM
To: Nicolaas Busscher
Cc: [EMAIL PROTECTED]
Subject: Re: [R] kruskal wallis for manova?



 Hello,
 Is there like the kruskal wallis test in relation to ANOVA (no
 restrictions on normallity and variance homogenity) something (in R)
 for MANOVA?

You may know Fortunato Pesarin's book

@book{multivaria:2001,
   key   = {386},
   author= {Fortunato Pesarin},
   title = {Multivariate Permutation Tests:
With Applications to Biostatistics},
   year  = {2001},
   publisher = {John Wiley \ Sons},
   address   = {Chichester}
}

which addresses those problems. There is some S-Code on the authors
web-page which may be point to start.

Best,

Torsten


 thanks

 --
 Dr.Nicolaas Busscher Universität GH Kassel
 Nordbahnhofstrasse: 1a, D-37213 Witzenhausen
 Phone: 0049-(0)5542-98-1715, Fax: 0049-(0)5542-98-1713

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



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

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


[R] Hidden Rhistory files

2003-11-19 Thread Duncan Mackay
Hi all,
I've ecountered a problem in the last few days with my .Rhistory file
not being able to be updated when I quit an R session because its file
attributes under Windows have been set as Hidden. Recently, I put the
following line in my global Rprofile file:-

history(max.show=Inf)

so that I automatically open the entire history file for a project when
I begin a session, but I don't see why that would cause a problem.

This problem has arisen several times in the last few days while working
on different Rdata files in different folders. When I manually uncheck
the hidden attribute of my Rhistory file, the problem goes away. But
why did the files get that attribute in the first place? Is this
something that R itself may have done? I'm running R Version 1.8.0
(2003-10-08) under WinXP.
Cheers, Duncan


*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html

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


RE: [R] covariate data errors

2003-06-12 Thread Duncan Mackay

Hello,
I'm not qualified to judge about definitiveness, but you may find the
discussion of Time Series Regression and Generalized Least Squares in
Chapter 14 of Applied Regression Analysis, Linear Models, and Related
Models by John Fox (1997, Sage Publications) helpful. He also has an
accompanying package car on the CRAN R site.
Duncan

*
Dr. Duncan Mackay
School of Biological Sciences
Flinders University
GPO Box 2100
Adelaide
S.A.5001
AUSTRALIA

Ph (08) 8201 2627FAX (08) 8201 3015

http://www.scieng.flinders.edu.au/biology/people/mackay_d/index.html


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Andy Jacobson
Sent: Friday, 13 June 2003 1:10 PM
To: [EMAIL PROTECTED]
Subject: [R] covariate data errors


Greetings,

I would like to fit a multiple linear regression model in
which the residuals are expected to follow a multivariate normal
distribution, using weighted least squares.  I know that the data in
question have biases that would result in correlated residuals, and I
have a means for quantifying those biases as a covariance matrix. I
cannot, unfortunately, correct the data for these biases.

It seems that this should be a straightforward task, but so
much of the literature is concerned with the probability model in
which the residuals are uncorrelated that I can't find a good
reference.  So in order of importance, please, can someone point me to
a definitive reference for least squares with correlated residuals,
and is there a standard R package to handle this case?

Many thanks in advance,

Anthony

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

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


FW: [R] update.packages through proxy failing

2003-01-07 Thread Duncan Mackay

Hi all,
I have tried the helpful suggestion below from Andrew Ward, but I now get
the following error:-

 update.packages()
trying URL `http://cran.r-project.org/bin/windows/contrib/PACKAGES'
Error in download.file(url = paste(contriburl, PACKAGES, sep = /),  :
cannot open: HTTP status was `407 Proxy Authentication Required'

From previous correspondence on this help server, i believe that this
problem may arise from my site's requirement for a password to be entered
when outside sites are accessed.
??
Duncan





-Original Message-
From: Andrew C. Ward [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 8 January 2003 12:29 PM
To: Duncan Mackay
Subject: Re: [R] update.packages through proxy failing


Duncan,

My organisation also uses a proxy/firewall. I specify --internet2 on the
Target line of my R shortcut. This then uses the proxy configuration within
your web browser, and I have no problems.

Regards,

Andrew C. Ward

CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
[EMAIL PROTECTED]

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