Re: [R] No ~ in JGR

2005-05-28 Thread Henric Nilsson

CG Pettersson said the following on 2005-05-25 14:25:

R2.1.0
JGR 1.2
W2k

Hello all!
I´ve just installed JGR on my both R-equipped computers and am very 
pleased with the look and functionality.


Except in one, very important, way.

I can´t figure out how to get the ~ sign from the keyboard to the 
console. Copying it from old code works fine. Using the traditional GUI 
works as usual.


I have a Swedish keyboard layout, where ~ shares key with ¨ and ^, all 
reguiring a space after the hit to produce the sign on the screen.


The other signs from the key works, but AltGr + ~ followed by space just 
gives a blank. What do I do wrong?


Probably nothing, or we're both doing something wrong.

I'm experiencing the same thing, and the asked the JGR developers about 
it some time ago. See the thread that starts with


http://mailman.rz.uni-augsburg.de/pipermail/stats-rosuda-devel/2005q1/30.html


Henric

__
R-help@stat.math.ethz.ch 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] Soil texture triangle in R?

2005-05-28 Thread Sander Oom

Hi Jim,

Your email was classified as spam, so I missed it previously. 
Unfortunately you did not send a cc to the R-help list. I send a cc to 
the mailing list now, so all code gets archived.


Thanks for the improvements on your function! It seems that drawing the 
ternary graph and the points with the generic plot functions works well. 
Makes the function less dependent on other packages!


Will merge the two functions into one and post it back to the mailing 
list! Then the graph might be ready for the graph gallery!


Thanks,

Sander.


Jim Lemon wrote:
 Sander Oom wrote:
 Hi Jim,

 This looks impressive! It gives me the 'background' graph. However,
 I'm not sure how I can use this function to plot my soil texture
 values! Can you explain?

 I would like to be able to plot my soil texture samples in the same
 graph as the one your function plots.

 Yes, that's just the background figure for which you attached the link.
 I was unsure of how you were going to use this, that is, do you just
 place a symbol for each soil sample? Aha! Just read your latest email
 and I think that's what you want.

 Let's say you have one or more soil samples with the proportions of
 clay, sand and silt.

 sample1-c(0.1,0.4,0.5)
 sample2-c(0.2,0.5,0.3)
 soil.samples-rbind(sample1,sample2)
 colnames(soil.samples)-c(clay,sand,silt)

 This more complicated function allows you to overlay colored points
 representing soil samples on either an empty triangle, a gridded
 triangle or a triangle with soil type names. It also has an optional
 legend.

 par(ask=TRUE)
 soil.triangle(soil.samples)
 soil.triangle(soil.samples,show.grid=TRUE)
 soil.triangle(soil.samples,soil.names=TRUE,legend=TRUE)
 par(ask=FALSE)

 Jim

 

 soil.triangle-function(soilprop,pch=NULL,col=NULL,soil.names=FALSE,
  show.grid=FALSE,show.legend=FALSE) {
  if(missing(soilprop))
   stop(Usage: 
soil.triangle(soilprop,pch=NULL,col=NULL,soil.names=FALSE,show.grid=FALSE))

  if(!is.matrix(soilprop))
   stop(soilprop must be a matrix with at least three columns and one 
row.)

  if(any(soilprop  1) || any(soilprop  0))
   stop(All soil proportions must be between zero and one.)
  if(any(abs(rowSums(soilprop)-1)  0.01))
   warning(At least one set of soil proportions does not equal one.)
  oldpar-par(no.readonly=TRUE)
  plot(0:1,type=n,axes=FALSE,xlim=c(0,1.1),ylim=c(0,1),
   main=Soil Triangle,xlab=,ylab=)
  # first draw the triangle
  x1-c(0,0,0.5)
  sin60-sin(pi/3)
  x2-c(1,0.5,1)
  y1-c(0,0,sin60)
  y2-c(0,sin60,0)
  segments(x1,y1,x2,y2)
  # now the bottom internal ticks
  bx1-seq(0.1,0.9,by=0.1)
  bx2-bx1-0.01
  by1-rep(0,9)
  by2-rep(0.02*sin60,9)
  segments(bx1,by1,bx2,by2)
  text(bx1,by1-0.03,as.character(rev(seq(10,90,by=10
  # now the left internal ticks
  ly1-bx1*sin60
  lx1-bx1*0.5
  lx2-lx1+0.02
  ly2-ly1
  segments(lx1,ly1,lx2,ly2)
  text(lx1-0.03,ly1,as.character(seq(10,90,by=10)))
  # right internal ticks
  rx1-rev(lx1+0.5-0.01)
  rx2-rx1+0.01
  ry1-ly1-0.02*sin60
  ry2-ly2
  segments(rx1,ry1,rx2,ry2)
  if(show.grid) {
   segments(bx2,by2,lx1,ly1,lty=3)
   segments(lx2,ly2,rx2,ry2,lty=3)
   segments(rev(rx1),rev(ry1),bx1,by1,lty=3)
  }
  text(rx2+0.03,ry1+0.025,as.character(rev(seq(10,90,by=10
  text(0.5,0.9,100% clay)
  par(xpd=TRUE)
  text(-0.1,0,100% sand)
  text(1.1,0,100% loam)
  text(0.07,0.43,percent clay)
  text(0.93,0.43,percent silt)
  text(0.5,-0.1,percent sand)
  if(soil.names) {
   # boundary of clay with extensions
   x1-c(0.275,0.35,0.6)
   x2-c(0.4,0.79,0.7)
   y1-c(0.55*sin60,0.41*sin60,0.41*sin60)
   y2-c(0.285*sin60,0.41*sin60,0.6*sin60)
   segments(x1,y1,x2,y2)
   # lower bound of clay loam  silty divider
   x1-c(0.4,0.68)
   x2-c(0.86,0.6)
   y1-c(0.285*sin60,0.285*sin60)
   y2-c(0.285*sin60,0.41*sin60)
   segments(x1,y1,x2,y2)
   x1-c(0.185,0.1,0.37)
   x2-c(0.36,0.37,0.4)
   y1-c(0.37*sin60,0.2*sin60,0.2*sin60)
   y2-c(0.37*sin60,0.2*sin60,0.285*sin60)
   segments(x1,y1,x2,y2)
   # sand corner
   x1-c(0.05,0.075)
   x2-c(0.12,0.3)
   y1-c(0.1*sin60,0.15*sin60)
   y2-c(0,0)
   segments(x1,y1,x2,y2)
   x1-c(0.37,0.42,0.5,0.8,0.86)
   x2-c(0.42,0.54,0.65,0.86,0.94)
   y1-c(0.2*sin60,0.08*sin60,0,0,0.12*sin60)
   y2-c(0.08*sin60,0.08*sin60,0.285*sin60,0.12*sin60,0.12*sin60)
   segments(x1,y1,x2,y2)
   text(0.5,0.57,Clay)
   text(0.7,0.49*sin60,Silty)
   text(0.7,0.44*sin60,clay)
   text(0.73,0.37*sin60,Silty clay)
   text(0.73,0.33*sin60,loam)
   text(0.5,0.35*sin60,Clay loam)
   text(0.27,0.43*sin60,Sandy)
   text(0.27,0.39*sin60,clay)
   text(0.27,0.3*sin60,Sandy clay)
   text(0.27,0.26*sin60,loam)
   text(0.25,0.13*sin60,Sandy loam)
   text(0.13,0.075*sin60,Loamy)
   text(0.15,0.035*sin60,sand)
   text(0.055,0.021,Sand)
   text(0.49,0.18*sin60,Loam)
   text(0.72,0.15*sin60,Silt loam)
   text(0.9,0.06*sin60,Silt)
  }
  if(is.null(pch)) pch-1:nrow(soilprop)
  if(is.null(col)) col-2:(nrow(soilprop)+1)
  

[R] read.spss trouble

2005-05-28 Thread Martin Klaffenboeck
Hello!

I'm not sure if this is an german list, so I will post in english.

I'm using R on my gentoo linux and now I got an spss .sav file.  I found
that r has a function like read.spss(file.sav) but when I try this I
get the Error: couldn't find function read.spss.  Can anyone tell me
what's going wrong?

Thanks for your help,
Martin

__
R-help@stat.math.ethz.ch 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] images and maps in R

2005-05-28 Thread Roger Bivand
On Fri, 27 May 2005, Don MacQueen wrote:

 This is is not difficult from the online help for the map() function. 
 Here is an example.
 
 map('state', region = c('new york', 'new jersey', 'penn'),fill=TRUE,col=1:4)
 
 There is also an example there in how to add text to the map.
 
 Another way uses the maptools package.
 
 require(maptools)
 ?plot.Map
 
 and then follow the examples given in the help page for plot.Map().

Both for map() in the maps package and plot.Map() and plot.polylist() in 
the maptools package, there are three things to sort out. Firstly, are the 
map polygons the same, and in the same order as the data you want to map? 
Next, which palette of colours do you want to use (the RColorBrewer 
palettes are well-chosen)? And finally, which breakpoints will you use 
for the class intervals to divide the data into colours?

If the breakpoints are brks:

cols - brewer.pal(length(brks)-1, your choice of palette)
col_choices - findInterval(data, brks, all.inside=TRUE)

and your data are the same length and in the same order as the polygons, 
thematic maps are not too difficult.

 
 At 2:42 PM -0700 5/27/05, yyan liu wrote:
 Hi:
I have a question arising from my project.
A sample of the data is below. The first row stands
 for the names of state in USA. The second row stand
 for some numeric value in that state. Some of them are
 NA. I can use the commands data(stateMapEnv) and
 map('state', fill = F) in library maps to make a
 plot of USA states. What I want to do is: 1. put the
 corresponding state name on the Map 2. give different
 state different colors which is related to their
 value. For example, red for values ranging from
 0-30, green for values from 80-90, etc. 3. if
 possible, put the value of each state within the state
 on the map. here, take the numeric value as some text.
 
 Thank you very much!
 
 AB   AK  AL  AR  AZ  CT   CA
 91   80  NA  NA  17  33   20
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 
 

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

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


Re: [R] read.spss trouble

2005-05-28 Thread Kevin Wang

Hi Martin,

Martin Klaffenboeck wrote:

Hello!

I'm not sure if this is an german list, so I will post in english.


It's an English list.


I'm using R on my gentoo linux and now I got an spss .sav file.  I found
that r has a function like read.spss(file.sav) but when I try this I
get the Error: couldn't find function read.spss.  Can anyone tell me
what's going wrong?


It's in the package foreign.  Try:
  library(foreign)

HTH,

Kevin

--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

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

2005-05-28 Thread Marc Schwartz
On Sat, 2005-05-28 at 13:23 +, Martin Klaffenboeck wrote:
 Hello!
 
 I'm not sure if this is an german list, so I will post in english.

The official language is English.

 I'm using R on my gentoo linux and now I got an spss .sav file.  I found
 that r has a function like read.spss(file.sav) but when I try this I
 get the Error: couldn't find function read.spss.  Can anyone tell me
 what's going wrong?

read.spss() is part of the foreign package, which is installed as part
of the base R installation, but it is not loaded by default.

Thus, you need to use:

 library(foreign)
 read.spss(...)

See ?library and page 74 in An Introduction to R.

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


Re: [R] read.spss trouble

2005-05-28 Thread John Sorkin
Martin,
If you have trouble finding page 74 of Introduction to R, you can get
the information that Marc suggested you read by doing the following. At
the R prompt enter
 
help.start()
 
Then when you see the web page Statistical Data Analysis R, click on
the SEARCH ENGINE  KEYWORDS link. In the search box enter SPSS.
John
 
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC
 
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
 
410-605-7119 
- NOTE NEW EMAIL ADDRESS:
[EMAIL PROTECTED]

 Marc Schwartz [EMAIL PROTECTED] 5/28/2005 9:35:52 AM 


On Sat, 2005-05-28 at 13:23 +, Martin Klaffenboeck wrote:
 Hello!
 
 I'm not sure if this is an german list, so I will post in english.

The official language is English.

 I'm using R on my gentoo linux and now I got an spss .sav file.  I
found
 that r has a function like read.spss(file.sav) but when I try this
I
 get the Error: couldn't find function read.spss.  Can anyone tell
me
 what's going wrong?

read.spss() is part of the foreign package, which is installed as
part
of the base R installation, but it is not loaded by default.

Thus, you need to use:

library(foreign)
read.spss(...)

See ?library and page 74 in An Introduction to R.

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


[[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] Errors in Variables

2005-05-28 Thread Eric-Olivier Le Bigot
I'm interested in this 2D line fitting too!  I've been looking, without 
success, in the list of R packages.


It might be possible to implement quite easily some of the formalism that you 
can find in Numerical Recipes (Fortran 77, 2nd ed.), paragraph 15.3.  As a 
matter of fact, I did this in R but only for a model of the form y ~ x (with 
a given covariance matrix between x and y).  I can send you the R code 
(preliminary version: I wrote it yesterday), if you want.


Another interesting reference might be Am. J. Phys. 60, p. 66 (1992).  But, 
again, you would have to implement things by yourself.


All the best,

EOL

--
Dr. Eric-Olivier LE BIGOT (EOL)CNRS Associate Researcher
~~~o~oo~o~~~
Kastler Brossel Laboratory (LKB)   http://www.lkb.ens.fr
Université P.  M. Curie and Ecole Normale Supérieure, Case 74
4 place Jussieu  75252 Paris CEDEX 05 France
~~~o~oo~o~~~
office  : 01 44 27 73 67 fax: 01 44 27 38 45
ECR room: 01 44 27 47 12  x-ray room: 01 44 27 63 00
home: 01 73 74 61 87  For int'l calls: 33 + number without leading 0


On Wed, 25 May 2005, Jacob van Wyk wrote:


I hope somebody can help.
A student of mine is doing a study on Measurement Error models
(errors-in-variables, total least squares, etc.). I have an old
reference to a multi archive  that contains
leiv3: Programs for best line fitting with errors in both coordinates.
(The date is October 1989, by B.D. Ripley et al.)
I have done a search for something similar in R withour success. Has
this been implemented in a R-package, possibly under some sort of
assumptions about variances. I would lke my student to apply some
regression techniques to data that fit this profile.
Any help is much appreciated.
(If I have not done my search more carefully - my apologies.)
Thanks
Jacob


Jacob L van Wyk
Department of Mathematics and Statistics
University of Johannesburg APK
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-489-3080
Fax: +27-11-489-2832

__
R-help@stat.math.ethz.ch 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] Forcing ticks in plot for hclust object outside the limits

2005-05-28 Thread Aleš Žiberna

Hello!

I have the following problem.

I would like to plot the hclust object hcd (bellow, at the end of the 
mail) with ticks at seq(0.05,0.25,by=0.05). I tried using the code

plot(hcd)
and
plot(hcd,axes=FALSE)
axis(2,seq(0.05,0.25,by=0.05))

In both cases, the resoult is the same, ticks at 0.05 and 0.25 are not 
printed. I tried changing the ylim argumet in plot, however I got a warning 
parameter ylim couldn't be set in high-level plot() function.


I would like to force those two ticks. Can this be done with axis or plot, 
or should I use lines?


Thanks in advance for any suggestions!
Ale iberna


hcd -
structure(list(merge = structure(as.integer(c(-4, -5, -1, -7,
-6, -10, -3, -12, -8, -2, 8, 1, -9, -11, 2, 3, -13, 4, 6, 5,
7, 9, 10, 11)), .Dim = as.integer(c(12, 2))), height = c(0.0906288626438465,
0.10278145998519, 0.114885217561497, 0.127812745765521, 0.13237798522,
0.168594637784091, 0.177187802444346, 0.209803430657638, 0.210361529934791,
0.218946973173863, 0.234000873708654, 0.235702383243089), order = 
as.integer(c(4,

9, 12, 6, 13, 2, 8, 3, 10, 7, 1, 5, 11)), labels = NULL, method = single,
   call = quote(hclust(d = d, method = single)), dist.method = NULL), 
.Names = c(merge,
height, order, labels, method, call, dist.method), class = 
hclust)


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

2005-05-28 Thread Amir Safari
 
 
 Dear All ,
Is it possible to find and select the best lags for time series  in R? ( Lag 
Selection Problem )
Could you please introduce a package or function for this ?
Thanks a lot
 

__



[[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] Forcing ticks in plot for hclust object outside the limits

2005-05-28 Thread Uwe Ligges

Ale iberna wrote:

Hello!

I have the following problem.

I would like to plot the hclust object hcd (bellow, at the end of the 
mail) with ticks at seq(0.05,0.25,by=0.05). I tried using the code

plot(hcd)
and
plot(hcd,axes=FALSE)
axis(2,seq(0.05,0.25,by=0.05))

In both cases, the resoult is the same, ticks at 0.05 and 0.25 are not 
printed. I tried changing the ylim argumet in plot, however I got a 
warning parameter ylim couldn't be set in high-level plot() function.


I would like to force those two ticks. Can this be done with axis or 
plot, or should I use lines?



Not easy with the plot method for a hclust object, because 0.05 and 0.25 
are getting clipped, because they are out od the usr coordinated of 
the plot.


Of course you could hack plot.hclust (in Namespace stats) by modifying 
.../R/library/src/stats/R/hclust.R as follows (in order to provide a 
proper ylim argument):


diff hclust.R-orig hclust.R

91c91,92
   sub = NULL, xlab = NULL, ylab = Height, ...)
---
   sub = NULL, xlab = NULL, ylab = Height,
   ylim = NULL, ...)
116c117,120
 .Internal(dend.window(n, merge, height, hang, labels, ...))
---
 height2 - height
 if(!is.null(ylim))
 height2 - c(range(ylim), rep(ylim[1], length(height) - 2))
 .Internal(dend.window(n, merge, height2, hang, labels, ...))


Note that this quick hack is a *dirty* solution.

Uwe Ligges





Thanks in advance for any suggestions!
Ale iberna


hcd -
structure(list(merge = structure(as.integer(c(-4, -5, -1, -7,
-6, -10, -3, -12, -8, -2, 8, 1, -9, -11, 2, 3, -13, 4, 6, 5,
7, 9, 10, 11)), .Dim = as.integer(c(12, 2))), height = 
c(0.0906288626438465,

0.10278145998519, 0.114885217561497, 0.127812745765521, 0.13237798522,
0.168594637784091, 0.177187802444346, 0.209803430657638, 0.210361529934791,
0.218946973173863, 0.234000873708654, 0.235702383243089), order = 
as.integer(c(4,

9, 12, 6, 13, 2, 8, 3, 10, 7, 1, 5, 11)), labels = NULL, method = single,
   call = quote(hclust(d = d, method = single)), dist.method = NULL), 
.Names = c(merge,
height, order, labels, method, call, dist.method), class = 
hclust)


__
R-help@stat.math.ethz.ch 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] how to make legends on histograms

2005-05-28 Thread Andreas Zankl
I have a histogram with histograms for several datasets superimposed. 
How can I add a legend that indicates which dataset uses which 
linetype?


Thanks
Andreas

--

--
Dr. med. Andreas Zankl
Division de Pediatrie Moleculaire
Clinique Infantile 02/50
CHUV
Avenue Pierre Decker 2
CH-1011 Lausanne
Suisse
Tel.: +41-21-3143778
Fax: +41-21-3143546
Email: [EMAIL PROTECTED]

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


Re: [R] Soil texture triangle in R?

2005-05-28 Thread Sander Oom

Dear R users,

Please find attached a new plot function, plot.soiltexture, to plot soil 
texture data on a triangular plot with an optional backdrop of the USDA 
soil texture classification, written by Jim Lemon and me.


I tried to write the function and documentation confirm the R 
conventions. However, this is a new experience for me, so any comments 
and suggestions are welcome!


I tried to find a suitable package for the plot function, but none are 
obvious.


I have approached Todd Skaggs to ask permission to include sample data 
from the paper:
Skaggs, T.H., L.M. Arya, P.J. Shouse, and B.P. Mohanty. 2001. Estimating 
particle-size distribution from limited soil texture data. Soil Sci. 
Soc. Am. J., 65:1038-1044.

http://soil.scijournals.org/cgi/content/full/65/4/1038

Things still to do:
- rotate axis labels;
- rotate axis tick labels
- provide option to plot ticks inside or outside plot area.

Thus making it look like:
http://soils.usda.gov/technical/manual/images/fig3-16_large.jpg
or
http://soil.scijournals.org/content/vol65/issue4/images/large/1038f2.jpeg

Enjoy,

Sander.
# Description
# 
# Plots soil texture data on an equilateral triangle. Provides the option to
# draw the USDA soil texture classification as a backdrop.
# 
# Usage
# 
# plot.soiltexture - function(soiltexture, main=NULL, pch=1, col=black,
#   soil.names=TRUE, soil.lines=TRUE, show.points=TRUE,
#   show.clabels=FALSE, show.grid=FALSE, show.legend=FALSE, 
#   col.names=grey, col.lines=grey, bg.pch=white,
#   col.grid=grey, lty.grid=3)
# 
# Arguments
#
# soiltexture   a matrix with three columns (see details)
# main  title of the plot; defaults to NULL
# pch   variable or vector containing point symbols; defaults to 1
# col   variable or vector containing point colour; defaults to black
# soil.namesa logical value indicating whether the soil texture class names 
are printed; defaults to TRUE
# soil.linesa logical value indicating whether the soil texture class 
division lines are plotted; defaults to TRUE
# show.points   a logical value indicating whether the soil sample points are 
plotted; defaults to TRUE
# show.clabels  a logical value indicating whether the corner labels for 100% 
sand, silt and clay are printed; defaults to FALSE
# show.grid a logical value indicating whether the fixed grid is plotted; 
defaults to FALSE
# show.legend   a logical value indicating whether the legendis plotted; 
defaults to FALSE
# col.names colour of the soil texture class names; defaults to grey
# col.lines colour of the soil texture class division lines; defaults to 
grey
# bg.pchcolour of the points symbols when pch 21:25 are used; defaults 
to white
# col.grid  colour of the fixed grid; defaults to grey
# lty.grid  line style for the fixed grid; defaults to 3
#
# Details
# 
# The object soiltexture must be a matrix with at least three columns and one 
row.
# Columns should contain data for Sand, Silt, and Clay, in that order! Sand, 
Silt, 
# and Clay should be expressed in proportions between 0 and 1.
#
# The soil sample points' coordinates are calculated using simple trigonometry.
# Thus, the coordinates of a point P(Sand,Silt,Clay), where Sand + Silt + Clay 
= 1,
# are: P(1-Sand+(Sand-(1-Silt))*0.5, Clay*sin(pi/3))
#
# Author(s)
# 
# Jim Lemon
# Sander Oom
# 
# References
# 
# Soil Survey Division Staff. 1993. Soil survey manual. Soil Conservation 
Service.
# U.S. Department of Agriculture Handbook 18.
#
# Examples
# 
# # some triangular data
# library(MASS)
# tmp-(Skye/100)
# # colnames choosen to be consistent with MASS-fig4.4
# colnames(tmp) - c(Clay,Sand,Silt)
# soiltexture - cbind(tmp$Sand,tmp$Silt,tmp$Clay)
# # the USDA backdrop in black
# plot.soiltexture(NULL, show.points=FALSE, col.names=black, 
col.lines=black)
# # the USDA backdrop and a fixed grid in grey
# plot.soiltexture(NULL, show.points=FALSE, show.grid=TRUE)
# # soil sample points with backdrop in grey
# plot.soiltexture(soiltexture)

plot.soiltexture - function(soiltexture, main=Soil Texture Plot, pch=1, 
col=black,
  soil.names=TRUE, soil.lines=TRUE,
  show.points=TRUE, show.clabels=FALSE, show.grid=FALSE, show.legend=FALSE, 
  col.names=grey, col.lines=grey, bg.pch=white,
  col.grid=grey, lty.grid=3) {
  
  if(show.points) {
## error checking
if(missing(soiltexture))
  stop(Usage: plot.soiltexture(soiltexture, pch=NULL, col=NULL, 
soil.names=FALSE, show.grid=FALSE))
if(!is.matrix(soiltexture))
  stop(Object soiltexture must be a matrix with at least three columns 
(for Sand, Silt, and Clay) and one row.)
if(any(soiltexture  1) || any(soiltexture  0))
  stop(All soil texture proportions must be between zero and one.)
if(any(abs(rowSums(soiltexture)-1)  0.01))
  warning(At least one set of soil texture proportions does not equal 
one.)
  }
  
  oldpar-par(no.readonly=TRUE)
  sin60-sin(pi/3)
  par(xpd=TRUE) 

  # create empty canvas to draw
  

Re: [R] how to make legends on histograms

2005-05-28 Thread Kjetil Brinchmann Halvorsen

Andreas Zankl wrote:

I have a histogram with histograms for several datasets superimposed. 
How can I add a legend that indicates which dataset uses which linetype?


Thanks
Andreas


?legend
?locator

--

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

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

2005-05-28 Thread Spencer Graves
	  I'm sorry, I have not followed this thread, but I wonder if you have 
considered library(sem), structural equations modeling?  Errors in 
variables problems are the canonical special case.


	  Also, have you done a search of www.r-project.org - search - R 
site search for terms like errors in variables regression?  This just 
led me to ODRpack, which is NOT a CRAN package but is apparently 
available after a Google search.  If it were my problem, I'd first try 
to figure out sem;  if that seemed too difficult, I might then look at 
ODRpack.


	  Also, have you read the posting guide! 
http://www.R-project.org/posting-guide.html?  This suggests, among other 
things, that you provide a toy example that a potential respondant could 
easily copy from your email, test a few modifications, and prase a reply 
in a minute or so.  This also helps clarify your question so any 
respondants are more likely to suggest something that is actually useful 
to you.  Moreover, many people have reported that they were able to 
answer their own question in the course of preparing a question for this 
list using the posting guide.


  hope this helps.  spencer graves

Eric-Olivier Le Bigot wrote:

I'm interested in this 2D line fitting too!  I've been looking, 
without success, in the list of R packages.


It might be possible to implement quite easily some of the formalism 
that you can find in Numerical Recipes (Fortran 77, 2nd ed.), paragraph 
15.3.  As a matter of fact, I did this in R but only for a model of the 
form y ~ x (with a given covariance matrix between x and y).  I can send 
you the R code (preliminary version: I wrote it yesterday), if you want.


Another interesting reference might be Am. J. Phys. 60, p. 66 (1992).  
But, again, you would have to implement things by yourself.


All the best,

EOL

--
Dr. Eric-Olivier LE BIGOT (EOL)CNRS Associate Researcher
~~~o~oo~o~~~
Kastler Brossel Laboratory (LKB)   http://www.lkb.ens.fr
Université P.  M. Curie and Ecole Normale Supérieure, Case 74
4 place Jussieu  75252 Paris CEDEX 05 France
~~~o~oo~o~~~
office  : 01 44 27 73 67 fax: 01 44 27 38 45
ECR room: 01 44 27 47 12  x-ray room: 01 44 27 63 00
home: 01 73 74 61 87  For int'l calls: 33 + number without leading 0


On Wed, 25 May 2005, Jacob van Wyk wrote:


I hope somebody can help.
A student of mine is doing a study on Measurement Error models
(errors-in-variables, total least squares, etc.). I have an old
reference to a multi archive  that contains
leiv3: Programs for best line fitting with errors in both coordinates.
(The date is October 1989, by B.D. Ripley et al.)
I have done a search for something similar in R withour success. Has
this been implemented in a R-package, possibly under some sort of
assumptions about variances. I would lke my student to apply some
regression techniques to data that fit this profile.
Any help is much appreciated.
(If I have not done my search more carefully - my apologies.)
Thanks
Jacob


Jacob L van Wyk
Department of Mathematics and Statistics
University of Johannesburg APK
P O Box 524
Auckland Park 2006
South Africa
Tel: +27-11-489-3080
Fax: +27-11-489-2832

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

2005-05-28 Thread Spencer Graves

  What kind of problem?  For one variable or more?

	  What have you tried?  For only a single time series, the standard 
approach that I learned from Box and Jenkins, Time Series Analysis, 
Forecasting and Control, starts by preparing both acf and pacf, both of 
which are functions in R.  If the acf shows only 1, 2 or 3 significant 
spikes, it suggests a moving average only model of the indicated order. 
 If the pacf shows only 1, 2, or 3 significant spikes, that suggests an 
autogregression only model.  If the acf shows very high autoregressions 
of all orders with very slow decay, it suggests at least one difference. 
 If both acf and pacf show reasonable, possibly oscillating decay with 
no clear cut-off, then I'd first try an ARMA(1,1), then look at the 
residuals and expand the model as needed.


	  Finally, have you read the posting guide! 
http://www.R-project.org/posting-guide.html?  This suggests, among other

things, that you provide a toy example that a potential respondant could
easily copy from your email, test a few modifications, and prase a reply
in a minute or so.  This also helps clarify your question so any
respondants are more likely to suggest something that is actually useful
to you.  Moreover, many people have reported that they were able to
answer their own question in the course of preparing a question for this
list using the posting guide.

  hope this helps.
  spencer graves

Amir Safari wrote:

 
 
 Dear All ,

Is it possible to find and select the best lags for time series  in R? ( Lag 
Selection Problem )
Could you please introduce a package or function for this ?
Thanks a lot
 


__



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