[R] Unable to load R

2009-05-28 Thread anupam sinha
Dear all,
I have recently installed R on a Red Hat Enterprise Linux
(RHEL5)  system. But I am unable to load R and it is giving the following
error :

*/usr/local/lib/R/bin/exec/R: error while loading shared libraries:
libreadline.so.5: cannot open shared object file: No such file or directory*

I have checked for the presence of the above mention library and found that
the library is present.  I have run out of ideas. Can anyone help me out???
I will be greatly indebted.


Cheers,

Anupam Sinha,
Graduate Student,
Lab of Computational Biology,
Centre for DNA Fingerprinting and Diagnostics,
Hyderabad, India

[[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] Unable to load R

2009-05-28 Thread Zeljko Vrba
On Thu, May 28, 2009 at 11:42:41AM +0530, anupam sinha wrote:

 I have checked for the presence of the above mention library and found that
 the library is present.  I have run out of ideas. Can anyone help me out???
 I will be greatly indebted.
 
First: how did you check that the library is present?

It might be that you have installed 32-bit R on 64-bit RHEL or vice-versa, so
you need to install the requisite libraries in appropriate bitness.

__
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] Interaction plots as lines or bars?

2009-05-28 Thread Dieter Menne



Michael Kubovy wrote:
 
 An editor has suggested that I use bar plots to capture an interaction  
 of two 2-level factors and an interaction of a 2 by 3 factorial  
 experiment. (It would seem that there's a fear that someone might try  
 to interpolate between, e.g., 'male' and 'female'.) In general it  
 seems to me that an interaction plot with lines is easier to read, and  
 not likely to mislead. Does anyone know if and where this has been  
 discussed?
 

Editors are paid by the ink. 

I have never seen anything else than lines for such a plot. However, I once
was successful in using somewhat wider lines that looked barish. Which made
me believe that the paid by the ink is not too bad an analogy: editors
fear graphics that look too empty, so give them their black.  I am sure
Hadley will argue that this is the reason why ggplot2 by default has a gray
background.

Dieter


-- 
View this message in context: 
http://www.nabble.com/Interaction-plots-as-lines-or-bars--tp23754973p23755909.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] question about using a remote system

2009-05-28 Thread Ted Harding
On 28-May-09 00:58:17, Erin Hodgess wrote:
 Dear R People:
 I would like to set up a plug-in for Rcmdr to do the following:
 
 I would start on a Linux laptop.  Then I would log into another
 outside system and run a some commands.
 
 Now, when I tried to do
 system(ssh e...@xxx.edu)
 password xx
 
 It goes to the remote system.  how do I continue to issue commands
 from the Linux laptop please?
 
 (hope this makes sense)
 thanks,
 Erin

Hi Erin,
If I understand what you want, I think you may be asking a bit
too much from R itself.

When you, Erin, are interacting with your Linux laptop you can
switch between two (or more) different X windows or consoles,
on one of which you are logged in to the remote machine and on
which you issue commands to the remote machine, and can read
its output and, maybe, copy this to a terminal running commands
on your Linux laptop.

When you ask R to log in as you describe, you are tying that
instance of R to the login. I don't know of any resources within
R itself which can emulate your personal behaviour. Though maybe
others do know ...

However, there is in principle a work-round. You will need to
get your toolbox out and get to grips with Unix plmubing;
and, to make it accessible to R, you will need to create a
Unix plumber.

The basic component is the FIFO, or named pipe. To create
one of these, use a Linux command like

  mkfifo myFIFO1

Then 'ls -l' in the directory you are working in will show this
pipe as present with the name myFIFO1. For example, if in one
terminal window [A] you start the command

  cat myFIFO1

then in another [B] you

  echo Some text to test my FIFO  myFIFO1

you will find that this text will be output in the [A] window
by the 'cat' command.

Similarly, you could 'mkfifo myFIFO2' and write tc this while
in the [A] window, and read from it while in the [B] window.

So, if you can get R to write to myFIFO1 (which is being read
from by another program which will send the output to a remote
machine which that program is logged into), and read from myFIFO2
which is being written to by that other program (and that is
easy to do in R, using connections), then you have the plumbing
set up.

But, to set it up, R needs to call in the plumber. In other words,
R needs to execute a command like

  system(MakeMyFIFOs)

where MakeMyFIFOs is a script that creates myFIFO1 and myFIFO2,
logs in to the remote machine, watches myFIFO1 and sends anything
it reads to the remote machine, watches for any feedback from
the remote machine and then writes this into myFIFO2.

Meanwhile, back in R, any time you want R to send something to
the remote machine you write() it (or similar) to myFIFO1, and
whenever you want to receive something from the remote machine
you readLines() it (or similar) from myFIFO2.

That's an outline of a possible work-round. Maybe other have solved
your same problem in a better way (and maybe there's an R package
which does just that ... ). If so, I hope they'll chip in!

Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 28-May-09   Time: 07:33:09
-- XFMail --

__
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] alternative to built-in data editor

2009-05-28 Thread Dieter Menne



urlwolf wrote:
 
 I often have to peek at large data.
 While head and tail are convenient, at times I'd like some more
 comprehensive.
 I guess I debug better in a more visual way?
 I was wondering if there's a way to override the default data editor.
 

I have never seen the data editor.  The radical alternative I use is to do
all data-peeking in an external database, e.g. Access or SQLServer Express.
Writing using RODBC is so easy that write all intermediate results back to
the database for inspection and re-use in a later step. 

Dieter

-- 
View this message in context: 
http://www.nabble.com/alternative-to-built-in-data-editor-tp23747080p23756182.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] question about using a remote system

2009-05-28 Thread Mark Wardle
Hi.

Do you need an interactive session at the remote machine, or are you
simply wanting to run a pre-written script?

If the latter, then you can ask ssh to execute a remote command, which
conceivably could be R CMD x

If you explain exactly why and what you are trying to do, then perhaps
there's a better solution

bw

Mark

2009/5/28 Erin Hodgess erinm.hodg...@gmail.com:
 Dear R People:

 I would like to set up a plug-in for Rcmdr to do the following:

 I would start on a Linux laptop.  Then I would log into another
 outside system and run a some commands.

 Now, when I tried to do
 system(ssh e...@xxx.edu)
 password xx

 It goes to the remote system.  how do I continue to issue commands
 from the Linux laptop please?

 (hope this makes sense)

 thanks,
 Erin


 --
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: erinm.hodg...@gmail.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.





-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

__
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 get removed from this mailing list?

2009-05-28 Thread Peter Dalgaard

Andrey Lyalko wrote:

How do I get removed from this mailing list?

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


By following the links in the footer!

Specifically, bottom of page at

https://stat.ethz.ch/mailman/listinfo/r-help


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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] 1L and 0L

2009-05-28 Thread bogaso.christofer
Hi, 

Recently I come through those R-expressions and understood that 1L means
1 and 0L means 0. Why they are so? I mean, what the excess meanings
they carry, instead writing simple 1 or 0? Is there any more this kind
of expressions in R?

 

Regards


[[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] Object-oriented programming in R

2009-05-28 Thread Mark Wardle
Hi. I remember considering these options myself but concluded that for
most analyses a strictly procedural approach was satisfactory.
Although I may re-run multiple analyses, the data manipulation (and
subsequent analysis - the former always more complex than the latter
IMHO) is fairly project- and data-specific. As such, quick and
specific code always seemed more appropriate than slow (to write) and
generic.

Obviously that doesn't apply to package creators and maintainers,
creating something that is going to re-used in many different projects
and can be made generic. That's the heuristic I now use - is this good
enough for other people's consumption - if so, create a package and
adopt some of the OO approaches seen in the base R packages.
Otherwise, stick to bespoke and specific (procedural) functions.

I've a small library of helper functions, but these don't use OO
usually. They sometimes make assumptions about data passed in, don't
have particularly robust error checking, but in general, work well. I
suppose it depends on what you're trying to achieve and how much time
you've got!

Interested in other's thoughts too as clearly there's no right answer here.

bw

Mark

2009/5/27 Luc Villandre villa...@dms.umontreal.ca:
 Dear R-users,

 I have very recently started learning about object-oriented programming in
 R. I am far from being an expert in programming, although I do have an
 elementary C++ background.

 Please take a look at these lines of code.

 some.data = data.frame(V1 = 1:5, V2 = 6:10) ;
 p.plot = ggplot(data=some.data,aes(x=V1, y=V2)) ;
 class(p.plot) ;
 [1] ggplot

 My understanding is that the object p.plot belongs to the ggplot class.
 However, a new class definition like

 setClass(AClass, representation(mFirst = numeric, mSecond = ggplot))
 ;

 yields the warning

 Warning message:
 In .completeClassSlots(ClassDef, where) :
  undefined slot classes in definition of AClass: mSecond(class ggplot)

 The ggplot object is also a list :

 is.list(p.plot)
 [1] TRUE

 So, I guess I could identify mSecond as being a list.

 However, I don't understand why ggplot is not considered a valid slot
 type. I thought setClass() was analogous to the class declaration in C++,
 but I guess I might be wrong. Would anyone care to provide additional
 explanations about this?

 I decided to explore object-oriented programming in R so that I could
 organize the output from my analysis in a more rigorous fashion and then
 define custom methods that would yield relevant output. However, I'm
 starting to wonder if this aspect is not better suited for package builders.
 R lists are already very powerful and convenient templates. Although it
 wouldn't be as elegant, I could define functions that would take lists
 outputted by the different steps of my analysis and do what I want with
 them. I'm wondering what the merits of both approaches in the context of R
 would be. If anyone has any thoughts about this, I'd be most glad to read
 them.

 Cheers,
 --
 *Luc Villandré*
 /Biostatistician
 McGill University Health Center -
 Montreal Children's Hospital Research Institute/

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





-- 
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

__
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 get removed from this mailing list?

2009-05-28 Thread Peter Dalgaard

Duncan Murdoch wrote:

On 27/05/2009 8:25 PM, Andrey Lyalko wrote:

How do I get removed from this mailing list?



Like most lists nowadays, it gives the instructions in each message header:

List-Unsubscribe: https://stat.ethz.ch/mailman/options/r-help,
mailto:r-help-requ...@r-project.org?subject=unsubscribe

Duncan Murdoch


Unfortunately, user-friendly mailers nowadays tends to hide such 
information from users. E.g. if I set headers to All in Thunderbird I 
get a window full of headers larger than the screen and no scrolling 
capacity. So it ends with X-Mailman something and the List-Unsubscribe: 
stuff is nowhere to be seen.


-p

--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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 get removed from this mailing list?

2009-05-28 Thread Wacek Kusnierczyk
Peter Dalgaard wrote:
 Duncan Murdoch wrote:
 On 27/05/2009 8:25 PM, Andrey Lyalko wrote:
 How do I get removed from this mailing list?


 Like most lists nowadays, it gives the instructions in each message
 header:

 List-Unsubscribe: https://stat.ethz.ch/mailman/options/r-help,
 mailto:r-help-requ...@r-project.org?subject=unsubscribe

 Duncan Murdoch

 Unfortunately, user-friendly mailers nowadays tends to hide such
 information from users. E.g. if I set headers to All in Thunderbird I
 get a window full of headers larger than the screen and no scrolling
 capacity. So it ends with X-Mailman something and the
 List-Unsubscribe: stuff is nowhere to be seen.

right, but there are (at least) three things you can do in thunderbird
when all headers are on:

- open a print preview -- there you have a scrollable content with all
headers;
- save the message and open it in a regular text editor;
- install a suitable plugin (header scroll [1] works fine for me)

the last one turns thunderbird a bit more user friendly.

vQ

[1] https://addons.mozilla.org/en-US/thunderbird/addon/1003

__
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] ggplot2 adding vertical line at a certain date

2009-05-28 Thread Ivan Alves

check out geom_vline

 + geom_vline(xintercept=as.numeric(as.Date(2002-11-01)))

[you may not need to convert the date to numeric in the most recent  
ggplot2 version]


On 27 May 2009, at 20:31, stephen sefick wrote:


library(ggplot2)

melt.updn - (structure(list(date = structure(c(11808, 11869, 11961,  
11992,

12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057,
13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418,
12600, 12631, 12753, 12996, 13057, 13149), class = Date), variable =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(unrestored,
restored), class = factor), value = c(1.1080259671261,  
0.732188576856918,
0.410334408061265, 0.458980396410056, 0.429867902470711,  
0.83126337241925,
0.602008712602784, 0.818751283264408, 1.12606382402475,  
0.246174719479079,
0.941043753226865, 0.986511619794787, 0.291074883642735,  
0.346361775752625,
1.36209038621623, 0.878561166753624, 0.525156715576168,  
0.80305564765846,
1.08084449441812, 1.24906568558731, 0.970954515841768,  
0.936838439269239,
1.26970090246036, 0.337831520417547, 0.909204325710795,  
0.951009811036613,

0.290735620653709, 0.426683515714219)), .Names = c(date, variable,
value), row.names = c(NA, -28L), class = data.frame))

qplot(date, value, data=melt.updn, shape=variable)+geom_smooth()

#I would like to add a line at November 1, 2002
#thanks for the help

--
Stephen Sefick

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

__
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] optima in unimode

2009-05-28 Thread ms.com

Dear all
i could not estimate the optima value or range value in unimodal plot in glm
please help me out

thanking you 

regard
madan

_
Hotmail® has a new way to see what's up with your friends.

orial_WhatsNew1_052009
[[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] 1L and 0L

2009-05-28 Thread Gavin Simpson
On Thu, 2009-05-28 at 12:50 +0530, bogaso.christofer wrote:
 Hi, 
 
 Recently I come through those R-expressions and understood that 1L means
 1 and 0L means 0. Why they are so? I mean, what the excess meanings
 they carry, instead writing simple 1 or 0? Is there any more this kind
 of expressions in R?
 

 typeof(1)
[1] double
 typeof(1L)
[1] integer

So the L notation ensures that the number is stored as an integer not a
double.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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 get removed from this mailing list?

2009-05-28 Thread Gavin Simpson
On Thu, 2009-05-28 at 09:33 +0200, Wacek Kusnierczyk wrote:
 Peter Dalgaard wrote:
  Duncan Murdoch wrote:
  On 27/05/2009 8:25 PM, Andrey Lyalko wrote:
  How do I get removed from this mailing list?
 
 
  Like most lists nowadays, it gives the instructions in each message
  header:
 
  List-Unsubscribe: https://stat.ethz.ch/mailman/options/r-help,
  mailto:r-help-requ...@r-project.org?subject=unsubscribe
 
  Duncan Murdoch
 
  Unfortunately, user-friendly mailers nowadays tends to hide such
  information from users. E.g. if I set headers to All in Thunderbird I
  get a window full of headers larger than the screen and no scrolling
  capacity. So it ends with X-Mailman something and the
  List-Unsubscribe: stuff is nowhere to be seen.
 
 right, but there are (at least) three things you can do in thunderbird
 when all headers are on:

The View message source would be a more direct way of viewing the full
email, not just the bits TBird shows you in the preview pane. I forget
how it is named exactly and under which menu it is found as it has been
quite a while since I used TBird.

G

 
 - open a print preview -- there you have a scrollable content with all
 headers;
 - save the message and open it in a regular text editor;
 - install a suitable plugin (header scroll [1] works fine for me)
 
 the last one turns thunderbird a bit more user friendly.
 
 vQ
 
 [1] https://addons.mozilla.org/en-US/thunderbird/addon/1003
 
 __
 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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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] optima in unimode

2009-05-28 Thread Gavin Simpson
On Thu, 2009-05-28 at 07:50 +, ms.com wrote:
 Dear all
 i could not estimate the optima value or range value in unimodal plot in glm
 please help me out
 
 thanking you 
 
 regard
 madan

You're going to have to give us more to go on than that, but...

Are you an ecologist and you want to estimate the optima and tolerance
range from a fitted logit model? If so, here is an example:

## install.packages(analogue) if not installed
require(analogue)
data(ImbrieKipp, SumSST)

## fit a model
mod - glm(G.pacR ~ SumSST + I(SumSST^2), data = ImbrieKipp/100,
   family = binomial)
## plot it
pdat - data.frame(SumSST= seq(min(SumSST), max(SumSST), length = 100))
p2 - predict(mod, pdat, type = response)
lines(p2 ~ SumSST, data = pdat, col = blue, lwd = 3)

## model ceofficients
c.mod - coef(mod)
## optima
-c.mod[2]/(2 * c.mod[3])
## tolerance
sqrt(-(1/(2 * c.mod[3])))
## height == abundance at optimum
exp(c.mod[1] - (c.mod[2]^2/(4 * c.mod[3])))

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
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 load R

2009-05-28 Thread anupam sinha
Actually I did a search using locate but could not find the file. But when
I  do yum install readline (package containing the dependency
libreadline.so.5)  I get the following error:


yum install readline
Loading security plugin
Loading rhnplugin plugin
rhel-x86_64-client-5  100% |=| 1.3 kB
00:00
Setting up Install Process
Parsing package install arguments
Package readline - 5.1-1.1.x86_64 is already installed.
Package readline - 5.1-1.1.i386 is already installed.
Nothing to do

Plzz help me out.

Cheers,
Anupam Sinha



On Thu, May 28, 2009 at 11:54 AM, Zeljko Vrba zv...@ifi.uio.no wrote:

 On Thu, May 28, 2009 at 11:42:41AM +0530, anupam sinha wrote:
 
  I have checked for the presence of the above mention library and found
 that
  the library is present.  I have run out of ideas. Can anyone help me
 out???
  I will be greatly indebted.
 
 First: how did you check that the library is present?

 It might be that you have installed 32-bit R on 64-bit RHEL or vice-versa,
 so
 you need to install the requisite libraries in appropriate bitness.



[[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] Unable to load R

2009-05-28 Thread Zeljko Vrba
On Thu, May 28, 2009 at 02:02:52PM +0530, anupam sinha wrote:

 Actually I did a search using locate but could not find the file. But when

Locate reports useful results only if its database is up-to-date.  Try running
one of 

ldd /usr/lib/R/bin/exec/R
ldd /usr/lib64/R/bin/exec/R

and see what it reports.  Maybe R is linked to another readline version than
is installed on the system.

 I  do yum install readline (package containing the dependency
 libreadline.so.5)  I get the following error:
 
 
 yum install readline
 Loading security plugin
 Loading rhnplugin plugin
 rhel-x86_64-client-5  100% |=| 1.3 kB
 00:00
 Setting up Install Process
 Parsing package install arguments
 Package readline - 5.1-1.1.x86_64 is already installed.
 Package readline - 5.1-1.1.i386 is already installed.
 Nothing to do
 

Otherwise, you could also ask on a mailing list related to your distribution.



 Plzz help me out.

And learn how to spell please.

__
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] Delta Kronecker

2009-05-28 Thread FMH
Hi,

Could some give some ideas on how to compute the spatiotemporal covariance 
matrix by a sum of Kronecker products in R. Is there any special function that 
can be used?

Cheers.

Firdaus



  
[[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] R help

2009-05-28 Thread Richard . Cotton
 I am interested in modeling hydrological extreme events. I found 
 MSClaio2008 very interesting function. In this function four 
 criterions for choosing distributions. Can we call these criterions 
 as model selection techniques or goodness of fit techniques or both?
 Because goodness of fit techniques are usually performed after modle
 selection. 

What is MSClaio2008?  I don't quite understand this bit.  If you provide 
code examples, then questions are often easier to answer.

  Can I found chi-square, kolmogrov-sminov and cramer-von mises tests
 for testing goodness of fit for proposed distributions?

Yes, you can do these things in R.  The functions you want are: 
chisq.test for the chi-square test
ks.test  for the kolmogorov-smirnoff test.

You can view the help pages for these functions by typing a question mark 
before the function name, e.g. ?chisq.test.

For the Cramer-von Mises tests, I didn't know, so I typed 
RSiteSearch(cramer von mises test), from which there are several 
suggestions.  In particular, look at the CvM2SL1Test and CvM2SL2Test 
packages.

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] r-plot problem resolved

2009-05-28 Thread durden10

Thanks a lot for all the helpful comments! It finally works :handshake:
(I settled with the code of Gavin)

Best,
Durden

-- 
View this message in context: 
http://www.nabble.com/r-plot-tp23739356p23757458.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] R connectivity with Oracle DB

2009-05-28 Thread Madan Mohan

Hi Friends,

I am working on R-2.9.0 and i want to connect oracle through R, but i could
not find ROracle (zip file for windows) on CRAN Packages. Can anyone suggest
me how to connect Oracle from R in windows platform? I would be grateful if
u can provide me code aswell.

Thanks  Regards,
Madan
-- 
View this message in context: 
http://www.nabble.com/R-connectivity-with-Oracle-DB-tp23758768p23758768.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] How do I get removed from this mailing list?

2009-05-28 Thread Wacek Kusnierczyk
Gavin Simpson wrote:

 The View message source would be a more direct way of viewing the full
 email, not just the bits TBird shows you in the preview pane. I forget
 how it is named exactly and under which menu it is found as it has been
 quite a while since I used TBird.
   

indeed;  it's C-U, or under view  message source

vQ

__
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] no internal function int.unzip in R 2.9.0 for Windows

2009-05-28 Thread Uwe Ligges
The most recent version on CRAN is already fixed. We had a 
non-maintainer update end of March that fixed the R2HTML issues - the 
maintainer was unresponsive to our requests, unfortunately.


Hence please update from CRAN.

Best,
Uwe Ligges



Romain Francois wrote:

Hi,

I'll try to fix this soon. Could you log a bug request here:
http://r-forge.r-project.org/tracker/?atid=1643group_id=405func=browse

Regards,

Romain

Carson, John wrote:

library(R2HTML)



Loading required package: R2HTML

Error in .Internal(int.unzip(zipname, NULL, dest)) :
  no internal function int.unzip

Error : .onLoad failed in 'loadNamespace' for 'R2HTML'

Error: package 'R2HTML' could not be loaded

Version: R 2.9.0 for Windows
  





__
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 get removed from this mailing list?

2009-05-28 Thread Patrick Connolly
On Thu, 28-May-2009 at 09:20AM +0200, Peter Dalgaard wrote:

 Duncan Murdoch wrote:
 On 27/05/2009 8:25 PM, Andrey Lyalko wrote:
 How do I get removed from this mailing list?


 Like most lists nowadays, it gives the instructions in each message header:

 List-Unsubscribe: https://stat.ethz.ch/mailman/options/r-help,
 mailto:r-help-requ...@r-project.org?subject=unsubscribe

 Duncan Murdoch

 Unfortunately, user-friendly mailers nowadays tends to hide such  
 information from users. E.g. if I set headers to All in Thunderbird I  
 get a window full of headers larger than the screen and no scrolling  
 capacity. So it ends with X-Mailman something and the List-Unsubscribe:  
 stuff is nowhere to be seen.

That's true, but because it takes up so much space, nobody would leave
it like that for long.  Clicking on the '-' next to Subject
collapses headers to a single line and the rest of the message is
scrollable.

Even Outlook in HTML mode still doesn't hide the bottom, so I fail to
see why it becomes invisible.  Perhaps such enquirers should be
directed to the footer, not the header.


-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
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] no internal function int.unzip in R 2.9.0 for Windows

2009-05-28 Thread Romain Francois

Hello Uwe,

I have recently taken over maintenance of the package, which is now 
version controlled at r-forge 
(http://r-forge.r-project.org/projects/r2html/), and I am planning these 
changes:
- rework the HTML function so that the html code is generated from a 
brew template, which in time will give more control to the user/package 
using R2HTML
- enhance the sweave html driver so that it can take advantage of the 
source code highlighter I am currently writing.


Do you know the extent of the modification. I'd like to propagate this 
to the r-forge version.


Romain

Uwe Ligges wrote:


The most recent version on CRAN is already fixed. We had a 
non-maintainer update end of March that fixed the R2HTML issues - the 
maintainer was unresponsive to our requests, unfortunately.


Hence please update from CRAN.

Best,
Uwe Ligges



Romain Francois wrote:

Hi,

I'll try to fix this soon. Could you log a bug request here:
http://r-forge.r-project.org/tracker/?atid=1643group_id=405func=browse

Regards,

Romain

Carson, John wrote:

library(R2HTML)



Loading required package: R2HTML

Error in .Internal(int.unzip(zipname, NULL, dest)) :
  no internal function int.unzip

Error : .onLoad failed in 'loadNamespace' for 'R2HTML'

Error: package 'R2HTML' could not be loaded

Version: R 2.9.0 for Windows
  









--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr

__
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] sample unique pairs from a matrix

2009-05-28 Thread jos matejus
Dear R users,

I have a matrix of both negative and positive values that I would like
to randomly sample with the following 2 conditions:

1. only sample positive values
2. once a cell in the matrix has been sampled the row and column of
that cell cannot be sampled from again.

#some dummy data
set.seed(101)
dataf - matrix(rnorm(36,1,2), nrow=6)

I can do this quite simply if all the values are positive by using the
sample function without replacement on the column and row indices.

samrow - sample(6,replace=F)
samcol - sample(6,replace=F)
values - numeric(6)
for(i in 1:6){
values[i] - dataf[samrow[i], samcol[i]]
}

However, I am not sure how to include the logical condition to only
include postitive values
Any help would be gratefully received.
Jos

__
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 get removed from this mailing list?

2009-05-28 Thread Duncan Murdoch

On 28/05/2009 5:03 AM, Gavin Simpson wrote:

On Thu, 2009-05-28 at 09:33 +0200, Wacek Kusnierczyk wrote:

Peter Dalgaard wrote:

Duncan Murdoch wrote:

On 27/05/2009 8:25 PM, Andrey Lyalko wrote:

How do I get removed from this mailing list?


Like most lists nowadays, it gives the instructions in each message
header:

List-Unsubscribe: https://stat.ethz.ch/mailman/options/r-help,
mailto:r-help-requ...@r-project.org?subject=unsubscribe

Duncan Murdoch

Unfortunately, user-friendly mailers nowadays tends to hide such
information from users. E.g. if I set headers to All in Thunderbird I
get a window full of headers larger than the screen and no scrolling
capacity. So it ends with X-Mailman something and the
List-Unsubscribe: stuff is nowhere to be seen.

right, but there are (at least) three things you can do in thunderbird
when all headers are on:


The View message source would be a more direct way of viewing the full
email, not just the bits TBird shows you in the preview pane. I forget
how it is named exactly and under which menu it is found as it has been
quite a while since I used TBird.


That's what I use.  It's Ctrl-U for the shortcut, View | Message 
source by menu.


Duncan Murdoch



G


- open a print preview -- there you have a scrollable content with all
headers;
- save the message and open it in a regular text editor;
- install a suitable plugin (header scroll [1] works fine for me)

the last one turns thunderbird a bit more user friendly.

vQ

[1] https://addons.mozilla.org/en-US/thunderbird/addon/1003

__
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] Object-oriented programming in R

2009-05-28 Thread Gabor Grothendieck
p.plot is an S3 object and you are attempting to define an S4 class
so you if you really want to do that then you would need this to let
S4 know about the ggplot class:

# S4 class with S3 slot
setClass(ggplot) # make ggplot visible to S4
 setClass(AClass, representation(mFirst = numeric, mSecond = ggplot))
a - new(AClass, mFirst = 1, mSecond = p.plot)

Probably you don't want to use S4 at all here but rather
define an S3 subclass, A of the ggplot class and
give it an attribute also called A.

# S3 subclass
AClass - function(mFirst, mSecond) {
   attr(mSecond, A) - mFirst
   class(mSecond) - c(A, setdiff(class(mSecond), A))
   mSecond
}
a2 - AClass(1, p.plot)

or alternately represent A as an S3 list holding with the two objects
as components:

# S3 class but not subclass
AClass2 - function(mfirst, mSecond) {
out - list(mFirst = mFirst, mSecond = mSecond)
class(out) - A
out
}
a3 - AClass2(1, p.plot)

Also note that

1. ggplot uses S3 at the user level but uses the proto
package internally.  Depending on what you want to do using proto
objects might be preferable.  See home page at
http://r-proto.googlecode.com

2. R statements do not normally end in a semicolon.

On Wed, May 27, 2009 at 12:00 PM, Luc Villandre
villa...@dms.umontreal.ca wrote:
 Dear R-users,

 I have very recently started learning about object-oriented programming in
 R. I am far from being an expert in programming, although I do have an
 elementary C++ background.

 Please take a look at these lines of code.

 some.data = data.frame(V1 = 1:5, V2 = 6:10) ;
 p.plot = ggplot(data=some.data,aes(x=V1, y=V2)) ;
 class(p.plot) ;
 [1] ggplot

 My understanding is that the object p.plot belongs to the ggplot class.
 However, a new class definition like

 setClass(AClass, representation(mFirst = numeric, mSecond = ggplot))
 ;

 yields the warning

 Warning message:
 In .completeClassSlots(ClassDef, where) :
  undefined slot classes in definition of AClass: mSecond(class ggplot)

 The ggplot object is also a list :

 is.list(p.plot)
 [1] TRUE

 So, I guess I could identify mSecond as being a list.

 However, I don't understand why ggplot is not considered a valid slot
 type. I thought setClass() was analogous to the class declaration in C++,
 but I guess I might be wrong. Would anyone care to provide additional
 explanations about this?

 I decided to explore object-oriented programming in R so that I could
 organize the output from my analysis in a more rigorous fashion and then
 define custom methods that would yield relevant output. However, I'm
 starting to wonder if this aspect is not better suited for package builders.
 R lists are already very powerful and convenient templates. Although it
 wouldn't be as elegant, I could define functions that would take lists
 outputted by the different steps of my analysis and do what I want with
 them. I'm wondering what the merits of both approaches in the context of R
 would be. If anyone has any thoughts about this, I'd be most glad to read
 them.

 Cheers,
 --
 *Luc Villandré*
 /Biostatistician
 McGill University Health Center -
 Montreal Children's Hospital Research Institute/

 __
 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] Labeling barplot bars by multiple factors

2009-05-28 Thread Jim Lemon

Thomas Levine wrote:

I want to plot quantitative data as a function of three two-level factors.
How do I group the bars on a barplot by level through labeling and spacing?
Here http://www.thomaslevine.org/sample_multiple-factor_barplot.png's what
I'm thinking of. Also, I'm pretty sure that I want a barplot, but there may
be something better.

  

Hi Tom,
You may find that the hierobarp function in the plotrix package will do 
what you want.


Jim

__
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] R connectivity with Oracle DB

2009-05-28 Thread Prof Brian Ripley
See http://cran.r-project.org/bin/windows/contrib/2.9/@ReadMe (ReadMe 
files are there to be read!) and consider the use of RODBC, which is 
used by lots of Oracle users as an R client on Windows.


On Thu, 28 May 2009, Madan Mohan wrote:



Hi Friends,

I am working on R-2.9.0 and i want to connect oracle through R, but i could
not find ROracle (zip file for windows) on CRAN Packages. Can anyone suggest
me how to connect Oracle from R in windows platform? I would be grateful if
u can provide me code aswell.

Thanks  Regards,
Madan


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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] 1L and 0L

2009-05-28 Thread Duncan Murdoch

On 28/05/2009 3:20 AM, bogaso.christofer wrote:
Hi, 


Recently I come through those R-expressions and understood that 1L means
1 and 0L means 0. Why they are so? I mean, what the excess meanings
they carry, instead writing simple 1 or 0? Is there any more this kind
of expressions in R?


Gavin explained the L marks the number as being stored as an integer. 
The i in 1i is somewhat similar: it marks the number as complex (but 
also changes the value, 1i is the imaginary value, not the real one). 
There's a discussion on this in section 3.1.1 Constants in the R 
Language Definition.


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.


Re: [R] R connectivity with Oracle DB

2009-05-28 Thread Duncan Murdoch

On 28/05/2009 6:03 AM, Madan Mohan wrote:

Hi Friends,

I am working on R-2.9.0 and i want to connect oracle through R, but i could
not find ROracle (zip file for windows) on CRAN Packages. Can anyone suggest
me how to connect Oracle from R in windows platform? I would be grateful if
u can provide me code aswell.


Get an ODBC driver from Oracle, and use RODBC.

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.


Re: [R] sample unique pairs from a matrix

2009-05-28 Thread Richard . Cotton
 I have a matrix of both negative and positive values that I would like
 to randomly sample with the following 2 conditions:
 
 1. only sample positive values
 2. once a cell in the matrix has been sampled the row and column of
 that cell cannot be sampled from again.
 
 #some dummy data
 set.seed(101)
 dataf - matrix(rnorm(36,1,2), nrow=6)
 
 I can do this quite simply if all the values are positive by using the
 sample function without replacement on the column and row indices.
 
 samrow - sample(6,replace=F)
 samcol - sample(6,replace=F)
 values - numeric(6)
 for(i in 1:6){
values[i] - dataf[samrow[i], samcol[i]]
 }
 
 However, I am not sure how to include the logical condition to only
 include postitive values

You could create a new variable containing only the positive values of 
dataf, and sample from that, e.g.
dataf - matrix(rnorm(36,1,2), nrow=6)
posdata - dataf[dataf  0]
sample(posdata, 6, replace=FALSE)

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.


Re: [R] consultation

2009-05-28 Thread David Winsemius


http://cran.r-project.org/web/views/Survival.html

On May 11, 2009, at 1:46 PM, Nancy Tejerina wrote:


*Dear R Users;*

* *

*I´m writing to ask you how can I do Survivals Curves using Time- 
dependent

covariates? Which packages I need to Install?*
*Thanks for your help, I look foward you reply.*
**
*Sincerelly.*
**

*Nancy Tejerina.*


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] sample unique pairs from a matrix

2009-05-28 Thread David Winsemius


On May 28, 2009, at 6:33 AM, jos matejus wrote:


Dear R users,

I have a matrix of both negative and positive values that I would like
to randomly sample with the following 2 conditions:

1. only sample positive values
2. once a cell in the matrix has been sampled the row and column of
that cell cannot be sampled from again.

#some dummy data
set.seed(101)
dataf - matrix(rnorm(36,1,2), nrow=6)

I can do this quite simply if all the values are positive by using the
sample function without replacement on the column and row indices.

samrow - sample(6,replace=F)
samcol - sample(6,replace=F)
values - numeric(6)
for(i in 1:6){
values[i] - dataf[samrow[i], samcol[i]]
}

However, I am not sure how to include the logical condition to only
include postitive values
Any help would be gratefully received.
Jos


 M - matrix(rnorm(36),nrow=6)

 M[M[,]0]
 [1] 1.65619781 0.56182830 0.23812890 0.81493915 1.01279243  
1.29188874 0.64252343 0.53748655 0.31503112
[10] 0.37245358 0.07942883 0.56834586 0.62200056 0.39478167 0.02374574  
0.04974857 0.56219171 0.52901658



 sample(M[M[,]0],6,replace=F)
[1] 0.56834586 0.07942883 0.31503112 0.62200056 0.02374574 0.64252343

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] no internal function int.unzip in R 2.9.0 for Windows

2009-05-28 Thread Uwe Ligges
Will respond privately, since the thread becomes uninteresting for 
R-help, I guess.


Uwe


Romain Francois wrote:

Hello Uwe,

I have recently taken over maintenance of the package, which is now 
version controlled at r-forge 
(http://r-forge.r-project.org/projects/r2html/), and I am planning these 
changes:
- rework the HTML function so that the html code is generated from a 
brew template, which in time will give more control to the user/package 
using R2HTML
- enhance the sweave html driver so that it can take advantage of the 
source code highlighter I am currently writing.


Do you know the extent of the modification. I'd like to propagate this 
to the r-forge version.


Romain

Uwe Ligges wrote:


The most recent version on CRAN is already fixed. We had a 
non-maintainer update end of March that fixed the R2HTML issues - the 
maintainer was unresponsive to our requests, unfortunately.


Hence please update from CRAN.

Best,
Uwe Ligges



Romain Francois wrote:

Hi,

I'll try to fix this soon. Could you log a bug request here:
http://r-forge.r-project.org/tracker/?atid=1643group_id=405func=browse

Regards,

Romain

Carson, John wrote:

library(R2HTML)



Loading required package: R2HTML

Error in .Internal(int.unzip(zipname, NULL, dest)) :
  no internal function int.unzip

Error : .onLoad failed in 'loadNamespace' for 'R2HTML'

Error: package 'R2HTML' could not be loaded

Version: R 2.9.0 for Windows
  











__
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] Read name multiple excel sheets using RODBC

2009-05-28 Thread simeon duckworth
I'd like to be able to read multiple sheets from an excel workbook and use
the sheet name to name the resulting dataframe using RODBC.  at the moment
i've figured out how to do it the long way (see below) but feel sure that
there is a speedier  possibly automatic way to do it in R.  i've tried to
run a loop using sqlTables but it seemed to break the connection.  unless
i've missed something, i cant see a solution to this on the help list.

grateful for any help or pointers

simeon

# long way
library(RODBC)
filepath - C:/Data/workbook.xlsx
connect - odbcConnectExcel2007(filepath)
tbls - sqlTables(connect)
sheet1 -sqlFetch(channel=connect,sqtable='sheet1')
sheet2 -sqlFetch(channel=connect,sqtable='sheet2')
sheet3 -sqlFetch(channel=connect,sqtable='sheet3')
.. etc
close(connect)

[[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] Full likelihood from survreg

2009-05-28 Thread Terry Therneau
 How can I find out what survreg generates: the full likelihood or a
 likelihood with unnecessary constants dropped?

 Survreg returns a log-likelihood, not a deviance (LL with parameters dropped); 
and the result is labeled as such.  
 
It turns out that the deviance is not as easily defined for censored data.

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] How do I get removed from this mailing list?

2009-05-28 Thread Peter Dalgaard
Wacek Kusnierczyk wrote:
 Gavin Simpson wrote:
 The View message source would be a more direct way of viewing the full
 email, not just the bits TBird shows you in the preview pane. I forget
 how it is named exactly and under which menu it is found as it has been
 quite a while since I used TBird.
   
 
 indeed;  it's C-U, or under view  message source

Nice, thanks.


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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] Labeling barplot bars by multiple factors

2009-05-28 Thread Thomas Levine
Both of those worked, but hierobarp looked a bit easier, so I used that. The
one annoying thing is that it sorts alphabetically.

Tom

On Thu, May 28, 2009 at 6:46 AM, Jim Lemon j...@bitwrit.com.au wrote:

 Thomas Levine wrote:

 I want to plot quantitative data as a function of three two-level factors.
 How do I group the bars on a barplot by level through labeling and
 spacing?
 Here http://www.thomaslevine.org/sample_multiple-factor_barplot.png's
 what
 I'm thinking of. Also, I'm pretty sure that I want a barplot, but there
 may
 be something better.



 Hi Tom,
 You may find that the hierobarp function in the plotrix package will do
 what you want.

 Jim



[[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] sample unique pairs from a matrix

2009-05-28 Thread jos matejus
Dear Ritchie and David,

Thanks very much for your advice. I had thought of this potential
solution, however it doesn't really fullfill my second criteria which
is that once a particular cell has been sampled, the row and column of
that cell can't be sampled from subsequently. In other words, the next
sample would be taken from a 5x5 matrix, and then a 4x4 matrix and so
on until I have my 6 values.

I will keep thinking!
Cheers
Jos

2009/5/28 David Winsemius dwinsem...@comcast.net:

 On May 28, 2009, at 6:33 AM, jos matejus wrote:

 Dear R users,

 I have a matrix of both negative and positive values that I would like
 to randomly sample with the following 2 conditions:

 1. only sample positive values
 2. once a cell in the matrix has been sampled the row and column of
 that cell cannot be sampled from again.

 #some dummy data
 set.seed(101)
 dataf - matrix(rnorm(36,1,2), nrow=6)

 I can do this quite simply if all the values are positive by using the
 sample function without replacement on the column and row indices.

 samrow - sample(6,replace=F)
 samcol - sample(6,replace=F)
 values - numeric(6)
 for(i in 1:6){
        values[i] - dataf[samrow[i], samcol[i]]
 }

 However, I am not sure how to include the logical condition to only
 include postitive values
 Any help would be gratefully received.
 Jos

 M - matrix(rnorm(36),nrow=6)

 M[M[,]0]
  [1] 1.65619781 0.56182830 0.23812890 0.81493915 1.01279243 1.29188874
 0.64252343 0.53748655 0.31503112
 [10] 0.37245358 0.07942883 0.56834586 0.62200056 0.39478167 0.02374574
 0.04974857 0.56219171 0.52901658


 sample(M[M[,]0],6,replace=F)
 [1] 0.56834586 0.07942883 0.31503112 0.62200056 0.02374574 0.64252343

 --
 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT



__
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] sample unique pairs from a matrix

2009-05-28 Thread jim holtman
This is one way of sampling all the values in the matrix that meet your
criteria:

 set.seed(1)
 (x - matrix(rnorm(100), 10))
[,1][,2][,3][,4]   [,5]
[,6][,7] [,8]   [,9]  [,10]
 [1,] -0.6264538  1.51178117  0.91897737  1.35867955 -0.1645236  0.3981059
2.40161776  0.475509529 -0.5686687 -0.5425200
 [2,]  0.1836433  0.38984324  0.78213630 -0.10278773 -0.2533617 -0.6120264
-0.03924000 -0.709946431 -0.1351786  1.2078678
 [3,] -0.8356286 -0.62124058  0.07456498  0.38767161  0.6969634  0.3411197
0.68973936  0.610726353  1.1780870  1.1604026
 [4,]  1.5952808 -2.21469989 -1.98935170 -0.05380504  0.5566632 -1.1293631
0.02800216 -0.934097632 -1.5235668  0.7002136
 [5,]  0.3295078  1.12493092  0.61982575 -1.37705956 -0.6887557  1.4330237
-0.74327321 -1.253633400  0.5939462  1.5868335
 [6,] -0.8204684 -0.04493361 -0.05612874 -0.41499456 -0.7074952  1.9803999
0.18879230  0.291446236  0.3329504  0.5584864
 [7,]  0.4874291 -0.01619026 -0.15579551 -0.39428995  0.3645820 -0.3672215
-1.80495863 -0.443291873  1.0630998 -1.2765922
 [8,]  0.7383247  0.94383621 -1.47075238 -0.05931340  0.7685329 -1.0441346
1.46555486  0.001105352 -0.3041839 -0.5732654
 [9,]  0.5757814  0.82122120 -0.47815006  1.10002537 -0.1123462  0.5697196
0.15325334  0.074341324  0.3700188 -1.2246126
[10,] -0.3053884  0.59390132  0.41794156  0.76317575  0.8811077 -0.1350546
2.17261167 -0.589520946  0.2670988 -0.4734006
 # create new matrix with R/C indicator
 x.ind - cbind(R=as.vector(row(x)), C=as.vector(col(x)), val=as.vector(x))
 # only keep positive values
 x.ind - x.ind[x.ind[, 'val'] = 0,, drop=FALSE]
 # now loop and select a value then delete others in the same R/C
 while (nrow(x.ind)  0){
+ i - sample(nrow(x.ind), 1)
+ cat(sample:, x.ind[i,], \n)
+ # remove matching R/C
+ x.ind - x.ind[!((x.ind[, R] == x.ind[i, R]) | (x.ind[, C] ==
x.ind[i, C])),, drop=FALSE]
+ }
sample: 3 3 0.07456498
sample: 8 2 0.9438362
sample: 4 7 0.02800216
sample: 10 4 0.7631757
sample: 9 1 0.5757814
sample: 5 9 0.5939462
sample: 1 8 0.4755095
sample: 7 5 0.3645820
sample: 6 6 1.9804
sample: 2 10 1.207868



On Thu, May 28, 2009 at 8:21 AM, jos matejus matejus...@googlemail.comwrote:

 Dear Ritchie and David,

 Thanks very much for your advice. I had thought of this potential
 solution, however it doesn't really fullfill my second criteria which
 is that once a particular cell has been sampled, the row and column of
 that cell can't be sampled from subsequently. In other words, the next
 sample would be taken from a 5x5 matrix, and then a 4x4 matrix and so
 on until I have my 6 values.

 I will keep thinking!
 Cheers
 Jos

 2009/5/28 David Winsemius dwinsem...@comcast.net:
  
  On May 28, 2009, at 6:33 AM, jos matejus wrote:
 
  Dear R users,
 
  I have a matrix of both negative and positive values that I would like
  to randomly sample with the following 2 conditions:
 
  1. only sample positive values
  2. once a cell in the matrix has been sampled the row and column of
  that cell cannot be sampled from again.
 
  #some dummy data
  set.seed(101)
  dataf - matrix(rnorm(36,1,2), nrow=6)
 
  I can do this quite simply if all the values are positive by using the
  sample function without replacement on the column and row indices.
 
  samrow - sample(6,replace=F)
  samcol - sample(6,replace=F)
  values - numeric(6)
  for(i in 1:6){
 values[i] - dataf[samrow[i], samcol[i]]
  }
 
  However, I am not sure how to include the logical condition to only
  include postitive values
  Any help would be gratefully received.
  Jos
 
  M - matrix(rnorm(36),nrow=6)
 
  M[M[,]0]
   [1] 1.65619781 0.56182830 0.23812890 0.81493915 1.01279243 1.29188874
  0.64252343 0.53748655 0.31503112
  [10] 0.37245358 0.07942883 0.56834586 0.62200056 0.39478167 0.02374574
  0.04974857 0.56219171 0.52901658
 
 
  sample(M[M[,]0],6,replace=F)
  [1] 0.56834586 0.07942883 0.31503112 0.62200056 0.02374574 0.64252343
 
  --
  David Winsemius, MD
  Heritage Laboratories
  West Hartford, CT
 
 

 __
 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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




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

What is the problem that you are trying to solve?

[[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] split strings

2009-05-28 Thread Wacek Kusnierczyk
(diverted to r-devel, a source code patch attached)

Wacek Kusnierczyk wrote:
 Allan Engelhardt wrote:
   
 Immaterial, yes, but it is always good to test :) and your solution
 *is* faster and it is even faster if you can assume byte strings:
 

 :)

 indeed;  though if the speed is immaterial (and in this case it
 supposedly was), it's probably not worth risking fixed=TRUE removing
 '.tif' from the middle of the name, however unlikely this might be (cf
 murphy's laws).

 but if you can assume that each string ends with a '.tif' (or any other
 \..{3} substring), then substr is marginally faster than sub, even as a
 three-pass approach, while avoiding the risk of removing '.tif' from the
 middle:

 strings = sprintf('f:/foo/bar//%s.tif', replicate(1000,
 paste(sample(letters, 10), collapse='')))
 library(rbenchmark)
 benchmark(columns=c('test', 'elapsed'), replications=1000, order=NULL,
substr={basenames=basename(strings); substr(basenames, 1,
 nchar(basenames)-4)},
sub=sub('.tif', '', basename(strings), fixed=TRUE, useBytes=TRUE))
 # test elapsed
 # 1 substr   3.176
 # 2sub   3.296
   

btw., i wonder why negative indices default to 1 in substr:

substr('foobar', -5, 5)
# fooba
# substr('foobar', 1, 5)
substr('foobar', 2, -2)
# 
# substr('foobar', 2, 1)

this does not seem to be documented in ?substr.  there are ways to make
negative indices meaningful, e.g., by taking them as indexing from
behind (as in, e.g., perl):

# hypothetical
substr('foobar', -5, 5)
# ooba
# substr('foobar', 6-5+1, 5)
substr('foobar', 2, -2)
# ooba
# substr('foobar', 2, 6-2+1)

there is a trivial fix to src/main/character.c that gives substr the
extended functionality -- see the attached patch.  the patch has been
created and tested as follows:

svn co https://svn.r-project.org/R/trunk r-devel
cd r-devel
# modifications made to src/main/character.c
svn diff  character.c.diff
svn revert -R .
patch -p0  character.c.diff
   
./configure
make
make check-all
# no problems reported

with the patched substr, the original problem can now be solved more
concisely, using a two-pass approach, with performance still better than
the sub/fixed/bytes one, as follows:

strings = sprintf('f:/foo/bar//%s.tif', replicate(1000,
paste(sample(letters, 10), collapse='')))
library(rbenchmark)
benchmark(columns=c('test', 'elapsed'), replications=1000, order=NULL,
substr=substr(basename(strings), 1, -5),
'substr-nchar'={
basenames=basename(strings)
substr(basenames, 1, nchar(basenames)-4) },
sub=sub('.tif', '', basename(strings), fixed=TRUE, useBytes=TRUE))
# test elapsed
# 1   substr   2.981
# 2 substr-nchar   3.206
# 3  sub   3.273

if this sounds interesting, i can update the docs accordingly.

vQ
__
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] Re ad name multiple excel sheets using RODBC

2009-05-28 Thread Dieter Menne



simeon duckworth wrote:
 
 I'd like to be able to read multiple sheets from an excel workbook and use
 the sheet name to name the resulting dataframe using RODBC.  
 

In Microsoft theory, something like the below should be ok (note the $), but
never managed to get this to work. The same method works perfectly when you
have name ranges within a spreadsheet.

If you only have the sheet names, you should use package xlsReadWrite which
is rather fast, but has some limitations in the non-commercial version.

Dieter


library(RODBC)
filepath - workbook.xlsx
tabls  = list()
channel - odbcConnectExcel2007(filepath)
for (i in 1:2)
  tabls[[i]] =  sqlQuery(channel, paste(SELECT * from
[Tabelle,i,$],sep=))
odbcClose(channel) # I prefer an explicit odbcClose, but generic close.RODBC
should work.



-- 
View this message in context: 
http://www.nabble.com/Read---name-multiple-excel-sheets-using-RODBC-tp23760020p23760912.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] Still can't find missing data

2009-05-28 Thread Dieter Menne



Farley, Robert wrote:
 
 I can't get the syntax that will allow me to show NA values (rows) in the
 xtabs.
 
 lengthy non-reproducible example removed
 

If you want a reproducible answer, prepare a reproducible result. And check
that the 
syntax is 

na.action=na.pass

Dieter




-- 
View this message in context: 
http://www.nabble.com/Still-can%27t-find-missing-data-tp23730627p23761006.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] question about using a remote system

2009-05-28 Thread Erin Hodgess
My goal is for a user to sit down at a Linux laptop, get to an Rcmdr
type screen, submit jobs on a remote system and then get the results
back in R.

We will assume that the user is naive, and the only thing he/she can
do is get to the Rcmdr screen.

The Rcmdr plugin will have a submit jobs menu.  The user presses
that option, and gets results, without having to know the underside.

thanks,
Erin

On Thu, May 28, 2009 at 1:54 AM, Mark Wardle m...@wardle.org wrote:
 Hi.

 Do you need an interactive session at the remote machine, or are you
 simply wanting to run a pre-written script?

 If the latter, then you can ask ssh to execute a remote command, which
 conceivably could be R CMD x

 If you explain exactly why and what you are trying to do, then perhaps
 there's a better solution

 bw

 Mark

 2009/5/28 Erin Hodgess erinm.hodg...@gmail.com:
 Dear R People:

 I would like to set up a plug-in for Rcmdr to do the following:

 I would start on a Linux laptop.  Then I would log into another
 outside system and run a some commands.

 Now, when I tried to do
 system(ssh e...@xxx.edu)
 password xx

 It goes to the remote system.  how do I continue to issue commands
 from the Linux laptop please?

 (hope this makes sense)

 thanks,
 Erin


 --
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: erinm.hodg...@gmail.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.





 --
 Dr. Mark Wardle
 Specialist registrar, Neurology
 Cardiff, UK




-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] How could I terminate a script (without leaving R)?

2009-05-28 Thread Mario Valle
Good morning!
Which is the preferred method to leave a sourced script and returning back to 
the '' prompt?

For example I search for certain files to be processed, but nothing should be 
done if they
are not present. Normally I do in my script:
f-dir(pattern=qq)
if(length(f)  0) {
...process file list...
}
# script end

But I don't like those {} encompassing the whole script so I'm searching for 
something to
put in place of the '???' here:
f-dir(pattern=qq)
if(length(f) == 0) '???'
...process file list...
# script end

Using stop(No file found, call.=F) works, but the Error message is ugly in 
this case.

Any suggestion?

Thanks for your help!
mario

-- 
Ing. Mario Valle
Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82

__
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] R-help Digest, Vol 75, Issue 28

2009-05-28 Thread Ista Zahn
  From: Jeff Newmiller jdnew...@dcn.davis.ca.us
  To: R Heberto Ghezzo, Dr heberto.ghe...@mcgill.ca
  Date: Wed, 27 May 2009 09:00:44 -0700
  Subject: Re: [R] R in Ubunto
  R Heberto Ghezzo, Dr wrote:
 
     Hello , I do not know anything abount Ubunto, but I found a Portable 
  Ubunto for Windows and since so many people
     prefer Linux to Windows I decided to give it a try.
     It runs very nicely, so I tried to load R, following Instructions in 
  CRAN I added the line
     deb http://probability.ca/cran/bin/linux/ubuntu hardy/ to 
  /etc/apt/sources.list and then from a console
     I did
     sudo apt-get update
     sudo apt-get install r-base
     a lot of printout and when it inishes I typed R in the console and 
  surprise!
     I got R 2.6.2!! in Windows I have R 2.9.0??
     Did I do something wrong or there is another way to get the latest 
  version of R?

 From: stephen sefick ssef...@gmail.com
 To: R Heberto Ghezzo, Dr heberto.ghe...@mcgill.ca
 Date: Wed, 27 May 2009 11:51:25 -0400
 Subject: Re: [R] R in Ubunto
 I don't remember what the version of R in deb repositories is, but
 2.6.2 is probably about right.  One of the things the Debian project
 is focused on is the stability of the operating system, so they do not
 update packages as readily as some other distributions.  I had this
 with Debian 5.0 and just decided to compile R from source after
 getting the R development package and some x11 development libraries.

 sudo apt-get install r-base-dev


 I can help you through this process if you like, or there are good
 instructions for this process at the R website.

 FAQ 2.5.1 How can R be installed (Unix)

  On the web page
 
  http://probability.ca/cran/bin/linux/ubuntu/
 
  it presents instructions for activating this repository.  Special
  instructions are included for hardy regarding activating backports
  also.

I'm running the latest Ubuntu version, and I get the latest version of
R no problem. I see that
http://probability.ca/cran/bin/linux/ubuntu/hardy/ does list R 2.9.0,
so it seems to me that if the repository was correctly added you
should get it. Were there any errors when you ran sudo apt-get update?
Also, I second the idea of activating the backports repository.

-Ista

__
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] can you help me please :)

2009-05-28 Thread NOUF AL NUMAIR


hi there :)
i want to use barplot with if else but i dont know how to do it ?
i tried this but it is not working with me 

SNP - read.table(my.txt)

 SNP[,2]
  [1] 1175  483  240  170   99   79   76   45   38   35   21   16   14   19   16
 [16]333   1021686820511
 [31]10620   13050501000
 [46]055010000000000
 [61]000000000000007
 [76]000030000000000
 [91]000000000000030
[106]000000000000000
[121]000000000000000
[136]100011000000000
[151]000000000000000
[166]002000000100000
[181]000000000000001
[196]000000000000000
[211]000000001000000
[226]1

SNP[,2] == 0
  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [25] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE
 [37]  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE FALSE FALSE
 [49]  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [61]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [73]  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE
 [85]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [97]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE
[109]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[121]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[133]  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE
[145]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[157]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE
[169]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE
[181]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[193]  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[205]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
[217]  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE


 SNP[,2][SNP[,2] == 0]
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

 SNP[,2][! SNP[,2] == 0]
 [1] 1175  483  240  170   99   79   76   45   38   35   21   16   14   19   16
[16]333   1021686825111
[31]62   13551551733111
[46]2111   

 SNP[,1]

  [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
 [19]  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
 [37]  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54
 [55]  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72
 [73]  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
 [91]  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108
[109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
[127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
[145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
[163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
[181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
[199] 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
[217] 217 218 219 220 221 222 223 224 225 226

 zz - SNP[,2][! SNP[,2] == 0]
 zz
 [1] 1175  483  240  170   99   79   76   45   38   35   21   16   14   19   16
[16]333   1021686825111
[31]62   13551551733111
[46]21111

 [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19
[20]  20  21  22  23  24  25  26  28  29  30  

Re: [R] How could I terminate a script (without leaving R)?

2009-05-28 Thread Duncan Murdoch

On 5/28/2009 8:58 AM, Mario Valle wrote:

Good morning!
Which is the preferred method to leave a sourced script and returning back to the 
'' prompt?

For example I search for certain files to be processed, but nothing should be 
done if they
are not present. Normally I do in my script:
f-dir(pattern=qq)
if(length(f)  0) {
...process file list...
}
# script end

But I don't like those {} encompassing the whole script so I'm searching for 
something to
put in place of the '???' here:
f-dir(pattern=qq)
if(length(f) == 0) '???'
...process file list...
# script end

Using stop(No file found, call.=F) works, but the Error message is ugly in 
this case.

Any suggestion?


Put the code in a function, call the function as the last line of the 
script, and return from the function when you want to exit the script.


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.


Re: [R] Re ad name multiple excel sheets using RODBC

2009-05-28 Thread Hans-Peter Suter
2009/5/28 Dieter Menne dieter.me...@menne-biomed.de:
 If you only have the sheet names, you should use package xlsReadWrite which
 is rather fast, but has some limitations in the non-commercial version.

what limitations, i.e. features do you miss?

Cheers,
Hans-Peter

__
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] [Rd] split strings

2009-05-28 Thread William Dunlap


Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com  

 -Original Message-
 From: r-devel-boun...@r-project.org 
 [mailto:r-devel-boun...@r-project.org] On Behalf Of Wacek Kusnierczyk
 Sent: Thursday, May 28, 2009 5:30 AM
 Cc: R help project; r-de...@r-project.org; Allan Engelhardt
 Subject: Re: [Rd] [R] split strings
 
 (diverted to r-devel, a source code patch attached)
 
 Wacek Kusnierczyk wrote:
  Allan Engelhardt wrote:

  Immaterial, yes, but it is always good to test :) and your solution
  *is* faster and it is even faster if you can assume byte strings:
  
 
  :)
 
  indeed;  though if the speed is immaterial (and in this case it
  supposedly was), it's probably not worth risking fixed=TRUE removing
  '.tif' from the middle of the name, however unlikely this 
 might be (cf
  murphy's laws).
 
  but if you can assume that each string ends with a '.tif' 
 (or any other
  \..{3} substring), then substr is marginally faster than 
 sub, even as a
  three-pass approach, while avoiding the risk of removing 
 '.tif' from the
  middle:
 
  strings = sprintf('f:/foo/bar//%s.tif', replicate(1000,
  paste(sample(letters, 10), collapse='')))
  library(rbenchmark)
  benchmark(columns=c('test', 'elapsed'), 
 replications=1000, order=NULL,
 substr={basenames=basename(strings); substr(basenames, 1,
  nchar(basenames)-4)},
 sub=sub('.tif', '', basename(strings), fixed=TRUE, 
 useBytes=TRUE))
  # test elapsed
  # 1 substr   3.176
  # 2sub   3.296

 
 btw., i wonder why negative indices default to 1 in substr:
 
 substr('foobar', -5, 5)
 # fooba
 # substr('foobar', 1, 5)
 substr('foobar', 2, -2)
 # 
 # substr('foobar', 2, 1)
 
 this does not seem to be documented in ?substr.

Would your patched code affect the following
use of regexpr's output as input to substr, to
pull out the matched text from the string?
x-c(ooo,good food,bad)
r-regexpr(o+, x)
substring(x,r,attr(r,match.length)+r-1)
   [1] ooo oo 
substr(x,r,attr(r,match.length)+r-1)
   [1] ooo oo 
r
   [1]  1  2 -1
   attr(,match.length)
   [1]  3  2 -1
attr(r,match.length)+r-1
   [1]  3  3 -3
   attr(,match.length)
   [1]  3  2 -1

  there are 
 ways to make
 negative indices meaningful, e.g., by taking them as indexing from
 behind (as in, e.g., perl):
 
 # hypothetical
 substr('foobar', -5, 5)
 # ooba
 # substr('foobar', 6-5+1, 5)
 substr('foobar', 2, -2)
 # ooba
 # substr('foobar', 2, 6-2+1)
 
 there is a trivial fix to src/main/character.c that gives substr the
 extended functionality -- see the attached patch.  the patch has been
 created and tested as follows:
 
 svn co https://svn.r-project.org/R/trunk r-devel
 cd r-devel
 # modifications made to src/main/character.c
 svn diff  character.c.diff
 svn revert -R .
 patch -p0  character.c.diff

 ./configure
 make
 make check-all
 # no problems reported
 
 with the patched substr, the original problem can now be solved more
 concisely, using a two-pass approach, with performance still 
 better than
 the sub/fixed/bytes one, as follows:
 
 strings = sprintf('f:/foo/bar//%s.tif', replicate(1000,
 paste(sample(letters, 10), collapse='')))
 library(rbenchmark)
 benchmark(columns=c('test', 'elapsed'), 
 replications=1000, order=NULL,
 substr=substr(basename(strings), 1, -5),
 'substr-nchar'={
 basenames=basename(strings)
 substr(basenames, 1, nchar(basenames)-4) },
 sub=sub('.tif', '', basename(strings), fixed=TRUE, 
 useBytes=TRUE))
 # test elapsed
 # 1   substr   2.981
 # 2 substr-nchar   3.206
 # 3  sub   3.273
 
 if this sounds interesting, i can update the docs accordingly.
 
 vQ
 

__
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] Re ad name multiple excel sheets using RODBC

2009-05-28 Thread Dieter Menne



Hans-Peter Suter wrote:
 
 If you only have the sheet names, you should use package xlsReadWrite
 which
 is rather fast, but has some limitations in the non-commercial version.
 
 what limitations, i.e. features do you miss?
 
 

Reading of named ranges.

Dieter

-- 
View this message in context: 
http://www.nabble.com/Read---name-multiple-excel-sheets-using-RODBC-tp23760020p23761745.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] Re ad name multiple excel sheets using RODBC

2009-05-28 Thread Erich Neuwirth
Using the package rcom (by Thomas Baier) you can do everything you want
since you have the full power of COM at your disposal.


Dieter Menne wrote:
 
 
 Hans-Peter Suter wrote:
 If you only have the sheet names, you should use package xlsReadWrite
 which
 is rather fast, but has some limitations in the non-commercial version.
 what limitations, i.e. features do you miss?


 
 Reading of named ranges.
 
 Dieter
 

-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

__
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] re gularly spaced points on multi-segement line

2009-05-28 Thread PLAFF

Dear all ...

I need your help for the following purpose :

I would like to create regularly spaced points on a multi-segment line (a
'psp class' object).

A function of the spatstat library( = pointsOnLines() ) is dedicated to that
objective but the problem is that the probability of falling on a particular
segment is proportional to the length of each segment of the multi-segment
line.

What about a solution using the whole multi-segment line and not individual
segments for points distribution ? 

Many thanks in advance for your help !

Plaff
-- 
View this message in context: 
http://www.nabble.com/regularly-spaced-points-on-multi-segement-line-tp23761782p23761782.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] Changing data point size in quilt.plot

2009-05-28 Thread Wilson, R.C.
Hi,

I am new to R and am using quilt.plot (from fields package) to plot gas 
concentrations in Europe.

I am using the following code to plot my data
library(maps)
library(fields)

test = read.csv(%change 1996_2005.txt, sep=\t)
colnames(test) = c(Station, Measurement_BaseO3, Model_BaseO3, 
Measuerment_PeakO3,
Model_PeakO3, Longitude, Latitude)

quilt.plot(test$Longitude, test$Latitude, test$Model_BaseO3,
breaks = c(-50, -40, -30, -20, -10, 0, 10, 20, 30, 40, 50), col = 
tim.colors(10),
xlim=c(-11,25), ylim=c(40,60), zlim=c(-50, 50), xlab=Longitude, 
ylab=Latitude, asp=1,
main=Modelled Base Ozone)

map(add=TRUE)

It all plots beautifully, except the size of the plotted data points is far too 
small.  I have tried using cex = xx into quilt.plot() to change the size of 
the data points but that doesn't seem to work. Maybe I am just using this 
wrong?!

I was wondering if someone could help me to alter the data point size (increase 
it to x 3 the current size).

Thanks,

Becca

[[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] Urgent Statistician Position near Philadelphia

2009-05-28 Thread José Ignacio Bustos Melo
Dear R-list,

I know is going to be weird, but I need to do something about and I know
the R-list is big group of good people. I’m moving to Philadelphia in
August 2009 (my fiancé is there) and I need to find a job. I know to do so
many things, but my skill is in science and research. I would like to know
if you know a possible position near Philadelphia, New Jersey or New York.

I was working in so many projects, doing statistical analysis, research in
parasitology, cancer research and public health in dentistry problems.  I
would love to work doing cancer research or public health. I was working
with cancer epidemiology using survival analysis and modeling.

I know how work and programing with many softwares, R, SAS, S-plus,
MathLab. I know too Statistica y SPSS in any version.

You are free to give advice to me. I’m applying in so many web pages, but
does not work. I don’t have any problem with visa to be in USA, just I
need some help.

I will send you my resume if you ask me

Best Regards,



   O__   José Bustos M.
  c/ /'_ --- Master in Applied Statistics (University of Concepcion)
 (*) \(*) -- B.S. in Marine Biology (Catholic University of Concepcion)
-Science Faculty
-Catholic University of Concepcion
-Alonso de Ribera 2850 – Concepción, Casilla 297
-Cell phone: +56 9 9 5939144

__
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] Plot error

2009-05-28 Thread NatsS

Hello,

I am an R amateur.

I want to plot data such that the 3 time points(a,b,c) lie on the X-axis and
the values of these times points are on Y-axis for n samples (e.g.100).

So, I have an object x, dim 100 4, it is a dataframe (when checked the
class)
x = 
name   a   b  c
10.11  1.11   0.86
2   .  .   .
3   .  .   .
.
.
.
100

so when i say:

 plot(1:3, x[,2:4], type=l) - I get the error below

Error in xy.coords(x, y, xlabel, ylabel, log) : 
   (list) object cannot be coerced to type 'double'

However if I do:
 plot(1:3, x[1,2:4], type=l) -- It works for the 1st row, and each
 individual row BUT NOT ALL ROWS

Please could someone explain what is happening here?

I wonder if I need to use 'lines' for the remaining, BUT I have another
dataset y with same dimensions as x, which I want to plot on the same
graph/plot to see the difference between x and y.

Thanks,
NS
-- 
View this message in context: 
http://www.nabble.com/Plot-error-tp23761408p23761408.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] Plot error

2009-05-28 Thread Richard . Cotton
 I want to plot data such that the 3 time points(a,b,c) lie on the X-axis 
and
 the values of these times points are on Y-axis for n samples (e.g.100).
 
 So, I have an object x, dim 100 4, it is a dataframe (when checked the
 class)
 x = 
 name   a   b  c
 10.11  1.11   0.86
 2   .  .   .
 3   .  .   .
 .
 .
 .
 100
 
 so when i say:
 
  plot(1:3, x[,2:4], type=l) - I get the error below
 
 Error in xy.coords(x, y, xlabel, ylabel, log) : 
(list) object cannot be coerced to type 'double'
 
 However if I do:
  plot(1:3, x[1,2:4], type=l) -- It works for the 1st row, and 
each
  individual row BUT NOT ALL ROWS
 
 Please could someone explain what is happening here?
 
 I wonder if I need to use 'lines' for the remaining, BUT I have another
 dataset y with same dimensions as x, which I want to plot on the same
 graph/plot to see the difference between x and y.

Your data looks like this:
x - data.frame(name=sample(letters, 10), a=runif(10), b=rnorm(10), 
c=rlnorm(10))

The problem is that the subset x[,2:4] is also a data frame, not a matrix.
class(x[,2:4])  #[1] data.frame

The simplest thing is probably to use lines, as you say.
row - seq_len(nrow(x))
xx - x[,2:4]
plot(row, xx$a, ylim=range(xx), type=l)
lines(row, xx$b, col=blue)
lines(row, xx$c, col=green)

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.


Re: [R] question about using a remote system

2009-05-28 Thread Greg Snow
Will R be able to send one batch of commands to the remote machine, then wait 
for the output?  Or will there be back and forth with new commands based on the 
output from the first commands?

You may want to look at the nws package for one way to have jobs run on a 
remote machine.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Erin Hodgess
 Sent: Thursday, May 28, 2009 6:56 AM
 To: Mark Wardle
 Cc: R help
 Subject: Re: [R] question about using a remote system
 
 My goal is for a user to sit down at a Linux laptop, get to an Rcmdr
 type screen, submit jobs on a remote system and then get the results
 back in R.
 
 We will assume that the user is naive, and the only thing he/she can
 do is get to the Rcmdr screen.
 
 The Rcmdr plugin will have a submit jobs menu.  The user presses
 that option, and gets results, without having to know the underside.
 
 thanks,
 Erin
 
 On Thu, May 28, 2009 at 1:54 AM, Mark Wardle m...@wardle.org wrote:
  Hi.
 
  Do you need an interactive session at the remote machine, or are you
  simply wanting to run a pre-written script?
 
  If the latter, then you can ask ssh to execute a remote command,
 which
  conceivably could be R CMD x
 
  If you explain exactly why and what you are trying to do, then
 perhaps
  there's a better solution
 
  bw
 
  Mark
 
  2009/5/28 Erin Hodgess erinm.hodg...@gmail.com:
  Dear R People:
 
  I would like to set up a plug-in for Rcmdr to do the following:
 
  I would start on a Linux laptop.  Then I would log into another
  outside system and run a some commands.
 
  Now, when I tried to do
  system(ssh e...@xxx.edu)
  password xx
 
  It goes to the remote system.  how do I continue to issue commands
  from the Linux laptop please?
 
  (hope this makes sense)
 
  thanks,
  Erin
 
 
  --
  Erin Hodgess
  Associate Professor
  Department of Computer and Mathematical Sciences
  University of Houston - Downtown
  mailto: erinm.hodg...@gmail.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.
 
 
 
 
 
  --
  Dr. Mark Wardle
  Specialist registrar, Neurology
  Cardiff, UK
 
 
 
 
 --
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: erinm.hodg...@gmail.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
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] maximum over one dimension of a 3-dimensional array

2009-05-28 Thread eric lee
Hi,

I'm running R 2.7.2 on windows XP.  I'd like to find the maximum of a
3-d array over it's third index to create a 2-d array.  For example:

 x - array(c(1,2,3,10,11,12,3:8),c(2,3,2))
 x
, , 1

 [,1] [,2] [,3]
[1,]13   11
[2,]2   10   12

, , 2

 [,1] [,2] [,3]
[1,]357
[2,]468

 x1 - x[,,1]
 x2 - x[,,2]
 pmax(x1,x2)
 [,1] [,2] [,3]
[1,]35   11
[2,]4   10   12

Is there a pre-defined function that I can use to do this without
using a for-loop?  Also, the third index can be long and of variable
length, so I don't want to explicitly write out x1, x2,...  Thanks in
advance for your help.

eric

__
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] sample unique pairs from a matrix

2009-05-28 Thread David Winsemius
Your last step will either be a single number (not really a sampling  
operation) or a
non-positive number. So at best you really only have an number that  
depends

entirely on the prior sequence of draws.

--
David.

On May 28, 2009, at 8:21 AM, jos matejus wrote:


Dear Ritchie and David,

Thanks very much for your advice. I had thought of this potential
solution, however it doesn't really fullfill my second criteria which
is that once a particular cell has been sampled, the row and column of
that cell can't be sampled from subsequently. In other words, the next
sample would be taken from a 5x5 matrix, and then a 4x4 matrix and so
on until I have my 6 values.

I will keep thinking!
Cheers
Jos

2009/5/28 David Winsemius dwinsem...@comcast.net:


On May 28, 2009, at 6:33 AM, jos matejus wrote:


Dear R users,

I have a matrix of both negative and positive values that I would  
like

to randomly sample with the following 2 conditions:

1. only sample positive values
2. once a cell in the matrix has been sampled the row and column of
that cell cannot be sampled from again.

#some dummy data
set.seed(101)
dataf - matrix(rnorm(36,1,2), nrow=6)

I can do this quite simply if all the values are positive by using  
the

sample function without replacement on the column and row indices.

samrow - sample(6,replace=F)
samcol - sample(6,replace=F)
values - numeric(6)
for(i in 1:6){
   values[i] - dataf[samrow[i], samcol[i]]
}

However, I am not sure how to include the logical condition to only
include postitive values
Any help would be gratefully received.
Jos



M - matrix(rnorm(36),nrow=6)



M[M[,]0]
 [1] 1.65619781 0.56182830 0.23812890 0.81493915 1.01279243  
1.29188874

0.64252343 0.53748655 0.31503112
[10] 0.37245358 0.07942883 0.56834586 0.62200056 0.39478167  
0.02374574

0.04974857 0.56219171 0.52901658



sample(M[M[,]0],6,replace=F)

[1] 0.56834586 0.07942883 0.31503112 0.62200056 0.02374574 0.64252343

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT




David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] maximum over one dimension of a 3-dimensional array

2009-05-28 Thread David Winsemius


On May 28, 2009, at 11:25 AM, eric lee wrote:


Hi,

I'm running R 2.7.2 on windows XP.  I'd like to find the maximum of a
3-d array over it's third index to create a 2-d array.  For example:


x - array(c(1,2,3,10,11,12,3:8),c(2,3,2))
x

, , 1

[,1] [,2] [,3]
[1,]13   11
[2,]2   10   12

, , 2

[,1] [,2] [,3]
[1,]357
[2,]468


x1 - x[,,1]
x2 - x[,,2]
pmax(x1,x2)

[,1] [,2] [,3]
[1,]35   11
[2,]4   10   12


Consider:

 apply(x, 1:2, max)
 [,1] [,2] [,3]
[1,]35   11
[2,]4   10   12

or

 apply(x, c(1,2), max)  # not necessarily adjacent dimensions
 [,1] [,2] [,3]
[1,]35   11
[2,]4   10   12







Is there a pre-defined function that I can use to do this without
using a for-loop?  Also, the third index can be long and of variable
length, so I don't want to explicitly write out x1, x2,...  Thanks in
advance for your help.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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] String replacement in an expression

2009-05-28 Thread Caroline Bazzoli

Dear R-experts,

I need to replace in an expression the character Cl by Cl+beta

But in the following case:

form-expression((Cl-(V *ka)  ) +(V   *Vm   *exp(-(Clm/Vm)   *t)))

gsub(Cl,(Cl+beta),as.character(form))

We obtain:

[1] ((Cl+beta) - (V * ka)) + (V * Vm * exp(-((Cl+beta)m/Vm) * t))


the character Clm has been also replaced.


How could I avoid this unwanted replacement ?


Thank you in advance for any help.

--
-
Caroline BAZZOLI


INSERM U738 - Université PARIS 7
UFR de Medecine - Site Bichat
16 rue Henri Huchard
75018 PARIS, FRANCE
email: caroline.bazz...@inserm.fr

www.biostat.fr 
PFIM: www.pfim.biostat.fr


__
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] String replacement in an expression

2009-05-28 Thread Gabor Grothendieck
Try matching on word boundaries as well:

 gsub(\\bCl\\b,(Cl+beta),as.character(form))
[1] ((Cl+beta) - (V * ka)) + (V * Vm * exp(-(Clm/Vm) * t))

See ?regexp

On Thu, May 28, 2009 at 11:41 AM, Caroline Bazzoli
caroline.bazz...@inserm.fr wrote:
 Dear R-experts,

 I need to replace in an expression the character Cl by Cl+beta

 But in the following case:

 form-expression((Cl-(V *ka)  ) +(V   *Vm   *exp(-(Clm/Vm)   *t)))

 gsub(Cl,(Cl+beta),as.character(form))

 We obtain:

 [1] ((Cl+beta) - (V * ka)) + (V * Vm * exp(-((Cl+beta)m/Vm) * t))


 the character Clm has been also replaced.


 How could I avoid this unwanted replacement ?


 Thank you in advance for any help.

 --
 -
 Caroline BAZZOLI


 INSERM U738 - Université PARIS 7
 UFR de Medecine - Site Bichat
 16 rue Henri Huchard
 75018 PARIS, FRANCE
 email: caroline.bazz...@inserm.fr

 www.biostat.fr PFIM: www.pfim.biostat.fr

 __
 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] getTree visualization (randomForest)

2009-05-28 Thread Károly Kovács
Dear All,

I would like to visualize a tree extracted from a random forest using
getTree {randomForest}.
I'm wondering if there is any way to do it directly or to convert my tree
to any other class of tree repesentation, which then can be plotted?

Thank you in advance,
Karoly

__
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] can you help me please :)

2009-05-28 Thread Stefan Grosse
On Thu, 28 May 2009 15:47:18 +0300 NOUF AL NUMAIR
noufalnum...@hotmail.com wrote:

NAN  barplot(zz,width = 4,names.arg= xx,axes = TRUE, axisnames = TRUE,
NAN main=title,xlab=xlab,ylab=ylab,ylim=c(0,1175),xlim=c(0,226),col =
NAN c(for (i in zz){if i70 col= lightblue else col= mistyrose))
NAN 
NAN 
NAN i tried to get red of zero then plot it 

? I have no idea what this means...

NAN i want to color different result with different colors ?
NAN 
NAN any body can help plaaaeee

If you want help try to be more clear about what you want. It is hard
with your mail because there is so much what does not belong to your
current problem, one has to scroll over plenty of numbers and still I am
not sure whether I understood what you want.

Hence you want your bar color conditional on the value or the height,
it is helpful to create a vector beforehand.(for control purposes)

y-c(1175,  483,  240,  170,   99,   79,   76,   45,   38,   35,
21,   16,   14,   19,   16) 
x-c( 1,   2,   3,   4,   5,   6,   7,
8,   9,  10,  11,  12,  13,  14,  15) 

d1-data.frame(x=x,y=y)

Color-ifelse(d1$y70,blue,red)

barplot(as.matrix(d1$y),names.arg=d1$x,col=Color,beside=T)

as an example.

hth
Stefan

__
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] Neural Network resource

2009-05-28 Thread jude.ryan
The package AMORE appears to be more flexible, but I got very poor
results using it when I tried to improve the predictive accuracy of a
regression model. I don't understand all the options well enough to be
able to fine tune it to get better predictions. However, using the
nnet() function in package VR gave me decent results and is pretty easy
to use (see the Venables and Ripley book, Modern Applied Statistics with
S, pages 243 to 249, for more details). I tried using package neuralnet
as well but the neural net failed to converge. I could not figure out
how to set the threshold option (or other options) to get the neural net
to converge. I explored package neural as well. Of all these 4 packages,
the nnet() function in package VR worked the best for me.

 

As another R user commented as well, you have too many hidden layers and
too many neurons. In general you do not need more than 1 hidden layer.
One hidden layer is sufficient for the universal approximator property
of neural networks to hold true. As you keep adding neurons to the one
hidden layer, the problem becomes more and more non-linear. If you add
too many neurons you will overfit. In general, you do not need to add
more than 10 neurons. The activation function in the hidden layer of
Venables and Ripley's nnet() function is logistic, and you can specify
the activation function in the output layer to be linear using linout =
T in nnet(). Using one hidden layer, and starting with one hidden neuron
and working up to 10 hidden neurons, I built several neural nets (4,000
records) and computed the training MSE. I also computed the validation
MSE on a holdout sample of over 1,000 records. I also started with 2
variables and worked up to 15 variables in a for loop, so in all, I
built 140 neural nets using 2 for loops, and stored the results in
lists. I arranged my variables in the data frame based on correlations
and partial correlations so that I could easily add variables in a for
loop. This was my crude attempt to simulate variable selection since,
from what I have seen, neural networks do not have variable selection
methods. In my particular case, neural networks gave me marginally
better results than regression. It all depends on the problem. If the
data has non-linear patterns, neural networks will be better than linear
regression.

 

My code is below. You can modify it to suit your needs if you find it
useful. There are probably lines in the code that are redundant which
can be deleted.

 

HTH.

 

Jude Ryan

 

My code:

 

# set order in data frame train2 based on correlations and partial
correlations

train2 - train[, c(5,27,19,20,25,26,4,9,3,10,16,6,2,14,21,28)]

dim(train2)

names(train2)

library(nnet)

# skip = T

# train 10 neural networks in a loop and find the one with the minimum
test and validation error

# create various lists to store the results of the neural network
running in two for loops

# The Column List is for the outer for loop, which loops over variables

# The Row List is for the inner for loop, which loops over number of
neurons in the hidden layer

col_nn - list()  # stores the results of nnet() over variables - outer
loop

row_nn - list()  # stores the results of nnet() over neurons - inner
loop

col_mse - list()

# row_mse - list() # not needed because nn.mse is a data frame with
rows

col_sum - list()

row_sum - list()

col_vars - list()

row_vars - list()

col_wts - list()

row_wts - list()

df_dim - dim(train2)

df_dim[2]  # number of variables

df_dim[2] - 1

num_of_neurons - 10

# build data frame to store results of neural net for each run

nn.mse - data.frame(Train_MSE=seq(1:num_of_neurons),
Valid_MSE=seq(1:num_of_neurons))

# open log file and redirect output to log file

sink(D:\\XXX\\YYY\\ Programs\\Neural_Network_v8_VR_log.txt)

# outer loop - loop over variables

for (i in 3:df_dim[2]) {  # df_dim[2]

  # inner loop - loop over number of hidden neurons

  for (j in 1:num_of_neurons) { # upto 10 neurons in the hidden layer

# need to create a new data frame with just the predictor/input
variables needed

train3 - train2[,c(1:i)]

coreaff.nn - nnet(dep_var ~ ., train3, size = j, decay = 1e-3,
linout = T, skip = T, maxit = 1000, Hess = T)

# row_vars[[j]] - coreaff.nn$call # not what we want

# row_vars[[j]] - names(train3)[c(2:i)] # not needed in inner loop
- same number of variables for all neurons

row_sum[[j]] - summary(coreaff.nn)

row_wts[[j]] - coreaff.nn$wts

rownames(nn.mse)[j] - paste(H, j, sep=)

nn.mse[j, Train_MSE] - mean((train3$dep_var -
predict(coreaff.nn))^2)

nn.mse[j, Valid_MSE] - mean((valid$dep_var - predict(coreaff.nn,
valid))^2)

  }

  col_vars[[i-2]] - names(train3)[c(2:i)]

  col_sum[[i-2]] - row_sum

  col_wts[[i-2]] - row_wts

  col_mse[[i-2]] - nn.mse

}

# cbind(col_vars[1],col_vars[2])

col_vars

col_sum

col_wts

sink()

cbind(col_mse[[1]],col_mse[[2]],col_mse[[3]],col_mse[[4]],col_mse[[5]],c
ol_mse[[6]],col_mse[[7]],

 

Re: [R] String replacement in an expression

2009-05-28 Thread William Dunlap
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Caroline Bazzoli
 Sent: Thursday, May 28, 2009 8:41 AM
 To: r-help@r-project.org
 Subject: [R] String replacement in an expression
 
 Dear R-experts,
 
 I need to replace in an expression the character Cl by Cl+beta
 
 But in the following case:
 
 form-expression((Cl-(V *ka)  ) +(V   *Vm   *exp(-(Clm/Vm)   *t)))
 
 gsub(Cl,(Cl+beta),as.character(form))
 
 We obtain:
 
 [1] ((Cl+beta) - (V * ka)) + (V * Vm * exp(-((Cl+beta)m/Vm) * t))
 
 
 the character Clm has been also replaced.
 
 
 How could I avoid this unwanted replacement ?

I like to use substitute(), which works with the expression
as an expression, instead of converting it to a string, changing
it, and then parsing the result to make the new expression.
E.g.,

   form-expression((Cl-(V *ka)  ) +(V   *Vm   *exp(-(Clm/Vm)   *t)))
   do.call(substitute, list(form[[1]], list(Cl=Quote(Cl+beta
  (Cl + beta - (V * ka)) + (V * Vm * exp(-(Clm/Vm) * t))
  
Note how it adds parentheses where appropriate:
   do.call(substitute, list(form[[1]], list(Cl=Quote(Cl+beta), 
Clm=Quote(Clm+gamma
  (Cl + beta - (V * ka)) + (V * Vm * exp(-((Clm + gamma)/Vm) *  t))
 
The do.call() is needed in this case because substitute() does not
evaluate its first argument and the do.call takes care of evaluating
the variable 'form' so substitute sees its value.  (S+'s substitute()
has an evaluator=FALSE/TRUE argument to let you avoid the do.call().)

R's substitute() doesn't seem to go into expression objects, hence
I passed it the first element of the expression and it returned the
converted first element.  You could wrap the output with as.expression
if you really wanted the expression object output.

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com 

 
 Thank you in advance for any help.
 
 -- 
 -
 Caroline BAZZOLI
 
 
 INSERM U738 - Université PARIS 7
 UFR de Medecine - Site Bichat
 16 rue Henri Huchard
 75018 PARIS, FRANCE
 email: caroline.bazz...@inserm.fr
 
 www.biostat.fr 
 PFIM: www.pfim.biostat.fr
 
 __
 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] boxplot

2009-05-28 Thread Dieter Menne



amor Gandhi wrote:
 
 Hi gues,
 

This should read: Hi, guess what I want
 

amor Gandhi wrote:
 
 Is there any function in R for boxplot with different time points?
 t1 - c(rep(1,20),rep(2,20))
 t2 - c(rep(1,10),rep(2,10),rep(1,10),rep(2,10))
 x - rnorm(40,5,1)
 dat - data.frame(t1,t2,x)
 
 boxplot(x~t1,t2)
 
 

This might come close

library(lattice)
t1 - c(rep(1,20),rep(2,20))
t2 - c(rep(1,10),rep(2,10),rep(1,10),rep(2,10))
x - rnorm(40,5,1)
dat - data.frame(t1=as.factor(t1),t2=as.factor(t2),x)
bwplot(x~t1|t2,data=dat)
bwplot(t1+t2~x,data=dat,outer=TRUE)



-- 
View this message in context: 
http://www.nabble.com/boxplot-tp23752278p23767111.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] Hmisc package: deff() command's formula for the design effect

2009-05-28 Thread jjh21

One additional question:

It seems that in practice the design effect is often calculated on the
response variable or on individual predictor variables. I have some OLS
models using observational data that are clustered. Does it make sense to
calculate the design effect on the residuals of one of these models to see
the extent to which there is still clustering left even after including
covariates?



Thomas Lumley wrote:
 
 The formula in Hmisc is correct (if the correlation doesn't vary with the 
 cluster size).  If you think of the formula for the variance of a sum, it 
 involves adding up all the variances and covariances.  A cluster of size k 
 has k^2-k covariances between members, so the total number of covariances 
 is sum(k^2-k) over all the clusters, plus the sum(k) variances.
 
 Another way to think of it is that the larger clusters get too much 
 weight, so in addition to the rho*(B-1) factor that you would have for 
 equal-sized clusters there is an additional loss of efficiency due to 
 giving too much weight to the larger clusters.
 
   -thomas
 
 __
 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/Hmisc-package%3A-deff%28%29-command%27s-formula-for-the-design-effect-tp23415477p23767287.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] ggplot2 legend

2009-05-28 Thread Felipe Carrillo

Hi:
  I need some help with the legend. I got 14 samples(Muestreo) and I
  am trying to plot a smooth line for each sample. I am able to accomplish that 
but the problem is that the legend only displays every other sample. How can I 
force the legend to show all of my Muestreos? Thanks in advance.

fish_ByMuestreo - structure(list(data = structure(list(SampleDate = 
structure(c(3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L, 7L, 7L,
10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L, 27L, 27L,
17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L, 24L, 24L,
30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L, 33L, 33L,
36L, 36L, 36L, 36L, 36L, 39L, 39L, 39L, 39L, 39L, 39L, 14L, 14L,
14L, 14L, 14L, 14L, 5L, 5L, 5L, 8L, 8L, 8L, 11L, 11L, 11L, 11L,
15L, 15L, 15L, 28L, 28L, 28L, 28L, 28L, 18L, 18L, 18L, 18L, 18L,
22L, 22L, 22L, 22L, 25L, 25L, 25L, 25L, 40L, 40L, 40L, 40L, 40L,
31L, 31L, 31L, 31L, 37L, 37L, 37L, 37L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L, 7L, 7L,
10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L, 27L, 27L,
17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L, 24L, 24L,
30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L, 33L, 33L,
36L, 36L, 36L, 36L, 36L, 14L, 14L, 14L, 14L, 14L, 14L, 5L, 5L,
5L, 8L, 8L, 8L, 11L, 11L, 11L, 11L, 15L, 15L, 15L, 28L, 28L,
28L, 28L, 28L, 18L, 18L, 18L, 18L, 18L, 22L, 22L, 22L, 22L, 25L,
25L, 25L, 25L, 40L, 40L, 40L, 40L, 40L, 31L, 31L, 31L, 31L, 34L,
34L, 34L, 34L, 34L, 37L, 37L, 37L, 37L, 1L, 1L, 1L, 1L, 1L, 6L,
6L, 6L, 6L, 6L, 6L, 9L, 9L, 9L, 12L, 12L, 12L, 21L, 21L, 21L,
21L, 29L, 29L, 29L, 19L, 19L, 19L, 19L, 19L, 23L, 23L, 23L, 23L,
23L, 26L, 26L, 26L, 26L, 41L, 41L, 41L, 41L, 32L, 32L, 32L, 32L,
32L, 35L, 35L, 35L, 35L, 38L, 38L, 38L, 38L, 38L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L,
7L, 7L, 10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L,
27L, 27L, 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L,
24L, 24L, 30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L,
33L, 33L, 36L, 36L, 36L, 36L, 36L, 39L, 39L, 39L, 39L, 39L, 39L,
3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L, 7L,
7L, 10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L, 27L,
27L, 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L, 24L,
24L, 30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L, 33L,
33L, 36L, 36L, 36L, 36L, 36L, 39L, 39L, 39L, 39L, 39L, 39L), .Label = 
c(10/2/2002,
10/4/2002, 6/23/2002, 6/30/2002, 7/10/2002, 7/12/2002,
7/14/2002, 7/17/2002, 7/19/2002, 7/21/2002, 7/24/2002,
7/26/2002, 7/28/2002, 7/3/2002, 7/31/2002, 7/7/2002,
8/11/2002, 8/14/2002, 8/16/2002, 8/18/2002, 8/2/2002,
8/21/2002, 8/23/2002, 8/25/2002, 8/28/2002, 8/30/2002,
8/4/2002, 8/7/2002, 8/9/2002, 9/1/2002, 9/11/2002,
9/13/2002, 9/15/2002, 9/18/2002, 9/20/2002, 9/22/2002,
9/25/2002, 9/27/2002, 9/29/2002, 9/4/2002, 9/6/2002,
9/8/2002), class = factor), PondName = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L), .Label = c(Pond01,
Pond02, Pond03, Pond04, Pond05, Pond06, Pond07), class = factor),
Muestreo = c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 7L, 7L,
7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 10L, 10L, 10L,
10L, 10L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 13L,

Re: [R] Changing point color/character in qqmath

2009-05-28 Thread Kevin W
Apologies once more, there was a slight error in our example.  Here is a
correct version of how to color the points in qqmath according to another
variable.

qqmath(~ yield | variety, data = barley, groups=year,
   auto.key=TRUE,
   prepanel = function(x, ...) {
 list(xlim = range(qnorm(ppoints(length(x)
   },
   panel = function(x, ...) {
 qx - qnorm(ppoints(length(x)))[rank(x)]
 panel.xyplot(qx, x, ...)
   })

Kevin


On Wed, May 27, 2009 at 4:39 PM, Kevin W kw.st...@gmail.com wrote:

 Thanks to Deepayan, I have a corrected version of how to color points in a
 qqmath plot according to another variable.  Using the barley data for a more
 concise example::

 qqmath(~ yield | variety, data = barley, groups=year,
auto.key=TRUE,
   prepanel = function(x, ...) {
   list(xlim = range(qnorm(ppoints(length(x)
   },
   panel = function(x, ...) {
   xx - qnorm(ppoints(length(x)))[order(x)]
   panel.xyplot(x = xx, y = x, ...)
   })


 The example I posted previously (and shown below) is not correct.  My
 apologies.

 Kevin


 On Wed, May 27, 2009 at 11:05 AM, Kevin W kw.st...@gmail.com wrote:

 Having solved this problem, I am posting this so that the next time I
 search for how to do this I will find an answer...

 Using qqmath(..., groups=num) creates a separate qq distribution for each
 group (within a panel).  Using the 'col' or 'pch' argument does not
 (usually) work because panel.qqmath sorts the data (but not 'col' or 'pch')
 before plotting.  Sorting the data before calling qqmath will ensure that
 the sorting does not change the order of the data.

 For example, to obtain one distribution per voice part and color the point
 by part 1 or part 2:

 library(lattice)
 singer - singer
 singer - singer[order(singer$height),]
 singer$part - factor(sapply(strsplit(as.character(singer$voice.part),
 split =  ), [, 1),
  levels = c(Bass, Tenor, Alto, Soprano))
 singer$num - factor(sapply(strsplit(as.character(singer$voice.part),
 split =  ), [, 2))
 qqmath(~ height | part, data = singer,
col=singer$num,
layout=c(4,1))



 Kevin




[[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 time series with data gap using type line- but do not want to connect gap with line

2009-05-28 Thread Josef . Kardos
I have a time series of about 1500 measurements.  There are sporadic data 
gaps.  I would like to plot the time series with type line.  I only want 
a line to connect the periods with data; I don't want a line to connect 
the points across a data gap.  Is there a function or recommended method 
to deal with this?

For example
there are 2000 days
days 1:1000 each have one measurement of temperature
days 1001: 1199 have no data
days 1200:2000 each have one measurement of temperature

I want the plot to connect points 1:1000 with a line, and to connect 
points 1200: 2000 with a different  line. I don't want a line to connect 
points 1001:1200. 

I searched the help archives and google but couldn't find anything. Any 
advice?



JK
[[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] plotting time series with data gap using type line- but do not want to connect gap with line

2009-05-28 Thread Gabor Grothendieck
Just place a point with an NA value between the two segments.
Here is one way to do it in zoo:

set.seed(123)
library(zoo)

# create sample data
tt - c(1:1000, 1200:2000)
z - zoo(rnorm(length(tt)), tt)

# this will fill in omitted values with NAs
z - as.zoo(as.ts(z))

plot(z)



On Thu, May 28, 2009 at 3:05 PM,  josef.kar...@phila.gov wrote:
 I have a time series of about 1500 measurements.  There are sporadic data
 gaps.  I would like to plot the time series with type line.  I only want
 a line to connect the periods with data; I don't want a line to connect
 the points across a data gap.  Is there a function or recommended method
 to deal with this?

 For example
 there are 2000 days
 days 1:1000 each have one measurement of temperature
 days 1001: 1199 have no data
 days 1200:2000 each have one measurement of temperature

 I want the plot to connect points 1:1000 with a line, and to connect
 points 1200: 2000 with a different  line. I don't want a line to connect
 points 1001:1200.

 I searched the help archives and google but couldn't find anything. Any
 advice?



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


[R] installing gRain package on ubuntu 8.10

2009-05-28 Thread Alex Biedermann

Dear all

I am trying to install the gRain package on ubuntu 8.10,
running R Vers. 2.9. Unfortunately, I get a bad
Exit-Status. What could cause that problem?

Any help is appreciated.
Many thanks in advance.

A. Biedermann



install.packages(gRain)
Warnung in install.packages(gRain) :
  Argument 'lib' fehlt: nutze
'/home/user1/R/i486-pc-linux-gnu-library/2.9'
versuche URL
'http://cran.ch.r-project.org/src/contrib/gRain_0.8.0.tar.gz'
Content type 'application/x-gzip' length 133482 bytes (130
Kb)
URL geöffnet
==
downloaded 130 Kb

* Installing *source* package ‘gRain’ ...
** R
** demo
** inst
** preparing package for lazy loading
Error in library(pkg, character.only = TRUE,
logical.return = TRUE, lib.loc = lib.loc) :
  'gRbase' is not a valid installed package
Fehler: lazy loading failed für Paket ‘gRain’
* Removing
‘/home/user1/R/i486-pc-linux-gnu-library/2.9/gRain’

Die heruntergeladenen Pakete sind in
‘/tmp/RtmpgVRO21/downloaded_packages’
Warning message:
In install.packages(gRain) :
  Installation des Pakets 'gRain' hatte Exit-Status ungleich
0

__
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 avoid add 'X' before numeric colnames when read.table

2009-05-28 Thread Zheng, Xin (NIH) [C]
Hi all,

Is there any way to keep numeric colnames as is? Any hint will be appreicated.

Xin Zheng


[[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] String replacement in an expression

2009-05-28 Thread Wacek Kusnierczyk
Caroline Bazzoli wrote:
 Dear R-experts,

 I need to replace in an expression the character Cl by Cl+beta

 But in the following case:

 form-expression((Cl-(V *ka)  ) +(V   *Vm   *exp(-(Clm/Vm)   *t)))

 gsub(Cl,(Cl+beta),as.character(form))

 We obtain:

 [1] ((Cl+beta) - (V * ka)) + (V * Vm * exp(-((Cl+beta)m/Vm) * t))


 the character Clm has been also replaced.


 How could I avoid this unwanted replacement ?

try '\\bCl\\b' as the pattern, which says 'match Cl as a separate word'.

vQ

__
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 avoid add 'X' before numeric colnames when read.table

2009-05-28 Thread jim holtman
?read.table  check.names=FALSE

On Thu, May 28, 2009 at 3:25 PM, Zheng, Xin (NIH) [C] zheng...@mail.nih.gov
 wrote:

 Hi all,

 Is there any way to keep numeric colnames as is? Any hint will be
 appreicated.

 Xin Zheng


[[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




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

What is the problem that you are trying to solve?

[[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 to avoid add 'X' before numeric colnames when read.table

2009-05-28 Thread Greg Snow
This really depends on where the 'X' is coming from, which you did not tell us 
(see the posting guide).

For example, if the 'data.frame' function is the one adding the 'X', then you 
can use the 'check.names' argument to prevent the addition (or you can use 
data.frame with the argument to explicitly create your own data frame with the 
names you want, then pass that to the function that is doing the conversion 
currently).

If a different function is adding the 'X', then look at the help page for that 
function, or give us more to go on.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Zheng, Xin (NIH) [C]
 Sent: Thursday, May 28, 2009 1:26 PM
 To: r-help@r-project.org
 Subject: [R] how to avoid add 'X' before numeric colnames when
 read.table
 
 Hi all,
 
 Is there any way to keep numeric colnames as is? Any hint will be
 appreicated.
 
 Xin Zheng
 
 
   [[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 to avoid add 'X' before numeric colnames when read.table

2009-05-28 Thread Zheng, Xin (NIH) [C]
Thank you guys. But I also want 'check.names' to help keeping colnames unique. 
It seems there's no proper option for that in 'read.table'. I have to alter 
colnames with strsplit or other similar functions.

From: jim holtman [mailto:jholt...@gmail.com]
Sent: Thursday, May 28, 2009 3:40 PM
To: Zheng, Xin (NIH) [C]
Cc: r-help@r-project.org
Subject: Re: [R] how to avoid add 'X' before numeric colnames when read.table

?read.table  check.names=FALSE
On Thu, May 28, 2009 at 3:25 PM, Zheng, Xin (NIH) [C] 
zheng...@mail.nih.govmailto:zheng...@mail.nih.gov wrote:
Hi all,

Is there any way to keep numeric colnames as is? Any hint will be appreicated.

Xin Zheng


   [[alternative HTML version deleted]]

__
R-help@r-project.orgmailto: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.htmlhttp://www.r-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



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

What is the problem that you are trying to solve?

[[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] How this addition works?

2009-05-28 Thread bogaso.christofer
I have following addition :

 

 1:2 + 1:10

 [1]  2  4  4  6  6  8  8 10 10 12

 

I could not understand how R adding those two unequal vector? Any help?


[[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 to avoid add 'X' before numeric colnames when read.table

2009-05-28 Thread Zheng, Xin (NIH) [C]
substring(header, 2,) works for the purpose perfectly.

Xin Zheng


[[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] filter function speed

2009-05-28 Thread Bishara, Anthony J
I am trying to use a linear filter to reduce loops and thereby increase
the speed of an existing program.  However,  while the filter function
(stats package) should have reduced the looping by about 30-fold, the
time to complete the program remained about the same.  This surprised
me, because I had made an analogous change to a Matlab version of the
same program using Matlab's filter function, and that change made the
program run about 9 times as fast.  

In R, is there another function that would be more efficient than
filter in the stats package?  Any advice would be appreciated, as I
would hate to see Matlab win this speed battle.

Relevant line from R code:
   
evTemp=filter(lambda*tempterm,1-lambda,method=recursive)
#lambda=scalar between 0 and 1 (representing learning rate in a
reinforcement learning model)
#tempterm=vector with from 1 to 150 elements (representing reinforcement
value data)


Thank you.

Anthony Bishara
Department of Psychology
College of Charleston
http://bisharaa.people.cofc.edu/

__
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] String replacement in an expression

2009-05-28 Thread William Dunlap


Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com  

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Wacek Kusnierczyk
 Sent: Thursday, May 28, 2009 12:31 PM
 To: Caroline Bazzoli
 Cc: r-help@r-project.org
 Subject: Re: [R] String replacement in an expression
 
 Caroline Bazzoli wrote:
  Dear R-experts,
 
  I need to replace in an expression the character Cl by Cl+beta
 
  But in the following case:
 
  form-expression((Cl-(V *ka)  ) +(V   *Vm   *exp(-(Clm/Vm)   *t)))
 
  gsub(Cl,(Cl+beta),as.character(form))
 
  We obtain:
 
  [1] ((Cl+beta) - (V * ka)) + (V * Vm * exp(-((Cl+beta)m/Vm) * t))
 
 
  the character Clm has been also replaced.
 
 
  How could I avoid this unwanted replacement ?
 
 try '\\bCl\\b' as the pattern, which says 'match Cl as a 
 separate word'.

That works in this case, but \\b idea of what a word is not
same as R's idea of what a name is.  E..g, \\b thinks that
a period is not in a word but R thinks periods in names are
fine.
gsub(\\bC1\\b, (C1+beta), C1 * exp(C1.5 / C2.5))
   [1] (C1+beta) * exp((C1+beta).5 / C2.5)
This is one more reason to use substitute(), which directly
edits an expression to produce a new one.  It avoids
the deparse-edit-parse cycle that can corrupt things
(even if you don't do any editing).
substitute(C1 * exp(C1.5 / C2.5), list(C1=Quote(C1+beta)))
   (C1 + beta) * exp(C1.5/C2.5)

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com 

 
 
 vQ
 
 __
 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] Labeling barplot bars by multiple factors

2009-05-28 Thread Thomas Levine
Ah, that makes sense. But now another two issues have arisen.

Firstly, the error bars look like confidence intervals, and I'm pretty
sure that they are but does some document verify this? I suppose I
could check the code too.

Secondly, I just read about how dynamite plots should be avoided. It's
quite easy to turn the dynamite plots into dot plots with Inkscape,
but is there an equivalent function that generates _hierarchical_ dot
plots?

Tom

On Thu, May 28, 2009 at 12:32 PM, William Dunlap wdun...@tibco.com wrote:
 -Original Message-
 From: r-help-boun...@r-project.org
 [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas Levine
 Sent: Thursday, May 28, 2009 5:04 AM
 To: Jim Lemon
 Cc: r-help@r-project.org
 Subject: Re: [R] Labeling barplot bars by multiple factors

 Both of those worked, but hierobarp looked a bit easier, so I
 used that. The
 one annoying thing is that it sorts alphabetically.

 Tom

 The sorts of functions almost always order things by
 the order of the levels of your factors.  The default ordering
 is alphabetical (or increasing numeric, if your factor
 was made from numerical data).  To change the order remake
 the factor and supply the levels argument.  E.g., to reverse the
 order use rev:
    data$someFactor - factor(data$someFactor,
 levels=rev(levels(data$someFactor)))

 Bill Dunlap
 TIBCO Software Inc - Spotfire Division
 wdunlap tibco.com


 On Thu, May 28, 2009 at 6:46 AM, Jim Lemon j...@bitwrit.com.au wrote:

  Thomas Levine wrote:
 
  I want to plot quantitative data as a function of three
 two-level factors.
  How do I group the bars on a barplot by level through labeling and
  spacing?
  Here
 http://www.thomaslevine.org/sample_multiple-factor_barplot.png's
  what
  I'm thinking of. Also, I'm pretty sure that I want a
 barplot, but there
  may
  be something better.
 
 
 
  Hi Tom,
  You may find that the hierobarp function in the plotrix
 package will do
  what you want.
 
  Jim
 
 

       [[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 this addition works?

2009-05-28 Thread Rolf Turner


On 29/05/2009, at 8:00 AM, bogaso.christofer wrote:


I have following addition :




1:2 + 1:10


 [1]  2  4  4  6  6  8  8 10 10 12



I could not understand how R adding those two unequal vector? Any  
help?


Look at the help for ``+'' (?+) and look at ``Value''.  There you will
see:


These operators return vectors containing the result of the
element by element operations.  The elements of shorter vectors
are recycled as necessary (with a 'warning' when they are recycled
only _fractionally_).  The operators are '+' for addition, '-' for
subtraction, '*' for multiplication, '/' for division and '^' for
exponentiation.


The key word is ``recycled''.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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 this addition works?

2009-05-28 Thread baptiste auguie

recycling rule: repeat the shorter element as many times as necessary,

all.equal(1:2 + 1:10 , rep(1:2, length=10) + 1:10)
# TRUE

HTH,

baptiste

On 28 May 2009, at 22:00, bogaso.christofer wrote:


I have following addition :




1:2 + 1:10


[1]  2  4  4  6  6  8  8 10 10 12



I could not understand how R adding those two unequal vector? Any  
help?



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


_

Baptiste Auguié

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

Phone: +44 1392 264187

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

__
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 this addition works?

2009-05-28 Thread Sarah Goslee
R recycles the shorter one to match the longer one:

1  2  3  4  5  6  7  8  9 10
+
1  2  1  2  1  2  1   2  1   2
=
2  4  4  6  6  8  8 10 10 12

R does this recycling in many cases, and it can sometimes trap the
unwary.

Sarah

On Thu, May 28, 2009 at 4:00 PM, bogaso.christofer
bogaso.christo...@gmail.com wrote:
 I have following addition :



 1:2 + 1:10

  [1]  2  4  4  6  6  8  8 10 10 12



 I could not understand how R adding those two unequal vector? Any help?





-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] ggplot2 legend

2009-05-28 Thread Mike Lawrence
First, your example didn't work because fish_ByMuestreo didn't build
properly (deleting the first structure(list(data =  bit solves
this).

To solve your plotting problem, note that as constructed, the Muestreo
column is numeric, whereas you seem to want to treat it as a factor.
Solution: convert to factor:

fish_ByMuestreo$Muestreo=factor(fish_ByMuestreo$Muestreo)

On Thu, May 28, 2009 at 3:47 PM, Felipe Carrillo
mazatlanmex...@yahoo.com wrote:

 Hi:
  I need some help with the legend. I got 14 samples(Muestreo) and I
  am trying to plot a smooth line for each sample. I am able to accomplish 
 that but the problem is that the legend only displays every other sample. How 
 can I force the legend to show all of my Muestreos? Thanks in advance.

 fish_ByMuestreo - structure(list(data = structure(list(SampleDate = 
 structure(c(3L,
 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L, 7L, 7L,
 10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L, 27L, 27L,
 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L, 24L, 24L,
 30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L, 33L, 33L,
 36L, 36L, 36L, 36L, 36L, 39L, 39L, 39L, 39L, 39L, 39L, 14L, 14L,
 14L, 14L, 14L, 14L, 5L, 5L, 5L, 8L, 8L, 8L, 11L, 11L, 11L, 11L,
 15L, 15L, 15L, 28L, 28L, 28L, 28L, 28L, 18L, 18L, 18L, 18L, 18L,
 22L, 22L, 22L, 22L, 25L, 25L, 25L, 25L, 40L, 40L, 40L, 40L, 40L,
 31L, 31L, 31L, 31L, 37L, 37L, 37L, 37L, 1L, 1L, 1L, 1L, 1L, 3L,
 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L, 7L, 7L,
 10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L, 27L, 27L,
 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L, 24L, 24L,
 30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L, 33L, 33L,
 36L, 36L, 36L, 36L, 36L, 14L, 14L, 14L, 14L, 14L, 14L, 5L, 5L,
 5L, 8L, 8L, 8L, 11L, 11L, 11L, 11L, 15L, 15L, 15L, 28L, 28L,
 28L, 28L, 28L, 18L, 18L, 18L, 18L, 18L, 22L, 22L, 22L, 22L, 25L,
 25L, 25L, 25L, 40L, 40L, 40L, 40L, 40L, 31L, 31L, 31L, 31L, 34L,
 34L, 34L, 34L, 34L, 37L, 37L, 37L, 37L, 1L, 1L, 1L, 1L, 1L, 6L,
 6L, 6L, 6L, 6L, 6L, 9L, 9L, 9L, 12L, 12L, 12L, 21L, 21L, 21L,
 21L, 29L, 29L, 29L, 19L, 19L, 19L, 19L, 19L, 23L, 23L, 23L, 23L,
 23L, 26L, 26L, 26L, 26L, 41L, 41L, 41L, 41L, 32L, 32L, 32L, 32L,
 32L, 35L, 35L, 35L, 35L, 38L, 38L, 38L, 38L, 38L, 2L, 2L, 2L,
 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L,
 7L, 7L, 10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L,
 27L, 27L, 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L,
 24L, 24L, 30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L,
 33L, 33L, 36L, 36L, 36L, 36L, 36L, 39L, 39L, 39L, 39L, 39L, 39L,
 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 16L, 16L, 16L, 7L, 7L, 7L,
 7L, 10L, 10L, 10L, 13L, 13L, 13L, 13L, 13L, 27L, 27L, 27L, 27L,
 27L, 17L, 17L, 17L, 17L, 20L, 20L, 20L, 20L, 24L, 24L, 24L, 24L,
 24L, 30L, 30L, 30L, 30L, 42L, 42L, 42L, 42L, 42L, 33L, 33L, 33L,
 33L, 36L, 36L, 36L, 36L, 36L, 39L, 39L, 39L, 39L, 39L, 39L), .Label = 
 c(10/2/2002,
 10/4/2002, 6/23/2002, 6/30/2002, 7/10/2002, 7/12/2002,
 7/14/2002, 7/17/2002, 7/19/2002, 7/21/2002, 7/24/2002,
 7/26/2002, 7/28/2002, 7/3/2002, 7/31/2002, 7/7/2002,
 8/11/2002, 8/14/2002, 8/16/2002, 8/18/2002, 8/2/2002,
 8/21/2002, 8/23/2002, 8/25/2002, 8/28/2002, 8/30/2002,
 8/4/2002, 8/7/2002, 8/9/2002, 9/1/2002, 9/11/2002,
 9/13/2002, 9/15/2002, 9/18/2002, 9/20/2002, 9/22/2002,
 9/25/2002, 9/27/2002, 9/29/2002, 9/4/2002, 9/6/2002,
 9/8/2002), class = factor), PondName = structure(c(1L, 1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L,
 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 

Re: [R] How this addition works?

2009-05-28 Thread Luc Villandre



bogaso.christofer wrote:

I have following addition :

 

  

1:2 + 1:10



 [1]  2  4  4  6  6  8  8 10 10 12

 


I could not understand how R adding those two unequal vector? Any help?


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

Hi,

R recycles the shorter vector to yield:

1+1 = 2
2+2 = 4
3+1 = 4
4+2 = 6
5+1 = 6
6+2 = 8

and so on. Is this what you wanted to know?

Cheers, 
--

*Luc Villandré*
/Biostatistician
McGill University Health Center -
Montreal Children's Hospital Research Institute/

__
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] max.col weirdness

2009-05-28 Thread Daryl Morris

Hi,
I think there's some rounding issue with returning the max column.  
(running 2.9.0 on an Apple, but my buddy found it on his PC)


 x - matrix(c(1234.568,1234.569,1234.567),1)
 max.col(x)
[1] 2
 x - matrix(c(12345.568,12345.569,12345.567),1)
 max.col(x)
[1] 3
 x - matrix(c(112345.568,112345.569,112345.567),1)
 max.col(x)
[1] 3
 max.col(-x)
[1] 1

Thanks, Daryl

__
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] ggplot2 legend

2009-05-28 Thread Felipe Carrillo

Thanks for your help Mike, it works like a charm now!!

--- On Thu, 5/28/09, Mike Lawrence mike.lawre...@dal.ca wrote:

 From: Mike Lawrence mike.lawre...@dal.ca
 Subject: Re: [R] ggplot2 legend
 To: Felipe Carrillo mazatlanmex...@yahoo.com
 Cc: r-h...@stat.math.ethz.ch
 Date: Thursday, May 28, 2009, 1:06 PM
 First, your example didn't work
 because fish_ByMuestreo didn't build
 properly (deleting the first structure(list(data =  bit
 solves
 this).
 
 To solve your plotting problem, note that as constructed,
 the Muestreo
 column is numeric, whereas you seem to want to treat it as
 a factor.
 Solution: convert to factor:
 
 fish_ByMuestreo$Muestreo=factor(fish_ByMuestreo$Muestreo)
 
 On Thu, May 28, 2009 at 3:47 PM, Felipe Carrillo
 mazatlanmex...@yahoo.com
 wrote:
 
  Hi:
   I need some help with the legend. I got 14
 samples(Muestreo) and I
   am trying to plot a smooth line for each sample. I
 am able to accomplish that but the problem is that the
 legend only displays every other sample. How can I force the
 legend to show all of my Muestreos? Thanks in advance.
  library(ggplot2)
  fishplot -
  qplot(PondName,BodyWeight.g.,data=fish_ByMuestreo,colour=Muestreo,position=jitter)+stat_summary(aes(group=Muestreo),fun.data=mean_cl_normal,
colour=green,geom=smooth,fill=NA)+
opts(title=Average weight(grs) by Pond)
print(fishplot)


  Felipe D. Carrillo
  Supervisory Fishery Biologist
  Department of the Interior
  US Fish  Wildlife Service
  California, USA

 Mike Lawrence
 Graduate Student
 Department of Psychology
 Dalhousie University





__
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] sample unique pairs from a matrix

2009-05-28 Thread jos matejus
Dear All,

Many thanks for all your useful suggestions. Much appreciated.

Jos

2009/5/28 David Winsemius dwinsem...@comcast.net:
 Your last step will either be a single number (not really a sampling
 operation) or a
 non-positive number. So at best you really only have an number that depends
 entirely on the prior sequence of draws.

 --
 David.

 On May 28, 2009, at 8:21 AM, jos matejus wrote:

 Dear Ritchie and David,

 Thanks very much for your advice. I had thought of this potential
 solution, however it doesn't really fullfill my second criteria which
 is that once a particular cell has been sampled, the row and column of
 that cell can't be sampled from subsequently. In other words, the next
 sample would be taken from a 5x5 matrix, and then a 4x4 matrix and so
 on until I have my 6 values.

 I will keep thinking!
 Cheers
 Jos

 2009/5/28 David Winsemius dwinsem...@comcast.net:

 On May 28, 2009, at 6:33 AM, jos matejus wrote:

 Dear R users,

 I have a matrix of both negative and positive values that I would like
 to randomly sample with the following 2 conditions:

 1. only sample positive values
 2. once a cell in the matrix has been sampled the row and column of
 that cell cannot be sampled from again.

 #some dummy data
 set.seed(101)
 dataf - matrix(rnorm(36,1,2), nrow=6)

 I can do this quite simply if all the values are positive by using the
 sample function without replacement on the column and row indices.

 samrow - sample(6,replace=F)
 samcol - sample(6,replace=F)
 values - numeric(6)
 for(i in 1:6){
   values[i] - dataf[samrow[i], samcol[i]]
 }

 However, I am not sure how to include the logical condition to only
 include postitive values
 Any help would be gratefully received.
 Jos

 M - matrix(rnorm(36),nrow=6)

 M[M[,]0]

  [1] 1.65619781 0.56182830 0.23812890 0.81493915 1.01279243 1.29188874
 0.64252343 0.53748655 0.31503112
 [10] 0.37245358 0.07942883 0.56834586 0.62200056 0.39478167 0.02374574
 0.04974857 0.56219171 0.52901658


 sample(M[M[,]0],6,replace=F)

 [1] 0.56834586 0.07942883 0.31503112 0.62200056 0.02374574 0.64252343

 --
 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT



 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT



__
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] max.col weirdness

2009-05-28 Thread Daryl Morris

Hi,
Sorry, I was too hasty.  I see that the tolerance is in the 
documentation (and that random is the default tie-breaker).


Would it be possible to allow tolerance to be a parameter?

thanks, Daryl



Daryl Morris wrote:

Hi,
I think there's some rounding issue with returning the max column.  
(running 2.9.0 on an Apple, but my buddy found it on his PC)


 x - matrix(c(1234.568,1234.569,1234.567),1)
 max.col(x)
[1] 2
 x - matrix(c(12345.568,12345.569,12345.567),1)
 max.col(x)
[1] 3
 x - matrix(c(112345.568,112345.569,112345.567),1)
 max.col(x)
[1] 3
 max.col(-x)
[1] 1

Thanks, Daryl





__
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] max.col weirdness

2009-05-28 Thread Bert Gunter
Try reading the man page, which says:

Details

When ties.method = random, as per default, ties are broken at random. In
this case, the determination of a tie assumes that the entries are
probabilities: there is a relative tolerance of 1e-5, relative to the
largest (in magnitude, omitting infinity) entry in the row.


Bert Gunter
Genentech Nonclinical Biostatistics

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Daryl Morris
Sent: Thursday, May 28, 2009 1:47 PM
To: r-help@r-project.org
Subject: [R] max.col weirdness

Hi,
I think there's some rounding issue with returning the max column.  
(running 2.9.0 on an Apple, but my buddy found it on his PC)

  x - matrix(c(1234.568,1234.569,1234.567),1)
  max.col(x)
[1] 2
  x - matrix(c(12345.568,12345.569,12345.567),1)
  max.col(x)
[1] 3
  x - matrix(c(112345.568,112345.569,112345.567),1)
  max.col(x)
[1] 3
  max.col(-x)
[1] 1

Thanks, Daryl

__
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] custom sort?

2009-05-28 Thread Steve Jaffe

Sounds simple but haven't been able to find it in docs: is it possible to
sort a vector using a user-defined comparison function? Seems it must be, 
but sort doesn't seem to provide that option, nor does order sfaics
-- 
View this message in context: 
http://www.nabble.com/custom-sort--tp23770565p23770565.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] why warning appears when set both 'scale' and 'breaks' meanwhile in heatmap.2 of gplots

2009-05-28 Thread Zheng, Xin (NIH) [C]
The warning I met with is attached here:

Warning message:
In heatmap.2(as.matrix(val.sf.ns[-1:-3]), Rowv = F, Colv = T, dendrogram = 
column,  :
  Using scale=row or scale=column when breaks arespecified can produce 
unpredictable results.Please consider using only one or the other.


What does 'unpredictable results' mean? Could anyone explain that? Thanks a lot.

Xin Zheng


[[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] avoid a loop

2009-05-28 Thread KARAVASILIS GEORGE

Hello, R users.
I have the following code:

a=1:10
b=-3:15
n=5
x - rep(0,n)
for (i in 1:n) x[i] - sum( outer(a,b, function(s,t)  abs(a-b-i)==0) )

Can someone tell me if I could avoid the for command?

Thank you in advance.

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


  1   2   >