Re: [R] sscanf equivalent

2005-10-09 Thread Paul Roebuck
On Fri, 7 Oct 2005, Prof Brian Ripley wrote:

 On Fri, 7 Oct 2005, Paul Roebuck wrote:

  I have a data file from which I need to read portions of
  data but data location/quantity can change from file to file.
  I wrote some code and have a working solution but it seems
  wasteful to have to do it this way. Here's the contrived
  incomplete code.
 
 datalines - readLines(datafile.pathname)
 # marker will appear on line preceding and following
 # actual data
 offset.data - grep(marker, datalines)
 datalines - NULL
 
 # grab first column of each assoc dataline
 data - scan(datafile.pathname,
  what = numeric(0),
  skip = offset.data[1],
  nlines = offset.data[2]-offset.data[1]-1,
  flush = TRUE,
  multi.line = FALSE,
  quiet = TRUE)
 # output is vector of values
 
  Originally wrote code to parse data from 'datalines'
  using sub and strsplit methods but it was woefully slower
  and more complex than using scan method. What is desired
  is a means of invoking method like scan but with existing
  data instead of filename.

 Why not use a text connection?

I tried that but result was far slower than the method above.

R file.info(datafile.pathname)$size
[1] 944850
R system.time(datalines-readLines(datafile.pathname), TRUE)[3]
[1] 0.59
R length(datalines)
[1] 67931
R system.time(tconn-textConnection(datalines), TRUE)[3]
[1] 52.97

Once a textConnection object was created, the scan method
invocation using it took less than half the time of the
corresponding filename-based invocation. Problem is that
this was only taking a second to perform the scan using
the filename-based invocation. And since grep method doesn't
accept textConnection as argument, I still require the
otherwise unused 'datalines' variable and its associated
memory. Even if grep supported such, the timing increased
even more not having the variable.

R system.time(tconn-textConnection(readLines(datafile.pathname)), TRUE)[3]
[1] 66.61


Any other thoughts?


# R version 2.1.1, 2005-06-20, powerpc-apple-darwin7.9.0

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch 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] How to get the remaining vector after sampling a subset?

2005-10-09 Thread Xiao Shi
Hi ,
I have a vector,for example,
x=rnorm(100)
Then i rendom choose 20 of them.
chosen=sample(x,20).
And i want to get the remain values in x.
Is there a quick way to go?

Thanks in advance.

[[alternative HTML version deleted]]

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


Re: [R] How to get the remaining vector after sampling a subset?

2005-10-09 Thread Sundar Dorai-Raj


Xiao Shi wrote:
 Hi ,
 I have a vector,for example,
 x=rnorm(100)
 Then i rendom choose 20 of them.
 chosen=sample(x,20).
 And i want to get the remain values in x.
 Is there a quick way to go?
 
 Thanks in advance.
 
   [[alternative HTML version deleted]]
 

How about:

x - rnorm(100)
y - sample(x, 20)
z - x[!x %in% y]

But probably a safer way is to sample the indicies:

x - rnorm(100)
w - sample(length(x), 20)
y - x[w]
z - x[-w]

HTH,

--sundar

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


Re: [R] How to get the remaining vector after sampling a subset?

2005-10-09 Thread Dimitris Rizopoulos
one way is to use:

x[!x %in% chosen]


I hope it helps.

Best,
Dimitris


- Original Message - 
From: Xiao Shi [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Sunday, October 09, 2005 11:26 AM
Subject: [R] How to get the remaining vector after sampling a subset?


 Hi ,
 I have a vector,for example,
 x=rnorm(100)
 Then i rendom choose 20 of them.
 chosen=sample(x,20).
 And i want to get the remain values in x.
 Is there a quick way to go?

 Thanks in advance.

 [[alternative HTML version deleted]]

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


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

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


Re: [R] lm.ridge

2005-10-09 Thread Prof Brian Ripley
On Sat, 8 Oct 2005, Erin Hodgess wrote:

 Dear R People:

 I have a question about the lm.ridge function, please.

 In the example, there is one set of output values in the select
 function but another in the comment section.

 Am I missing something please?

The values in the examples were computed in S-PLUS.  Apparently the 
dataset in R is not the same as that in S-PLUS.

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


[R] Rmetrics fMultivar how to?

2005-10-09 Thread Benedict P. Barszcz
Hi Everybody,
I am a total beginner at this so please bear with me.
I downloaded by hand the file WIG20.txt (Warsaw Stock Exchange Index of 20 
most important stocks). The format is this:

Name,Date,Open,High,Low,Close,Volume 
WIG20,19940414,1000.00,1000.00,1000.00,1000.00,71600.000 
WIG20,19940418,1050.50,1050.50,1050.50,1050.50,99950.000 
WIG20,19940419,1124.90,1124.90,1124.90,1124.90,138059.000 
WIG20,19940421,1304.80,1304.80,1304.80,1304.80,154151.000 
WIG20,19940425,1350.10,1350.10,1350.10,1350.10,228438.000 
WIG20,19940426,1216.20,1216.20,1216.20,1216.20,16618.000 
WIG20,19940428,1096.70,1096.70,1096.70,1096.70,32685.000 
WIG20,19940505,1138.10,1138.10,1138.10,1138.10,113777.000 
WIG20,19940506,1077.60,1077.60,1077.60,1077.60,137910.000 
WIG20,19940509,1035.60,1035.60,1035.60,1035.60,97091.000

I read the data in with this command:

tabelka = read.table(/home/kb2qzv/WIG20.txt,sep=,,header=TRUE)

And I can see that 'tabelka' has 2840 rows in it which is correct (this many 
sessions since the Exchange started operating).
Now I would like to utilize some of the functions available from RMetrics and 
see how useful they might be. I can image that one way to know this would be 
to plot a candlestick chart of the wig20 index and below it a TA indicator, 
like one of these:

macdTA  MACD Indicator
cdsTA MACD Signal Line
cdoTA  MACD Oscillator
vohlTA High/Low Volatility

Trouble is there is no easy way (for me as a beginner) to start with.
Questions:
A) how to plot a candlestick chart with my data?
there seems to be no 'type=candlestick' parameter in plot() function.

B) how to create a second pane where an indicator can be drawn.

thanks for any answers or tips.


-- 
Benedict

Cyfrowy klucz publiczny / Digital public key 
http://agrypa1.atspace.com/klucze/kb2qzv_wp.pl-public.asc

__
R-help@stat.math.ethz.ch 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] background color of xyplot

2005-10-09 Thread Marc Bernard
Dear All, 
 
I am wondering if there is a way to change the color  of  the panels of  the  
xyplot  (lattice package) from gray to white  ..  Because the  printing 
 of the xyplot's graph is not  visible with the gray color ... I've seen the 
xyplot help  but without any success
 
 
Thanks  lot in advance, 
 
 
Bernard, 
 
 


-


[[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] background color of xyplot

2005-10-09 Thread ronggui
 see ?trellis.device

 trellis.device(color=F)
  Depth - equal.count(quakes$depth, number=8, overlap=.1)
  xyplot(lat ~ long | Depth, data = quakes)


will get what you want.


=== 2005-10-09 22:32:10 您在来信中写道:===

Dear All, 
 
I am wondering if there is a way to change the color  of  the panels of  the  
xyplot  (lattice package) from gray to white  ..  Because the  
printing  of the xyplot's graph is not  visible with the gray color ... I've 
seen the xyplot help  but without any success
 
 
Thanks  lot in advance, 
 
 
Bernard, 
 
 

   
-


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

= = = = = = = = = = = = = = = = = = = =



 

2005-10-09

--
Deparment of Sociology
Fudan 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

Re: [R] color for points

2005-10-09 Thread Vincent Goulet
Le 8 Octobre 2005 05:35, [EMAIL PROTECTED] a écrit :
 Sam R. Smith a écrit :
  Hi,
  I have the following code to randomly generate the points:
  csr -function(n=60){
  x=runif(n)
  y=runif(n)
  f=cbind(x,y)
  }
  plot(csr())
 
  I wonder how to code to make the first twenty points to be BLUE; second
  twenty points to be RED; the last twenty points to be GREEN?

 mynewfct = function(n=60)
 {
 x=runif(n)
 y=runif(n)
 f=cbind(x,y)
 plot(f[1:20] , col='blue');
 par(new=T);
 plot(f[21:40] , col='red');
 par(new=T);
 plot(f[41:60] , col='green');
 }

 hih

This function will plot 60 points, no matter the value of argument 'n'. 
Building also on Jim Holtman's comment, may I rather suggest

csr - function(n=60)
{
x - cbind(runif(n), runif(n))
plot(x, col=rep(c(blue, red, green), each=20, length.out=n))
x   # why not return the values...
}

HTH

-- 
  Vincent Goulet, Professeur agrégé
  École d'actuariat
  Université Laval, Québec 
  [EMAIL PROTECTED]   http://vgoulet.act.ulaval.ca

__
R-help@stat.math.ethz.ch 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] Glmm for multiple outcomes

2005-10-09 Thread Spencer Graves
Does the following help:

n.subjects - 3
J - 4
K - 5
n.ijk - rep(2, each=n.subjects*J*K)

x - rep(1:K, n.subjects, each=J)

subj - factor(rep(1:n.subjects, each=K*J))

sa.subject - 1
sb.subject - 1

set.seed(2)
a.subj - rep(sa.subject*rnorm(n.subjects), each=K*J)
b.subj - rep(sb.subject*rnorm(n.subjects), each=K*J)

Z - a.subj+b.subj*x

library(boot)
Y - (rbinom(n.subjects*K*J, n.ijk, inv.logit(Z))
  /n.ijk)

Dat - data.frame(subj=subj, x=x, y=Y)

library(lme4)

fit - lmer(y~x+(x|subj), Dat)
Linear mixed-effects model fit by REML
Formula: y ~ x + (x | subj)
Data: Dat
   AIC  BIClogLik MLdeviance REMLdeviance
  51.63172 64.19779 -19.8158633.1066 39.63172
Random effects:
  Groups   NameVariance  Std.Dev. Corr
  subj (Intercept) 0.0446346 0.211269
   x   0.0032613 0.057108 1.000
  Residual 0.0879438 0.296553
# of obs: 60, groups: subj, 3

Fixed effects:
  Estimate Std. Error DF t value Pr(|t|)
(Intercept)  0.35   0.151459 58  2.3109  0.02442 *
x0.03   0.042661 58  0.7814  0.43777
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

  spencer graves

Abderrahim Oulhaj wrote:

 Dear All,
 
 I wonder if there is an efficient way to fit the  generalized linear mixed 
 model  for multivariate outcomes.
 
 More specifically, Suppose that for a given subject i and at a  given time j 
 we observe a multivariate  outcome Yij = (Y_ij1, Y_ij2, ..., Y_ijK). 
  where Y_ijk is a binomial(n_ijk, p_ijk). 
 
 One way to jointly model  the data is to use the following specification:
 
 g(p_ijk) = beta_0k + b_0ik + (beta_1k + b_1ik)*x_ijk  with k = 1,2 , K , 
 g is a specified link function and (b_0ik,b_1ik) k=1,...K are random effects 
 ...
 
  I my case, the glmmPQL converges only  and give good results when k is less 
 than 3 (i.e. for a small number of random effects). I also used the gee 
 (generalized estimating equations) to estimate the fixed effects and the same 
 probleme ariseed with k.
 
 Is there any help?
 
 Thank you in advance, 
  
 Abderrahim Oulhaj
   [[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

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch 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] Insert value from same column of another row (lag across observations)

2005-10-09 Thread David L. Van Brunt, Ph.D.
I know I've done this before, but it's been a while and I can't find quite
what I need in the help files or archives.

I have a text field in a very large data frame. I'd like to add a column
that represents the value from an existing field, from the next record (the
data are sorted). I'm trying to represent what happens tomorrow, so the
today row would have an NA value (unknown).

So if x is:
 x
[,1]
[1,] today
[2,] yesterday
[3,] the day before
[4,] two days before

any y is
 cbind(x,c(1,2,3,4))
[,1] [,2]
[1,] today 1
[2,] yesterday 2
[3,] the day before 3
[4,] two days before 4


z should become

[,1] [,2] [,3]
[1,] today 1 NA
[2,] yesterday 2 1
[3,] the day before 3 2
[4,] two days before 4 3

I've tried
z-cbind(y,c(NA,y[-1,2]))

but I get
[1,] today 1 NA
[2,] yesterday 2 2
[3,] the day before 3 3
[4,] two days before 4 4

So the lagging doesn't work.

Any ideas?

--
---
David L. Van Brunt, Ph.D.
mailto:[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


[R] enter a survey design in survey2.9

2005-10-09 Thread justin bem
Hi dears,
 
I expect that Mr Thomas Lumley will read this message.
I have data from a complexe stratified survey. The population is divide in 12 
regions and a region consist to and urban area and rural one. there to region 
just with urbain area.
 
stratification variable is a combinaison of region and area type (urban/rural)
 
In rural area, subdivision are sample with probabilties proporionnal to size in 
population then enuration area are sample in selected division and finally 
households are selected in those EA.
 
In urban area, EA are directly selected and finally household are selected.
to schematise we have:
 
(12 regions)
 each region is divised in two regions / Urbain and rural. this are strata
   in Rural : PSU are subdivision , SSU are EA and TSU are households
   in Urban : PSU are EA , SSU are households.
 
I use svydesign function as follow :
esi-svydesign(id=~subdiv+EA+HHID,strata=~REGION+AREATYP,fpc=~FPC1+FPC2FPC3,weig=~pw,nest=T)
FPC1: number of subdivision in each strata
FPC2: number of EA in each subdivision
FPC3: number of HH in each EA.
pw : sampling weights
 
but I have this error message : erron in data.frame(strata, 1:i,...) I dont 
understand why !
Can someone help me ?
 
Sincerly.
 
 
 
 


-


[[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] Error using a data frame as the start parameter in mle()

2005-10-09 Thread Spencer Graves
  I will attempt a brief comment on this post, as I've seen no replies. 
  It's difficult to comment on this, as you do not really provide enough 
information to permit someone like me to understand your problem.  Only 
one portion of this problem is the fact that I can't find your function 
mle in one of the standard libraries, and I don't know if it is part 
of a contributed library or something you wrote.

  However, I've encountered problems roughly like what you describe, 
and I've solved them in three different ways:

  (a) Making a local copy inside the wrapper function and then pass to 
the standard function like mle only arguments locally defined.

  (b) Using assign  with (I think) something like pos=0.  I don't 
remember exactly for that, and the help file for assign and several 
searches with RSiteSearch didn't help me.  If you want to try this, I 
suggest you look for information on lexical scoping with assign, etc.

  (c) Passing additional references via ... if mle has such in its 
function definition.

  If you still would like more help from this group, PLEASE do read the 
posting guide (www.R-project.org/posting-guide.html).  I believe people 
who follow that guide on average get more useful answers quicker.

  Viel Glück!
  spencer graves

Coryn Bailer-Jones wrote:

 Dear R-Users,
 
 I am trying to use mle() to optimize two (or more) parameters, but I want
 to specify those parmeters in a data frame rather than having to spell
 them out separately in the start variable of mle().
 
 My call is
 
 
mle(negll, start=list(aps=init), fixed=list(measphot=newphot,
 
 formod=formod, Nbands=Nbands), method=BFGS)
 
 where negll is a function I have written which uses the function
 predict.loess(). negll works fine when called directly. The parameter I am
 trying to optimize, aps, is a data frame containing two parameters, e.g.
 
 
init
 
   teff logg
 1 8000  4.5
 
 When I run mle I get the following error message
 
 Error in predict.loess(formod[[band]], aps) :
 Argument aps is missing, with no default
 
 As negll does work fine, I presume I am incorrectly passing aps into
 mle(). Note that mle() works fine if I rewrite negll to work on a scalar
 aps and then I use start=list(aps=500), for example. Can anyone help me
 with this?
 
 Incidentally, I am only using a data frame for aps because I am using
 loess(), and this seems to require a formula with named variables in a
 data frame (here logg and teff). I can't get it work with arrays:
 
 
temp - loess(formula = photd[, band] ~ gridaps[, 1] * gridaps[, 2])
predict(temp, c(4,8000))
 
 Error in predict.loess(temp, c(4, 8000)) :
 newdata does not contain the variables needed
 
 Thanks in advance for any clues.
 
 Coryn.
 
 ---
 Coryn Bailer-Jones[EMAIL PROTECTED]
 Max-Planck-Institut fuer Astronomie   http://www.mpia-hd.mpg.de/homes/calj/
 Koenigstuhl 17tel: +49 6221 528-224(direct)
 D-69117 Heidelberg +49 6221 528-0   (reception)
 Germany   fax: +49 6221 528-246
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch 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] Matrix calculations in R--erroneous?

2005-10-09 Thread Thomas Lumley
On Fri, 7 Oct 2005, Peter Muhlberger wrote:

 The max function won't do the trick because I need the entire matrix.  I
 could do one cell at a time, but this is part of a ML routine that needs to
 be evaluated hundreds of thousands of times, so I can't afford to slow it
 down that much.

pmax, then?

-thomas

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


[R] acf.plot() question

2005-10-09 Thread DeBarr, Dave
When I run the acf() function using the acf(ts.union(mdeaths,
fdeaths)) example, the acf() function calls the acf.plot()
function to generate this plot...
http://members.cox.net/ddebarr/images/acf_example.png

The plot in the lower right-hand corner is labeled fdeaths  mdeaths,
but the negative lags appear to belong to mdeaths  fdeaths [which
correspond to the positive lags of fdeaths  mdeaths].

Am I missing something, or should the plot in the lower right-hand
corner be labeled mdeaths  fdeaths (instead of fdeaths  mdeaths)?

Note: The unit of measure for the lags is years.

 autocorrelation - function(x, y, lags) {
+ n - length(x)
+ x.bar - mean(x)
+ y.bar - mean(y)
+ c - array(0, length(lags))
+ i - 1
+ for (t in lags) {
+ s - seq(max(1, 1 - t), min(n - t, n))
+ c[i] - sum((x[s + t] - x.bar) * (y[s] - y.bar)) / n
+ i - i + 1
+ }
+ x.sd - sqrt(sum((x - x.bar) ^ 2) / n)
+ y.sd - sqrt(sum((y - y.bar) ^ 2) / n)
+ return(c / (x.sd * y.sd))
+ }
 autocorrelation(mdeaths, fdeaths, -15:15)
 [1]  0.015054983  0.365626026  0.615427121  0.708206289  0.621895801
 [6]  0.340005447 -0.024534195 -0.381671430 -0.611793479 -0.677803477
[11] -0.604031174 -0.349468396  0.019759425  0.405200639  0.744309322
[16]  0.976241251  0.735668532  0.364241839 -0.010675725 -0.382920620
[21] -0.622386979 -0.688538519 -0.610583980 -0.383338305 -0.018112073
[26]  0.391983088  0.656592111  0.721397236  0.639104375  0.361352626
[31] -0.003385423
 autocorrelation(fdeaths, mdeaths, -15:15)
 [1] -0.003385423  0.361352626  0.639104375  0.721397236  0.656592111
 [6]  0.391983088 -0.018112073 -0.383338305 -0.610583980 -0.688538519
[11] -0.622386979 -0.382920620 -0.010675725  0.364241839  0.735668532
[16]  0.976241251  0.744309322  0.405200639  0.019759425 -0.349468396
[21] -0.604031174 -0.677803477 -0.611793479 -0.381671430 -0.024534195
[26]  0.340005447  0.621895801  0.708206289  0.615427121  0.365626026
[31]  0.015054983

__
R-help@stat.math.ethz.ch 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] greek symbols using pch

2005-10-09 Thread FISCHER, Matthew


Hi R-users,

In a plot, can I specify pch to be a greek symbol? (I looked at
show.pch() in the Hmisc package but couldn't see the right symbols in there).
If not, I guess I can get around this using text(x,y,expression()).

cheers!,

Matt.


Dr Matt Fischer
Postdoctoral Fellow - IPILPS
ANSTO - Institute for Nuclear Geophysiology 
Building 21A
PMB 1 Menai NSW 2234
Ph: +61 2 9717 9686
Fax: +61 2 9717 3599
Mobile: 0428 363 146
http://www.ansto.gov.au/nugeo/
http://ipilps.ansto.gov.au/



[[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] possible bug in image() ??

2005-10-09 Thread Gareth Davies
Hi everyone. 
The function image() seems not to be correctly plotting some 
matrices that I give it. (I’m using R 2.1.1)   
The following code creates a matrix (denoted x) with 1500 
rows and 3 columns, with all entries 0 or 1, and then plots 
the image of this matrix.

 cc=runif(n=1500,min=0.1,max=1.2)
 ccc=ceiling(cc-1)
 dd=runif(n=1500,min=0.1,max=1.2)
 ddd=ceiling(dd-1)
 ee=runif(n=1500,min=0.1,max=1.2)
 eee=ceiling(ee-1)
 x=matrix(data=c(ccc,ddd,eee),nrow=1500)
 image(x)

..where the first column in x  (vector ccc) is depicted 
horizontally along the bottom of the image. However, when I 
overplot the non-zero elements of the vectors ccc, ddd and 
eee onto their respective horizontal positions on the 
image,..

 points(seq(0,1,1/(1500-1)),(ccc)^-1*0)
points(seq(0,1,1/(1500-1)),(ddd)^-1*0.5)
 points(seq(0,1,1/(1500-1)),(eee)^-1*1)


 …the locations of the 1’s in image do not always match the 
locations of the 1’s in ccc,ddd, and eee (although they are 
mostly correct). Do other people find this problem?? I've 
tried with other matrices, and the results only seem in 
error when the matrix is large, say with more than 1000 
rows. 

Cheers, Gareth Davies

__
R-help@stat.math.ethz.ch 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] greek symbols using pch

2005-10-09 Thread Marc Schwartz
On Mon, 2005-10-10 at 12:02 +1000, FISCHER, Matthew wrote:
 
 Hi R-users,
 
 In a plot, can I specify pch to be a greek symbol? (I looked at
 show.pch() in the Hmisc package but couldn't see the right symbols in there).
 If not, I guess I can get around this using text(x,y,expression()).
 
 cheers!,
 
 Matt.


You will need to use text() in order to plot greek characters as
plotting symbols.

The 'pch' argument (or par(pch)) must be a single character or an
integer specifying one of the symbols as seen in ?points or as you noted
in Frank's show.pch().

See ?plotmath for more information on plotting mathematical expressions.

HTH,

Marc Schwartz

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


[R] plot

2005-10-09 Thread Sam R. Smith
After I made a new plot, the old plot can not be found. How can I check all the 
plots I have made?



-

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

2005-10-09 Thread Murray Pung
Select History  Recording.

You can see previous plots using 'page up'.

Murray

-Original Message-
From: Sam R. Smith [mailto:[EMAIL PROTECTED]
Sent: Monday, 10 October 2005 1:27 PM
To: r-help@stat.math.ethz.ch
Subject: [R] plot


After I made a new plot, the old plot can not be found. How can I check all the 
plots I have made?



-

[[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-help@stat.math.ethz.ch 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] sqlFetch on MySQL-DB

2005-10-09 Thread Bernd Weiss
Dear all,

I successfully set up a local MySQL-database. Connecting via RODBC is 
not problem, the same in fetching 3 of 4 tables. But trying to 
connect to table 4 fails. 

 author-sqlFetch(test,author)
Error in fromchar(unclass(x)) : character string is not in a standard 
unambiguous format

In principle I understand that error message, but I don't know any 
solution. 

Thanks for any help,

Bernd


 version
 _   
platform i386-pc-mingw32 
arch i386
os   mingw32 
system   i386, mingw32   
status   Under development (unstable)
major2   
minor3.0 
year 2005
month10  
day  06  
svn rev  35759   
language R

__
R-help@stat.math.ethz.ch 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] line

2005-10-09 Thread Sam R. Smith
There are four points with coordinates:
2,3;4,9;1,6;3,10.
How to use Python to draw one perpendicular bisector between (2,3) and (4,9);
the other perpendicular bisector between (1,6)ºÍ(3,10);
then, makes the output like:
l1 a b c
l2 a b c
(Note: l indicates the perpendicular bisector with equation ax + by = c.)
Plus the intersection coordinates of the two perpendicular bisectors:
x,y



-

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

2005-10-09 Thread Sam R. Smith
Sorry for the typo, ask for R code.

Sam R. Smith [EMAIL PROTECTED] wrote:There are four points with coordinates:
2,3;4,9;1,6;3,10.
How to use Python to draw one perpendicular bisector between (2,3) and (4,9);
the other perpendicular bisector between (1,6)ºÍ(3,10);
then, makes the output like:
l1 a b c
l2 a b c
(Note: l indicates the perpendicular bisector with equation ax + by = c.)
Plus the intersection coordinates of the two perpendicular bisectors:
x,y



-

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


-

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