Re: [R] Query regarding linking R with Matlab

2006-12-27 Thread Henrik Bengtsson
Hi,

It might be that R can't find Matlab; then you have to specify option
'matlab', see help(Matlab).  Try also a different port. Try to add a
line setVerbose(matlab, -2) to get more detailed output what is going
on;

matlab - Matlab(host=localhost, port=9998)
setVerbose(matlab, -2)
if (!open(matlab))
  throw(Matlab server is not running: waited 30 seconds.)

If you can't get it to work, send the output of the above.

/Henrik

On 12/27/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote:
 Respected Sir,

 I thank you for your concern. I have worked with the code that you have
 provided. But it has generated errors like:

  if (!open(matlab))
 +   throw(Matlab server is not running: waited 30 seconds.)
  //This command is not responding even after 30 seconds.

  res - evaluate(matlab, swissroll)
 Error in writeBin(con = con, as.integer(b), size = 1) :
 invalid connection

  vars - getVariable(matlab, c(Y, X, K, d))
 Error in writeBin(con = con, as.integer(b), size = 1) :
 invalid connection
 Kindly help me with this.

 Regards
 Bhanu Kalyan K


 Bhanu Kalyan K
 BTech CSE Final Year
 [EMAIL PROTECTED]
 Tel :+91-9885238228

  __
 Do You Yahoo!?
 Tired of spam? Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com

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


[R] fitting all models in log-lm

2006-12-27 Thread Nicolas Mazziotta
Hello,

I am trying to use R to carry out loglinear analysis. So far, starting from a 
previous post in this list 
(http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33698.html), I have been 
able to use loglm() to generate likelihood ratio.

I now try to find a function that generates all the models and another one to 
compare them.

Thanks for any help.

-- 
Nicolas Mazziotta

The contents of this e-mail, including any attachments, are ...{{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] how to transform string to variable name in a fuction?

2006-12-27 Thread Abhijit Dasgupta
I believe the split function should work in this case.
 From the help file:

split(x, f, drop = FALSE, ...)
split(x, f, drop = FALSE, ...) - value
unsplit(value, f, drop = FALSE)


  Arguments

|x| vector or data frame containing values to be divided into groups.
|f| a “factor” in the sense that |as.factor factor.html(f)| defines 
the grouping, or a list of such factors in which case their interaction 
is used for the grouping.
|drop|  logical indicating if levels that do not occur should be dropped 
(if |f| is a |factor| or a list).
|value| a list of vectors or data frames compatible with a splitting of 
|x|. Recycling applies if the lengths do not match.
|...|   further potential arguments passed to methods.



Abhijit Dasgupta, Ph.D.

Assistant Professor | Division of Biostatistics
Department of Pharmacology and Experimental Therapeutics | Thomas 
Jefferson University
1015 Chestnut St | Suite M100 | Philadelphia, PA 19107
Ph: (215) 503-9201 | Fax: (215) 503-3804

jingjiangyan wrote:
 there is a data frame, like this:
   
 df
 
   aa   bb
 1  a 20.27802
 2  b 22.10664
 3  c 21.33470
 4  a 22.32898
 5  b 19.73760
 6  c 20.38979
 .(suppressed)
 what I want to do is to copy the data frame's rows into different data frames 
 according to the levels of 'aa' column, 
   
 df.a - df[df[,1]=='a',] ; df.b - df[df[,1]=='b',] ; 
 df.a
 
   aa   bb
 1  a 20.27802
 4  a 22.32898
 ...

 So, when completed, there should be df.a, df.b,df.c, etc. 
 If we could do this by hand, it is pretty fine.  But could I write a loop to 
 do this ?
 when I tried this using a funciton, there is a problem.

   
 for ( i in levels(df[,1])) {
 
 +  name = paste('df',i,sep='')
 +  name - df[df[,1]==i,]
 + }
   
 name
 
   aa   bb
 3  c 21.33470
 6  c 20.38979
   
 ls()
 
 [1] df   iname
   
 i
 
 [1] c
 there is not data frames df.a, df.b,etc.

 Could you please give me some suggestion?
 I have found that write a function in R for a beginner is difficult. Is there 
  any tutorial on writing the functions in R? 
 Furthermore, someone also said that loop is not used as frequently as in 
 other script language (e.g. bash, perl). So, If you have any other smart 
 means do this more efficiently, please let me know, I would appreciate your 
 kindness.

   [[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] counties in different colours using map()

2006-12-27 Thread Tord Snäll
Hi,
I would like to plot a map of US counties using different colors. map() 
seems to be the function to use, e.g.
library(maps); map('usa'); map('county', 'colorado', add=T,fill = T, 
col=c(1:5))
plots Colorado counties using colours 1 to 5.

However, I want each color to represent a certain value - a value to be 
picked from a data frame.
This code should show a correspoding map at the level of states:
state.names - system('tr [A-Z] [a-z]', state.name)
map.states - unix('sed s/:.*//', map(names=T,plot=F))
state.to.map - match(map.states, state.names)
color- votes.repub[state.to.map, votes.year = 1900] / 100
map('state', fill=T, col=color); map('state', add=T)
It is copied from page 6 in
Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell 
Laboratories Statistics Research Report [93.2], 1993.
http://public.research.att.com/areas/stat/doc/93.2.ps

I also wonder whether the county names are available in the database 
used by map(), and, if yes, how to extract or utilize them.

Thanks!

Tord

-- 

Tord Snäll
Department of Conservation Biology
Swedish University of Agricultural Sciences (SLU)
P.O. 7002, SE-750 07 Uppsala, Sweden
Office/Mobile/Fax
+46-18-672612/+46-730-891356/+46-18-673537
E-mail: [EMAIL PROTECTED]
www.nvb.slu.se/staff_tordsnall

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] axis and times() problem

2006-12-27 Thread Gabor Grothendieck
Try:

plot(x, y, bty = n, xaxs = i, yaxs = i)

Actually I think there may be a bug here since the axes do not intersect.

On 12/27/06, Knut Krueger [EMAIL PROTECTED] wrote:
 Dear R-Group,
 the first example is working as expected, but I need the plot without
 the box,
 normally no problem, but I am not able to get the x-axis formatted as
 times with the axis, command.
 I tried a lot of things, nothing was working so I used the most easy
 axis command in the second example here 

 # working
  library(chron) # for times()
  library(graphics)# for axis
par(cex=1.2,lwd=1)
  x - c(times(12:15:00),times(15:30:00))
y - c(1,5)
plot(x, y, type=n,adj=0, asp=0, xlab=, ylab=,font.axis=2,yaxt='n')

 # axis() command problem:
par(cex=1.2,lwd=1)
  x - c(times(12:15:00),times(15:30:00))
y - c(1,5)
plot(x, y,axes=FALSE, type=n,adj=0, asp=0, xlab=,
 ylab=,font.axis=2,yaxt='n')
  axis(1)


 Maybe anybody could help me to disable the box around the plot and get
 the x-axis formatted as times

 Regards Knut

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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] slightly inconsistent behavior

2006-12-27 Thread Prof Brian Ripley
What do you think is `slightly inconsistent behavior' here?  (You seem to 
be quite consistent in not telling us such relevant facts, including your 
OS and version of R!)

If you think that the memory usage of R should be monotone in the size of 
the problem, your expectations are unfounded.  Here it is likely you are 
seeing memory fragmentation on a 32-bit OS: see help(Memory-limits).

But setting nrows= and 'extend nrows by a few more 9's' seems to 
me suggesting something like nrows=99 which is invalid and gives
a warning message you did not mention.

On Tue, 26 Dec 2006, ivo welch wrote:

 dear R experts:

 This is just a minor, minor nuisance, but I thought I would point it out:

 dataset - read.table(file=pipe(cmdline), header =T,
 +   na.strings=c(NaN, C,I,M, E), sep=,,
 as.is=T, nrows=);
 Error: cannot allocate vector of size 781249 Kb

 If I extend nrows by a few more 9's, the error goes away.  Similarly,
 if I use much fewer observations, the error goes away.

 regards,

 /iaw

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

PLEASE do, at long last.

-- 
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] building R-package under windows - error - in options(deafultPackages) was not found

2006-12-27 Thread Uwe Ligges
Given the lines after Description: have been wrapped during e-mail 
transfer and are in one line in your DESCRIPTION file, here are two guesses:
- You have some additional library added that contains a broken 
installation of some base package?
- You have declared some non-existing default packages in some Rprofile 
or whereever that are not existing?

Anyway, you might want to send the whole package in a private message.

Uwe Ligges



Daniel Berg wrote:
 I have tried to uninstall R-2.4.1 and reinstall it but I still get the same
 error message. I have also tried reinstalling both mingw and perl, both 
 with
 no effect.
 
 My DESCRIPTION file:
 
 Package: copulaGOF
 Type: Package
 Title: Copula simulation, estimation and goodness-of-fit
 Version: 1.5
 Date: 2006-12-15
 Author: Daniel Berg, Henrik Bakken (Norwegian Computing Center)
 Depends: adapt, copula, fBasics, mnormt, mvtnorm, scatterplot3d, sn
 Maintainer: Daniel Berg [EMAIL PROTECTED]
 URL: www.danielberg.no
 Description: Functions for copula simulation, estimation and 
 goodness-of-fit
 testing. Includes functions for simulating and estimating higher 
 dimensional
 distributions.
 License: GPL Version 2 or later, GSL-1.6
 
 and the error message read:
 $ Rcmd build --binary copulaGOF
 * checking for file 'copulaGOF/DESCRIPTION' ... OK
 * preparing 'copulaGOF' :
 * checking DESCRIPTION meta-information ... ERROR
 During startup - Warning messages:
 '  in: library(package, lib.loc = lib.loc, character.only = TRUE, logical =
 TRUE,
 in options(defaultPackages) was not found
 
 I don't have access to binaries of older versions of R now but will try 
 with
 older version after the holidays to see if this has an effect.
 
 Regards,
 Daniel
 
 On 12/23/06, Brian Ripley [EMAIL PROTECTED] wrote:

 On Sat, 23 Dec 2006, Uwe Ligges wrote:

 
 
  Daniel Berg wrote:
  Dear all,
 
  I have been building R packages under windows on my old pc,
 successfully.
  Now I have bought a new pc, still running windows, and I am trying to
 build
  the same R packages as before, but now without the same success. I 
 have
  installed the Rtools, perl, mingw and added them to the environment
  variables.
  I am running Windows XP Professional on a Thinkpad T60. I have
 installed
  R-2.4.1, ActivePerl 5.8.8 Build 819, MinGW 5.1.2, and I downloaded
  tools.zipfrom
  http://www.murdoch-sutherland.com/Rtools.
 
  I receive the following error message:
 
  $ Rcmd build --binary copulaGOF/
  * checking for file 'mypackage/DESCRIPTION' ... OK
  * preparing 'copulaGOF' :
  * checking DESCRIPTION meta-information ... ERROR
 
  Looks like something is wrong with your DESCRIPTION file. Can you send
  us the contents of that file?

 I think rather with his R: the message below says 'During startup', and
 indicates that one of the default packages is missing.  That would mean
 that it has not got to running the code to look at DESCRIPTION.

 
  Uwe Ligges
 
 
  During startup - Warning messages :
  ' in: library(package, lib.loc = lob.loc, character.only = TRUE,
 logical =
  TRUE,
   in options(defaultPackages) was not found
 
  In my package I have included a zzz.r file that contains the 
 following,
  perhaps this is the cause?
  .First.lib -function (lib, pkg)   {
  library(adapt)
  library(copula)
  library(fBasics)
  library(mvtnorm)
  runif(1)
  library.dynam(mypackage, package=mypackage)
  }
 
  Any help or comments is most welcome. Thank you.
 
  Best wishes,
  Daniel Berg
  -
  danielberg.no
 
   [[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.
 

 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 http://www.stats.ox.ac.uk/%7Eripley/
 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] plotting time series with zoo pckg

2006-12-27 Thread ahmad ajakh
Dear Gabor,
sorry for not posting the code. below I have a piece of code that generates
a multivariate zoo data (3 columns) and graphs it using the axis
commands to generate the labels. This does not work. However, if one
extracts one column the labelling works using the same commands!
I cannot figure out what I am missing here.
Thanks for any suggestion.
AA.
I am using R version 2.4.0 (windows XP) and zoo package version 
1.2-1(2006-09-20).


#-Begin--
# Let's take the previous example to create a simple zoo data.
 z - structure(c(21,34,33,41,39,38,37,28,33,40),
index = structure(c(8044,8051,8058,8065,8072,
8079,8086,8093,8100,8107), class=Date), class = zoo)

# generating 3 random vectors with the same length as z.
jx1 - rnorm(10); jx2 - rnorm(10); jx3 - rnorm(10)
# create a zoo class data using the random vectors.
jx  - cbind(jx1,jx2,jx3)
z1  - zoo(jx, index(z))
# now we just repete the previous example.
plot(z1, xaxt = n)
axis(1, time(z1), lab = FALSE)
jd - time(z1)[seq(1, dim(z1)[[1]], 3)]
axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
# now we extract one column of z1 and graph it with the same axis commands.
z2 - z1[,1, drop = F]
windows()
plot(z2, xaxt = n)
axis(1, time(z2), lab = FALSE)
jd - time(z2)[seq(1, dim(z2)[[1]], 3)]
axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
#---End---

- Original Message 
From: Gabor Grothendieck [EMAIL PROTECTED]
To: ahmad ajakh [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Tuesday, December 26, 2006 11:17:44 PM
Subject: Re: [R] plotting time series with zoo pckg

Please read the last line of every message to r-help and follow that.

On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote:
 Dear Gabor,
 Thank you for your quick reply.
 This solution works for my univariate zoo class time series. I first tried
 it for a timeseries with 4 columns of data, it did not plot the labels nor the
 ticks, I tried it on a one dim timeseries (one column zoo class data as the 
 example
 in the question) and it worked!  is there something that I am missing?
 Thanks again.
 AA.


 - Original Message 
 From: Gabor Grothendieck [EMAIL PROTECTED]
 To: ahmad ajakh [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Tuesday, December 26, 2006 8:31:07 PM
 Subject: Re: [R] plotting time series with zoo pckg

 Try this:


 # test data
 library(zoo)
 z - structure(c(21, 34, 33, 41, 39, 38, 37, 28, 33, 40),
 index = structure(c(8044, 8051, 8058, 8065, 8072, 8079, 8086,
 8093, 8100, 8107), class = Date), class = zoo)
 z

 # plot without X axis
 plot(z, xaxt = n)

 # unlabelled tick at each point
 axis(1, time(z), lab = FALSE)

 # labelled tick every third point
 dd - time(z)[seq(1, length(z), 3)]
 axis(1, dd, as.character(dd), cex.axis = 0.7, tcl = -0.7)



 On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote:
  Hi all,
 
  I am using the zoo package to plot time series. I have a problem with 
  formatting the axes.
  my zoo object (z) looks like the following.
 
 c1
  1992-01-10 21
  1992-01-17 34
  1992-01-24 33
  1992-01-31 41
  1992-02-07 39
  1992-02-14 38
  1992-02-21 37
  1992-02-28 28
  1992-03-06 33
  1992-03-13 40
 
  plot.zoo(z) produces a plot with the labels on the x-axis that I cannot 
  control.
  I want a an xtick every 10 data points with corresponding date labels.
  I have tried different combination of axis command without success
  any idea?
  Thanks
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 




 __
 Do You Yahoo!?

 http://mail.yahoo.com


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


[R] how to suppress a loading required package: ... message

2006-12-27 Thread jacinthe
Hi,

how to suppress a loading required package:...  message?

Kind regards

Jaci
--

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 suppress a loading required package: ... message

2006-12-27 Thread BBands
On 12/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

 how to suppress a loading required package:...  message?

require(package, quiet=TRUE)

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

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

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


[R] Formatting an arry to typeset as a table

2006-12-27 Thread Greg Snow

I am writting some functions that return an array of coefficients
along with confidence intetervals for each coefficient.  My intent is
to eventually typeset the coefficients and intervals into a table (or
tables) in a document.  I would like to use existing tools such as the
'latex' function in the Hmisc package, the 'odfTable' function in
odfWeave package, or 'HTML' in the R2HTML package (or any others that
work similarly).

This is fairly straight forward for 2 dimensional arrays (matrices)
without the confidence intervals, just add the proper dimnames and
call latex or whatever.  In some cases the array is 3 dimensional and
could possibly have 4 dimensions, which complicates things a bit.  If
nothing better presents itself I can use apply to produce several 2
dimensional tables from the higher dimentsional array.

The big complication is that I would like each cell of the final table
to have the coefficient value with the confidence limits below it,
e.g.:

   5.3
(4.2,6.4)

My current thinking is to have a function (possibly a summary method)
that takes the output from my functions and returns something that
could be passed directly to the latex, odfTable, etc. functions:

 myobj - myfunc(myargs)
 latex( summary(myobj), file='mytempfile' )

I prefer to use LaTeX, but many of the people I work with are stuck
with MS products so the odf or html options are attractive there.

Does anyone have any suggestions on how best to format the output so
it can be passed to latex and friends?  or will I need to write my own
methods for these functions? (I know enough LaTeX to probably do a
method for latex, but don't have enough knowledge of html or odf to do
the others myself)

Thanks for any suggestions,


[[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] plotting time series with zoo pckg

2006-12-27 Thread Gabor Grothendieck
To do it with plot.zoo one has to create a custom panel.

Another approach is to use xyplot.zoo since that supports custom scales
directly.   Note that the ?xyplot.zoo examples contain code that is along the
lines of the xyplot.zoo solution.

Here are examples of both approaches:

library(zoo)
# test data
z - structure(c(21,34,33,41,39,38,37,28,33,40),
index = structure(c(8044,8051,8058,8065,8072,
8079,8086,8093,8100,8107), class=Date), class = zoo)
set.seed(1) # needed to make it reproducible
jx1 - rnorm(10); jx2 - rnorm(10); jx3 - rnorm(10)
# create a zoo class data using the random vectors.
jx  - cbind(jx1,jx2,jx3)
z1  - zoo(jx, index(z))


# 1. plot.zoo solution using custom panel function, my.panel
my.panel - function(...) {
   lines(...)
   if (parent.frame()$j == ncol(z1)) {
  # following line only if non-labelled ticks wanted for each point
  axis(1, at = time(z1), lab = FALSE)
  ix - seq(1, length(z1), 3)
  labs - format(time(z1)[ix], %b-%d)
  axis(1, at = time(z1)[ix], lab = labs, tcl = -0.7, cex.axis = 0.7)
   }
}
plot(z1, panel = my.panel, xaxt = n)

# 2. xyplot.zoo solution
# z1 is from above

library(lattice)
ix - seq(1, length(z1), 3)
labs - format(time(z1)[ix], %b-%d)
xyplot(z1, scales = list(x = list(at = time(z1)[ix], labels = labs)))

# only need following if non-labelled ticks are to be added for each point
trellis.focus(panel, 1, 1, clip.off = TRUE)
panel.axis(bottom, check.overlap = TRUE, outside = TRUE, labels = FALSE,
   tck = .7, at = time(z1))
trellis.unfocus()


On 12/27/06, ahmad ajakh [EMAIL PROTECTED] wrote:
 Dear Gabor,
 sorry for not posting the code. below I have a piece of code that generates
 a multivariate zoo data (3 columns) and graphs it using the axis
 commands to generate the labels. This does not work. However, if one
 extracts one column the labelling works using the same commands!
 I cannot figure out what I am missing here.
 Thanks for any suggestion.
 AA.
 I am using R version 2.4.0 (windows XP) and zoo package version 
 1.2-1(2006-09-20).


 #-Begin--
 # Let's take the previous example to create a simple zoo data.
  z - structure(c(21,34,33,41,39,38,37,28,33,40),
index = structure(c(8044,8051,8058,8065,8072,
8079,8086,8093,8100,8107), class=Date), class = zoo)

 # generating 3 random vectors with the same length as z.
 jx1 - rnorm(10); jx2 - rnorm(10); jx3 - rnorm(10)
 # create a zoo class data using the random vectors.
 jx  - cbind(jx1,jx2,jx3)
 z1  - zoo(jx, index(z))
 # now we just repete the previous example.
 plot(z1, xaxt = n)
 axis(1, time(z1), lab = FALSE)
 jd - time(z1)[seq(1, dim(z1)[[1]], 3)]
 axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
 # now we extract one column of z1 and graph it with the same axis commands.
 z2 - z1[,1, drop = F]
 windows()
 plot(z2, xaxt = n)
 axis(1, time(z2), lab = FALSE)
 jd - time(z2)[seq(1, dim(z2)[[1]], 3)]
 axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
 #---End---

 - Original Message 
 From: Gabor Grothendieck [EMAIL PROTECTED]
 To: ahmad ajakh [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Tuesday, December 26, 2006 11:17:44 PM
 Subject: Re: [R] plotting time series with zoo pckg

 Please read the last line of every message to r-help and follow that.

 On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote:
  Dear Gabor,
  Thank you for your quick reply.
  This solution works for my univariate zoo class time series. I first tried
  it for a timeseries with 4 columns of data, it did not plot the labels nor 
  the
  ticks, I tried it on a one dim timeseries (one column zoo class data as the 
  example
  in the question) and it worked!  is there something that I am missing?
  Thanks again.
  AA.
 
 
  - Original Message 
  From: Gabor Grothendieck [EMAIL PROTECTED]
  To: ahmad ajakh [EMAIL PROTECTED]
  Cc: r-help@stat.math.ethz.ch
  Sent: Tuesday, December 26, 2006 8:31:07 PM
  Subject: Re: [R] plotting time series with zoo pckg
 
  Try this:
 
 
  # test data
  library(zoo)
  z - structure(c(21, 34, 33, 41, 39, 38, 37, 28, 33, 40),
  index = structure(c(8044, 8051, 8058, 8065, 8072, 8079, 8086,
  8093, 8100, 8107), class = Date), class = zoo)
  z
 
  # plot without X axis
  plot(z, xaxt = n)
 
  # unlabelled tick at each point
  axis(1, time(z), lab = FALSE)
 
  # labelled tick every third point
  dd - time(z)[seq(1, length(z), 3)]
  axis(1, dd, as.character(dd), cex.axis = 0.7, tcl = -0.7)
 
 
 
  On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote:
   Hi all,
  
   I am using the zoo package to plot time series. I have a problem with 
   formatting the axes.
   my zoo object (z) looks like the following.
  
  c1
   1992-01-10 21
   1992-01-17 34
   1992-01-24 33
   1992-01-31 41
   1992-02-07 39
   1992-02-14 38
   1992-02-21 37
   

Re: [R] stacked plots

2006-12-27 Thread Gabor Grothendieck
If this is time series data try

library(zoo)
example(plot.zoo)
example(xyplot.zoo)

to see if any of those fit your requirements.

On 12/27/06, BBands [EMAIL PROTECTED] wrote:
 Dear helpeRs,

 Is there a better method of producing stacked charts than
 par(mfrow(3,1)), plot(x), plot(y), plot(z)? What I would like to do is
 produce a chart of several panes stacked vertically with no space
 between them so they appeared to be a single figure. I've attached a
 small example, though it is not clear that it will make it, as the
 posting guide doesn't say which sort of images are allowed--it is a
 gif. My data will be in zoo objects like those from get.hist.quote()
 with the data for the extra panes in additional columns.

 Thanks in advance,

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

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


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




__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] stacked plots

2006-12-27 Thread Dirk Eddelbuettel

John,

On 27 December 2006 at 08:36, BBands wrote:
| Dear helpeRs,
| 
| Is there a better method of producing stacked charts than
| par(mfrow(3,1)), plot(x), plot(y), plot(z)? What I would like to do is
| produce a chart of several panes stacked vertically with no space
| between them so they appeared to be a single figure. I've attached a
| small example, though it is not clear that it will make it, as the
| posting guide doesn't say which sort of images are allowed--it is a
| gif. My data will be in zoo objects like those from get.hist.quote()
| with the data for the extra panes in additional columns.

Do you remember the bollingerBands example we worked on a few years ago and
that is still at Romain's incredible R Graph Gallery at
  http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=65

It uses layout, you can also use the simpler par(mfrow=...) approach *if* you
also reduce bottom and top spacing accordingly as e.g. in the plot functions
in the script referenced above.

Cheers, 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] counties in different colours using map()

2006-12-27 Thread Mihai Nica
since dr. bivand seems to be away, i will try to help a little :-) 

i did not work with the database that comes with maps, but with shapefiles from 
http://www.census.gov/geo/www/cob/co2000.html#shp. you need to merge the 
dataframe that you have with the shapefile. 

do you have access to gis software? the merging can be done with r but it is 
quite cumbersome. 

The road to plot the map could be:

_
require(maptools)
a=read.shape(your_merged_file.shp, dbf.data=TRUE, verbose=TRUE)
attach(a)
win.graph(width=5,height=3, pointsize=8)
plot.Map(a, auxvar=the_variable_to_plot_from_dbf_file, xlab= , ylab= ,
 ol=NA)
__
 
more about this at: http://cran.r-project.org/src/contrib/Views/Spatial.html

hth,
 
Mihai Nica
170 East Griffith St. G5
Jackson, MS 39201
601-914-0361

- Original Message 
From: Tord Snäll [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Wednesday, December 27, 2006 5:12:04 AM
Subject: [R] counties in different colours using map()

Hi,
I would like to plot a map of US counties using different colors. map() 
seems to be the function to use, e.g.
library(maps); map('usa'); map('county', 'colorado', add=T,fill = T, 
col=c(1:5))
plots Colorado counties using colours 1 to 5.

However, I want each color to represent a certain value - a value to be 
picked from a data frame.
This code should show a correspoding map at the level of states:
state.names - system('tr [A-Z] [a-z]', state.name)
map.states - unix('sed s/:.*//', map(names=T,plot=F))
state.to.map - match(map.states, state.names)
color- votes.repub[state.to.map, votes.year = 1900] / 100
map('state', fill=T, col=color); map('state', add=T)
It is copied from page 6 in
Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell 
Laboratories Statistics Research Report [93.2], 1993.
http://public.research.att.com/areas/stat/doc/93.2.ps

I also wonder whether the county names are available in the database 
used by map(), and, if yes, how to extract or utilize them.

Thanks!

Tord

-- 

Tord Snäll
Department of Conservation Biology
Swedish University of Agricultural Sciences (SLU)
P.O. 7002, SE-750 07 Uppsala, Sweden
Office/Mobile/Fax
+46-18-672612/+46-730-891356/+46-18-673537
E-mail: [EMAIL PROTECTED]
www.nvb.slu.se/staff_tordsnall

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






__



[[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 suppress a loading required package: ... message

2006-12-27 Thread Dirk Eddelbuettel

On 27 December 2006 at 08:52, BBands wrote:
| On 12/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
|  Hi,
| 
|  how to suppress a loading required package:...  message?
| 
| require(package, quiet=TRUE)

Some packages insist on talking even when they are asked to be quiet, in
which case I have also resorted to wrapping sink() around the loading:

 sink(/dev/null)
 library(Hmisc)
 sink()
 cat(Hi again\n)
Hi again
 

Hth, 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] how to suppress a loading required package: ... message

2006-12-27 Thread Gabor Grothendieck
Or try:

   invisible(capture.output(library(Hmisc)))




On 12/27/06, Dirk Eddelbuettel [EMAIL PROTECTED] wrote:

 On 27 December 2006 at 08:52, BBands wrote:
 | On 12/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 |  Hi,
 | 
 |  how to suppress a loading required package:...  message?
 |
 | require(package, quiet=TRUE)

 Some packages insist on talking even when they are asked to be quiet, in
 which case I have also resorted to wrapping sink() around the loading:

 sink(/dev/null)
 library(Hmisc)
 sink()
 cat(Hi again\n)
Hi again


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


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] stacked plots

2006-12-27 Thread BBands
On 12/27/06, Dirk Eddelbuettel [EMAIL PROTECTED] wrote:
 Do you remember the bollingerBands example we worked on a few years ago and
 that is still at Romain's incredible R Graph Gallery at
   http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=65

 It uses layout, you can also use the simpler par(mfrow=...) approach *if* you
 also reduce bottom and top spacing accordingly as e.g. in the plot functions
 in the script referenced above.

I do indeed remember that, it was a nice piece of work that I learned
a lot from. At the time you mentioned there were some newer methods in
the works that might serve better, which prompted my question after an
appropriate delay. ;-)

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

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

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


Re: [R] stacked plots

2006-12-27 Thread ahmad ajakh
Hi John,

I cannot see the attached file but if you read the vignette of the zoo package
there is an example with Lucent stock price (High Low Open Close) doing what 
you want.
the command plot(z) (z being the zoo multivariate object) produces the graph 
that
you want I guess. Also there are some posts today on how to label them.
good luck
AA.

- Original Message 
From: BBands [EMAIL PROTECTED]
To: R-Help r-help@stat.math.ethz.ch
Sent: Wednesday, December 27, 2006 11:36:00 AM
Subject: [R] stacked plots

Dear helpeRs,

Is there a better method of producing stacked charts than
par(mfrow(3,1)), plot(x), plot(y), plot(z)? What I would like to do is
produce a chart of several panes stacked vertically with no space
between them so they appeared to be a single figure. I've attached a
small example, though it is not clear that it will make it, as the
posting guide doesn't say which sort of images are allowed--it is a
gif. My data will be in zoo objects like those from get.hist.quote()
with the data for the extra panes in additional columns.

Thanks in advance,

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

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

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 suppress a loading required package: ... message

2006-12-27 Thread Frank E Harrell Jr
Dirk Eddelbuettel wrote:
 On 27 December 2006 at 08:52, BBands wrote:
 | On 12/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 |  Hi,
 | 
 |  how to suppress a loading required package:...  message?
 | 
 | require(package, quiet=TRUE)
 
 Some packages insist on talking even when they are asked to be quiet, in
 which case I have also resorted to wrapping sink() around the loading:
 
sink(/dev/null)
library(Hmisc)

For that one, do options(Hverbose=FALSE) before library(Hmisc)

Frank

sink()
cat(Hi again\n)
   Hi again

 
 Hth, Dirk
 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 write string dynamicly?

2006-12-27 Thread Feng Qiu
Hi everyone:
 I'm trying to compose a string dynamicly for the parameter input of 
some function. For example:
In package MASS, function lda() require to input the name of predictor 
variable. Let's say the 16th column is the predictor variable. Then we call 
the function like this: lda(V16~., data=mydata). I don't want to hard-code 
the call, instead, I would like to use a dynamic expression for this 
parameter so that I can use my program on different set of data.
I guess there are some function that can do this, but I didn't find 
it in Introduction to R so far, could someone please tell me this kind of 
function? Thank you!

Best,

Feng

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Consensus Fork Index

2006-12-27 Thread Taiwo Ojurongbe
Dear All,

I am trying to automate series of dendrograms for
binary data in R as well as calculate the Consensus
Fork Index (Colless' index). I'll appreciate any
assistance with regards to this.

Thank you and best regards,

Taiwo

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 debug R program?

2006-12-27 Thread Feng Qiu


 Hi everyone:
   I wrote a R program which has loops. When I run the program, it 
 crashed. I would like to identify in which loop the pragram crashed, how 
 can I debug ?  I'm new to R, could somebody please give me a general idea 
 about debugging in R.(I'm a C/C++ programmer and have general knowledge 
 about program debugging.)
  Thank you!

 Best,

 Feng


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] model comparison + use of offset in glmmPQL

2006-12-27 Thread wayne hallstrom
Hi,
  I have 2 questions.
   
  First - is it possible to use the offset term in a glmmPQL formula rather 
than transforming the variables in the dataset beforehand?
   
  Second - how do you compare the output/fit of 2 models produced through 
glmmPQL if you can't use the Anova(model1, model2, test=) method? 
   

 __



[[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] Question about predict function

2006-12-27 Thread Thomas L Jones
I am working with a non-parametic smoothing operation using a 
Generalized Additive Model. It is a bivariate data set. I know how to 
do the smooth, and out comes a nice smooth curve.

Now I want to find the value of the smoothed curve for several values 
of x (the abscissa). This can be done (please correct me if I am 
wrong) by using the predict.gam function. You feed the predict.gam 
function a data frame, telling it what you want.

Let's start with the predict.gam function. Are you supposed to be able 
to look up how to use it? E.g., what goes into the various columns of 
the data frame? I do have a working function call for predict. It 
says:

pred_out - predict (mod, data.frame (x = x), type = response)

(mod is the model)

Now, if you tell me that x = x, I will believe you. But what is meant 
by data.frame (x = x), I know not.

Or would it better to call the class, names, and str functions, using 
some well chosen objects?

Tom Jones

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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-help Digest, Vol 46, Issue 27

2006-12-27 Thread Grant Izmirlian
On Wednesday 27 December 2006 06:00, [EMAIL PROTECTED] wrote:
 jingjiangyan

I agree, you can use 'assign'. To be more explicit, you could use the 
following function. 

jingjiangyan - 
function(formula, data)
{
  m - match.call()
  %,% - function(x,y)paste(x,y,sep=)
  d.nm - as.character(m$data)
  y.nm - as.character(formula[[2]])
  x.nm - as.character(formula[[3]])
  for(i in levels(data[[x.nm]])){
var.name - d.nm %,% . %,% i
var.val - data[[y.nm]][data[[x.nm]]==i]
cmd - var.name %,%  -  %,% var.val
eval(cmd)
assign(var.name, var.val, globalenv())
  }
}

Next, assuming the data.frame listed in the previous posting, 'df' 
exists in your workspace, the call 

  jingjiangyan(bb ~ aa, data=df)

would produce the desired results.

Cheers,
Grant Izmirlian
-- 
Հրանդ Իզմիրլյան

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 write string dynamicly?

2006-12-27 Thread Gabor Grothendieck
Try:

lda(iris[-5], iris[,5])

On 12/26/06, Feng Qiu [EMAIL PROTECTED] wrote:
 Hi everyone:
 I'm trying to compose a string dynamicly for the parameter input of
 some function. For example:
 In package MASS, function lda() require to input the name of predictor
 variable. Let's say the 16th column is the predictor variable. Then we call
 the function like this: lda(V16~., data=mydata). I don't want to hard-code
 the call, instead, I would like to use a dynamic expression for this
 parameter so that I can use my program on different set of data.
I guess there,- are some function that can do this, but I didn't find
 it in Introduction to R so far, could someone please tell me this kind of
 function? Thank you!

 Best,

 Feng

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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] vectorizing an iterative process.

2006-12-27 Thread Martin Maechler
 Geoffrey == Geoffrey Zhu [EMAIL PROTECTED]
 on Tue, 26 Dec 2006 10:05:55 -0600 writes:

Geoffrey I meant  x[i] - x[i-1] + y[i-1] and Y[i] - y[i-1] + x[i] below.
Geoffrey The mailing list software just keep adding 3D's. Sorry. 

It's not the mailing list software - not per se at least.
Rather it's your own e-mail software's behavior (maybe in
conjunction with our (i.e. r-help's) mail server software configuration)
If I write
   x[i] = x[i-i]
then I'm pretty sure you won't get an extra 3D when you'll
read it.

Regards
Martin Maechler
ETH Zurich (where the R-help list is running from)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 time series with zoo pckg

2006-12-27 Thread ahmad ajakh
Thank you Gabor. This is very helpful.
AA.

- Original Message 
From: Gabor Grothendieck [EMAIL PROTECTED]
To: ahmad ajakh [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Wednesday, December 27, 2006 12:08:41 PM
Subject: Re: [R] plotting time series with zoo pckg

To do it with plot.zoo one has to create a custom panel.

Another approach is to use xyplot.zoo since that supports custom scales
directly.   Note that the ?xyplot.zoo examples contain code that is along the
lines of the xyplot.zoo solution.

Here are examples of both approaches:

library(zoo)
# test data
z - structure(c(21,34,33,41,39,38,37,28,33,40),
index = structure(c(8044,8051,8058,8065,8072,
8079,8086,8093,8100,8107), class=Date), class = zoo)
set.seed(1) # needed to make it reproducible
jx1 - rnorm(10); jx2 - rnorm(10); jx3 - rnorm(10)
# create a zoo class data using the random vectors.
jx  - cbind(jx1,jx2,jx3)
z1  - zoo(jx, index(z))


# 1. plot.zoo solution using custom panel function, my.panel
my.panel - function(...) {
   lines(...)
   if (parent.frame()$j == ncol(z1)) {
  # following line only if non-labelled ticks wanted for each point
  axis(1, at = time(z1), lab = FALSE)
  ix - seq(1, length(z1), 3)
  labs - format(time(z1)[ix], %b-%d)
  axis(1, at = time(z1)[ix], lab = labs, tcl = -0.7, cex.axis = 0.7)
   }
}
plot(z1, panel = my.panel, xaxt = n)

# 2. xyplot.zoo solution
# z1 is from above

library(lattice)
ix - seq(1, length(z1), 3)
labs - format(time(z1)[ix], %b-%d)
xyplot(z1, scales = list(x = list(at = time(z1)[ix], labels = labs)))

# only need following if non-labelled ticks are to be added for each point
trellis.focus(panel, 1, 1, clip.off = TRUE)
panel.axis(bottom, check.overlap = TRUE, outside = TRUE, labels = FALSE,
   tck = .7, at = time(z1))
trellis.unfocus()


On 12/27/06, ahmad ajakh [EMAIL PROTECTED] wrote:
 Dear Gabor,
 sorry for not posting the code. below I have a piece of code that generates
 a multivariate zoo data (3 columns) and graphs it using the axis
 commands to generate the labels. This does not work. However, if one
 extracts one column the labelling works using the same commands!
 I cannot figure out what I am missing here.
 Thanks for any suggestion.
 AA.
 I am using R version 2.4.0 (windows XP) and zoo package version 
 1.2-1(2006-09-20).


 #-Begin--
 # Let's take the previous example to create a simple zoo data.
  z - structure(c(21,34,33,41,39,38,37,28,33,40),
index = structure(c(8044,8051,8058,8065,8072,
8079,8086,8093,8100,8107), class=Date), class = zoo)

 # generating 3 random vectors with the same length as z.
 jx1 - rnorm(10); jx2 - rnorm(10); jx3 - rnorm(10)
 # create a zoo class data using the random vectors.
 jx  - cbind(jx1,jx2,jx3)
 z1  - zoo(jx, index(z))
 # now we just repete the previous example.
 plot(z1, xaxt = n)
 axis(1, time(z1), lab = FALSE)
 jd - time(z1)[seq(1, dim(z1)[[1]], 3)]
 axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
 # now we extract one column of z1 and graph it with the same axis commands.
 z2 - z1[,1, drop = F]
 windows()
 plot(z2, xaxt = n)
 axis(1, time(z2), lab = FALSE)
 jd - time(z2)[seq(1, dim(z2)[[1]], 3)]
 axis(1,jd, as.character(jd),cex.axis = 0.8, tcl = -0.7, las = 2)
 #---End---

 - Original Message 
 From: Gabor Grothendieck [EMAIL PROTECTED]
 To: ahmad ajakh [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Tuesday, December 26, 2006 11:17:44 PM
 Subject: Re: [R] plotting time series with zoo pckg

 Please read the last line of every message to r-help and follow that.

 On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote:
  Dear Gabor,
  Thank you for your quick reply.
  This solution works for my univariate zoo class time series. I first tried
  it for a timeseries with 4 columns of data, it did not plot the labels nor 
  the
  ticks, I tried it on a one dim timeseries (one column zoo class data as the 
  example
  in the question) and it worked!  is there something that I am missing?
  Thanks again.
  AA.
 
 
  - Original Message 
  From: Gabor Grothendieck [EMAIL PROTECTED]
  To: ahmad ajakh [EMAIL PROTECTED]
  Cc: r-help@stat.math.ethz.ch
  Sent: Tuesday, December 26, 2006 8:31:07 PM
  Subject: Re: [R] plotting time series with zoo pckg
 
  Try this:
 
 
  # test data
  library(zoo)
  z - structure(c(21, 34, 33, 41, 39, 38, 37, 28, 33, 40),
  index = structure(c(8044, 8051, 8058, 8065, 8072, 8079, 8086,
  8093, 8100, 8107), class = Date), class = zoo)
  z
 
  # plot without X axis
  plot(z, xaxt = n)
 
  # unlabelled tick at each point
  axis(1, time(z), lab = FALSE)
 
  # labelled tick every third point
  dd - time(z)[seq(1, length(z), 3)]
  axis(1, dd, as.character(dd), cex.axis = 0.7, tcl = -0.7)
 
 
 
  On 12/26/06, ahmad ajakh [EMAIL PROTECTED] wrote:
   Hi all,
  
   I am using the zoo package to plot time 

Re: [R] Question about predict function

2006-12-27 Thread Chuck Cleland
Thomas L Jones wrote:
 I am working with a non-parametic smoothing operation using a 
 Generalized Additive Model. It is a bivariate data set. I know how to 
 do the smooth, and out comes a nice smooth curve.
 
 Now I want to find the value of the smoothed curve for several values 
 of x (the abscissa). This can be done (please correct me if I am 
 wrong) by using the predict.gam function. You feed the predict.gam 
 function a data frame, telling it what you want.
 
 Let's start with the predict.gam function. Are you supposed to be able 
 to look up how to use it? E.g., what goes into the various columns of 
 the data frame? I do have a working function call for predict. It 
 says:
 
 pred_out - predict (mod, data.frame (x = x), type = response)
 
 (mod is the model)
 
 Now, if you tell me that x = x, I will believe you. But what is meant 
 by data.frame (x = x), I know not.
 
 Or would it better to call the class, names, and str functions, using 
 some well chosen objects?

  Does this help?

library(gam)
data(kyphosis)

kyphosis.gam - gam(Kyphosis ~ s(Age,4) + Number, family = binomial,
data=kyphosis)

predict(kyphosis.gam, data.frame(Age = c(10,100,200), Number = 3),
type=response)

  1   2   3
0.019098701 0.248043366 0.005807921

  The data frame should contain the predictor variables in the model and
the values for the variables should be those at which you want a prediction.

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

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

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


Re: [R] counties in different colours using map()

2006-12-27 Thread Earl F. Glynn
The following example shows how to get/display the county names:

library(maps)

# Get County Data
m - map('county', 'colorado', plot=FALSE)
names(m)
m$names   # State,County names

# The names appear to be in alphabetical order by state, e.g.:
 m$names[1:3]
[1] colorado,adamscolorado,alamosa  colorado,arapahoe

# Show county names on map
map.text('county', 'colorado', proj='bonne', param=45)

# Show county indices on map
map.text('county', 'colorado', proj='bonne', param=45, 
labels=paste(1:length(m$names)))

#or perhaps
map.text('county', 'colorado', proj='bonne', param=45, 
labels=paste(1:length(m$names)), col=1:length(m$names))


You can use your own labels vector above to show county abbreviations 
instead of full names, or other info, if desired.

Once you get the mapping of the counties, you can connect to other sources 
of information.

efg

Tord Snäll [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hi,
I would like to plot a map of US counties using different colors. map()
seems to be the function to use, e.g.
library(maps); map('usa'); map('county', 'colorado', add=T,fill = T,
col=c(1:5))
plots Colorado counties using colours 1 to 5.

However, I want each color to represent a certain value - a value to be
picked from a data frame.
This code should show a correspoding map at the level of states:
state.names - system('tr [A-Z] [a-z]', state.name)
map.states - unix('sed s/:.*//', map(names=T,plot=F))
state.to.map - match(map.states, state.names)
color- votes.repub[state.to.map, votes.year = 1900] / 100
map('state', fill=T, col=color); map('state', add=T)
It is copied from page 6 in
Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell
Laboratories Statistics Research Report [93.2], 1993.
http://public.research.att.com/areas/stat/doc/93.2.ps

I also wonder whether the county names are available in the database
used by map(), and, if yes, how to extract or utilize them.

Thanks!

Tord

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Google Desktop Search and R script files

2006-12-27 Thread Farrel Buchinsky
I want to be able to search my saved R script files on my hard drive.
Thankfully the files are all saved with the .R filename extension which
means that filetype:R in the Google Desktop Search (GDS) box limits the
search to those files. Unfortunately if I put any other term in the search
box (for example, hist to find scripts where I have created a histogram)
then GDS does not find it. It only seems to index based on the filename and
not on the contents of the file. So for instance, if I had a file called
HistAnalysis.R then the search filetype:R hist would find it.

Google web based search is working correctly (As somebody pointed out
previously). I am only having the problem with GDS. Has anyone succeeded
with what I am attempting to do.

-- 
Farrel Buchinsky

[[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] Google Desktop Search and R script files

2006-12-27 Thread bogdan romocea
If you're on Windows switch to
http://www.copernic.com/en/products/desktop-search/index.html ,
last time I looked it was quite a lot better than Google Desktop Search.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Farrel
 Buchinsky
 Sent: Wednesday, December 27, 2006 4:16 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Google Desktop Search and R script files

 I want to be able to search my saved R script files on my hard drive.
 Thankfully the files are all saved with the .R filename
 extension which
 means that filetype:R in the Google Desktop Search (GDS)
 box limits the
 search to those files. Unfortunately if I put any other term
 in the search
 box (for example, hist to find scripts where I have created
 a histogram)
 then GDS does not find it. It only seems to index based on
 the filename and
 not on the contents of the file. So for instance, if I had a
 file called
 HistAnalysis.R then the search filetype:R hist would find it.

 Google web based search is working correctly (As somebody pointed out
 previously). I am only having the problem with GDS. Has
 anyone succeeded
 with what I am attempting to do.

 --
 Farrel Buchinsky

   [[alternative HTML version deleted]]

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


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


[R] Help with histograms

2006-12-27 Thread sloan jones

I would like to make one histogram combining two value vectors. One vector has 
more than 50 entries and the other only has 16. Both vectors contain dates in 
the POSIXct format. I need to be able to highlight the 16 entries from the 
smaller data set. 

Is it possible to do this with the hist function? Which function should I use?

Sloan

-- 
___
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

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


Re: [R] Google Desktop Search and R script files

2006-12-27 Thread Richard M. Heiberger
Go to the gooogle desktop preferences page and install
Larry's Any Text File Indexer 1.00 by Larry Gadea (Index any file extension 
specified as plaintext)

then tell it to search the .R and other extensions as plaintext.
Google will then index all indicated files on your harddisk and will
find them very fast.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Google Desktop Search and R script files

2006-12-27 Thread Farrel Buchinsky
Wonderful. I did it and it works perfectly. Thanks a lot.

Richard M. Heiberger [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Go to the gooogle desktop preferences page and install
 Larry's Any Text File Indexer 1.00 by Larry Gadea (Index any file 
 extension specified as plaintext)

 then tell it to search the .R and other extensions as plaintext.
 Google will then index all indicated files on your harddisk and will
 find them very fast.

-- 
Farrel Buchinsky, MD
Pediatric Otolaryngologist
Allegheny General Hospital
Pittsburgh, PA

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Google Desktop Search and R script files

2006-12-27 Thread Farrel Buchinsky
Thank you for your advice. I have read quite a bit about Copernic Desktop 
Search. Nevertheless, I chose not to download yet another indexing program. 
I am very happy with Google Desktop Search and particularly how well it 
integrates with many other features. Therefore, when I saw the reply to my 
original posting that allowed me to simply download a GDS add-on, I decided 
to go with that.


bogdan romocea [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 If you're on Windows switch to
 http://www.copernic.com/en/products/desktop-search/index.html ,
 last time I looked it was quite a lot better than Google Desktop Search.

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


Re: [R] Help with histograms

2006-12-27 Thread Greg Snow

If you look at the help for the tkBrush function in the TeachingDemos package, 
the examples show the definition of a function called colhist.  That function 
may do what you want.

Hope this helps,

-Original Message-
From: [EMAIL PROTECTED] on behalf of sloan jones
Sent: Wed 12/27/2006 2:49 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Help with histograms
 

I would like to make one histogram combining two value vectors. One vector has 
more than 50 entries and the other only has 16. Both vectors contain dates in 
the POSIXct format. I need to be able to highlight the 16 entries from the 
smaller data set. 

Is it possible to do this with the hist function? Which function should I use?

Sloan

-- 
___
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

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


[[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 test difference in my case?

2006-12-27 Thread Xu Yuan
hello all,

I wonder if anyone could give me a hint on which statistical technique
I should use and how to carry it out in R in my case. Thanks in
advance.

My data is composed of two columns, the same numerical variable
(continuous) from actual measurement and model prediction. My
objective is to compare the data agreement (if there is significant
difference) and make conclusions about the model efficiency. Since the
measured and predicted variable was based on the same unit, the first
test came into my mind was paired t-test. However, the paired
difference is not normal (p-value = 0.0048 from SAS proc univariate).
In this case, I can either do a wilcoxon signed-rank test or do
transformations about the data. I was told that wilcoxon signed-rank
test is not as widely recognized as paired t-test in the literature,
so I prefer to do transformation. My question is: do I need to do
transformations on both columns of original data, or just the paired
difference? What transformation is appropriate? I thought about log
transformation, but if I find significant (or no significant)
difference between the logged data (measured and predicted), can I say
there is significant (or no significant) difference between the
original data?


After this step of analysis, I will convert the continuous numerical
data into qualitative categorical ranking (value=1, 2, 3 and 4). Which
statistical test and R command should I use to compare the ranking
agreement between the actual measurement and prediction?

Thank you very much for helping me out. I haven't slept since a long
time ago and this is kind of emergency. If there is any confusion
about my description, please let me know.

Regards,
XY

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


Re: [R] Query regarding linking R with Matlab

2006-12-27 Thread Henrik Bengtsson
Hi.

From what you tell me you manage to start Matlab in the background by calling:

  Matlab$startServer()

but that R fails to connect to Matlab by:

  matlab - Matlab(host=localhost, port=9998)
  if (!open(matlab))
throw(Matlab server is not running: waited 30 seconds.)

Sorry for not being explicit enough; if no port is given,
Matlab$startServer() will setup up Matlab to listen to port  (as
explained in the help), but then you try to communicate with it via
port 9998.  I realize that the example might be a bit confusing since
it is using port 9998 (for the purpose of illustrating the fact that
you can choose another port).

Either try the above with   Matlab$startServer(port=9998), *or*, maybe simpler:

  Matlab$startServer()
  matlab - Matlab(host=localhost)
  if (!open(matlab))
throw(Matlab server is not running: waited 30 seconds.)

Does this work for you?

Henrik

On 12/27/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote:

  library(R.matlab)
 Loading required package: R.oo
 R.oo v1.2.3 (2006-09-07) successfully loaded. See ?R.oo for help.
 R.matlab v1.1.2 (2006-05-08) successfully loaded. See ?R.matlab for help.

  help(Matlab)

  Matlab$startServer()Loading required package: R.utils
 R.utils v0.8.0 (2006-08-21) successfully loaded. See ?R.utils for help.
 [1] 0
 // Here a Matlab window opened but that window couldnot be maximized.

  matlab - Matlab(host=localhost, port=9998)

  matlab
 [1] Matlab: The Matlab host is 'localhost' and communication goes via port
 9998. Objects are passed via the local file system (remote=FALSE). The
 connection to the Matlab server is closed (not opened).

  setVerbose(matlab, -2)

  open(matlab)
 Opens a blocked connection to host 'localhost' (port 9998)...
  Try #0.
  Try #1.
  Try #2.
  Try #3.
  Try #4.
  Try #5.
  Try #6.
  Try #7.
  Try #8.
  Try #9.
  Try #10.
  Try #11.
  Try #12.

 There were 12 warnings (use warnings() to see them)
 Opens a blocked connection to host 'localhost' (port 9998)...done

  if (!open(matlab))
 +   throw(Matlab server is not running: waited 30 seconds.)
 Opens a blocked connection to host 'localhost' (port 9998)...
  Try #0.
  Try #1.
 // I 'stopped' the computation here
 Warning message:
 localhost:9998 cannot be opened Opens a blocked connection to host
 'localhost' (port 9998)...done

 This is the output obtained after running the commands. Kindly go through
 the above commands and help me identify the problem.

 Regards,
 Bhanu Kalyan K


 Bhanu Kalyan K
 BTech CSE Final Year
 [EMAIL PROTECTED]
 Tel :+91-9885238228

  __
 Do You Yahoo!?
 Tired of spam? Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com

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


Re: [R] R.matlab question

2006-12-27 Thread Henrik Bengtsson
Hi,

a follow up after realizing that you might not have started the Matlab
application to listen on port 9998.  Try:

Matlab$startServer(port=9998)

and then

matlab - Matlab(host=localhost, port=9998)
if (!open(matlab)) throw(Matlab server is not running: waited 30 seconds.)

Does this help?

Henrik

On 12/20/06, Henrik Bengtsson [EMAIL PROTECTED] wrote:
 Hi.

 On 12/20/06, Aimin Yan [EMAIL PROTECTED] wrote:
  Does anyone know how to solve this question about R.matlab?
  I am in windowsXP, my matlab is matlab 7.0.0 19920(R14)
 
  thanks,
 
  Aimin
 
matlab - Matlab(host=localhost, port=9998)
if (!open(matlab)) throw(Matlab server is not running: waited 30 
  seconds.)
  Error in list(throw(Matlab server is not running: waited 30 seconds.) =
  environment,  :
 
  [2006-12-17 22:26:03] Exception: Matlab server is not running: waited 30
  seconds.
 at throw(Exception(...))
 at throw.default(Matlab server is not running: waited 30 seconds.)
 at throw(Matlab server is not running: waited 30 seconds.)
  In addition: There were 30 warnings (use warnings() to see them)
warnings
  function (...)
  UseMethod(warnings)
warnings()
  Warning messages:
  1: localhost:9998 cannot be opened
  2: localhost:9998 cannot be opened
 [snip]
  30: localhost:9998 cannot be opened

 This could be because your firewall is blocking R from connecting
 to Matlab.  Try a few different port numbers.  I recently learned that
 the current default port in R.matlab might not be the best one;
 different port intervals are reserved for different purposes, cf.
 http://www.iana.org/assignments/port-numbers.  That document indicates
 that a port number in [49152, 65535] might be better.  See if this
 helps.  Does someone else knowof a port interval that is more likely
 to work in general?

 You can also tell the Matlab object to report more details what it is
 trying to do by setting the verbosity threshold, i.e.
 setVerbose(matlab, threshold=-1); the lower the threshold the more
 details you'll see.

 Cheers

 Henrik

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


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


Re: [R] How to write string dynamicly?

2006-12-27 Thread talepanda
Generally, you can create formula from string:

 lda(formula(paste(names(iris)[5],~.)),iris)

On 12/28/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Try:

 lda(iris[-5], iris[,5])

 On 12/26/06, Feng Qiu [EMAIL PROTECTED] wrote:
  Hi everyone:
  I'm trying to compose a string dynamicly for the parameter input
 of
  some function. For example:
  In package MASS, function lda() require to input the name of predictor
  variable. Let's say the 16th column is the predictor variable. Then we
 call
  the function like this: lda(V16~., data=mydata). I don't want to hard-code
  the call, instead, I would like to use a dynamic expression for this
  parameter so that I can use my program on different set of data.
 I guess there,- are some function that can do this, but I didn't
 find
  it in Introduction to R so far, could someone please tell me this kind
 of
  function? Thank you!
 
  Best,
 
  Feng
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/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] how to suppress a loading required package: ... message

2006-12-27 Thread Dirk Eddelbuettel


Frank,

On 27 December 2006 at 12:30, Frank E Harrell Jr wrote:
| Dirk Eddelbuettel wrote:
|  On 27 December 2006 at 08:52, BBands wrote:
|  | On 12/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
|  |  how to suppress a loading required package:...  message?
|  | 
|  | require(package, quiet=TRUE)
|  
|  Some packages insist on talking even when they are asked to be quiet, in
|  which case I have also resorted to wrapping sink() around the loading:
|  
|   sink(/dev/null)
|   library(Hmisc)
| 
| For that one, do options(Hverbose=FALSE) before library(Hmisc)

With all due respect, I think you are misguided here. Per-package options for
verbosity strike me as suboptimal. IMHO, if options(verbose) is FALSE, or
if the quiet argument to require() has been given, Hmisc should simply be
quiet.

In any event, Gabor's one-liner is preferable here as it is generic.

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.


[R] Dates in R

2006-12-27 Thread Brian Edward
Hello all,

Can somebody point me to references or provide some code on dealing with
this date issue.  Basically, I have two vectors of values that represent
dates.  I want to convert these values into a date format and subtract the
differences to show elapsed time in days.  More specifically, here is the
example:

Date1  Date2
032398061585
032398061585
111694101994
111694101994
062695021595
051898111597
072495040195
072495040195

The dates are in the mmddyy format, but when I attempt to format these in R
with the function, date.mmddyy(Date1), I get very odd results.  Any help on
this matter would be greatly appreciated!

Thanks in advance,
Brian

[[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] Dates in R

2006-12-27 Thread jim holtman
Try this:

 x - 'Date1  Date2
+ 032398061585
+ 032398061585
+ 111694101994
+ 111694101994
+ 062695021595
+ 051898111597
+ 072495040195
+ 072495040195'
 data.in - read.table(textConnection(x), header=TRUE,
colClasses=c('character', 'character'))
 data.in$Date1 - as.POSIXct(strptime(data.in$Date1, %m%d%y))
 data.in$Date2 - as.POSIXct(strptime(data.in$Date2, %m%d%y))
 data.in$diff - difftime(data.in$Date1, data.in$Date2, units='days')


 data.in
   Date1  Date2 diff
1 1998-03-23 1985-06-15 4664
2 1998-03-23 1985-06-15 4664
3 1994-11-16 1994-10-19   28
4 1994-11-16 1994-10-19   28
5 1995-06-26 1995-02-15  131
6 1998-05-18 1997-11-15  184
7 1995-07-24 1995-04-01  114
8 1995-07-24 1995-04-01  114




On 12/27/06, Brian Edward [EMAIL PROTECTED] wrote:

 Hello all,

 Can somebody point me to references or provide some code on dealing with
 this date issue.  Basically, I have two vectors of values that represent
 dates.  I want to convert these values into a date format and subtract the
 differences to show elapsed time in days.  More specifically, here is the
 example:

 Date1  Date2
 032398061585
 032398061585
 111694101994
 111694101994
 062695021595
 051898111597
 072495040195
 072495040195

 The dates are in the mmddyy format, but when I attempt to format these in
 R
 with the function, date.mmddyy(Date1), I get very odd results.  Any help
 on
 this matter would be greatly appreciated!

 Thanks in advance,
 Brian

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




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

What is the problem you are trying to solve?

[[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] Dates in R

2006-12-27 Thread talepanda
Try:

as.date(Date1)-as.date(Date2)

On 12/28/06, Brian Edward [EMAIL PROTECTED] wrote:
 Hello all,

 Can somebody point me to references or provide some code on dealing with
 this date issue.  Basically, I have two vectors of values that represent
 dates.  I want to convert these values into a date format and subtract the
 differences to show elapsed time in days.  More specifically, here is the
 example:

 Date1  Date2
 032398061585
 032398061585
 111694101994
 111694101994
 062695021595
 051898111597
 072495040195
 072495040195

 The dates are in the mmddyy format, but when I attempt to format these in R
 with the function, date.mmddyy(Date1), I get very odd results.  Any help on
 this matter would be greatly appreciated!

 Thanks in advance,
 Brian

   [[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] Dates in R

2006-12-27 Thread Don MacQueen
See the documentation for

   as.Date

Something like (untested):

as.Date(Date1, '%m%d%y) - as.Date(Date2,%m%d%y)

That's assuming Date1 and Date2 have already been loaded into R, and 
are character vectors. They would have to be character vectors in 
order to display the leading zero, as in 032398.

-Don

At 10:18 PM -0600 12/27/06, Brian Edward wrote:
Hello all,

Can somebody point me to references or provide some code on dealing with
this date issue.  Basically, I have two vectors of values that represent
dates.  I want to convert these values into a date format and subtract the
differences to show elapsed time in days.  More specifically, here is the
example:

Date1  Date2
032398061585
032398061585
111694101994
111694101994
062695021595
051898111597
072495040195
072495040195

The dates are in the mmddyy format, but when I attempt to format these in R
with the function, date.mmddyy(Date1), I get very odd results.  Any help on
this matter would be greatly appreciated!

Thanks in advance,
Brian

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


-- 
-
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA

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


Re: [R] how to suppress a loading required package: ... message

2006-12-27 Thread Frank E Harrell Jr
Dirk Eddelbuettel wrote:
 
 Frank,
 
 On 27 December 2006 at 12:30, Frank E Harrell Jr wrote:
 | Dirk Eddelbuettel wrote:
 |  On 27 December 2006 at 08:52, BBands wrote:
 |  | On 12/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 |  |  how to suppress a loading required package:...  message?
 |  | 
 |  | require(package, quiet=TRUE)
 |  
 |  Some packages insist on talking even when they are asked to be quiet, in
 |  which case I have also resorted to wrapping sink() around the loading:
 |  
 | sink(/dev/null)
 | library(Hmisc)
 | 
 | For that one, do options(Hverbose=FALSE) before library(Hmisc)
 
 With all due respect, I think you are misguided here. Per-package options for
 verbosity strike me as suboptimal. IMHO, if options(verbose) is FALSE, or
 if the quiet argument to require() has been given, Hmisc should simply be
 quiet.

Dirk,

I spent a significant amount of time a year ago trying to get the more 
general approach to work but to no avail.  As I recall there either was 
missing documentation or some failure of the system to pass a correct 
argument to .First.lib.  Hence the creation of the workaround.

Frank

 
 In any event, Gabor's one-liner is preferable here as it is generic.
 
 Dirk
 
 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Colored Dendrogram

2006-12-27 Thread Richard C. Yeh
In your colLab function, you are assigning the label colors using the  
mycols 4-element vector, which you generated using the rainbow()  
function.  So, to pick colors using the values in vector c, normalize c  
and then try the colorRamp function.

I don't know how to use that function, myself, so instead I did:

# Generate lots of colors, starting at blue (0.6) and ending at red (0)
# We started at blue because you wanted blue for the lower-valued elements
# and red for the higher-valued elements.
pal - rainbow(4000,start=0.5,end=0.05)
# Normalize vector c to the range 0-1 (well, not really)
# and scale the range to a color index
mycols - pal[length(pal)*c/max(c)]

Then define your colLab function and run.


On Tue, 26 Dec 2006 11:20:45 -0500, Om [EMAIL PROTECTED] wrote:
 In this dendrogram, each leaf is colored differently. But, I do not want  
 the
 leaf colored on a random basis. I want to assign color for leaf on basis  
 of
 some criterion.

 My actual problem: How to generate a dendrogram with the leaf colored
 according to the values in the second matrix (which is 4x1 dim, say  
 matrix
 c)? Meaning, the leaf 1 and 2 should be colored in neighboring spectra of
 color (say different shade of red) and leaf 3 and 4 in a different color
 (say different shade of blue)

 Below is R code and data matrix

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] importing bitmap images to R

2006-12-27 Thread Michael Wolosin
All -

I'm creating some plots in R that I would like to overlay on images that 
are created outside of R.

I've used image before to plot image-like data within R, and have added 
vector plots on top of them, but I can't find a way to read in an external 
bitmap file into R and use that.

Currently the external files are .png's, but I could generate a few other 
types, if something else might be easier to import.

Thanks,
-Mike

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


[R] Re : how to test difference in my case?

2006-12-27 Thread justin bem
How about fitted statistics of the model ?
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

- Message d'origine 
De : Xu Yuan [EMAIL PROTECTED]
À : r-help@stat.math.ethz.ch
Envoyé le : Jeudi, 28 Décembre 2006, 1h14mn 35s
Objet : [R] how to test difference in my case?

hello all,

I wonder if anyone could give me a hint on which statistical technique
I should use and how to carry it out in R in my case. Thanks in
advance.

My data is composed of two columns, the same numerical variable
(continuous) from actual measurement and model prediction. My
objective is to compare the data agreement (if there is significant
difference) and make conclusions about the model efficiency. Since the
measured and predicted variable was based on the same unit, the first
test came into my mind was paired t-test. However, the paired
difference is not normal (p-value = 0.0048 from SAS proc univariate).
In this case, I can either do a wilcoxon signed-rank test or do
transformations about the data. I was told that wilcoxon signed-rank
test is not as widely recognized as paired t-test in the literature,
so I prefer to do transformation. My question is: do I need to do
transformations on both columns of original data, or just the paired
difference? What transformation is appropriate? I thought about log
transformation, but if I find significant (or no significant)
difference between the logged data (measured and predicted), can I say
there is significant (or no significant) difference between the
original data?


After this step of analysis, I will convert the continuous numerical
data into qualitative categorical ranking (value=1, 2, 3 and 4). Which
statistical test and R command should I use to compare the ranking
agreement between the actual measurement and prediction?

Thank you very much for helping me out. I haven't slept since a long
time ago and this is kind of emergency. If there is any confusion
about my description, please let me know.

Regards,
XY

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










___ 

 interface révolutionnaire. 

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