[R] Wholesale and retail data analysis tasks

2008-05-06 Thread Sevana Ltd
Hello,

We are searching for information resources for wholesale and retail data 
analysis
tasks: the tasks that are relevant and demanded from statists of
wholesale and retail companies. The reason for this search for us, a
sfotware development company is simple: one wholesale
company showed interest in our product that builds associative if-then
rules based on purchase transactions, and we are redeveloping the
system in order it to be a low cost and effective solution for solving
analytical tasks for wholesale and retail.

We would be happy if we can find here partners that would like to
participate in the project providing their requirements and/or
additional information on what functionality they would like to have
in such a system and being our alpha testers in the future. We take
all costs related to system design and development and would be eager
to share final results with the people involved in the project
and also consider working out future sales channels with them.

Thank you for your time and we hope to get some feedback from the audience.

Best regards,

Endre Domiczi, CEO
Sevana Oy, http://www.sevana.fi
Email : [EMAIL PROTECTED]
GSM   : +372 53485178

__
R-help@r-project.org 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 do I write a sum of matrixes??

2008-05-06 Thread Richard . Cotton
 I am a new user and I have been struggling for hours. So finally I 
 decide to ask you:
 If I have a matrix P, and P.2 = P%*%P, and P.3=P.2%*%P
 is there a function to calculate the power of a matrix?? if not how can 
i do:
 for (i in 1:10)  {P.i=P^i} 
 after this I need to sum them up and my problem is to combine P and 
 i to P.i  can anyone help me please???

Take a look at FAQ on R 7.21 (How can I turn a string into a variable?).

This code will do what you ask (though the first matrix is named P.1, 
rather than P for convenience):

paste0 - function(x) paste(P., x, sep=)
P.1 - matrix(rnorm(25), nrow=5)
varnames - paste0(1:10)
for(i in 2:10) assign(paste0(i), get(paste0(i-1)) %*% P.1)

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org 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] ggplo2: x_discrete labels size/direction

2008-05-06 Thread Mikhail Spivakov

Hi everyone,

I've got quite a few labels along the x axis and ggplot2 basically just
crams them on top of each other.
Is it possible to reduce the font size and/or text direction?

Stretching the windows device window manually also helps, but I found that
setting the parameters for the pdf device (where my scripts should print the
data), such as paper=a4r just results in a lot of empty space at both
sides.

Thanks for your help!

Mikhail


Mikhail Spivakov, PhD
Postdoctoral Fellow
EMBL/EBI
UK  Germany
-- 
View this message in context: 
http://www.nabble.com/ggplo2%3A-x_discrete-labels-size-direction-tp17077479p17077479.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] ggplo2: x_discrete labels size/direction

2008-05-06 Thread Xavier Chardon

Hi Mikhail,

You can reduce the text size using the grid.gedit approach described 
at the end of the ggplot book, available on Hadley Wickham's website:

http://had.co.nz/ggplot2/book.pdf

You could use something like:
grid.gedit(gPath(xaxis, labels), gp=gpar(fontsize=6))

I'm not aware of a good way of rotating the text. I tried it but it did 
not look good, because with grid.gedit, the position of the different 
elements is not adjusted. So if you rotate labels, maybe they will be 
drawn on top of the axis title.


For the pdf device, you also need to specify the size of the graphic 
region, with something like:

pdf(paper=a4r, width=9, height=6)
see ?pdf for details

Xavier


Mikhail Spivakov a écrit :

Hi everyone,

I've got quite a few labels along the x axis and ggplot2 basically just
crams them on top of each other.
Is it possible to reduce the font size and/or text direction?

Stretching the windows device window manually also helps, but I found that
setting the parameters for the pdf device (where my scripts should print the
data), such as paper=a4r just results in a lot of empty space at both
sides.

Thanks for your help!

Mikhail


Mikhail Spivakov, PhD
Postdoctoral Fellow
EMBL/EBI
UK  Germany
  


--
Xavier Chardon
Thésard Institut de l'élevage / INRA
Projet ACTA modélisation environnementale des systèmes bovins et porcins

[EMAIL PROTECTED]
[EMAIL PROTECTED]
02 23 48 50 91

__
R-help@r-project.org 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 Based Bootstrap

2008-05-06 Thread Andreas Klein
Hello.

Has anyone any idea how a function would look like of a model based bootstrap, 
when the underlying time series follows an ARIMA(1,1,1)-process?
A pure AR-process is no problem, but what is, if the time series need to be 
differentiated of order one or above and the additional MA-part?

Sample code for a series, which follows a pure AR-process:

#Series y of 192 observations, which follows an AR(1)-process
#Fit of an AR(1)-Model to y

ar.coef - ar(y)$ar
ar.resid- ar(y)$resid

#Sampling for mean

y_sample- numeric(192)
y_sample[1] - y[1]
mean_y  - numeric(1)

for (i in 1:1)

{

 for (j in 1:191)

 {

  idx   - sample(2:192,1,replace=TRUE)
  y_sample[j+1] - y_sample[j]*ar.coef+ar.resid[idx]

 }

 mean_y[i] - mean(y_sample)
 
}


What would the function look like if y follows an ARIMA(1,1,1)-process for 
example or in general if y is a time series, which need to be differentiated 
and is best modeled with a mixture of AR and MA?

I hope you can help me.

Sincerely
Andreas.


  Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
__
R-help@r-project.org 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] adding an argument to ...

2008-05-06 Thread Romain Francois

Bonjour Christophe,

You can pass ... to a list and then extract its names, so something like:

if( ! uuu %in% names(list(...)) )

Good luck with your keyboard,

Romain

[EMAIL PROTECTED] wrote:

Hi the list

Is it possible to add one argument to the arguments contain in ... ?

I would like to do :

f - function(ttt,...)[
   if(... does not contain the args uuu)
   [add uuu=3 to ...]
   else[]
   g(ttt,...)
]

More precisely, my function g is a callNextMethod()

Thanks

Christophe

PS: sorry for using [ instead of accolade, I am not in my contry and I 
do not manage to get the accolade on this ¤¦²¤£$¤@ keybord...


--
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 76 77 00
Fax:  +44(0) 1249 76 77 07
Mob:  +44(0) 7813 52 61 23

__
R-help@r-project.org 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] merge numerous columns of unequal length

2008-05-06 Thread Patrick Burns

As the answers you've received suggest, you
can use a list.  Or you could have two
vectors: one with the data, the other with the
group identity.  The latter format is likely more
convenient for a lot of analyses.

Since your data are not inherently rectangular,
it is probably best to get the idea of spreadsheet
out of your head.  (It is probably best anyway.)

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)

T.D.Rudolph wrote:

I have numerous objects, each containing continuous data representing the
same variable, movement rate, yet each having a different number of rows.  
e.g.

d1-as.matrix(rnorm(5))
d2-as.matrix(rnorm(3))
d3-as.matrix(rnorm(6))

How can I merge these three columns side-by-side in order to create a table
regardless of the difference in length?  I wish to analyze the output in a
spreadsheet format.

Thanks!
Tyler



__
R-help@r-project.org 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] Regarding nls()

2008-05-06 Thread Guru S
Hi,

I have no problem performing the regression using R, and I successfully 
obtain the parameter estimates using the function nls(). However, how do I 
obtain the ANOVA output, r, r^2 and adj. r^2? 

Thanks  Regards,
Guru
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Lattice problems / cannot load lattice

2008-05-06 Thread K. Elo
Hi,

My problem is simple: since having updated the lattice package, I cannot 
load lattice anymore. If I type in the command 'library(lattice)' the 
loading fails with the following message:

--- cut here ---
Error in library.dynam(lib, package, package.lib) : 
  shared library 'lattice' not found
In addition: Warning messages:
1: In loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = 
keep.source) :
  package 'lattice' contains no R code
2: S3 
methods ‘[.shingle’, ‘as.data.frame.shingle’, ‘plot.shingle’, ‘print.shingle’, 
‘summary.shingle’, ‘as.character.shingleLevel’, ‘print.shingleLevel’, 
‘print.trellis’, ‘plot.trellis’, ‘update.trellis’, ‘dim.trellis’, 
‘dimnames.trellis’, ‘dimnames-.trellis’, ‘[.trellis’, ‘t.trellis’, 
‘summary.trellis’, ‘print.summary.trellis’, ‘barchart.formula’, 
‘barchart.array’, ‘barchart.default’, ‘barchart.matrix’, ‘barchart.numeric’, 
‘barchart.table’, ‘bwplot.formula’, ‘bwplot.numeric’, ‘densityplot.formula’, 
‘densityplot.numeric’, ‘dotplot.formula’, ‘dotplot.array’, ‘dotplot.default’, 
‘dotplot.matrix’, ‘dotplot.numeric’, ‘dotplot.table’, ‘histogram.formula’, 
‘histogram.factor’, ‘histogram.numeric’, ‘qqmath.formula’, ‘qqmath.numeric’, 
‘stripplot.formula’, ‘stripplot.numeric’, ‘qq.formula’, ‘xyplot.formula’, 
‘levelplot.formula’, 
[... truncated] 
Error: package/namespace load failed for 'lattice'
--- cut here ---

R-System info:
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  2
minor  7.0
year   2008
month  04
day22
svn rev45424
language   R
version.string R version 2.7.0 (2008-04-22)

Any hints? Any ideas?

Thanks in advance,
Kimmo
__
R-help@r-project.org 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] fCopulae

2008-05-06 Thread Yohan Chalabi
 CA == chockri adnen [EMAIL PROTECTED]
 on Wed, 30 Apr 2008 13:34:42 +0200


   CA My problem in a few words is as folow:
   CA I used the fCopulae packages because i have 2 series which
   CA are already
   CA transformed in the uniform domain (the space of the copulas
   CA functions) and i
   CA estimated with type archmList() from 1 to 22, but i don't
   CA know their
   CA names:for exemple the type=4 is the Gumbel Copula...and for
   CA the others i
   CA can't have any idea about how can i find teir names
   CA explicitly?
   CA Please can you help me in this point?
   CA Thank you.

the numbers archmList() corresponds to the copula numbers as defined in
An Introduction to Copulas by RB Nelson.

I will add the reference in the help page of archmList.

hope this helps,
Yohan

-- 
PhD student
Swiss Federal Institute of Technology
Zurich

www.ethz.ch
www.rmetrics.org

NOTE:
Rmetrics Workshop: http://www.rmetrics.org/meielisalp.htm
June 29th - July 3rd Meielisalp, Lake Thune, Switzerland

__
R-help@r-project.org 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] adaptive optimization of mesh size

2008-05-06 Thread baptiste Auguié
my post may have slipped through the bank holiday and be forgotten by  
now, I'm still hoping for some pointers. Please let me know if I need  
to clarify the problem.


baptiste


On 4 May 2008, at 16:39, baptiste Auguié wrote:


DeaR list,


I'm running an external program that computes some electromagnetic  
response of a scattering body. The numerical scheme is based on a  
discretization with a characteristic mesh size y. The smaller y  
is, the better the result (but obviously the computation will take  
longer).


A convergence study showed the error between the computed values  
and the exact solution of the problem to be a quadratic in y, with  
standard error increasing as y^3. I wrote the interface to the  
program in R, as it is much more user friendly and allows for post- 
processing analysis. Currently, it only runs with user-defined  
discretization parameter. I would like to implement an adaptive  
scheme [1] and provide the following improvements,


1) obtain an estimate of the error by fitting the result against a  
series of mesh sizes with the quadratic model, and extrapolate at y  
= 0. (quite straight forward)


2) adapt dynamically the set of mesh sizes to fulfill a final  
accuracy condition, between a starting value (a rule-of thumb  
estimate is given by the problem values). The lower limit of y  
should also be constrained by the resources (again, an empirical  
rule dictates the computation time and memory usage).


I'm looking for advice on this second point (both on the technical  
aspect, and whether this is sound statistically):


- I can foresee that I should always start with a few y values  
before I can do any extrapolation, but how many of them? 3, 10? How  
could I know?


- once I have enough points (say, 10) to use the fitting procedure  
and get an estimate of the error, how should I decide the best  
location of the next y if the error is too important?


- in a practical implementation, I would use a while loop and  
append the successive values to a data.frame(y, value). However,  
this procedure will be run for different parameters (wavelengths,  
actually), so the set and number of y values may vary between one  
run and another. I think I'd be better off using a list with each  
new run having its own data.frame. Does this make sense?



Below are a few lines of code to illustrate the problem,


program.result - function(x, p){ # made up function that mimicks  
the results of the real program


y - p[3]*x^2 + p[2]*x + p[1]
y * (1 + rnorm(1, mean=0,  sd =  0.1 * y^3))
}


p0 - c(0.1, 0.1, 2) # set of parameters

## user defined limits of the y parameter (log scale)
limits - c(0.1, 0.8)
limits.log - (10^limits)
y.log - seq(limits.log[1], limits.log[2], l=10)

y - log10(y.log)

result - sapply(y, function(x) program.result(x, p0)) # results  
of the program


 fitting and extrapolation procedure 
library(gplots) # plot with CI
plotCI(y,  result, y^3,  xlim=c(0, 1), ylim=c(0, 2)) # the data  
with y^3 errors


my.data - data.frame(y = y,  value = result)

fm - lm(value ~ poly(y, degree=2, raw=TRUE), data = my.data ,   
weights = 1/y^3)

lines(y, predict(fm, data.frame(y=y)), col = 2)

extrap - summary(fm)$coefficients[1,] # intercept and error on it
plotCI(0,extrap[1], 2 * extrap[2],  col = 2, add=T)


### my naive take on adaptive runs... ##

objective - 1e-3 # stop when the standard error of the  
extrapolated value is smaller than this


err - extrap[2]
my.color - 3
while (err  objective){

new.value - min(y)/2 # i don't know how to choose this optimally
y - c(new.value, y)
new.result - program.result(new.value, p0)
result - c(new.result, result)
points(new.value, new.result, col= my.color)
my.data - data.frame(y = y,  value = result)
	fm - lm(value ~ poly(y, degree=2, raw=TRUE), data = my.data ,   
weights = 1/y^3)

lines(y, predict(fm, data.frame(y=y)), col = my.color)

extrap - summary(fm)$coefficients[1,] # intercept and error on it
err - extrap[2]
print(err)
plotCI(0,extrap[1], 2 * err,  col = 2, add=T)
my.color - my.color + 1

}
err




Many thanks in advance for your comments,

baptiste


[1]: Yurkin et al., Convergence of the discrete dipole  
approximation. II. An extrapolation technique to increase the

accuracy. J. Opt. Soc. Am. A / Vol. 23, No. 10 / October 2006
_

Baptiste Auguié

Physics Department
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
http://projects.ex.ac.uk/atto
__







_

Baptiste Auguié

Physics Department
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
http://projects.ex.ac.uk/atto

__
R-help@r-project.org 

Re: [R] Lattice problems / cannot load lattice

2008-05-06 Thread Prof Brian Ripley

Try installing again by

install.packages(lattice, .Library)

(from an account with suitable privileges).

If that still fails, we need to see the output produced during 
installation.


On Tue, 6 May 2008, K. Elo wrote:


Hi,

My problem is simple: since having updated the lattice package, I cannot
load lattice anymore. If I type in the command 'library(lattice)' the
loading fails with the following message:

--- cut here ---
Error in library.dynam(lib, package, package.lib) :
 shared library 'lattice' not found
In addition: Warning messages:
1: In loadNamespace(package, c(which.lib.loc, lib.loc), keep.source =
keep.source) :
 package 'lattice' contains no R code
2: S3
methods ‘[.shingle’, ‘as.data.frame.shingle’, ‘plot.shingle’, ‘print.shingle’, 
‘summary.shingle’, ‘as.character.shingleLevel’, ‘print.shingleLevel’, 
‘print.trellis’, ‘plot.trellis’, ‘update.trellis’, ‘dim.trellis’, 
‘dimnames.trellis’, ‘dimnames-.trellis’, ‘[.trellis’, ‘t.trellis’, 
‘summary.trellis’, ‘print.summary.trellis’, ‘barchart.formula’, ‘barchart.array’, 
‘barchart.default’, ‘barchart.matrix’, ‘barchart.numeric’, ‘barchart.table’, 
‘bwplot.formula’, ‘bwplot.numeric’, ‘densityplot.formula’, ‘densityplot.numeric’, 
‘dotplot.formula’, ‘dotplot.array’, ‘dotplot.default’, ‘dotplot.matrix’, 
‘dotplot.numeric’, ‘dotplot.table’, ‘histogram.formula’, ‘histogram.factor’, 
‘histogram.numeric’, ‘qqmath.formula’, ‘qqmath.numeric’, ‘stripplot.formula’, 
‘stripplot.numeric’, ‘qq.formula’, ‘xyplot.formula’, ‘levelplot.f!

ormula’,

[... truncated]
Error: package/namespace load failed for 'lattice'
--- cut here ---

R-System info:
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  2
minor  7.0
year   2008
month  04
day22
svn rev45424
language   R
version.string R version 2.7.0 (2008-04-22)

Any hints? Any ideas?

Thanks in advance,
Kimmo
__
R-help@r-project.org 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/
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@r-project.org 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] Lattice problems / cannot load lattice

2008-05-06 Thread K. Elo
Hi,

thanks for the quick reply :)

Prof Brian Ripley kirjoitti viestissään (06.05.2008):
 Try installing again by

 install.packages(lattice, .Library)

 (from an account with suitable privileges).

Tried (as root) - not working :(

 If that still fails, we need to see the output produced during
 installation.

Here we go:
--
 install.packages(lattice, .Library)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying 
URL 'http://cran.ch.r-project.org/src/contrib/lattice_0.17-7.tar.gz'
Content type 'application/x-gzip' length 275240 bytes (268 Kb)
opened URL
==
downloaded 268 Kb

* Installing *source* package 'lattice' ...
** libs
gcc -std=gnu99 -I/usr/lib64/R/include  -I/usr/local/include-fpic  -g -O2 -c 
init.c -o init.o
gcc -std=gnu99 -I/usr/lib64/R/include  -I/usr/local/include-fpic  -g -O2 -c 
threeDplot.c -o threeDplot.o
gcc -std=gnu99 -shared -L/usr/local/lib64 -o lattice.so init.o 
threeDplot.o   -L/usr/lib64/R/lib -lR
** R
** data
**  moving datasets to lazyload DB
** demo
** preparing package for lazy loading
** help
  Building/Updating help pages for package 'lattice'
 Formats: text html latex example
  Lattice   texthtmllatex   example
  Rows  texthtmllatex
  axis.default  texthtmllatex   example
  banking   texthtmllatex   example
  barchart.tabletexthtmllatex   example
  barleytexthtmllatex   example
  cloud texthtmllatex   example
  draw.colorkey texthtmllatex
  draw.key  texthtmllatex
  environmental texthtmllatex   example
  ethanol   texthtmllatex   example
  histogram texthtmllatex   example
  interaction   texthtmllatex   example
  lattice.options   texthtmllatex   example
  latticeParseFormula   texthtmllatex
  level.colors  texthtmllatex   example
  levelplot texthtmllatex   example
  llinestexthtmllatex
  lset  texthtmllatex
  make.groups   texthtmllatex   example
  melanoma  texthtmllatex   example
  onewaytexthtmllatex
  packet.panel.default  texthtmllatex   example
  panel.axistexthtmllatex
  panel.barcharttexthtmllatex
  panel.bwplot  texthtmllatex   example
  panel.cloud   texthtmllatex
  panel.densityplot texthtmllatex
  panel.dotplot texthtmllatex
  panel.functions   texthtmllatex
  panel.histogram   texthtmllatex
  panel.levelplot   texthtmllatex
  panel.number  texthtmllatex
  panel.pairs   texthtmllatex
  panel.paralleltexthtmllatex
  panel.qqmath  texthtmllatex
  panel.qqmathline  texthtmllatex
  panel.stripplot   texthtmllatex
  panel.superpose   texthtmllatex
  panel.violin  texthtmllatex   example
  panel.xyplot  texthtmllatex   example
  prepanel.default  texthtmllatex
  prepanel.functionstexthtmllatex
  print.trellis texthtmllatex   example
  qqtexthtmllatex   example
  qqmathtexthtmllatex   example
  rfs   texthtmllatex   example
  shingles  texthtmllatex   example
  simpleKey texthtmllatex
  simpleTheme   texthtmllatex   example
  singertexthtmllatex   example
  splom texthtmllatex   example
  strip.default texthtmllatex   example
  tmd   texthtmllatex   example
  trellis.devicetexthtmllatex
  trellis.objecttexthtmllatex
  trellis.par.get   texthtmllatex   example
  update.trellistexthtmllatex   example
  utilities.3d  texthtmllatex
  xyplot   

Re: [R] Lattice problems / cannot load lattice

2008-05-06 Thread K. Elo
Prof Brian Ripley kirjoitti viestissään (06.05.2008):
 Does starting R --vanilla help?

 I am wondering if you have another corrupt copy of lattice somewhere.


The latter was the problem, many thanks for this! I use Rkward as GUI 
and obviously some packages have been installed into the user directory 
instead of being installed into the system directory. This messed up 
the installation :( After having deleted the local directory and 
restarted R lattice loaded just fine :)

Once again: many thanks to Brian for his kind help!

Kind regards,
Kimmo

__
R-help@r-project.org 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] Regarding nls()

2008-05-06 Thread Dieter Menne
Guru S guru.rcom at rediffmail.com writes:

 I have no problem performing the regression using R, and I successfully 
 obtain the parameter estimates using the function nls(). However, how do I 
 obtain the ANOVA output, r, r^2 and adj. r^2? 

This is a feature, not a bug. See Douglas Bates's comments on 

http://www.ens.gu.edu.au/ROBERTK/R/HELP/00B/0399.HTML


Dieter

__
R-help@r-project.org 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] Spacing between lattice panels

2008-05-06 Thread Richard . Cotton
I'm trying to set up a lattice plot with two y-axes for each panel.  (Yes, 
I know that multiple y-axes are generally a bad idea; the graph is for 
someone else and they want it that way.)  I've used a custom 
yscale.component in xyplot to achieve this:

myyscale.component - function(...)
{
  ans - yscale.components.default(...)
  ans$right - ans$left
  foo - ans$right$labels$at
  ans$right$labels$labels - as.character(10*foo)
  ans 
}

xyplot(Sepal.Length ~ Petal.Length| Species, data = iris, scales = 
list(y=list(relation=free, alternating=3, rot=0)), 
yscale.component=myyscale.component)
 
The problem is that the panels are too close together.  This appears to be 
because (according to the help documentation) xyplot ignores the 
alternating argument when relation is not same.  I presume that manually 
setting some plotting parameters with trellis.par.set() will allow me to 
adjust the spacing between the panels, though I can't figure out which 
ones to change.

Is there a way to get lattice to properly space the panels, or failing 
that, how do I manually space them?

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org 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] Dendrogram label size

2008-05-06 Thread Alex Reynolds
Is it possible to resize the labels in a dendrogram without applying  
circles and triangles to edges?


I tried cex.labels:

 plot(scoreDendogramObj, horiz=TRUE, axes=FALSE, cex.labels=0.8)

but that didn't have any effect.

Thanks,
Alex

__
R-help@r-project.org 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] Error in FUN(newX[, i], ...) : no complete element pairs in R 2.7.0 patched

2008-05-06 Thread Bos, Roger
Using R 2.6.0 patched I was able to calculate the variance of each row
of a matrix without error, even if some rows had only NAs.  I would just
get NAs back as the variance for those rows.  Now with R 2.7.0 patched I
get an error no complete element pairs if any one row has all NAs.
Can anyone tell if I can make R 2.7.0 patched behave as R 2.6.0 did so I
don't have to change all my code.  Or maybe suggest a simple work
around. A short example is below.  Thanks in advance. 

dat - data.frame(aa=c(1,2,as.numeric('NA'),4),
bb=c(2,3,as.numeric('NA'),5), cc=c(3,4,as.numeric('NA'),6),
dd=c(4,5,as.numeric('NA'),7))
apply(dat, 1, var, na.rm=TRUE)


 dat
  aa bb cc dd
1  1  2  3  4
2  2  3  4  5
3 NA NA NA NA
4  4  5  6  7
 apply(dat, 1, var, na.rm=TRUE)
Error in FUN(newX[, i], ...) : no complete element pairs
 
 

** * 
This message is for the named person's use only. It may 
contain confidential, proprietary or legally privileged 
information. No right to confidential or privileged treatment 
of this message is waived or lost by any error in 
transmission. If you have received this message in error, 
please immediately notify the sender by e-mail, 
delete the message and all copies from your system and destroy 
any hard copies. You must not, directly or indirectly, use, 
disclose, distribute, print or copy any part of this message 
if you are not the intended recipient. 

__
R-help@r-project.org 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 do I write a sum of matrixes??

2008-05-06 Thread David Winsemius
pascal vrolijk [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

 Hello best helpers,
 
 I am a new user and I have been struggling for hours. So finally I
 decide to ask you: If I have a matrix P, and P.2 = P%*%P, and
 P.3=P.2%*%P is there a function to calculate the power of a matrix??
 if not how can i do: for (i in 1:10)  {P.i=P^i} 

Three methods show up in a search r-help power of a matrix:

1) Use a pre-built function:
library(msm)
?MatrixExp 

2) 
https://stat.ethz.ch/pipermail/r-help/2007-May/131330.html

3) Bill Venables offered this about a week ago in this list:
--
This is probably as good a way as any way for this kind of problem.
First define a binary operator:

 %^% - function(x, n)
with(eigen(x), vectors %*% (values^n * t(vectors)))

Your toy example then becomes

 m - matrix(c(1, 0.4, 0.4, 1), nrow = 2)
 m
 [,1] [,2]
[1,]  1.0  0.4
[2,]  0.4  1.0

 m %^% (-0.5)
   [,1]   [,2]
[1,]  1.0680744 -0.2229201
[2,] -0.2229201  1.0680744 
-

-- 
David Winsemius


 after this I need to sum them up and my problem is to combine P and
 i to P.i  can anyone help me please??? 
 
 Thanks and have a nice day, 
 
 Pascal.

__
R-help@r-project.org 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] rpart for survival fits

2008-05-06 Thread Terry Therneau
 When I plot a survival fit using rpart for the classification tree, for each
 node, there is a decimal based number above the event/total. I tried to see if
 it's the exponential ratio or logrithmics, neither seem to be the case. I'm
 wondering if anyone knows what they are.

-
 
  It is an estimate of the event rate, using a Baysian shrinkage argument
(#events +a) / (n +b)  *c
 
To understand how the constants a and b are chosen, you need to read the 
detailed documentation (as pointed out already by Brian R).  The constant c is 
chosen to make the printed rate of the top node equal to 1.  This last is 
done 
just to make it easier to scan the tree -- one can easily see that the rate is, 
say, 20% lower in some particular node than for the data set as a whole.


Terry Therneau

__
R-help@r-project.org 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] Gravity (spatial interaction) models in R

2008-05-06 Thread Roger Bivand
Melanie Murphy mamurphy at turbonet.com writes:

 
 I was wondering if anyone has developed (or is developing) an
 implementation for gravity models (spatial interaction) in R.  I
 conducted several searches on the CRAN website with no luck.  Currently
 I am estimating parameters via linearization.

There isn't anything (yet) in the Spatial task view on CRAN, and I'm not aware
of the topic coming up on the R-sig-geo list either. The nearest sign of
transport planning is perhaps the emme2 package for interfacing EMME/2 software.
As you are aware, there are many almost equivalent ways of fitting gravity
models, so many R functions are feasible. But no dedicated functions so far, I'm
afraid - if I'm wrong, please let me know, and I'll update the task view.

Roger

 
 Thank you in advance
 
 Melanie Murphy


__
R-help@r-project.org 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] single plot statement, multiple plots

2008-05-06 Thread Shubha Vishwanath Karanth
Hi R,

 

par(mfrow=c(2,2))

x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4

 

I need to write a single plot statement, which creates 4 plots (for x1,
x2, x3 and x4) in the graphics window, without using 'for' loop. Is this
possible? Does 'do.call' help in this context? Or do I have any option
in the 'plot' statement itself to do this?

 

Thanks in advance,

Shubha

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

__
R-help@r-project.org 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] Significance analysis of Microarrays (SAM)

2008-05-06 Thread Eleni Christodoulou
Dear list,

I am trying to perform a significance analysis of a microarray experiment
with survival data using the {samr} package. I have a matrix containing my
data which has 17816 rows corresponding to genes, and 286 columns
corresponding to samples. The name of this matrix is data.matrix2. Some of
the first values of this matrix are:
data.matrix2[1:3,1:5]
 GSM36777  GSM36778 GSM36779 GSM36780 GSM36781
[1,] 1.009274 1.0740659 1.048540 1.015946 1.022650
[2,] 1.007992 0.8768410 0.962442 1.111742 1.121150
[3,] 0.981853 0.9606492 1.024987 1.053302 1.063408

 I also have the time in which each patient-sample is examined for relapse.
This information is in vector y, which has length 286, and is declared in
months. Indicatively:
y[1:5]
[1] 101 118   9 106  37

Finally, I have a variable censored, which is 1 if the patient has relapsed
when examined at the examined time and 0 if not. Indicatively:
censored[1:5]
[1] 0 0 1 0 1


I am trying to perform the following sam analysis:
d=list(data.matrix2,y,censored)
samr.obj=samr(d,resp.type=Survival, nperms=20)

When I am running the above commands I  get the error:
Error in check.format(y, resp.type = resp.type, censoring.status =
censoring.status) :
  Error in input response data: response type  Survival  specified; error in
censoring indicator
In addition: Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'


I really cannot understand what  is wrong with my code.  Could anyone please
help me with this?

Thank you all,
Eleni

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Spacing between lattice panels

2008-05-06 Thread Deepayan Sarkar
On 5/6/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I'm trying to set up a lattice plot with two y-axes for each panel.  (Yes,
  I know that multiple y-axes are generally a bad idea; the graph is for
  someone else and they want it that way.)  I've used a custom
  yscale.component in xyplot to achieve this:

  myyscale.component - function(...)
  {
   ans - yscale.components.default(...)
   ans$right - ans$left
   foo - ans$right$labels$at
   ans$right$labels$labels - as.character(10*foo)
   ans
  }

  xyplot(Sepal.Length ~ Petal.Length| Species, data = iris, scales =
  list(y=list(relation=free, alternating=3, rot=0)),
  yscale.component=myyscale.component)

  The problem is that the panels are too close together.  This appears to be
  because (according to the help documentation) xyplot ignores the
  alternating argument when relation is not same.  I presume that manually
  setting some plotting parameters with trellis.par.set() will allow me to
  adjust the spacing between the panels, though I can't figure out which
  ones to change.

  Is there a way to get lattice to properly space the panels,

No.

 or failing that, how do I manually space them?

The space between panels can be controlled using the 'between'
argument. You additionally need some space at the right, for which you
need to set a width component. E.g.,

xyplot(Sepal.Length ~ Petal.Length| Species, data = iris,
  scales = list(y=list(relation=free, alternating=3, rot=0)),
  yscale.component=myyscale.component,
  between = list(x = 2),
  par.settings = list(layout.widths = list(right.padding = 5)))

The full list of components of 'layout.widths' is given by

names(trellis.par.get(layout.widths))

-Deepayan

__
R-help@r-project.org 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] single plot statement, multiple plots

2008-05-06 Thread Gabor Grothendieck
Try plot.zoo in which case you don't need the par:

library(zoo)
plot(zoo(cbind(x1, x2, x3, x4)), nc = 2)

or

plot(zoo(outer(1:5, 1:4, ^)), nc = 2)

See ?plot.zoo, ?xyplot.zoo and the three vignettes in
the zoo package.

On Tue, May 6, 2008 at 9:47 AM, Shubha Vishwanath Karanth
[EMAIL PROTECTED] wrote:
 Hi R,



 par(mfrow=c(2,2))

 x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4



 I need to write a single plot statement, which creates 4 plots (for x1,
 x2, x3 and x4) in the graphics window, without using 'for' loop. Is this
 possible? Does 'do.call' help in this context? Or do I have any option
 in the 'plot' statement itself to do this?



 Thanks in advance,

 Shubha

 This e-mail may contain confidential and/or privileged i...{{dropped:13}}

 __
 R-help@r-project.org 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@r-project.org 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] single plot statement, multiple plots

2008-05-06 Thread Shubha Vishwanath Karanth
Thank you very much Gabor...Zoo is very powerful...

Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510 
Bangalore * Colombo * London * New York * San José * Singapore * 
www.ambaresearch.com
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 06, 2008 7:40 PM
To: Shubha Vishwanath Karanth
Cc: [EMAIL PROTECTED]
Subject: Re: [R] single plot statement, multiple plots

Try plot.zoo in which case you don't need the par:

library(zoo)
plot(zoo(cbind(x1, x2, x3, x4)), nc = 2)

or

plot(zoo(outer(1:5, 1:4, ^)), nc = 2)

See ?plot.zoo, ?xyplot.zoo and the three vignettes in
the zoo package.

On Tue, May 6, 2008 at 9:47 AM, Shubha Vishwanath Karanth
[EMAIL PROTECTED] wrote:
 Hi R,



 par(mfrow=c(2,2))

 x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4



 I need to write a single plot statement, which creates 4 plots (for x1,
 x2, x3 and x4) in the graphics window, without using 'for' loop. Is this
 possible? Does 'do.call' help in this context? Or do I have any option
 in the 'plot' statement itself to do this?



 Thanks in advance,

 Shubha

 This e-mail may contain confidential and/or privileged i...{{dropped:13}}

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

This e-mail may contain confidential and/or privileged i...{{dropped:10}}

__
R-help@r-project.org 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] single plot statement, multiple plots

2008-05-06 Thread David Winsemius
Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

 Hi R,
 
 par(mfrow=c(2,2))
 
 x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4
 
 I need to write a single plot statement, which creates 4 plots (for
 x1, x2, x3 and x4) in the graphics window, without using 'for' loop.
 Is this possible? Does 'do.call' help in this context? Or do I have
 any option in the 'plot' statement itself to do this?
 

Have you considered lapply()?

-- 
David Winsemius

__
R-help@r-project.org 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 put different color in some portion of a surface plot?

2008-05-06 Thread Megh Dal
Hi all,
   
  I have following problem :
   
  a = b = seq(1, 5, by=500)
v = matrix(0, nrow=length(a), ncol=length(a))
for (i in 1:length(a))
   {
for (j in 1:length(a))
   {
d = c(17989*a[i], -18109*b[j])
v[i,j] = t(d) %*% matrix(c(0.0001741, 0.0001280, 0.0001280, 0.0002570), 
nrow=2) %*% d
   }
   }
library(rgl)
open3d()
persp3d(a,b,v,col=green,alpha=0.7,aspect=c(1,1,0.5))

   
  Now I want to shed the portion with different color of the surface which 
satisfy following condition:
   
  0  (a-b)  max(a)
   
  Can anyone please tell me how to do that?
   
  Regards,

   
-
[[elided Yahoo spam]]
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] single plot statement, multiple plots

2008-05-06 Thread Shubha Vishwanath Karanth
Wonderful...This works...

lapply(list(x1,x2,x3,x4),plot,type=l)

Thanks a lot!
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of David Winsemius
Sent: Tuesday, May 06, 2008 7:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [R] single plot statement, multiple plots

Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

 Hi R,
 
 par(mfrow=c(2,2))
 
 x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4
 
 I need to write a single plot statement, which creates 4 plots (for
 x1, x2, x3 and x4) in the graphics window, without using 'for' loop.
 Is this possible? Does 'do.call' help in this context? Or do I have
 any option in the 'plot' statement itself to do this?
 

Have you considered lapply()?

-- 
David Winsemius

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
This e-mail may contain confidential and/or privileged i...{{dropped:10}}

__
R-help@r-project.org 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 put different color in some portion of a surface plot?

2008-05-06 Thread Duncan Murdoch

On 5/6/2008 10:31 AM, Megh Dal wrote:

Hi all,
   
  I have following problem :
   
  a = b = seq(1, 5, by=500)

v = matrix(0, nrow=length(a), ncol=length(a))
for (i in 1:length(a))
   {
for (j in 1:length(a))
   {
d = c(17989*a[i], -18109*b[j])
v[i,j] = t(d) %*% matrix(c(0.0001741, 0.0001280, 0.0001280, 0.0002570), 
nrow=2) %*% d
   }
   }
library(rgl)
open3d()
persp3d(a,b,v,col=green,alpha=0.7,aspect=c(1,1,0.5))

   
  Now I want to shed the portion with different color of the surface which satisfy following condition:
   
  0  (a-b)  max(a)
   
  Can anyone please tell me how to do that?


The col option can be a matrix of the same shape as v, giving the colour 
at each vertex.  (Note that this is different from persp(), which gives 
the colour in each cell, i.e. one less in each dimension.  The persp3d 
man page tells how to duplicate the persp() behaviour.)


For example,

shade - outer(a, b, function(x,y) (0  (x-y))  ((x-y)  max(a)))
persp3d(a,b,v,col=ifelse(shade, red, green),
alpha=0.7,aspect=c(1,1,0.5))

Duncan Murdoch

__
R-help@r-project.org 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] To preserve the class Matrix

2008-05-06 Thread Shubha Vishwanath Karanth
Hi,

 

Suppose

a=matrix(1:9,3,3)

 

 a

 [,1] [,2] [,3]

[1,]147

[2,]258

[3,]369

 

Now,

 class(a[1:2,])

[1] matrix

 class(a[1:3,])

[1] matrix

 class(a[,1:2])

[1] matrix

 class(a[,1:3])

[1] matrix

 

 

But,

 class(a[1,])

[1] integer

 class(a[,1])

[1] integer

 

Can in a general way get class(a[1,]) or class(a[,1]) to be matrix only?

Shubha Karanth | Amba Research

Ph +91 80 3980 8031 | Mob +91 94 4886 4510 

Bangalore * Colombo * London * New York * San José * Singapore * 
www.ambaresearch.com

 

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

__
R-help@r-project.org 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] To preserve the class Matrix

2008-05-06 Thread Shubha Vishwanath Karanth
Thank you very much Mark! That worked Just a question, ?[ does give an 
error to me...how do I find it?

Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510 
Bangalore * Colombo * London * New York * San José * Singapore * 
www.ambaresearch.com

-Original Message-
From: Shubha Vishwanath Karanth 
Sent: Tuesday, May 06, 2008 8:50 PM
To: 'Mark Leeds'
Subject: RE: [R] To preserve the class Matrix

Thank you very much Mark! That worked Just a question, ?[ does give an 
error to me...how do I find it?

Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510 
Bangalore * Colombo * London * New York * San José * Singapore * 
www.ambaresearch.com

-Original Message-
From: Mark Leeds [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 06, 2008 8:46 PM
To: Shubha Vishwanath Karanth
Subject: RE: [R] To preserve the class Matrix

Hui Shubha: If I understand what you're asking, you want to use drop=FALSE
as in a[1,,drop=FALSE] That retains the dimension ( ie, the matrixness ) of
the object.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Shubha Vishwanath Karanth
Sent: Tuesday, May 06, 2008 11:07 AM
To: [EMAIL PROTECTED]
Subject: [R] To preserve the class Matrix

Hi,

 

Suppose

a=matrix(1:9,3,3)

 

 a

 [,1] [,2] [,3]

[1,]147

[2,]258

[3,]369

 

Now,

 class(a[1:2,])

[1] matrix

 class(a[1:3,])

[1] matrix

 class(a[,1:2])

[1] matrix

 class(a[,1:3])

[1] matrix

 

 

But,

 class(a[1,])

[1] integer

 class(a[,1])

[1] integer

 

Can in a general way get class(a[1,]) or class(a[,1]) to be matrix only?

Shubha Karanth | Amba Research

Ph +91 80 3980 8031 | Mob +91 94 4886 4510 

Bangalore * Colombo * London * New York * San Josi * Singapore *
www.ambaresearch.com

 

This e-mail may contain confidential and/or privileged i...{{dropped:13}}


This e-mail may contain confidential and/or privileged i...{{dropped:10}}

__
R-help@r-project.org 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] split and subset

2008-05-06 Thread partofy
Dear list:

I ask for your help in a simple problem in which I'm not figuring out
the solution

My data looks like:
dat- data.frame(date=c(12/12/1980, 03/11/1994, 15/11/1999,
31/10/2000, 20/03/2007, 05/01/2001), 
var1=c(A, A, B, D, C, A), var2=runif(6))

I was wondering if I could split the column date in 3 new columns in 
he data frame corresponding to day, month and year.


If I decide not to split the date in 3 columns, I'd do:

dat$date- as.Date(dat$date, %d/%m/%Y)

Now, how can I subset parts of the dataframe, lets say for a given month
and year, something like
subset(dat, date==1999-11-??)
The ?? is obviously wrong. How should I do this?

Many thanks
-- 
  
  [EMAIL PROTECTED]

-- 

__
R-help@r-project.org 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] Significance analysis of Microarrays (SAM)

2008-05-06 Thread Martin Morgan
Hi Eleni --

Although samr is not a Bioconductor package, you might have more luck
asking on the Bioconductor mailing list, http://bioconductor.org. The
obvious place to start, and probably you have already done this, is to
ensure that the class of the objects passed to the function agree with
the classes described on the function help page.

Martin

Eleni Christodoulou [EMAIL PROTECTED] writes:

 Dear list,

 I am trying to perform a significance analysis of a microarray experiment
 with survival data using the {samr} package. I have a matrix containing my
 data which has 17816 rows corresponding to genes, and 286 columns
 corresponding to samples. The name of this matrix is data.matrix2. Some of
 the first values of this matrix are:
 data.matrix2[1:3,1:5]
  GSM36777  GSM36778 GSM36779 GSM36780 GSM36781
 [1,] 1.009274 1.0740659 1.048540 1.015946 1.022650
 [2,] 1.007992 0.8768410 0.962442 1.111742 1.121150
 [3,] 0.981853 0.9606492 1.024987 1.053302 1.063408

  I also have the time in which each patient-sample is examined for relapse.
 This information is in vector y, which has length 286, and is declared in
 months. Indicatively:
 y[1:5]
 [1] 101 118   9 106  37

 Finally, I have a variable censored, which is 1 if the patient has relapsed
 when examined at the examined time and 0 if not. Indicatively:
 censored[1:5]
 [1] 0 0 1 0 1


 I am trying to perform the following sam analysis:
 d=list(data.matrix2,y,censored)
 samr.obj=samr(d,resp.type=Survival, nperms=20)

 When I am running the above commands I  get the error:
 Error in check.format(y, resp.type = resp.type, censoring.status =
 censoring.status) :
   Error in input response data: response type  Survival  specified; error in
 censoring indicator
 In addition: Warning message:
 In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'


 I really cannot understand what  is wrong with my code.  Could anyone please
 help me with this?

 Thank you all,
 Eleni

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

__
R-help@r-project.org 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] Scatter Plot - 3 vectors side by side

2008-05-06 Thread A Ezhil
Hi,

I have 3 vectors, 
x=rnorm(10); y=rnorm(20); z=rnorm(30). 

I would like to plot 3 vectors side by side (like a
bar plot) with scatter plot something similar to the
following: 

..   ***  ;;;
..   **   ;;;
..   ***  ;;;
..   ***  ;;;
...  ***  ;;
x y   z

How can I do this with Plot()? 

Thanks in advance.
Best regards,
Ezhil





  


[[elided Yahoo spam]]

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


[R] Announcement: support of littler, rkward and rpy on Debian/Ubuntu

2008-05-06 Thread Vincent Goulet

Dear useRs,

This is to announce that the maintainers of the various distributions  
have decided to provide experimental up-to-date versions of the  
following R related packages on Debian stable and Ubuntu (i386 and  
amd64 architectures):


littler
rkward
python-rpy(not on Ubuntu Dapper)
python-rpy-doc (not on Ubuntu Dapper)

By experimental we mostly mean that support for these packages may  
remain somewhat of a moving target for some time. The maintainers are  
not necessarily users of these packages themselves, so positive and  
negative feedback through the usual channels (see below) would be  
appreciated.


See the Debian and Ubuntu README files on CRAN for more details:

http://cran.r-project.org/bin/linux/debian/
http://cran.r-project.org/bin/linux/ubuntu/

This message is CCd to r-help to reach as wide an audience as  
possible, but we remind that the best place to report problems with  
these packages or to ask R questions specific to Debian and Ubuntu is  
the R-SIG-Debian mailing list. See


https://stat.ethz.ch/mailman/listinfo/r-sig-debian

for more information.

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

__
R-help@r-project.org 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] split and subset

2008-05-06 Thread Henrique Dallazuanna
Try this:

subset(dat, format(date, %Y-%m) == 1999-11)



On Tue, May 6, 2008 at 12:25 PM, [EMAIL PROTECTED] wrote:

 Dear list:

 I ask for your help in a simple problem in which I'm not figuring out
 the solution

 My data looks like:
 dat- data.frame(date=c(12/12/1980, 03/11/1994, 15/11/1999,
 31/10/2000, 20/03/2007, 05/01/2001),
 var1=c(A, A, B, D, C, A), var2=runif(6))

 I was wondering if I could split the column date in 3 new columns in
 he data frame corresponding to day, month and year.


 If I decide not to split the date in 3 columns, I'd do:

 dat$date- as.Date(dat$date, %d/%m/%Y)

 Now, how can I subset parts of the dataframe, lets say for a given month
 and year, something like
 subset(dat, date==1999-11-??)
 The ?? is obviously wrong. How should I do this?

 Many thanks
 --

  [EMAIL PROTECTED]

 --

 __
 R-help@r-project.org 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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Scatter Plot - 3 vectors side by side

2008-05-06 Thread Chuck Cleland

On 5/6/2008 11:46 AM, A Ezhil wrote:

Hi,

I have 3 vectors, 
x=rnorm(10); y=rnorm(20); z=rnorm(30). 


I would like to plot 3 vectors side by side (like a
bar plot) with scatter plot something similar to the
following: 


..   ***  ;;;
..   **   ;;;
..   ***  ;;;
..   ***  ;;;
...  ***  ;;
x y   z

How can I do this with Plot()? 


  How about something like this:

stripchart(c(x,y,z) ~ rep(c(x,y,z), c(10,20,30)),
   vertical=TRUE, ylab=)


Thanks in advance.
Best regards,
Ezhil





  


[[elided Yahoo spam]]

__
R-help@r-project.org 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. (www.ndri.org)
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@r-project.org 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] Is there in R a function equivalent to the mround, as found in most spreadsheets?

2008-05-06 Thread Dr. Ottorino-Luca Pantani

Dear R-users,
I have the following problem

In a lab experiment I have to mix three solutions to get different 
concentrations of various molecules in a cuvette


I've used R to calculate the necessary µliters for each of the level of 
the experiment and I must confess that it is more useful and easier to 
achieve the results than using spreadsheets.


But there's a problem.

Imagine that for a particular cuvette (I have 112 different cuvettes !!) 
you have to mix the following volumes of solution A, B, and C respectively.


c(1803.02, 193.51, 3.47)

Each solution is to be taken with 3 different pipettes (5000, 250 and 10 
µL Volume max) and each of those delivers volumes in steps of 50 µL,  5 
µL  or 1µL, respectively

Since the above values  would eventually become

c(1800, 195, 3)

it is then necessary to recalculate all the final concentrations
of A, B and C, because the volumes are changed.


I know that in most spreadsheets (Calc in Open Office, Gnumeric, Excel 
and so on)

there's a function such as

mround(num; num)

that give the results I need, but I want to learn more on R functions.


I played a little with R functions such as

round, signif, ceiling, trunc, and floor

but without success.
Any hint to solve this problem ?

Thanks a lot

http://www.openofficetips.com/blog/archives/2005/04/rounding_to_the.html
http://www.gnome.org/projects/gnumeric/doc/gnumeric-MROUND.shtml

--
Ottorino-Luca Pantani, Università di Firenze
Dip. Scienza del Suolo e Nutrizione della Pianta
P.zle Cascine 28 50144 Firenze Italia
Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 
[EMAIL PROTECTED]  http://www4.unifi.it/dssnp/


__
R-help@r-project.org 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] merge numerous columns of unequal length

2008-05-06 Thread T.D.Rudolph

Indeed both options are salable, though I agree the latter may be more
convenient.
Merci!


Patrick Burns wrote:
 
 As the answers you've received suggest, you
 can use a list.  Or you could have two
 vectors: one with the data, the other with the
 group identity.  The latter format is likely more
 convenient for a lot of analyses.
 
 Since your data are not inherently rectangular,
 it is probably best to get the idea of spreadsheet
 out of your head.  (It is probably best anyway.)
 
 Patrick Burns
 [EMAIL PROTECTED]
 +44 (0)20 8525 0696
 http://www.burns-stat.com
 (home of S Poetry and A Guide for the Unwilling S User)
 
 T.D.Rudolph wrote:
 I have numerous objects, each containing continuous data representing the
 same variable, movement rate, yet each having a different number of rows.  
 e.g.
 d1-as.matrix(rnorm(5))
 d2-as.matrix(rnorm(3))
 d3-as.matrix(rnorm(6))

 How can I merge these three columns side-by-side in order to create a
 table
 regardless of the difference in length?  I wish to analyze the output in
 a
 spreadsheet format.

 Thanks!
 Tyler

 
 __
 R-help@r-project.org 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/merge-numerous-columns-of-unequal-length-tp17071464p17086657.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] unable to use functions require DLL from package base

2008-05-06 Thread A.N.

Hi all, 

I have issues using some basic functions in R such as these ones : 

 pp.test(R) (where is a vector of returns)
Error in .C(R_approx, as.double(x), as.double(y), as.integer(nx), xout =
as.double(xout),  : 
  C symbol name R_approx not in DLL for package base

boxcox(reg,plotit=T)  (where reg is an lm object)
Error in .C(spline_coef, method = as.integer(method), n = as.integer(nx), 
: 
  C symbol name spline_coef not in DLL for package base

as I do miss some symbol names. 

How can I overcome this serious problem ? 


-- 
View this message in context: 
http://www.nabble.com/unable-to-use-functions-require-DLL-from-package-%22base%22-tp17086783p17086783.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Regarding nls()

2008-05-06 Thread Spencer Graves
 My summary of Bates' comments cited below is as follows: 

  1.  ANOVA is an excellent tool but requires nested models.  
You can do this fairly easily, but it is not so easily automated. 

  2.  The standard definition of R^2 loses its meaning with 
nonlinear models.  Adjusted R^2 is even worse. 

 Bates' condemnation of R^2 has merit, but I would not go as far as 
he did in the comment cited below (dated 13 Aug 2000).  A standard 
definition of R^2 is as follows: 

   R^2 = (1 - var(prediction error) / var(obs)). 

 I can name several different ways of getting a negative R^2 in 
this case.  When that happens, it says the model is worse than useless, 
and you would be better off using the training set mean. 

 If I have an audience who wants an R^2 in an application where it 
is not clear what it even means, I try to briefly explain some of the 
difficulties while asking what question they are trying to solve using 
R^2.  Their answers will help me make a recommendation, which may 
include selecting which of the possible generalizations of R^2 to use. 

 Hope this helps. 
 Spencer Graves


Dieter Menne wrote:

Guru S guru.rcom at rediffmail.com writes:

  
I have no problem performing the regression using R, and I successfully 
obtain the parameter estimates using the function nls(). However, how do I 
obtain the ANOVA output, r, r^2 and adj. r^2? 



This is a feature, not a bug. See Douglas Bates's comments on 


http://www.ens.gu.edu.au/ROBERTK/R/HELP/00B/0399.HTML


Dieter

__
R-help@r-project.org 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@r-project.org 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] categorical data analysis

2008-05-06 Thread raymond chiruka
hie all
 

i am trying to carry out a categorical data analysis but my problem is that 
when in i use the chi squared  test some of my  expected values are less than 
5. is there a  test that can handle this situation. the data is not a 2*2 
table. its more from the social sciences where you have from strongly agree to 
strongly disagree. i know i can collapse vthe tables but there is a loss of 
information . is the a test vthat i can for this kind of data. 
thanks in advancde.

ray


   
-
[[elided Yahoo spam]]
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Is there in R a function equivalent to the mround, as found in most spreadsheets?

2008-05-06 Thread Duncan Murdoch

On 5/6/2008 12:07 PM, Dr. Ottorino-Luca Pantani wrote:

Dear R-users,
I have the following problem

In a lab experiment I have to mix three solutions to get different 
concentrations of various molecules in a cuvette


I've used R to calculate the necessary µliters for each of the level of 
the experiment and I must confess that it is more useful and easier to 
achieve the results than using spreadsheets.


But there's a problem.

Imagine that for a particular cuvette (I have 112 different cuvettes !!) 
you have to mix the following volumes of solution A, B, and C respectively.


c(1803.02, 193.51, 3.47)

Each solution is to be taken with 3 different pipettes (5000, 250 and 10 
µL Volume max) and each of those delivers volumes in steps of 50 µL,  5 
µL  or 1µL, respectively

Since the above values  would eventually become

c(1800, 195, 3)

it is then necessary to recalculate all the final concentrations
of A, B and C, because the volumes are changed.


I know that in most spreadsheets (Calc in Open Office, Gnumeric, Excel 
and so on)

there's a function such as

mround(num; num)

that give the results I need, but I want to learn more on R functions.


I played a little with R functions such as

round, signif, ceiling, trunc, and floor

but without success.
Any hint to solve this problem ?



I believe this function matches the description in OOO:

mround - function(number, multiple) multiple * round(number/multiple)

Duncan Murdoch

__
R-help@r-project.org 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] General Plotting Question

2008-05-06 Thread stephen sefick
f - (structure(list(X = structure(96:97, .Label = c(119DAmm, 119DN,
119DNN, 119DO, 119DOC, 119Flow, 119Nit, 119ON, 119OPhos,
119OrgP, 119Phos, 119TKN, 119TOC, 148DAmm, 148DN,
148DNN, 148DO, 148DOC, 148Flow, 148Nit, 148ON, 148OPhos,
148OrgP, 148Phos, 148TKN, 148TOC, 179DAmm, 179DN,
179DNN, 179DO, 179DOC, 179Flow, 179Nit, 179ON, 179OPhos,
179OrgP, 179Phos, 179TKN, 179TOC, 185DAmm, 185DN,
185DNN, 185DO, 185DOC, 185Flow, 185Nit, 185ON, 185OPhos,
185OrgP, 185Phos, 185TKN, 185TOC, 190DAmm, 190DN,
190DNN, 190DO, 190DOC, 190Flow, 190Nit, 190ON, 190OPhos,
190OrgP, 190Phos, 190TKN, 190TOC, 198DAmm, 198DN,
198DNN, 198DO, 198DOC, 198Flow, 198Nit, 198ON, 198OPhos,
198OrgP, 198Phos, 198TKN, 198TOC, 202DAmm, 202DN,
202DNN, 202DO, 202DOC, 202Flow, 202Nit, 202ON, 202OPhos,
202OrgP, 202Phos, 202TKN, 202TOC, 215DAmm, 215DN,
215DNN, 215DO, 215DOC, 215Flow, 215Nit, 215ON, 215OPhos,
215OrgP, 215Phos, 215TKN, 215TOC, 61DAmm, 61DN, 61DNN,
61DO, 61DOC, 61Flow, 61Nit, 61ON, 61OPhos, 61OrgP,
61Phos, 61TKN, 61TOC, BCOPhos, BCOrgP, BCPhos, BCTKN,
BCTOC, HCDAmm, HCDN, HCDNN, HCDO, HCDOC, HCFlow,
HCNit, HCON, HCOPhos, HCOrgP, HCPhos, HCTKN, HCTOC,
SCDAmm, SCDN, SCDNN, SCDO, SCDOC, SCFlow, SCNit,
SCON, SCOPhos, SCOrgP, SCPhos, SCTKN, SCTOC), class = factor),

RiverMile = structure(c(8L, 8L), .Label = c(119, 148,
179, 185, 190, 198, 202, 215, 61, BC, HC,
SC), class = factor), Constituent = structure(5:6, .Label =
c(DAmm,
DN, DNN, DO, DOC, Flow, Nit, ON, OPhos, OrgP,
Phos, TKN, TOC), class = factor), X2.1.06 = c(2.5,
2494), X4.1.06 = c(2.4, NA), X5.1.06 = c(2.3, NA), X6.1.06 = c(2.1,
NA), X7.1.06 = c(2, NA), X8.1.06 = c(1.9, NA), X9.1.06 = c(2,
NA), X10.1.06 = c(2.1, NA), X11.1.06 = c(2.9, NA), X12.1.06 = c(2.6,
NA), X1.1.07 = c(2.1, 4229.55), X2.1.07 = c(2.1, 1823.5),
X3.1.07 = c(2.8, 3617.5), X4.1.07 = c(2.3, NA), X5.1.07 = c(3.5,
NA), X6.1.07 = c(2.8, 10974.5), X7.1.07 = c(2.5, 9652), X8.1.07 = c(2.4,

6700.5), X9.1.07 = c(2.2, 11438.5), X10.1.07 = structure(c(34L,
33L), .Label = c(-0.0214, -0.3660, #VALUE!, 0.,
0.0010, 0.0040, 0.0060, 0.0080, 0.0086, 0.0090,
0.0100, 0.0110, 0.0120, 0.0140, 0.0220, 0.0230,
0.0240, 0.0280, 0.0300, 0.0720, 0.0890, 0.1000,
0.1200, 0.1280, 0.1400, 0.1500, 0.1880, 0.1910,
0.2000, 0.2080, 0.2200, 0.3900, 1141., 2.2000,
2.3000, 2.5000, 2.6000, 2606., 3., 3.4000,
4.5000, 4.6000, 4710., 4720., 4729.,
6.9768, 7.7065, 7.7338, 8.0097), class = factor),
X11.1.07 = c(2.2, 10968), X12.1.07 = c(2.2, 7361.5), X1.1.08 = c(2,
6797)), .Names = c(X, RiverMile, Constituent, X2.1.06,
X4.1.06, X5.1.06, X6.1.06, X7.1.06, X8.1.06, X9.1.06,
X10.1.06, X11.1.06, X12.1.06, X1.1.07, X2.1.07, X3.1.07,
X4.1.07, X5.1.07, X6.1.07, X7.1.07, X8.1.07, X9.1.07,
X10.1.07, X11.1.07, X12.1.07, X1.1.08), row.names = c(NA,
-2L), class = data.frame))

plot(f[2,4:26], f[1,4:26])

#Error in plot.window(...) : need finite 'xlim' values
#In addition: Warning messages:
#1: In min(x) : no non-missing arguments to min; returning Inf
#2: In max(x) : no non-missing arguments to max; returning -Inf

#I want a scatterplot like what I thought would happen with the plot command
and the rows and columns that contain the data.  If there is a NA in either
case there is no point .  plotted.  This is how plot works with the data in
columns, I think.  This is a small example of a much larger data set are
there any suggestions.  What am I missing?

thanks

stephen
-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] General Plotting Question

2008-05-06 Thread Gabor Grothendieck
Try:

x - unlist(f[2, 4:26])
y - unlist(f[1, 4:26])
plot(x, y)

On Tue, May 6, 2008 at 12:43 PM, stephen sefick [EMAIL PROTECTED] wrote:
 f - (structure(list(X = structure(96:97, .Label = c(119DAmm, 119DN,
 119DNN, 119DO, 119DOC, 119Flow, 119Nit, 119ON, 119OPhos,
 119OrgP, 119Phos, 119TKN, 119TOC, 148DAmm, 148DN,
 148DNN, 148DO, 148DOC, 148Flow, 148Nit, 148ON, 148OPhos,
 148OrgP, 148Phos, 148TKN, 148TOC, 179DAmm, 179DN,
 179DNN, 179DO, 179DOC, 179Flow, 179Nit, 179ON, 179OPhos,
 179OrgP, 179Phos, 179TKN, 179TOC, 185DAmm, 185DN,
 185DNN, 185DO, 185DOC, 185Flow, 185Nit, 185ON, 185OPhos,
 185OrgP, 185Phos, 185TKN, 185TOC, 190DAmm, 190DN,
 190DNN, 190DO, 190DOC, 190Flow, 190Nit, 190ON, 190OPhos,
 190OrgP, 190Phos, 190TKN, 190TOC, 198DAmm, 198DN,
 198DNN, 198DO, 198DOC, 198Flow, 198Nit, 198ON, 198OPhos,
 198OrgP, 198Phos, 198TKN, 198TOC, 202DAmm, 202DN,
 202DNN, 202DO, 202DOC, 202Flow, 202Nit, 202ON, 202OPhos,
 202OrgP, 202Phos, 202TKN, 202TOC, 215DAmm, 215DN,
 215DNN, 215DO, 215DOC, 215Flow, 215Nit, 215ON, 215OPhos,
 215OrgP, 215Phos, 215TKN, 215TOC, 61DAmm, 61DN, 61DNN,
 61DO, 61DOC, 61Flow, 61Nit, 61ON, 61OPhos, 61OrgP,
 61Phos, 61TKN, 61TOC, BCOPhos, BCOrgP, BCPhos, BCTKN,
 BCTOC, HCDAmm, HCDN, HCDNN, HCDO, HCDOC, HCFlow,
 HCNit, HCON, HCOPhos, HCOrgP, HCPhos, HCTKN, HCTOC,
 SCDAmm, SCDN, SCDNN, SCDO, SCDOC, SCFlow, SCNit,
 SCON, SCOPhos, SCOrgP, SCPhos, SCTKN, SCTOC), class = factor),

RiverMile = structure(c(8L, 8L), .Label = c(119, 148,
179, 185, 190, 198, 202, 215, 61, BC, HC,
SC), class = factor), Constituent = structure(5:6, .Label =
 c(DAmm,
DN, DNN, DO, DOC, Flow, Nit, ON, OPhos, OrgP,
Phos, TKN, TOC), class = factor), X2.1.06 = c(2.5,
2494), X4.1.06 = c(2.4, NA), X5.1.06 = c(2.3, NA), X6.1.06 = c(2.1,
NA), X7.1.06 = c(2, NA), X8.1.06 = c(1.9, NA), X9.1.06 = c(2,
NA), X10.1.06 = c(2.1, NA), X11.1.06 = c(2.9, NA), X12.1.06 = c(2.6,
NA), X1.1.07 = c(2.1, 4229.55), X2.1.07 = c(2.1, 1823.5),
X3.1.07 = c(2.8, 3617.5), X4.1.07 = c(2.3, NA), X5.1.07 = c(3.5,
NA), X6.1.07 = c(2.8, 10974.5), X7.1.07 = c(2.5, 9652), X8.1.07 = c(2.4,

6700.5), X9.1.07 = c(2.2, 11438.5), X10.1.07 = structure(c(34L,
33L), .Label = c(-0.0214, -0.3660, #VALUE!, 0.,
0.0010, 0.0040, 0.0060, 0.0080, 0.0086, 0.0090,
0.0100, 0.0110, 0.0120, 0.0140, 0.0220, 0.0230,
0.0240, 0.0280, 0.0300, 0.0720, 0.0890, 0.1000,
0.1200, 0.1280, 0.1400, 0.1500, 0.1880, 0.1910,
0.2000, 0.2080, 0.2200, 0.3900, 1141., 2.2000,
2.3000, 2.5000, 2.6000, 2606., 3., 3.4000,
4.5000, 4.6000, 4710., 4720., 4729.,
6.9768, 7.7065, 7.7338, 8.0097), class = factor),
X11.1.07 = c(2.2, 10968), X12.1.07 = c(2.2, 7361.5), X1.1.08 = c(2,
6797)), .Names = c(X, RiverMile, Constituent, X2.1.06,
 X4.1.06, X5.1.06, X6.1.06, X7.1.06, X8.1.06, X9.1.06,
 X10.1.06, X11.1.06, X12.1.06, X1.1.07, X2.1.07, X3.1.07,
 X4.1.07, X5.1.07, X6.1.07, X7.1.07, X8.1.07, X9.1.07,
 X10.1.07, X11.1.07, X12.1.07, X1.1.08), row.names = c(NA,
 -2L), class = data.frame))

 plot(f[2,4:26], f[1,4:26])

 #Error in plot.window(...) : need finite 'xlim' values
 #In addition: Warning messages:
 #1: In min(x) : no non-missing arguments to min; returning Inf
 #2: In max(x) : no non-missing arguments to max; returning -Inf

 #I want a scatterplot like what I thought would happen with the plot command
 and the rows and columns that contain the data.  If there is a NA in either
 case there is no point .  plotted.  This is how plot works with the data in
 columns, I think.  This is a small example of a much larger data set are
 there any suggestions.  What am I missing?

 thanks

 stephen
 --
 Let's not spend our time and resources thinking about things that are so
 little or so large that all they really do for us is puff us up and make us
 feel like gods. We are mammals, and have not exhausted the annoying little
 problems of being mammals.

 -K. Mullis

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] Is there in R a function equivalent to the mround, as found in most spreadsheets?

2008-05-06 Thread Yasir Kaheil

Hi Ottorino,
You could just use the modulus operator %% as follows:
 x-c(1803.02, 193.51, 3.47);
 x-x%%c(50,5,1) #just using the modulus operator
[1] 1800  1903

thanks


Dr. Ottorino-Luca Pantani wrote:
 
 Dear R-users,
 I have the following problem
 
 In a lab experiment I have to mix three solutions to get different 
 concentrations of various molecules in a cuvette
 
 I've used R to calculate the necessary µliters for each of the level of 
 the experiment and I must confess that it is more useful and easier to 
 achieve the results than using spreadsheets.
 
 But there's a problem.
 
 Imagine that for a particular cuvette (I have 112 different cuvettes !!) 
 you have to mix the following volumes of solution A, B, and C
 respectively.
 
 c(1803.02, 193.51, 3.47)
 
 Each solution is to be taken with 3 different pipettes (5000, 250 and 10 
 µL Volume max) and each of those delivers volumes in steps of 50 µL,  5 
 µL  or 1µL, respectively
 Since the above values  would eventually become
 
 c(1800, 195, 3)
 
 it is then necessary to recalculate all the final concentrations
 of A, B and C, because the volumes are changed.
 
 
 I know that in most spreadsheets (Calc in Open Office, Gnumeric, Excel 
 and so on)
 there's a function such as
 
 mround(num; num)
 
 that give the results I need, but I want to learn more on R functions.
 
 
 I played a little with R functions such as
 
 round, signif, ceiling, trunc, and floor
 
 but without success.
 Any hint to solve this problem ?
 
 Thanks a lot
 
 http://www.openofficetips.com/blog/archives/2005/04/rounding_to_the.html
 http://www.gnome.org/projects/gnumeric/doc/gnumeric-MROUND.shtml
 
 -- 
 Ottorino-Luca Pantani, Università di Firenze
 Dip. Scienza del Suolo e Nutrizione della Pianta
 P.zle Cascine 28 50144 Firenze Italia
 Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 
 [EMAIL PROTECTED]  http://www4.unifi.it/dssnp/
 
 __
 R-help@r-project.org 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.
 
 


-
Yasir H. Kaheil, Ph.D.
Catchment Research Facility
The University of Western Ontario 

-- 
View this message in context: 
http://www.nabble.com/Is-there-in-R-a-function-equivalent-to-the-mround%2C-as-found-in-most-spreadsheets--tp17086856p17087399.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Negative memory size: -1012.854

2008-05-06 Thread Søren Højsgaard
Dear all,
With R.2.7.0 (on windows XP) I have encountered what seems to be a negative 
memory size. If I use gc() afterwards the R goes down. I use R_alloc for 
*most* memory allocations in my C-routines: 
 
 memory.size()
[1] 11.08132
 dyn.load(rconipm.dll)
 
 dyn.unload(rconipm.dll)
 memory.size()
[1] -1012.854

Has anybody encountered similar problems? (It all worked well under R.2.6.2, 
but I am of course not blaming R for failing).
 
Regards
Søren

__
R-help@r-project.org 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] trouble installing Rmpi on 64-bit Ubuntu 8.04 with openmpi

2008-05-06 Thread Mark Kimpel
Subject pretty much says it all. I am running 64-bit Ubuntu 8.04, i.e. Hardy
Heron, have openmpi installed, and get the following error message with
attempted install of Rmpi. sessionInfo() follows.

Mark

checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mpi.h usability... no
checking mpi.h presence... no
checking for mpi.h... no
Try to find libmpi.so or libmpich.a
checking for main in -lmpi... yes
checking for openpty in -lutil... yes
checking for main in -lpthread... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/home/mkimpel/R_HOME/R-patched/R-build/lib64/R/include
-DPACKAGE_NAME=\\ -DPACKAGE_TARNAME=\\ -DPACKAGE_VERSION=\\
-DPACKAGE_STRING=\\ -DPACKAGE_BUGREPORT=\\ -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1
-DHAVE_UNISTD_H=1   -DUNKNOWN -fPIC -I/usr/local/include-fpic  -g -O2 -c
conversion.c -o conversion.o
In file included from conversion.c:18:
Rmpi.h:1:17: error: mpi.h: No such file or directory
In file included from conversion.c:18:
Rmpi.h:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'mpitype'
make: *** [conversion.o] Error 1
chmod: cannot access `/home/mkimpel/R_HOME/site-library-2.7.0/Rmpi/libs/*':
No such file or directory
ERROR: compilation failed for package 'Rmpi'
** Removing '/home/mkimpel/R_HOME/site-library-2.7.0/Rmpi'

The downloaded packages are in
/tmp/RtmppcK0FI/downloaded_packages
Warning message:

 sessionInfo()
R version 2.7.0 Patched (2008-05-04 r45620)
x86_64-unknown-linux-gnu

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

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

other attached packages:
[1] graph_1.18.0

loaded via a namespace (and not attached):
[1] cluster_1.11.10 tcltk_2.7.0 tools_2.7.0


-- 
Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN 46074

(317) 490-5129 Work,  Mobile  VoiceMail
(317) 663-0513 Home (no voice mail please)

**

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] General Plotting Question

2008-05-06 Thread Yasir Kaheil

cast the two vectors as.matrix-- see here:
plot(as.matrix(f[2,4:26]), as.matrix(f[1,4:26])) 

y


stephen sefick wrote:
 
 f - (structure(list(X = structure(96:97, .Label = c(119DAmm, 119DN,
 119DNN, 119DO, 119DOC, 119Flow, 119Nit, 119ON, 119OPhos,
 119OrgP, 119Phos, 119TKN, 119TOC, 148DAmm, 148DN,
 148DNN, 148DO, 148DOC, 148Flow, 148Nit, 148ON, 148OPhos,
 148OrgP, 148Phos, 148TKN, 148TOC, 179DAmm, 179DN,
 179DNN, 179DO, 179DOC, 179Flow, 179Nit, 179ON, 179OPhos,
 179OrgP, 179Phos, 179TKN, 179TOC, 185DAmm, 185DN,
 185DNN, 185DO, 185DOC, 185Flow, 185Nit, 185ON, 185OPhos,
 185OrgP, 185Phos, 185TKN, 185TOC, 190DAmm, 190DN,
 190DNN, 190DO, 190DOC, 190Flow, 190Nit, 190ON, 190OPhos,
 190OrgP, 190Phos, 190TKN, 190TOC, 198DAmm, 198DN,
 198DNN, 198DO, 198DOC, 198Flow, 198Nit, 198ON, 198OPhos,
 198OrgP, 198Phos, 198TKN, 198TOC, 202DAmm, 202DN,
 202DNN, 202DO, 202DOC, 202Flow, 202Nit, 202ON, 202OPhos,
 202OrgP, 202Phos, 202TKN, 202TOC, 215DAmm, 215DN,
 215DNN, 215DO, 215DOC, 215Flow, 215Nit, 215ON, 215OPhos,
 215OrgP, 215Phos, 215TKN, 215TOC, 61DAmm, 61DN, 61DNN,
 61DO, 61DOC, 61Flow, 61Nit, 61ON, 61OPhos, 61OrgP,
 61Phos, 61TKN, 61TOC, BCOPhos, BCOrgP, BCPhos, BCTKN,
 BCTOC, HCDAmm, HCDN, HCDNN, HCDO, HCDOC, HCFlow,
 HCNit, HCON, HCOPhos, HCOrgP, HCPhos, HCTKN, HCTOC,
 SCDAmm, SCDN, SCDNN, SCDO, SCDOC, SCFlow, SCNit,
 SCON, SCOPhos, SCOrgP, SCPhos, SCTKN, SCTOC), class =
 factor),
 
 RiverMile = structure(c(8L, 8L), .Label = c(119, 148,
 179, 185, 190, 198, 202, 215, 61, BC, HC,
 SC), class = factor), Constituent = structure(5:6, .Label =
 c(DAmm,
 DN, DNN, DO, DOC, Flow, Nit, ON, OPhos, OrgP,
 Phos, TKN, TOC), class = factor), X2.1.06 = c(2.5,
 2494), X4.1.06 = c(2.4, NA), X5.1.06 = c(2.3, NA), X6.1.06 = c(2.1,
 NA), X7.1.06 = c(2, NA), X8.1.06 = c(1.9, NA), X9.1.06 = c(2,
 NA), X10.1.06 = c(2.1, NA), X11.1.06 = c(2.9, NA), X12.1.06 = c(2.6,
 NA), X1.1.07 = c(2.1, 4229.55), X2.1.07 = c(2.1, 1823.5),
 X3.1.07 = c(2.8, 3617.5), X4.1.07 = c(2.3, NA), X5.1.07 = c(3.5,
 NA), X6.1.07 = c(2.8, 10974.5), X7.1.07 = c(2.5, 9652), X8.1.07 =
 c(2.4,
 
 6700.5), X9.1.07 = c(2.2, 11438.5), X10.1.07 = structure(c(34L,
 33L), .Label = c(-0.0214, -0.3660, #VALUE!, 0.,
 0.0010, 0.0040, 0.0060, 0.0080, 0.0086, 0.0090,
 0.0100, 0.0110, 0.0120, 0.0140, 0.0220, 0.0230,
 0.0240, 0.0280, 0.0300, 0.0720, 0.0890, 0.1000,
 0.1200, 0.1280, 0.1400, 0.1500, 0.1880, 0.1910,
 0.2000, 0.2080, 0.2200, 0.3900, 1141., 2.2000,
 2.3000, 2.5000, 2.6000, 2606., 3., 3.4000,
 4.5000, 4.6000, 4710., 4720., 4729.,
 6.9768, 7.7065, 7.7338, 8.0097), class = factor),
 X11.1.07 = c(2.2, 10968), X12.1.07 = c(2.2, 7361.5), X1.1.08 = c(2,
 6797)), .Names = c(X, RiverMile, Constituent, X2.1.06,
 X4.1.06, X5.1.06, X6.1.06, X7.1.06, X8.1.06, X9.1.06,
 X10.1.06, X11.1.06, X12.1.06, X1.1.07, X2.1.07, X3.1.07,
 X4.1.07, X5.1.07, X6.1.07, X7.1.07, X8.1.07, X9.1.07,
 X10.1.07, X11.1.07, X12.1.07, X1.1.08), row.names = c(NA,
 -2L), class = data.frame))
 
 plot(f[2,4:26], f[1,4:26])
 
 #Error in plot.window(...) : need finite 'xlim' values
 #In addition: Warning messages:
 #1: In min(x) : no non-missing arguments to min; returning Inf
 #2: In max(x) : no non-missing arguments to max; returning -Inf
 
 #I want a scatterplot like what I thought would happen with the plot
 command
 and the rows and columns that contain the data.  If there is a NA in
 either
 case there is no point .  plotted.  This is how plot works with the data
 in
 columns, I think.  This is a small example of a much larger data set are
 there any suggestions.  What am I missing?
 
 thanks
 
 stephen
 -- 
 Let's not spend our time and resources thinking about things that are so
 little or so large that all they really do for us is puff us up and make
 us
 feel like gods. We are mammals, and have not exhausted the annoying little
 problems of being mammals.
 
 -K. Mullis
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org 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.
 
 


-
Yasir H. Kaheil, Ph.D.
Catchment Research Facility
The University of Western Ontario 

-- 
View this message in context: 
http://www.nabble.com/General-Plotting-Question-tp17087346p17087502.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] rggobi is crashing R-2.7.0

2008-05-06 Thread Mark Kimpel
I am running 64-bit Ubuntu 8.04 and when I invoke rggobi the interactive
graph displays but R crashes. See my sessionInfo() and a short example
below. Ggobi and rggobi installed without complaints. Mark

 sessionInfo()
R version 2.7.0 Patched (2008-05-04 r45620)
x86_64-unknown-linux-gnu

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

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

other attached packages:
[1] rggobi_2.1.9   RGtk2_2.12.5-3 graph_1.18.0

loaded via a namespace (and not attached):
[1] cluster_1.11.10 tools_2.7.0


 a - matrix(rnorm(1000), nrow = 10)

 g - ggobi(a)

** (R:25146): CRITICAL **: Error on loading plugin library
plugins/GraphLayout/plugin.la: libgvc.so.3: cannot open shared object file:
No such file or directory

** (R:25146): CRITICAL **: Error on loading plugin library
plugins/GraphLayout/plugin.la: libgvc.so.3: cannot open shared object file:
No such file or directory

** (R:25146): CRITICAL **: can't locate required plugin routine
addToToolsMenu in GraphLayout


-- 
Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN 46074

(317) 490-5129 Work,  Mobile  VoiceMail
(317) 663-0513 Home (no voice mail please)

**

[[alternative HTML version deleted]]

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


[R] Plotting separate populations in scatterplot3d

2008-05-06 Thread Eleca Dunham
Hi,

I'm having trouble plotting populations as separate colors and points in the
3d scatterplot package. I have a column with 4 different population names
and 3 columns with my data. I want to plot each population with a different
color and pch. In addition, I want to use the type=h in my plotting so
that I can see the points clearly in my graph( for publication purposes).
I've also attached an example dataset.

I simply want to show that each population clusters separately in space.

I've attached a visual representation of what I want my data to look like.
The scripts for this graph is as follows:

data(trees) 
s3d - scatterplot3d(trees, type = h, color = blue,
angle = 55, scale.y = 0.7, pch = 16, main = Adding elements)

For some reason, R will not read my header, so I had to use the data.frame
function to get R to read my data. This is a real pain because I have tons
of data. I've tried the following to get R to recognize each population type
separately:

PopulationType.LK1-PopulationType[LK1]
PopulationType.LK2-PopulationType[LK2]
points((PopulationType.LK1, col=red, pch=19), (PopulationType.LK2,
col=blue, pch=22), .)

When I tweak the example tree code from above, R will plot all of my data no
problem (with the rgl 3d graphs, not scatterplot3d), but only with one color
and plotting character. It seems pretty straightforward, but I've spent 4
days on this already.



Any help would be greatly appreciated.

Regards,
EJ


__
R-help@r-project.org 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 separate populations in scatterplot3d

2008-05-06 Thread Yasir Kaheil

#Install library rgl 
#here is the function which you need to run first: 
rgl.plot3d-function(z, x, y, cols=red,axes=T,new=T) 
{xr-range(x) 
x01-(x-xr[1])/(xr[2]-xr[1]) 
yr-range(y) 
y01-(y-yr[1])/(yr[2]-yr[1]) 
zr-range(z) 
z01-(z-zr[1])/(zr[2]-zr[1]) 

if(new) rgl.clear() 
if(axes) 
{xlab-pretty(x) 
ylab-pretty(y) 
zlab-pretty(z) 
xat-(xlab-xr[1])/(xr[2]-xr[1]) 
yat-(ylab-yr[1])/(yr[2]-yr[1]) 
zat-(zlab-zr[1])/(zr[2]-zr[1]) 
rgl.lines(c(0,1.1),0,0) 
rgl.lines(0,c(0,1.1),0) 
rgl.lines(0,0,c(0,1.1)) 
rgl.texts(xat,-.05,-.05,xlab) 
rgl.texts(-.05,yat,-.05,ylab) 
rgl.texts(-.05,-.05,zat,zlab) 
rgl.texts(c(0.5,-.15,-.15),c(-.15,.5,-.15),c(-.15,-.15,.5), 
   
c(deparse(substitute(x)),deparse(substitute(y)),deparse(substitute(z 
} 

rgl.spheres(x01,y01,z01,.01,color=cols) 
} 

#and here is how you call it 
library(rgl) 
data(iris) 

iris.pc-prcomp(iris[,1:4],scale=T) 
rgl.plot3d(iris.pc$x[,1],iris.pc$x[,2],iris.pc$x[,3]) 
# different colors 
rgl.plot3d(iris.pc$x[,1],iris.pc$x[,2],iris.pc$x[,3],col=unclass(iris[,5])+1) 


Refer to:
http://www.nabble.com/interactive-rotatable-3d-scatterplot-td17030023.html#a17030164

thanks
y


Eleca Dunham wrote:
 
 Hi,
 
 I'm having trouble plotting populations as separate colors and points in
 the
 3d scatterplot package. I have a column with 4 different population names
 and 3 columns with my data. I want to plot each population with a
 different
 color and pch. In addition, I want to use the type=h in my plotting so
 that I can see the points clearly in my graph( for publication purposes).
 I've also attached an example dataset.
 
 I simply want to show that each population clusters separately in space.
 
 I've attached a visual representation of what I want my data to look like.
 The scripts for this graph is as follows:
 
 data(trees) 
 s3d - scatterplot3d(trees, type = h, color = blue,
 angle = 55, scale.y = 0.7, pch = 16, main = Adding elements)
 
 For some reason, R will not read my header, so I had to use the data.frame
 function to get R to read my data. This is a real pain because I have tons
 of data. I've tried the following to get R to recognize each population
 type
 separately:
 
 PopulationType.LK1-PopulationType[LK1]
 PopulationType.LK2-PopulationType[LK2]
 points((PopulationType.LK1, col=red, pch=19), (PopulationType.LK2,
 col=blue, pch=22), .)
 
 When I tweak the example tree code from above, R will plot all of my data
 no
 problem (with the rgl 3d graphs, not scatterplot3d), but only with one
 color
 and plotting character. It seems pretty straightforward, but I've spent 4
 days on this already.
 
 
 
 Any help would be greatly appreciated.
 
 Regards,
 EJ
 
 
 
 __
 R-help@r-project.org 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.
 
 


-
Yasir H. Kaheil, Ph.D.
Catchment Research Facility
The University of Western Ontario 

-- 
View this message in context: 
http://www.nabble.com/Plotting-separate-populations-in-scatterplot3d-tp17088785p17088937.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] General Plotting Question

2008-05-06 Thread stephen sefick
Thanks for the help- It worked just fine:
This will cast my ignorance across the table, but here it goes.  Why do I
need to make them a matrix?  because they are in a row?  if
d - as.matrix(f)
f.t - t(d)
f.m - as.data.frame(f.t)
now I could use just the following

plot(f.m[c(rownumber), column],  f.m[c(rownumber), column])

?

I am sure that I need to brush up on underlying data structures, but I am
trying to analyze data as we speak and R along with all of your help is an
invaluable tool.  Am I missing something easy, do I not understand the
logic/philosophy, or...?
thanks

Stephen

On Tue, May 6, 2008 at 12:53 PM, Yasir Kaheil [EMAIL PROTECTED] wrote:


 cast the two vectors as.matrix-- see here:
 plot(as.matrix(f[2,4:26]), as.matrix(f[1,4:26]))

 y


 stephen sefick wrote:
 
  f - (structure(list(X = structure(96:97, .Label = c(119DAmm, 119DN,
  119DNN, 119DO, 119DOC, 119Flow, 119Nit, 119ON, 119OPhos,
  119OrgP, 119Phos, 119TKN, 119TOC, 148DAmm, 148DN,
  148DNN, 148DO, 148DOC, 148Flow, 148Nit, 148ON, 148OPhos,
  148OrgP, 148Phos, 148TKN, 148TOC, 179DAmm, 179DN,
  179DNN, 179DO, 179DOC, 179Flow, 179Nit, 179ON, 179OPhos,
  179OrgP, 179Phos, 179TKN, 179TOC, 185DAmm, 185DN,
  185DNN, 185DO, 185DOC, 185Flow, 185Nit, 185ON, 185OPhos,
  185OrgP, 185Phos, 185TKN, 185TOC, 190DAmm, 190DN,
  190DNN, 190DO, 190DOC, 190Flow, 190Nit, 190ON, 190OPhos,
  190OrgP, 190Phos, 190TKN, 190TOC, 198DAmm, 198DN,
  198DNN, 198DO, 198DOC, 198Flow, 198Nit, 198ON, 198OPhos,
  198OrgP, 198Phos, 198TKN, 198TOC, 202DAmm, 202DN,
  202DNN, 202DO, 202DOC, 202Flow, 202Nit, 202ON, 202OPhos,
  202OrgP, 202Phos, 202TKN, 202TOC, 215DAmm, 215DN,
  215DNN, 215DO, 215DOC, 215Flow, 215Nit, 215ON, 215OPhos,
  215OrgP, 215Phos, 215TKN, 215TOC, 61DAmm, 61DN, 61DNN,
  61DO, 61DOC, 61Flow, 61Nit, 61ON, 61OPhos, 61OrgP,
  61Phos, 61TKN, 61TOC, BCOPhos, BCOrgP, BCPhos, BCTKN,
  BCTOC, HCDAmm, HCDN, HCDNN, HCDO, HCDOC, HCFlow,
  HCNit, HCON, HCOPhos, HCOrgP, HCPhos, HCTKN, HCTOC,
  SCDAmm, SCDN, SCDNN, SCDO, SCDOC, SCFlow, SCNit,
  SCON, SCOPhos, SCOrgP, SCPhos, SCTKN, SCTOC), class =
  factor),
 
  RiverMile = structure(c(8L, 8L), .Label = c(119, 148,
  179, 185, 190, 198, 202, 215, 61, BC, HC,
  SC), class = factor), Constituent = structure(5:6, .Label =
  c(DAmm,
  DN, DNN, DO, DOC, Flow, Nit, ON, OPhos, OrgP,
  Phos, TKN, TOC), class = factor), X2.1.06 = c(2.5,
  2494), X4.1.06 = c(2.4, NA), X5.1.06 = c(2.3, NA), X6.1.06 = c(2.1,
  NA), X7.1.06 = c(2, NA), X8.1.06 = c(1.9, NA), X9.1.06 = c(2,
  NA), X10.1.06 = c(2.1, NA), X11.1.06 = c(2.9, NA), X12.1.06 = c(2.6,
  NA), X1.1.07 = c(2.1, 4229.55), X2.1.07 = c(2.1, 1823.5),
  X3.1.07 = c(2.8, 3617.5), X4.1.07 = c(2.3, NA), X5.1.07 = c(3.5,
  NA), X6.1.07 = c(2.8, 10974.5), X7.1.07 = c(2.5, 9652), X8.1.07 =
  c(2.4,
 
  6700.5), X9.1.07 = c(2.2, 11438.5), X10.1.07 = structure(c(34L,
  33L), .Label = c(-0.0214, -0.3660, #VALUE!, 0.,
  0.0010, 0.0040, 0.0060, 0.0080, 0.0086, 0.0090,
  0.0100, 0.0110, 0.0120, 0.0140, 0.0220, 0.0230,
  0.0240, 0.0280, 0.0300, 0.0720, 0.0890, 0.1000,
  0.1200, 0.1280, 0.1400, 0.1500, 0.1880, 0.1910,
  0.2000, 0.2080, 0.2200, 0.3900, 1141., 2.2000,
  2.3000, 2.5000, 2.6000, 2606., 3., 3.4000,
  4.5000, 4.6000, 4710., 4720., 4729.,
  6.9768, 7.7065, 7.7338, 8.0097), class = factor),
  X11.1.07 = c(2.2, 10968), X12.1.07 = c(2.2, 7361.5), X1.1.08 = c(2,
  6797)), .Names = c(X, RiverMile, Constituent, X2.1.06,
  X4.1.06, X5.1.06, X6.1.06, X7.1.06, X8.1.06, X9.1.06,
  X10.1.06, X11.1.06, X12.1.06, X1.1.07, X2.1.07, X3.1.07,
  X4.1.07, X5.1.07, X6.1.07, X7.1.07, X8.1.07, X9.1.07,
  X10.1.07, X11.1.07, X12.1.07, X1.1.08), row.names = c(NA,
  -2L), class = data.frame))
 
  plot(f[2,4:26], f[1,4:26])
 
  #Error in plot.window(...) : need finite 'xlim' values
  #In addition: Warning messages:
  #1: In min(x) : no non-missing arguments to min; returning Inf
  #2: In max(x) : no non-missing arguments to max; returning -Inf
 
  #I want a scatterplot like what I thought would happen with the plot
  command
  and the rows and columns that contain the data.  If there is a NA in
  either
  case there is no point .  plotted.  This is how plot works with the data
  in
  columns, I think.  This is a small example of a much larger data set are
  there any suggestions.  What am I missing?
 
  thanks
 
  stephen
  --
  Let's not spend our time and resources thinking about things that are so
  little or so large that all they really do for us is puff us up and make
  us
  feel like gods. We are mammals, and have not exhausted the annoying
 little
  problems of being mammals.
 
  -K. Mullis
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org 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, 

Re: [R] substring

2008-05-06 Thread Weidong Gu
?gsub() 

Match the start (_) followed by anything (.*) and replace by 

gsub(_.*,,Name)

Weidong Gu, 
Department of Medicine
University of Alabama, Birmingham
1900 University Blvd., Birmingham, Alabama 35294
PH: (205)-975-9053


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Qian R
Sent: Tuesday, May 06, 2008 12:56 PM
To: R-help@r-project.org
Subject: [R] substring

I have a data frame such as
   
  Name
  DISC1_5916
  DABC2_789
  ABCD_1234
   
   
  I want to substring column Name so that 
   
  DISC1
  DABC2
  ABCD
  ...
   
  Thanks.
   
   

   
-
[[elided Yahoo spam]]
[[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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] General Plotting Question

2008-05-06 Thread Yasir Kaheil

the data frames work as follows: columns= variables and rows= records. when
you plot with a data frame it's logical to plot one variable against another
not one record against another. with casting into a matrix and rotating then
casting back into a dataframe, you made your records variables.. this is why
it worked.
I hope this makes sense to you. Thanks



stephen sefick wrote:
 
 Thanks for the help- It worked just fine:
 This will cast my ignorance across the table, but here it goes.  Why do I
 need to make them a matrix?  because they are in a row?  if
 d - as.matrix(f)
 f.t - t(d)
 f.m - as.data.frame(f.t)
 now I could use just the following
 
 plot(f.m[c(rownumber), column],  f.m[c(rownumber), column])
 
 ?
 
 I am sure that I need to brush up on underlying data structures, but I am
 trying to analyze data as we speak and R along with all of your help is an
 invaluable tool.  Am I missing something easy, do I not understand the
 logic/philosophy, or...?
 thanks
 
 Stephen
 
 On Tue, May 6, 2008 at 12:53 PM, Yasir Kaheil [EMAIL PROTECTED] wrote:
 

 cast the two vectors as.matrix-- see here:
 plot(as.matrix(f[2,4:26]), as.matrix(f[1,4:26]))

 y


 stephen sefick wrote:
 
  f - (structure(list(X = structure(96:97, .Label = c(119DAmm,
 119DN,
  119DNN, 119DO, 119DOC, 119Flow, 119Nit, 119ON, 119OPhos,
  119OrgP, 119Phos, 119TKN, 119TOC, 148DAmm, 148DN,
  148DNN, 148DO, 148DOC, 148Flow, 148Nit, 148ON, 148OPhos,
  148OrgP, 148Phos, 148TKN, 148TOC, 179DAmm, 179DN,
  179DNN, 179DO, 179DOC, 179Flow, 179Nit, 179ON, 179OPhos,
  179OrgP, 179Phos, 179TKN, 179TOC, 185DAmm, 185DN,
  185DNN, 185DO, 185DOC, 185Flow, 185Nit, 185ON, 185OPhos,
  185OrgP, 185Phos, 185TKN, 185TOC, 190DAmm, 190DN,
  190DNN, 190DO, 190DOC, 190Flow, 190Nit, 190ON, 190OPhos,
  190OrgP, 190Phos, 190TKN, 190TOC, 198DAmm, 198DN,
  198DNN, 198DO, 198DOC, 198Flow, 198Nit, 198ON, 198OPhos,
  198OrgP, 198Phos, 198TKN, 198TOC, 202DAmm, 202DN,
  202DNN, 202DO, 202DOC, 202Flow, 202Nit, 202ON, 202OPhos,
  202OrgP, 202Phos, 202TKN, 202TOC, 215DAmm, 215DN,
  215DNN, 215DO, 215DOC, 215Flow, 215Nit, 215ON, 215OPhos,
  215OrgP, 215Phos, 215TKN, 215TOC, 61DAmm, 61DN, 61DNN,
  61DO, 61DOC, 61Flow, 61Nit, 61ON, 61OPhos, 61OrgP,
  61Phos, 61TKN, 61TOC, BCOPhos, BCOrgP, BCPhos, BCTKN,
  BCTOC, HCDAmm, HCDN, HCDNN, HCDO, HCDOC, HCFlow,
  HCNit, HCON, HCOPhos, HCOrgP, HCPhos, HCTKN, HCTOC,
  SCDAmm, SCDN, SCDNN, SCDO, SCDOC, SCFlow, SCNit,
  SCON, SCOPhos, SCOrgP, SCPhos, SCTKN, SCTOC), class =
  factor),
 
  RiverMile = structure(c(8L, 8L), .Label = c(119, 148,
  179, 185, 190, 198, 202, 215, 61, BC, HC,
  SC), class = factor), Constituent = structure(5:6, .Label =
  c(DAmm,
  DN, DNN, DO, DOC, Flow, Nit, ON, OPhos, OrgP,
  Phos, TKN, TOC), class = factor), X2.1.06 = c(2.5,
  2494), X4.1.06 = c(2.4, NA), X5.1.06 = c(2.3, NA), X6.1.06 = c(2.1,
  NA), X7.1.06 = c(2, NA), X8.1.06 = c(1.9, NA), X9.1.06 = c(2,
  NA), X10.1.06 = c(2.1, NA), X11.1.06 = c(2.9, NA), X12.1.06 =
 c(2.6,
  NA), X1.1.07 = c(2.1, 4229.55), X2.1.07 = c(2.1, 1823.5),
  X3.1.07 = c(2.8, 3617.5), X4.1.07 = c(2.3, NA), X5.1.07 = c(3.5,
  NA), X6.1.07 = c(2.8, 10974.5), X7.1.07 = c(2.5, 9652), X8.1.07 =
  c(2.4,
 
  6700.5), X9.1.07 = c(2.2, 11438.5), X10.1.07 = structure(c(34L,
  33L), .Label = c(-0.0214, -0.3660, #VALUE!, 0.,
  0.0010, 0.0040, 0.0060, 0.0080, 0.0086, 0.0090,
  0.0100, 0.0110, 0.0120, 0.0140, 0.0220, 0.0230,
  0.0240, 0.0280, 0.0300, 0.0720, 0.0890, 0.1000,
  0.1200, 0.1280, 0.1400, 0.1500, 0.1880, 0.1910,
  0.2000, 0.2080, 0.2200, 0.3900, 1141., 2.2000,
  2.3000, 2.5000, 2.6000, 2606., 3., 3.4000,
  4.5000, 4.6000, 4710., 4720., 4729.,
  6.9768, 7.7065, 7.7338, 8.0097), class = factor),
  X11.1.07 = c(2.2, 10968), X12.1.07 = c(2.2, 7361.5), X1.1.08 = c(2,
  6797)), .Names = c(X, RiverMile, Constituent, X2.1.06,
  X4.1.06, X5.1.06, X6.1.06, X7.1.06, X8.1.06, X9.1.06,
  X10.1.06, X11.1.06, X12.1.06, X1.1.07, X2.1.07, X3.1.07,
  X4.1.07, X5.1.07, X6.1.07, X7.1.07, X8.1.07, X9.1.07,
  X10.1.07, X11.1.07, X12.1.07, X1.1.08), row.names = c(NA,
  -2L), class = data.frame))
 
  plot(f[2,4:26], f[1,4:26])
 
  #Error in plot.window(...) : need finite 'xlim' values
  #In addition: Warning messages:
  #1: In min(x) : no non-missing arguments to min; returning Inf
  #2: In max(x) : no non-missing arguments to max; returning -Inf
 
  #I want a scatterplot like what I thought would happen with the plot
  command
  and the rows and columns that contain the data.  If there is a NA in
  either
  case there is no point .  plotted.  This is how plot works with the
 data
  in
  columns, I think.  This is a small example of a much larger data set
 are
  there any suggestions.  What am I missing?
 
  thanks
 
  stephen
  --
  Let's not spend our time and resources thinking about things that are
 so
  little or so large that all they really do for us is puff us up and
 make
  us
  feel 

[R] Type I or III SS with mixed model function lme

2008-05-06 Thread Bill Shipley
Hello, I have come across a result that I cannot explain, and am hoping that
someone else can provide an answer.  A student fitted a mixed model using
the lme function: out- lme(fixed=Y~A+B+A:B, random=~1|Site).  Y is a
continuous variable while A and B are factors.  The data set is balanced
with the same number of observations in each combination of A and B.  There
are two hierarchical levels: Site and plots nested in site.

 

He tried two different ways of getting theANOVA table: anova(out) and
anova(out, type=”marginal”).

 

Since the data were balanced, these two ways should (I think) give the same
output since they correspond to Type I and III sums of squares in the SAS
terminology.  At least, this is the case with normal (i.e. not mixed) linear
models.  However, he finds very different results of these two types of
ANOVA tables.  Why?

 

Bill Shipley

North American Editor, Annals of Botany

Département de biologie

Université de Sherbrooke

Sherbrooke (Québec) J1K 2R1

Canada

(819) 821-8000, poste 62079

(819) 821-8049 FAX

 

 http://pages.usherbrooke.ca/jshipley/recherche/
http://pages.usherbrooke.ca/jshipley/recherche/

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Concatenate a vector into a string, only using distinct component

2008-05-06 Thread Anh Tran
I'm trying to use combine c('a','b','c','a','c') into 'a, b, c', the order
does not matter.

paste(c('a','b','c','a','c'), collapse=', ') yields 'a, b, c, a, c'.

Any idea?

-- 
Regards,
Anh Tran

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] list manipulation

2008-05-06 Thread Thompson, David (MNR)
Hello,

I have a set of one-liners (many thanks to previous responses from this
list) that I use to look at newly imported data sets with functions like
dim(), names(), str(), etc. within lapply(). Generally, these commands
work for me but, I am apparently still missing some aspect of list
manipulation. I don't understand why I get a set of NULL list elements
at the end of each output as demonstrated below. How can I generate this
(and similar) result(s) without all the trailing NULLs?

 lapply(ls(pattern='bn'), function(x) cat(x, dim(get(x)), \t,
names(get(x)), \n))
bn1993 2885 11   oplt rplt rsiz tree bd ht oaz odst raz rdst spr 
bn1994 3158 7oplt tree bd ht spr stat dam 
bn1995 734 7 oplt tree bd ht spr stat dam 
bn1996 293 7 oplt tree bd ht spr stat dam 
bn1997 264 7 oplt tree bd ht spr stat dam 
bn1998 768 7 oplt tree bd ht spr stat dam 
bn1999 654 7 oplt tree bd ht dbh stat dam 
bn2003 1407 9oplt tree bd94 ht94 ht99 ht02 ht03 stat dam 
[[1]]
NULL

[[2]]
NULL

[[3]]
NULL

[[4]]
NULL

[[5]]
NULL

[[6]]
NULL

[[7]]
NULL

[[8]]
NULL

Thanx, DaveT.
*
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
[EMAIL PROTECTED]
http://ofri.mnr.gov.on.ca

__
R-help@r-project.org 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 do I write a sum of matrixes??

2008-05-06 Thread Alberto Monteiro
 3) Bill Venables offered this about a week ago in this list:
 --
 This is probably as good a way as any way for this kind of problem.
 First define a binary operator:
 
  %^% - function(x, n)
 with(eigen(x), vectors %*% (values^n * t(vectors)))
 
This example only works for _diagonalizable_ matrices. It
crashes, for example, in cases like:

m -  rbind(c(1,1,0), c(0,1,1), c(0,0,1))
m %^% 2
m %*% m

Alberto Monteiro

__
R-help@r-project.org 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] Concatenate a vector into a string, only using distinct component

2008-05-06 Thread Jorge Ivan Velez
Hi Anh,

Try this,

x=c('a','b','c','a','c')
paste(unique(x),collapse=, )
[1] a, b, c

HTH,

Jorge

On Tue, May 6, 2008 at 2:22 PM, Anh Tran [EMAIL PROTECTED] wrote:

 I'm trying to use combine c('a','b','c','a','c') into 'a, b, c', the order
 does not matter.

 paste(c('a','b','c','a','c'), collapse=', ') yields 'a, b, c, a, c'.

 Any idea?

 --
 Regards,
 Anh Tran

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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 do I write a sum of matrixes??

2008-05-06 Thread Jorge Ivan Velez
Hi Pascal,

I think the function could be better but try this:

# Function: M is your matrix and n MUST be an integer0
mat.pow-function(M,n) {
  result-M
if(n1){
   for ( iter in 2:n) result-M%*%result
   result
   }
else {result}
  result
 }

# The matrix
m -  rbind(c(1,1,0), c(0,1,1), c(0,0,1))

# Goal m^2 = m x m
goal=m%*%m

# matpow
res=mat.pow(m,2)

# Check point
all.equal(goal,res)

See RSiteSearch('nth step transition matrices')


HTH,

Jorge


On Tue, May 6, 2008 at 1:37 AM, pascal vrolijk [EMAIL PROTECTED]
wrote:

 Hello best helpers,

 I am a new user and I have been struggling for hours. So finally I decide
 to ask you:
 If I have a matrix P, and P.2 = P%*%P, and P.3=P.2%*%P
 is there a function to calculate the power of a matrix?? if not how can i
 do:
 for (i in 1:10)  {P.i=P^i}
 after this I need to sum them up and my problem is to combine P and i to
 P.i  can anyone help me please???

 Thanks and have a nice day,

 Pascal.


 _
 [[elided Hotmail spam]]

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] list manipulation

2008-05-06 Thread Thompson, David (MNR)
Thanks Mark,

Your suggestion led me to this:

 !is.null(lapply(ls(pattern='bn'), function(y) cat(y, dim(get(y)),
\t, names(get(y)), \n)))
bn1993 2885 11   oplt rplt rsiz tree bd ht oaz odst raz rdst spr 
bn1994 3158 7oplt tree bd ht spr stat dam 
bn1995 734 7 oplt tree bd ht spr stat dam 
bn1996 293 7 oplt tree bd ht spr stat dam 
bn1997 264 7 oplt tree bd ht spr stat dam 
bn1998 768 7 oplt tree bd ht spr stat dam 
bn1999 654 7 oplt tree bd ht dbh stat dam 
bn2003 1407 9oplt tree bd94 ht94 ht99 ht02 ht03 stat dam 
[1] TRUE

Which is far cleaner and more compact (which was probably what I was
_actually_ looking for) than what I had started with.

Thanx, DaveT.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: May 6, 2008 02:47 PM
To: Thompson, David (MNR)
Subject: RE: [R] list manipulation

  Hi: i would guess that you are sending objects into the lapply that 
dim and names don't work on so you get NULL in those cases.
you can probably figure  out what's happening by doing 
ls(pattern='bn') 
and seeing what gets returned ? There could be some other
reason but that's my best guess.

if you  don't care why and you just want to get rid of them you can do

initialoutput-lapply( that stuff)
finaloutput-initialoutput[!sapply(initialoutput,is.null]
print(finaloutput)

i'm no R expert by any stretch but, if you want to get better 
at R , the 
best way is to live on this list if possible and watch the 
questions and 
solutions.
for me, it beats any book out there. good luck and let me know if 
anything above is unclear or doesn't work.





On Tue, May 6, 2008 at  2:35 PM, Thompson, David (MNR) wrote:

 Hello,

 I have a set of one-liners (many thanks to previous responses from 
 this
 list) that I use to look at newly imported data sets with functions 
 like
 dim(), names(), str(), etc. within lapply(). Generally, 
these commands
 work for me but, I am apparently still missing some aspect of list
 manipulation. I don't understand why I get a set of NULL 
list elements
 at the end of each output as demonstrated below. How can I generate 
 this
 (and similar) result(s) without all the trailing NULLs?

 lapply(ls(pattern='bn'), function(x) cat(x, dim(get(x)), \t,
 names(get(x)), \n))
 bn1993 2885 11   oplt rplt rsiz tree bd ht oaz odst raz rdst spr 
 bn1994 3158 7oplt tree bd ht spr stat dam bn1995 734 7 oplt 
 tree bd ht spr stat dam bn1996 293 7 oplt tree bd ht spr 
stat dam 
 bn1997 264 7 oplt tree bd ht spr stat dam bn1998 768 7 oplt 
 tree bd ht spr stat dam bn1999 654 7 oplt tree bd ht dbh 
stat dam 
 bn2003 1407 9oplt tree bd94 ht94 ht99 ht02 ht03 stat dam [[1]]
 NULL

 [[2]]
 NULL

 [[3]]
 NULL

 [[4]]
 NULL

 [[5]]
 NULL

 [[6]]
 NULL

 [[7]]
 NULL

 [[8]]
 NULL

 Thanx, DaveT.
 *
 Silviculture Data Analyst
 Ontario Forest Research Institute
 Ontario Ministry of Natural Resources
 [EMAIL PROTECTED]
 http://ofri.mnr.gov.on.ca

 __
 R-help@r-project.org 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@r-project.org 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] Concatenate a vector into a string, only using distinct component

2008-05-06 Thread Dimitris Rizopoulos

probably you want:

stg - c('a', 'b', 'c', 'a', 'c')
paste(unique(stg), collapse = , )


I hope it helps.

Best,
Dimitris

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

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


Quoting Anh Tran [EMAIL PROTECTED]:


I'm trying to use combine c('a','b','c','a','c') into 'a, b, c', the order
does not matter.

paste(c('a','b','c','a','c'), collapse=', ') yields 'a, b, c, a, c'.

Any idea?

--
Regards,
Anh Tran

[[alternative HTML version deleted]]

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






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

__
R-help@r-project.org 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] building a formula string bit by bit ..

2008-05-06 Thread Esmail Bonakdarian

Hello,

Still a newbie with R, though I have learned a lot from reading
this list. I'm hoping someone can help with this question:

I have two vectors, one for variables, and one for bits.

I want to build a string (really a formula) based on the values in my
vector of 1s and 0s in bits. If I have a one, I want to include the
corresponding entry in the vars vector, otherwise ignore it. Of course
the bits vector will not stay the same.

So for example:

  vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')

  bits=c(1, 0, 1, 1, 0)
  ones=which(bits==1)

should yield:

  X.1 + X.3 + X.4

where as

  bits=c(1, 1, 0, 0, 0)

would yield

  X.1 + X.2

the which operator gives me the index values, is there an easy and
*efficient* way to build this string so that I can pass it on to glm?
I can probably hack some ugly code together to do this, but it won't
be efficient, and it won't be elegant :-)

Can anyone help?

Thanks!

__
R-help@r-project.org 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 a formula string bit by bit ..

2008-05-06 Thread Jorge Ivan Velez
Hi Esmail,

Try this:

vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')
bits=c(1, 0, 1, 1, 0)
paste(vars[which(bits==1)],collapse=+)

HTH,

Jorge



On Tue, May 6, 2008 at 3:06 PM, Esmail Bonakdarian [EMAIL PROTECTED]
wrote:

 Hello,

 Still a newbie with R, though I have learned a lot from reading
 this list. I'm hoping someone can help with this question:

 I have two vectors, one for variables, and one for bits.

 I want to build a string (really a formula) based on the values in my
 vector of 1s and 0s in bits. If I have a one, I want to include the
 corresponding entry in the vars vector, otherwise ignore it. Of course
 the bits vector will not stay the same.

 So for example:

  vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')

  bits=c(1, 0, 1, 1, 0)
  ones=which(bits==1)

 should yield:

  X.1 + X.3 + X.4

 where as

  bits=c(1, 1, 0, 0, 0)

 would yield

  X.1 + X.2

 the which operator gives me the index values, is there an easy and
 *efficient* way to build this string so that I can pass it on to glm?
 I can probably hack some ugly code together to do this, but it won't
 be efficient, and it won't be elegant :-)

 Can anyone help?

 Thanks!

 __
 R-help@r-project.org 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@r-project.org 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 a formula string bit by bit ..

2008-05-06 Thread Marc Schwartz

Esmail Bonakdarian wrote:

Hello,

Still a newbie with R, though I have learned a lot from reading
this list. I'm hoping someone can help with this question:

I have two vectors, one for variables, and one for bits.

I want to build a string (really a formula) based on the values in my
vector of 1s and 0s in bits. If I have a one, I want to include the
corresponding entry in the vars vector, otherwise ignore it. Of course
the bits vector will not stay the same.

So for example:

  vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')

  bits=c(1, 0, 1, 1, 0)
  ones=which(bits==1)

should yield:

  X.1 + X.3 + X.4

where as

  bits=c(1, 1, 0, 0, 0)

would yield

  X.1 + X.2

the which operator gives me the index values, is there an easy and
*efficient* way to build this string so that I can pass it on to glm?
I can probably hack some ugly code together to do this, but it won't
be efficient, and it won't be elegant :-)

Can anyone help?

Thanks!


Depending upon other factors, there may be a better and more general 
approach to what you are trying to do relative to selecting subsets of 
IV's. However, given the information you have provided:


  vars - c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')
  bits - c(1, 0, 1, 1, 0)

   paste(vars[bits == 1], collapse =  + )
  [1] X.1 + X.3 + X.4


  bits - c(1, 1, 0, 0, 0)

   paste(vars[bits == 1], collapse =  + )
  [1] X.1 + X.2


You will then need to use as.formula() to coerce the resultant vectors 
before passing them to the model function.


HTH,

Marc Schwartz

__
R-help@r-project.org 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 a formula string bit by bit ..

2008-05-06 Thread Charilaos Skiadas

I would actually go with this:

bits=c(1, 0, 1, 1, 0)
paste(X, which(bits==1), sep=.,collapse=+)

No need for the vars variable. Though admittedly it breaks down if  
bits is identically 0.


Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

On May 6, 2008, at 3:11 PM, Jorge Ivan Velez wrote:


Hi Esmail,

Try this:

vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')
bits=c(1, 0, 1, 1, 0)
paste(vars[which(bits==1)],collapse=+)

HTH,

Jorge



On Tue, May 6, 2008 at 3:06 PM, Esmail Bonakdarian  
[EMAIL PROTECTED]

wrote:


Hello,

Still a newbie with R, though I have learned a lot from reading
this list. I'm hoping someone can help with this question:

I have two vectors, one for variables, and one for bits.

I want to build a string (really a formula) based on the values in my
vector of 1s and 0s in bits. If I have a one, I want to include the
corresponding entry in the vars vector, otherwise ignore it. Of  
course

the bits vector will not stay the same.

So for example:

 vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')

 bits=c(1, 0, 1, 1, 0)
 ones=which(bits==1)

should yield:

 X.1 + X.3 + X.4

where as

 bits=c(1, 1, 0, 0, 0)

would yield

 X.1 + X.2

the which operator gives me the index values, is there an easy and
*efficient* way to build this string so that I can pass it on to glm?
I can probably hack some ugly code together to do this, but it won't
be efficient, and it won't be elegant :-)

Can anyone help?

Thanks!


__
R-help@r-project.org 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] Installing A2R in Windows

2008-05-06 Thread Kate
Hi there,

I've tried to install the A2R package using the files from
http://addictedtor.free.fr/packages/A2R/lastVersion/

This is the error I get when trying to load the library:
 library(A2R)
Error in library(A2R) :
  'A2R' is not a valid package -- installed  2.0.0?

Can anyone please help? Thanks.
Kate

[[alternative HTML version deleted]]

__
R-help@r-project.org 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 a formula string bit by bit ..

2008-05-06 Thread Marc Schwartz

Marc Schwartz wrote:

Esmail Bonakdarian wrote:

Hello,

Still a newbie with R, though I have learned a lot from reading
this list. I'm hoping someone can help with this question:

I have two vectors, one for variables, and one for bits.

I want to build a string (really a formula) based on the values in my
vector of 1s and 0s in bits. If I have a one, I want to include the
corresponding entry in the vars vector, otherwise ignore it. Of course
the bits vector will not stay the same.

So for example:

  vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')

  bits=c(1, 0, 1, 1, 0)
  ones=which(bits==1)

should yield:

  X.1 + X.3 + X.4

where as

  bits=c(1, 1, 0, 0, 0)

would yield

  X.1 + X.2

the which operator gives me the index values, is there an easy and
*efficient* way to build this string so that I can pass it on to glm?
I can probably hack some ugly code together to do this, but it won't
be efficient, and it won't be elegant :-)

Can anyone help?

Thanks!


Depending upon other factors, there may be a better and more general 
approach to what you are trying to do relative to selecting subsets of 
IV's. However, given the information you have provided:


  vars - c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')
  bits - c(1, 0, 1, 1, 0)

   paste(vars[bits == 1], collapse =  + )
  [1] X.1 + X.3 + X.4


  bits - c(1, 1, 0, 0, 0)

   paste(vars[bits == 1], collapse =  + )
  [1] X.1 + X.2


You will then need to use as.formula() to coerce the resultant vectors 
before passing them to the model function.


One other tweak here, if you use TRUE/FALSE rather than 1/0 to define 
the positions and this gets rid of the need for 'vars':


  bits - c(TRUE, FALSE, TRUE, TRUE, FALSE)

   paste(X, which(bits), collapse =  + , sep = .)
  [1] X.1 + X.3 + X.4


HTH,

Marc

__
R-help@r-project.org 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] categorical data analysis

2008-05-06 Thread Greg Snow
Fisher's exact test works with small cells.  See ?fisher.test

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of raymond chiruka
 Sent: Tuesday, May 06, 2008 10:34 AM
 To: r
 Subject: [R] categorical data analysis

 hie all


 i am trying to carry out a categorical data analysis but my
 problem is that when in i use the chi squared  test some of
 my  expected values are less than 5. is there a  test that
 can handle this situation. the data is not a 2*2 table. its
 more from the social sciences where you have from strongly
 agree to strongly disagree. i know i can collapse vthe tables
 but there is a loss of information . is the a test vthat i
 can for this kind of data.
 thanks in advancde.

 ray



 -
 [[elided Yahoo spam]]
 [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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 do I write a sum of matrixes??

2008-05-06 Thread Vincent Goulet

Le mar. 06 mai à 14:23, Alberto Monteiro a écrit :


3) Bill Venables offered this about a week ago in this list:
--
This is probably as good a way as any way for this kind of problem.
First define a binary operator:


%^% - function(x, n)

   with(eigen(x), vectors %*% (values^n * t(vectors)))


This example only works for _diagonalizable_ matrices. It
crashes, for example, in cases like:

m -  rbind(c(1,1,0), c(0,1,1), c(0,0,1))
m %^% 2
m %*% m


Then the %^% operator defined in package expm [1] will work for any  
kind of (square) matrix. The actual work is done in C, so it is pretty  
fast.


[1] On R-Forge: http://r-forge.r-project.org/projects/expm/

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

__
R-help@r-project.org 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] ridge regression

2008-05-06 Thread Rodrigo Briceño
Thanks to all of you that helped me with the issues of bootstrapping
and downloading packages to a local disk.
As an starter I'm in the lower side of the learning curve, but this R
software is awesome. What I like most is this kind of forums when
people share their problems and we can find solutions.

My new inquiry is short: do any of you have some example (besides the
one that appears in help) about a simple ridge regression application
in R? I'm trying to figure out how the program estimates the constant
value that is most appropiate to run regression and how can I see that
value in the plot.

My operative system: windows XP, running R 2.6.2

Thanks to all

__
R-help@r-project.org 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 a formula string bit by bit ..

2008-05-06 Thread Esmail Bonakdarian

Jorge Ivan Velez wrote:

Hi Esmail,

Try this:

vars=c('X.1', 'X.2', 'X.3', 'X.4', 'X.5')
bits=c(1, 0, 1, 1, 0)
paste(vars[which(bits==1)],collapse=+)

HTH,

Jorge


Wow .. that is beautiful :-) .. and exactly what I was looking
for (and suspected existed).

I ended up doing this:

   eqn=(paste(vars[which(bits==1)],collapse= + ))
   eqn=paste(c(Y.data ~), eqn)
   GLM.9 - glm(as.formula(eqn) , family=gaussian(identity), data=simpleData)

For some reason I couldn't collapse the two eqn/paste statements into one
statement but this seems to work.

Thank again Jorge and everyone else .. this group is a big help.

Esmail

__
R-help@r-project.org 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] Print table data on to a plot

2008-05-06 Thread Anh Tran
Hi,
Is there away to print a short table out along side with a plot?
I'm thinking about doing a

par(mfrow = c(1,2))

Then, the plot is on one side, summary result on the other.
Is there any quick way to print out a data.frame in table format? Thanks

-- 
Regards,
Anh Tran

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Print table data on to a plot

2008-05-06 Thread Jorge Ivan Velez
Hi Anh,

Take a look at http://finzi.psych.upenn.edu/R/Rhelp02a/archive/128041.html

HTH,

Jorge


On Tue, May 6, 2008 at 3:46 PM, Anh Tran [EMAIL PROTECTED] wrote:

 Hi,
 Is there away to print a short table out along side with a plot?
 I'm thinking about doing a

 par(mfrow = c(1,2))

 Then, the plot is on one side, summary result on the other.
 Is there any quick way to print out a data.frame in table format? Thanks

 --
 Regards,
 Anh Tran

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] Print table data on to a plot

2008-05-06 Thread Greg Snow
Look at the addtable2plot function in the plotrix package.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Anh Tran
 Sent: Tuesday, May 06, 2008 1:47 PM
 To: R-help@r-project.org
 Subject: [R] Print table data on to a plot

 Hi,
 Is there away to print a short table out along side with a plot?
 I'm thinking about doing a

 par(mfrow = c(1,2))

 Then, the plot is on one side, summary result on the other.
 Is there any quick way to print out a data.frame in table
 format? Thanks

 --
 Regards,
 Anh Tran

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] Count data in random Forest

2008-05-06 Thread Volker Bahn

Hi Birgit,

I'm not sure that I understand your question. I'll try to answer 
anyways. Regression trees and therefore also RandomForests are invariant 
to monotonic transformations in the independent variables. There are no 
distributional assumptions for the independent variables. The dependent 
variable, however, is used to calculate the variances within the two 
groups of cases that result from a split. Therefore, it would make sense 
to have the dependent variable follow the typical distributional 
requirements of least-squares driven models such as homoscedasity, 
symmetrical distribution etc. For count data a square root 
transformation is often appropriate.


HTH

Volker

Birgit Lemcke wrote:
div class=moz-text-flowed style=font-family: -moz-fixedHello 
R-user!


I am running R 2.7.0 on a Power Book (Tiger). (I am still R and 
statistics beginner)


I try to find the most important variables to divide my dataset as 
given in a categorical variable using randomForest.


Is randomForest() able to deal with count data?
Or is there no difference because only the ranks are used in the trees?

Thanks in advance

Birgit

Birgit Lemcke
Institut für Systematische Botanik
Zollikerstrasse 107
CH-8008 Zürich
Switzerland
Ph: +41 (0)44 634 8351
[EMAIL PROTECTED]

175 Jahre UZH
«staunen.erleben.begreifen. Naturwissenschaft zum Anfassen.»
MNF-Jubiläumsevent für gross und klein.
19. April 2008, 10.00 Uhr bis 02.00 Uhr
Campus Irchel, Winterthurerstrasse 190, 8057 Zürich
Weitere Informationen http://www.175jahre.uzh.ch/naturwissenschaft


/div


__
R-help@r-project.org 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] ggplo2: x_discrete labels size/direction

2008-05-06 Thread Mikhail Spivakov

Hi Xavier,

Changing the grid settings has worked!

Thanks a lot!
Mikhail

PS Perhaps it'd still be really useful to be able to change text direction
in labels. 
Hadley, what do you think?
-- 
View this message in context: 
http://www.nabble.com/ggplo2%3A-x_discrete-labels-size-direction-tp17077479p17091078.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] rggobi is crashing R-2.7.0

2008-05-06 Thread Michael Lawrence
On Tue, May 6, 2008 at 10:32 AM, Mark Kimpel [EMAIL PROTECTED] wrote:

 I am running 64-bit Ubuntu 8.04 and when I invoke rggobi the interactive
 graph displays but R crashes. See my sessionInfo() and a short example
 below. Ggobi and rggobi installed without complaints. Mark

  sessionInfo()
 R version 2.7.0 Patched (2008-05-04 r45620)
 x86_64-unknown-linux-gnu

 locale:

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

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

 other attached packages:
 [1] rggobi_2.1.9   RGtk2_2.12.5-3 graph_1.18.0

 loaded via a namespace (and not attached):
 [1] cluster_1.11.10 tools_2.7.0


  a - matrix(rnorm(1000), nrow = 10)

  g - ggobi(a)

 ** (R:25146): CRITICAL **: Error on loading plugin library
 plugins/GraphLayout/plugin.la: libgvc.so.3: cannot open shared object
 file:
 No such file or directory

 ** (R:25146): CRITICAL **: Error on loading plugin library
 plugins/GraphLayout/plugin.la: libgvc.so.3: cannot open shared object
 file:
 No such file or directory

 ** (R:25146): CRITICAL **: can't locate required plugin routine
 addToToolsMenu in GraphLayout
 


It's not clear to me - did R crash or did you just receive these warnings?
These warnings are due to a missing graphviz, so the GraphLayout plugin
fails to load.



 --
 Mark W. Kimpel MD ** Neuroinformatics ** Dept. of Psychiatry
 Indiana University School of Medicine

 15032 Hunter Court, Westfield, IN 46074

 (317) 490-5129 Work,  Mobile  VoiceMail
 (317) 663-0513 Home (no voice mail please)

 **

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] NLS plinear question

2008-05-06 Thread Rick DeShon
Hi All.

I've run into a problem with the plinear algorithm in nls that is confusing
me.

Assume the following reaction time data over 15 trials for a single unit.
Trials are coded from 0-14 so that the intercept represents reaction time in
the first trial.

trl  RT
 01132.0
 1 630.5
 21371.5
 3 704.0
 4 488.5
 5 575.5
 6 613.0
 7 824.5
 8 509.0
 9 791.0
10 492.5
11 515.5
12 467.0
13 556.5
14 456.0

Now fit a power function to this data using nls with the plinear algorithm
fit.pw  -nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =
plinear, data=df.one)

Yields the following error message
Error in numericDeriv(form[[3]], names(ind), env) :
   Missing value or an infinity produced when evaluating the model

Now, recode trial from 1-15 and run the same model.
fit.pw  -nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =
plinear, data=df.one)

Seems to work fine now...
Nonlinear regression model
  model:  RT ~ cbind(1, trl, trl^p)
   data:  df.one
 p  .lin1.lin.trl   .lin3
   -0.2845   200.3230-8.9467   904.7582
 residual sum-of-squares: 555915

Number of iterations to convergence: 11

Any idea why having a zero for the first value of X causes this problem?

Thanks in advance,

Rick DeShon

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Installing A2R in Windows

2008-05-06 Thread Prof Brian Ripley

How did you install it?

You need to get A2R_0.0-4.tar.gz and do R CMD INSTALL A2R_0.0-4.tar.gz, 
after reading the 'R Installation and Administration manual, especially 
the sections for your OS.


The package in A2R/lastVersion/ was built for Unix on R 2.2.1. An expert 
might be able to get it working, but we don't even know your OS and R 
version.



On Tue, 6 May 2008, Kate wrote:


Hi there,

I've tried to install the A2R package using the files from
http://addictedtor.free.fr/packages/A2R/lastVersion/

This is the error I get when trying to load the library:
library(A2R)
Error in library(A2R) :
 'A2R' is not a valid package -- installed  2.0.0?

Can anyone please help? Thanks.
Kate

[[alternative HTML version deleted]]

__
R-help@r-project.org 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 read it.

--
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@r-project.org 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] unable to use functions require DLL from package base

2008-05-06 Thread Prof Brian Ripley
I suspect you have more than one version of R installed and are mixing 
them up.  Those symbols have been in package stats for quite a while.


Try starting R with --vanilla, and if that works, clean out your startup 
files (see ?Startup).  If not, remove all your R installations and 
reinstall R 2.7.0 (or R-patched).


On Tue, 6 May 2008, A.N. wrote:



Hi all,

I have issues using some basic functions in R such as these ones :


pp.test(R) (where is a vector of returns)

Error in .C(R_approx, as.double(x), as.double(y), as.integer(nx), xout =
as.double(xout),  :
 C symbol name R_approx not in DLL for package base


boxcox(reg,plotit=T)  (where reg is an lm object)

Error in .C(spline_coef, method = as.integer(method), n = as.integer(nx),
:
 C symbol name spline_coef not in DLL for package base

as I do miss some symbol names.

How can I overcome this serious problem ?


--
View this message in context: 
http://www.nabble.com/unable-to-use-functions-require-DLL-from-package-%22base%22-tp17086783p17086783.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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/
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@r-project.org 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] NLS plinear question

2008-05-06 Thread Katharine Mullen
recall that 0 ^{-.2} = 1/0^{.2}, and that dividing by 0 gives Inf.
so when 0 is in trl, part of your model for RT is Inf:

 trl - 0:14
 p - -.2
 cbind(1,trl, trl^p)
trl
 [1,] 1   0   Inf
 [2,] 1   1 1.000
 [3,] 1   2 0.8705506
 [4,] 1   3 0.8027416
 [5,] 1   4 0.7578583
 [6,] 1   5 0.7247797
 [7,] 1   6 0.6988271
 [8,] 1   7 0.6776109
 [9,] 1   8 0.6597540
[10,] 1   9 0.6443940
[11,] 1  10 0.6309573
[12,] 1  11 0.6190439
[13,] 1  12 0.6083643
[14,] 1  13 0.5987029
[15,] 1  14 0.5898946


On Tue, 6 May 2008, Rick DeShon wrote:

 Hi All.

 I've run into a problem with the plinear algorithm in nls that is confusing
 me.

 Assume the following reaction time data over 15 trials for a single unit.
 Trials are coded from 0-14 so that the intercept represents reaction time in
 the first trial.

 trl  RT
  01132.0
  1 630.5
  21371.5
  3 704.0
  4 488.5
  5 575.5
  6 613.0
  7 824.5
  8 509.0
  9 791.0
 10 492.5
 11 515.5
 12 467.0
 13 556.5
 14 456.0

 Now fit a power function to this data using nls with the plinear algorithm
 fit.pw  -nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =
 plinear, data=df.one)

 Yields the following error message
 Error in numericDeriv(form[[3]], names(ind), env) :
Missing value or an infinity produced when evaluating the model

 Now, recode trial from 1-15 and run the same model.
 fit.pw  -nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =
 plinear, data=df.one)

 Seems to work fine now...
 Nonlinear regression model
   model:  RT ~ cbind(1, trl, trl^p)
data:  df.one
  p  .lin1.lin.trl   .lin3
-0.2845   200.3230-8.9467   904.7582
  residual sum-of-squares: 555915

 Number of iterations to convergence: 11

 Any idea why having a zero for the first value of X causes this problem?

 Thanks in advance,

 Rick DeShon

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] Dendrogram label size

2008-05-06 Thread Peter Alspach
Alex 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Alex Reynolds
 Sent: Wednesday, 7 May 2008 12:26 a.m.
 To: r-help@r-project.org
 Subject: [R] Dendrogram label size
 
 Is it possible to resize the labels in a dendrogram without 
 applying circles and triangles to edges?
 
 I tried cex.labels:
 
   plot(scoreDendogramObj, horiz=TRUE, axes=FALSE, cex.labels=0.8)
 
 but that didn't have any effect.

One way is to get at the object itself to find where the labels are
located and then use text() to draw them.  This has the advantage of
allowing some labels to be emphasised by different colours/font sizes or
whatever.

HTH ...

Peter Alspach

The contents of this e-mail are privileged and/or confidential to the named
 recipient and are not to be used by any other person and/or organisation.
 If you have received this e-mail in error, please notify the sender and delete
 all material pertaining to this e-mail.

__
R-help@r-project.org 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] NLS plinear question

2008-05-06 Thread Prof Brian Ripley
0^(-0.2) = Inf, so you started with an infinite prediction for your first 
point and hence an infinite sum of squares.


On Tue, 6 May 2008, Rick DeShon wrote:


Hi All.

I've run into a problem with the plinear algorithm in nls that is confusing
me.

Assume the following reaction time data over 15 trials for a single unit.
Trials are coded from 0-14 so that the intercept represents reaction time in
the first trial.

trl  RT
01132.0
1 630.5
21371.5
3 704.0
4 488.5
5 575.5
6 613.0
7 824.5
8 509.0
9 791.0
10 492.5
11 515.5
12 467.0
13 556.5
14 456.0

Now fit a power function to this data using nls with the plinear algorithm

fit.pw  -nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =

plinear, data=df.one)

Yields the following error message
Error in numericDeriv(form[[3]], names(ind), env) :
  Missing value or an infinity produced when evaluating the model

Now, recode trial from 1-15 and run the same model.

fit.pw  -nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =

plinear, data=df.one)

Seems to work fine now...
Nonlinear regression model
 model:  RT ~ cbind(1, trl, trl^p)
  data:  df.one
p  .lin1.lin.trl   .lin3
  -0.2845   200.3230-8.9467   904.7582
residual sum-of-squares: 555915

Number of iterations to convergence: 11

Any idea why having a zero for the first value of X causes this problem?

Thanks in advance,

Rick DeShon

[[alternative HTML version deleted]]

__
R-help@r-project.org 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/
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@r-project.org 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] ridge regression

2008-05-06 Thread Rodrigo Briceño
Thanks to all of you that helped me with the issues of bootstrapping
and downloading packages to a local disk.
As an starter I'm in the lower side of the learning curve, but this R
software is awesome. What I like most is this kind of forums when
people share their problems and we can find solutions.
My new inquiry is short: do any of you have some example (besides the
one that appears in help) about a simple ridge regression application
in R? I'm trying to figure out how the program estimates the constant
value that is most appropiate to run regression and how can I see that
value in the plot.
My operative system: windows XP, running R 2.6.2
Thanks to all

__
R-help@r-project.org 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] Simulation Case/Control R Beginner

2008-05-06 Thread Claire_6700

I am looking for a way to simulate genotypes of cases and control at a
disease locus in R. I am supposed to set the allele frequency as
control/cases. for each of the column below simulate 200 snp dataset.

I am looking at treesim function from popgen to stimulate the genotypes in
R.

Here is what i have

size case   control 
20000.60.15
25000.10.17

what am i missing in the treesim parameter and how do i calculate the
p-value of trend test?

I am a bit confused with the parameter. 

N-2000
Sn-200
theta-0

a-treesim(N, Sn, theta, rho.vec, mutations=FALSE, sample=FALSE)
mat-LDmat(.)


Here is the documentation.
http://cran.r-project.org/web/packages/popgen/popgen.pdf

any help will really be helpful.

thank you,
Claire
-- 
View this message in context: 
http://www.nabble.com/Simulation-Case-Control-R-Beginner-tp17092885p17092885.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Type I or III SS with mixed model function lme

2008-05-06 Thread John Fox
Dear Bill,

I expect that the problem is in the contrasts that your student used for A
and B, though I haven't thought specifically about the context of a mixed
model. If he or she used the default contr.treatment(), then the contrasts
for different factors (and the interaction) are not orthogonal in the row
basis of the model matrix and hence are not orthogonal, even for balanced
data. Using, e.g., contr.sum() should provide A, B, and A:B contrasts that
are orthogonal to each other.

I hope this helps,
 John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
 Behalf Of Bill Shipley
 Sent: May-06-08 2:13 PM
 To: R help list
 Subject: [R] Type I or III SS with mixed model function lme
 
 Hello, I have come across a result that I cannot explain, and am hoping
that
 someone else can provide an answer.  A student fitted a mixed model using
the
 lme function: out- lme(fixed=Y~A+B+A:B, random=~1|Site).  Y is a
continuous
 variable while A and B are factors.  The data set is balanced with the
same
 number of observations in each combination of A and B.  There are two
 hierarchical levels: Site and plots nested in site.
 
 
 
 He tried two different ways of getting theANOVA table: anova(out) and
 anova(out, type=marginal).
 
 
 
 Since the data were balanced, these two ways should (I think) give the
same
 output since they correspond to Type I and III sums of squares in the SAS
 terminology.  At least, this is the case with normal (i.e. not mixed)
linear
 models.  However, he finds very different results of these two types of
ANOVA
 tables.  Why?
 
 
 
 Bill Shipley
 
 North American Editor, Annals of Botany
 
 Dipartement de biologie
 
 Universiti de Sherbrooke
 
 Sherbrooke (Quibec) J1K 2R1
 
 Canada
 
 (819) 821-8000, poste 62079
 
 (819) 821-8049 FAX
 
 
 
  http://pages.usherbrooke.ca/jshipley/recherche/
 http://pages.usherbrooke.ca/jshipley/recherche/
 
 
 
 
   [[alternative HTML version deleted]]

__
R-help@r-project.org 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] Spatial join between two datasets using x and y co-ordinates

2008-05-06 Thread Andrew McFadden
Hi R users

I am trying to create a spatial join between two datasets. 

The first data set is large and contains descriptive data including x
and y co-ordinates. 

The second dataset is small and has been selected spatially. The only
data contained within the second dataset is the x and y coordinates only
i.e. no descriptive data.

The aim of a join made between the two datasets is to select those
points (and hence all the descriptive data) from dataset one that has
the same x and y co-ordinates as dataset two.

x1-c(1824615,1823650,1821910)
y1-c(5980732,5983220,5990931)
descript-c(cat, dog, horse)
dat1-data.frame(x1,y1,descript)

x2-c(1824615,1823650)
y2-c(5980732,5983220)
dat2-data.frame(x2,y2)

dat1
dat2

The aim of the join is to produce:

   x1  y1 descript
1 1824615 5980732  cat
2 1823650 5983220  dog

And therefore limit the data in dataset 1 to that which has the same x
and y co-ordinates as dataset 2. 

Any suggestions?

Regards

Andy


Andrew McFadden MVS BVSc
Incursion Investigator
Investigation  Diagnostic Centres - Wallaceville Biosecurity New 
Zealand Ministry of Agriculture and Forestry

Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: 
Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St 
Upper Hutt






This email message and any attachment(s) is intended solely for the
addressee(s) named above. The information it contains is confidential
and may be legally privileged.  Unauthorised use of the message, or the
information it contains, may be unlawful. If you have received this
message by mistake please call the sender immediately on 64 4 8940100
or notify us by return email and erase the original message and
attachments. Thank you.

The Ministry of Agriculture and Forestry accepts no responsibility for
changes made to this email or to any attachments after transmission from
the office.


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Is there in R a function equivalent to the mround, as found in most spreadsheets?

2008-05-06 Thread hadley wickham

  I believe this function matches the description in OOO:

  mround - function(number, multiple) multiple * round(number/multiple)

I've implemented a slightly more general form in the reshape package:

round_any - function (x, accuracy, f = round) {
f(x/accuracy) * accuracy
}

Hadley

-- 
http://had.co.nz/

__
R-help@r-project.org 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] Installing A2R in Windows

2008-05-06 Thread Kate
Thanks. I used the command you mention and it works fine in Linux. But I
need to get it to work for Windows XP as well (currently running R-2.7.0).
Any idea if it's possible?

On Tue, May 6, 2008 at 5:18 PM, Prof Brian Ripley [EMAIL PROTECTED]
wrote:

 How did you install it?

 You need to get A2R_0.0-4.tar.gz and do R CMD INSTALL A2R_0.0-4.tar.gz,
 after reading the 'R Installation and Administration manual, especially the
 sections for your OS.

 The package in A2R/lastVersion/ was built for Unix on R 2.2.1. An expert
 might be able to get it working, but we don't even know your OS and R
 version.



 On Tue, 6 May 2008, Kate wrote:

  Hi there,
 
  I've tried to install the A2R package using the files from
  http://addictedtor.free.fr/packages/A2R/lastVersion/
 
  This is the error I get when trying to load the library:
  library(A2R)
  Error in library(A2R) :
   'A2R' is not a valid package -- installed  2.0.0?
 
  Can anyone please help? Thanks.
  Kate
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org 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 read it.

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


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Spatial join between two datasets using x and y co-ordinates

2008-05-06 Thread Peter Alspach
Andrew

?merge

HTH ..

Peter Alspach
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Andrew McFadden
 Sent: Wednesday, 7 May 2008 9:23 a.m.
 To: r-help@r-project.org
 Subject: [R] Spatial join between two datasets using x and y 
 co-ordinates
 
 Hi R users
 
 I am trying to create a spatial join between two datasets. 
 
 The first data set is large and contains descriptive data 
 including x and y co-ordinates. 
 
 The second dataset is small and has been selected spatially. 
 The only data contained within the second dataset is the x 
 and y coordinates only i.e. no descriptive data.
 
 The aim of a join made between the two datasets is to select 
 those points (and hence all the descriptive data) from 
 dataset one that has the same x and y co-ordinates as dataset two.
 
 x1-c(1824615,1823650,1821910)
 y1-c(5980732,5983220,5990931)
 descript-c(cat, dog, horse)
 dat1-data.frame(x1,y1,descript)
 
 x2-c(1824615,1823650)
 y2-c(5980732,5983220)
 dat2-data.frame(x2,y2)
 
 dat1
 dat2
 
 The aim of the join is to produce:
 
x1  y1 descript
 1 1824615 5980732  cat
 2 1823650 5983220  dog
 
 And therefore limit the data in dataset 1 to that which has 
 the same x and y co-ordinates as dataset 2. 
 
 Any suggestions?
 
 Regards
 
 Andy
 
 
 Andrew McFadden MVS BVSc
 Incursion Investigator
 Investigation  Diagnostic Centres - Wallaceville Biosecurity 
 New Zealand Ministry of Agriculture and Forestry
 
 Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: 
 Investigation and Diagnostic Centre- Wallaceville Box 40742 
 Ward St Upper Hutt
 
 
 
 
 
 ##
 ##
 This email message and any attachment(s) is intended solely for the
 addressee(s) named above. The information it contains is confidential
 and may be legally privileged.  Unauthorised use of the 
 message, or the
 information it contains, may be unlawful. If you have received this
 message by mistake please call the sender immediately on 64 4 8940100
 or notify us by return email and erase the original message and
 attachments. Thank you.
 
 The Ministry of Agriculture and Forestry accepts no responsibility for
 changes made to this email or to any attachments after 
 transmission from
 the office.
 ##
 ##
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org 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.
 

The contents of this e-mail are privileged and/or confidential to the named
 recipient and are not to be used by any other person and/or organisation.
 If you have received this e-mail in error, please notify the sender and delete
 all material pertaining to this e-mail.

__
R-help@r-project.org 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] mgcv::gam shrinkage of smooths

2008-05-06 Thread David Katz

In Dr. Wood's book on GAM, he suggests in section 4.1.6 that it might be
useful to shrink a single smooth by adding S=S+epsilon*I to the penalty
matrix S. The context was the need to be able to shrink the term to zero if
appropriate. I'd like to do this in order to shrink the coefficients towards
zero (irrespective of the penalty for wiggliness) - but not necessarily
all the way to zero. IE, my informal prior is to keep the contribution of a
specific term small.

1) Is adding eps*I to the penalty matrix an effective way to achieve this
goal?

2) How do I accomplish this in practice using mgcv::gam?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/mgcv%3A%3Agam-shrinkage-of-smooths-tp17093645p17093645.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Spatial join between two datasets using x and y co-ordinates

2008-05-06 Thread Yasir Kaheil

vector dat1.select is the selected records from dat1 by dat2.

 dat1.select- dat1$x1 %in% dat2$x2  dat1$y1 %in% dat2$y2
 dat1[dat1.select,]
   x1  y1 descript
1 1824615 5980732  cat
2 1823650 5983220  dog



Andrew McFadden wrote:
 
 Hi R users
 
 I am trying to create a spatial join between two datasets. 
 
 The first data set is large and contains descriptive data including x
 and y co-ordinates. 
 
 The second dataset is small and has been selected spatially. The only
 data contained within the second dataset is the x and y coordinates only
 i.e. no descriptive data.
 
 The aim of a join made between the two datasets is to select those
 points (and hence all the descriptive data) from dataset one that has
 the same x and y co-ordinates as dataset two.
 
 x1-c(1824615,1823650,1821910)
 y1-c(5980732,5983220,5990931)
 descript-c(cat, dog, horse)
 dat1-data.frame(x1,y1,descript)
 
 x2-c(1824615,1823650)
 y2-c(5980732,5983220)
 dat2-data.frame(x2,y2)
 
 dat1
 dat2
 
 The aim of the join is to produce:
 
x1  y1 descript
 1 1824615 5980732  cat
 2 1823650 5983220  dog
 
 And therefore limit the data in dataset 1 to that which has the same x
 and y co-ordinates as dataset 2. 
 
 Any suggestions?
 
 Regards
 
 Andy
 
 
 Andrew McFadden MVS BVSc
 Incursion Investigator
 Investigation  Diagnostic Centres - Wallaceville Biosecurity New 
 Zealand Ministry of Agriculture and Forestry
 
 Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: 
 Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St 
 Upper Hutt
 
 
 
 
 
 
 This email message and any attachment(s) is intended solely for the
 addressee(s) named above. The information it contains is confidential
 and may be legally privileged.  Unauthorised use of the message, or the
 information it contains, may be unlawful. If you have received this
 message by mistake please call the sender immediately on 64 4 8940100
 or notify us by return email and erase the original message and
 attachments. Thank you.
 
 The Ministry of Agriculture and Forestry accepts no responsibility for
 changes made to this email or to any attachments after transmission from
 the office.
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org 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.
 
 


-
Yasir H. Kaheil, Ph.D.
Catchment Research Facility
The University of Western Ontario 

-- 
View this message in context: 
http://www.nabble.com/Spatial-join-between-two-datasets-using-x-and-y-co-ordinates-tp17093486p17093656.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] Spatial join between two datasets using x and y co-ordinates

2008-05-06 Thread Jorge Ivan Velez
Hi Andrew,

Try also:

x1-c(1824615,1823650,1821910)
y1-c(5980732,5983220,5990931)
descript-c(cat, dog, horse)
dat1-data.frame(x1,y1,descript)

x2-c(1824615,1823650)
y2-c(5980732,5983220)
dat2-data.frame(x2,y2)
colnames(dat2)=c('x1','y1')

merge(dat1,dat2,by=c('x1','y1'))

HTH,

Jorge


On Tue, May 6, 2008 at 5:22 PM, Andrew McFadden [EMAIL PROTECTED]
wrote:

 Hi R users

 I am trying to create a spatial join between two datasets.

 The first data set is large and contains descriptive data including x
 and y co-ordinates.

 The second dataset is small and has been selected spatially. The only
 data contained within the second dataset is the x and y coordinates only
 i.e. no descriptive data.

 The aim of a join made between the two datasets is to select those
 points (and hence all the descriptive data) from dataset one that has
 the same x and y co-ordinates as dataset two.

 x1-c(1824615,1823650,1821910)
 y1-c(5980732,5983220,5990931)
 descript-c(cat, dog, horse)
 dat1-data.frame(x1,y1,descript)

 x2-c(1824615,1823650)
 y2-c(5980732,5983220)
 dat2-data.frame(x2,y2)

 dat1
 dat2

 The aim of the join is to produce:

   x1  y1 descript
 1 1824615 5980732  cat
 2 1823650 5983220  dog

 And therefore limit the data in dataset 1 to that which has the same x
 and y co-ordinates as dataset 2.

 Any suggestions?

 Regards

 Andy


 Andrew McFadden MVS BVSc
 Incursion Investigator
 Investigation  Diagnostic Centres - Wallaceville Biosecurity New
 Zealand Ministry of Agriculture and Forestry

 Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address:
 Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St
 Upper Hutt





 
 This email message and any attachment(s) is intended solely for the
 addressee(s) named above. The information it contains is confidential
 and may be legally privileged.  Unauthorised use of the message, or the
 information it contains, may be unlawful. If you have received this
 message by mistake please call the sender immediately on 64 4 8940100
 or notify us by return email and erase the original message and
 attachments. Thank you.

 The Ministry of Agriculture and Forestry accepts no responsibility for
 changes made to this email or to any attachments after transmission from
 the office.
 

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] Estimating QAIC using glm with the quasibinomial family

2008-05-06 Thread dgillis
Hello R-list.  I am a long time listener - first time caller who has  
been using R in research and graduate teaching for over 5 years.  I  
hope that my question is simple but not too foolish.  I've looked  
through the FAQ and searched the R site mail list with some close hits  
but no direct answers, so...
I would like to estimate QAIC (and QAICc) for a glm fit using the  
quasibinomial family.  I found a general reference suggesting a simple  
solution:


we calculated QAICc adjusting for overdispersion by dividing the  
residual deviance (i.e. -2 loglikelihood) with the overdispersion  
parameter calculated from the most complex model as the sum of squares  
Pearson residuals divided by the number of degrees of freedom (Burnham  
 Anderson, 2002). 

- Mystrud et al. 2007. Animal Conservation. 10:77-87.


My question is: Will this calculation be valid with the residual  
deviance returned by the glm() function using the quasibinomial family  
as reported in R?



I thought I should ask to be certain that there is no dispersion  
correction applied to the reported deviance, as encouraged by Burnham  
and Anderson, 2nd ed., 2002 on p.69:


When data are overdispersed and c  1, the proper likelihood is log(L)/c.

Regards,  Darren Gillis

Department of Biological Sciences
Faculty of Science
University of Manitoba
Winnipeg, MB
Canada, R3T 2N2

__
R-help@r-project.org 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] loess model with different percentile

2008-05-06 Thread Anh Tran
Hi all,

I'm looking for a way to use loess model (?loess) with a different
percentile (instead of median).

I hope I made myself clear enough. Here's and example:

a-data.frame(x=seq(1:200),y=200*rnorm(200))
lss-loess(y~x,a)
predict(lss, 120) will give a local median of that dataset.
How about a local 99 percentile?

Thanks.-
-- 
Regards,
Anh Tran

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] To preserve the class Matrix

2008-05-06 Thread David Winsemius
Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

 Thank you very much Mark! That worked Just a question, ?[ does
 give an error to me...how do I find it? 

Try:
?[

__
R-help@r-project.org 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] Spatial join between two datasets using x and y co-ordinates

2008-05-06 Thread Steven McKinney
 
 -Original Message-
 From: [EMAIL PROTECTED] on behalf of Yasir Kaheil
 Sent: Tue 5/6/2008 4:24 PM
 To: r-help@r-project.org
 Subject: Re: [R] Spatial join between two datasets using x and y co-ordinates
  
 
 vector dat1.select is the selected records from dat1 by dat2.
 
  dat1.select- dat1$x1 %in% dat2$x2  dat1$y1 %in% dat2$y2
  dat1[dat1.select,]
x1  y1 descript
 1 1824615 5980732  cat
 2 1823650 5983220  dog
 

This won't always work, for example if another observation in dat1 had
the x coordinate of one of the dat2 entries and the y coordinate of
another:

 x1-c(1824615,1823650,1821910,1823650)
 y1-c(5980732,5983220,5990931,5980732)
 descript-c(cat, dog, horse, cow)
 dat1-data.frame(x1,y1,descript)
 
 x2-c(1824615,1823650)
 y2-c(5980732,5983220)
 dat2-data.frame(x2,y2)
 
 dat1
   x1  y1 descript
1 1824615 5980732  cat
2 1823650 5983220  dog
3 1821910 5990931horse
4 1823650 5980732  cow
 dat2
   x2  y2
1 1824615 5980732
2 1823650 5983220
 
 dat1.select- dat1$x1 %in% dat2$x2  dat1$y1 %in% dat2$y2
 dat1[dat1.select,]
   x1  y1 descript
1 1824615 5980732  cat
2 1823650 5983220  dog
4 1823650 5980732  cow
 

merge() uses the key variables pasted together, to form a unique key,
e.g.

 dat1[match(paste(dat1$x1, dat1$y1, sep = \r), paste(dat2$x2, dat2$y2, sep = 
 \r), nomatch = 0),]
   x1  y1 descript
1 1824615 5980732  cat
2 1823650 5983220  dog

see e.g. merge.data.frame



Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

email: smckinney +at+ bccrc +dot+ ca

tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C. 
V5Z 1L3
Canada


 
 
 Andrew McFadden wrote:
  
  Hi R users
  
  I am trying to create a spatial join between two datasets. 
  
  The first data set is large and contains descriptive data including x
  and y co-ordinates. 
  
  The second dataset is small and has been selected spatially. The only
  data contained within the second dataset is the x and y coordinates only
  i.e. no descriptive data.
  
  The aim of a join made between the two datasets is to select those
  points (and hence all the descriptive data) from dataset one that has
  the same x and y co-ordinates as dataset two.
  
  x1-c(1824615,1823650,1821910)
  y1-c(5980732,5983220,5990931)
  descript-c(cat, dog, horse)
  dat1-data.frame(x1,y1,descript)
  
  x2-c(1824615,1823650)
  y2-c(5980732,5983220)
  dat2-data.frame(x2,y2)
  
  dat1
  dat2
  
  The aim of the join is to produce:
  
 x1  y1 descript
  1 1824615 5980732  cat
  2 1823650 5983220  dog
  
  And therefore limit the data in dataset 1 to that which has the same x
  and y co-ordinates as dataset 2. 
  
  Any suggestions?
  
  Regards
  
  Andy
  
  
  Andrew McFadden MVS BVSc
  Incursion Investigator
  Investigation  Diagnostic Centres - Wallaceville Biosecurity New 
  Zealand Ministry of Agriculture and Forestry
  
  Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: 
  Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St 
  Upper Hutt
  
  
  
  
  
  
  This email message and any attachment(s) is intended solely for the
  addressee(s) named above. The information it contains is confidential
  and may be legally privileged.  Unauthorised use of the message, or the
  information it contains, may be unlawful. If you have received this
  message by mistake please call the sender immediately on 64 4 8940100
  or notify us by return email and erase the original message and
  attachments. Thank you.
  
  The Ministry of Agriculture and Forestry accepts no responsibility for
  changes made to this email or to any attachments after transmission from
  the office.
  
  
  [[alternative HTML version deleted]]
  
  __
  R-help@r-project.org 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.
  
  
 
 
 -
 Yasir H. Kaheil, Ph.D.
 Catchment Research Facility
 The University of Western Ontario 
 
 -- 
 View this message in context: 
 http://www.nabble.com/Spatial-join-between-two-datasets-using-x-and-y-co-ordinates-tp17093486p17093656.html
 Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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@r-project.org mailing list

  1   2   >