Re: [R] Plot problems: xlim

2005-12-23 Thread Ronnie Babigumira
Many thanks Jacques Veslot and Ben Bolker, Im closer to my goal thanks to 
Jacques's code and Ben I will follow the leads.

Happy Holidays

Ronnie

Ronnie
Ben Bolker wrote:
 Ronnie Babigumira rb.glists at gmail.com writes:
 
It sounds like you might want to break your axis.
 plotrix provides a function to draw the axis break,
 but you have to mess around with the data scaling
 and axis labels yourself.  See  RSiteSearch(axis 
 break); most of these discussions
 are about breaking y axes but the same techniques
 apply to the x axis.
 
   good luck,
 Ben Bolker
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


[R] for loop error

2005-12-23 Thread Ita . Cirovic-Donev




I have the following code and I am not sure what's wrong or how to make it
work.

B - matrix(1,nrow=50,ncol=2)
for (i in 1:length(size.out)){  # length(size.out=2) these
are the two variables
X - var.range[i,1] #  min
Y - var.range[i,1] # min
ratio - size.out[,i]
for (j in 1:groups) # no.groups=50
A - 0
X - Y   # min
Y - X + span.group.size[i,1] # min + (max-min)/50
for (k in 1:length(ratio))  # there are
11065 observations per variable
if ((X = ratio[k])  (ratio[k] = Y))
A - A+1
B[j,i] - A
print(B)
 }

basically, what I want to do is obtain a range for the variables in
size.out data frame. I do this by computing min and max and getting a span.
Then I have

var.range is defined by row=variables from size.out and col=[min max]
span.group.size is defined as row=variables from size.out and col=[span]

Now I want to count how many values fall into defined range with if ((X =
ratio[k])  (ratio[k] = Y)). This count I need to store which I then later
on plot.

Thanks.

Ita Cirovic-Donev

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


[R] for loop error

2005-12-23 Thread Ita . Cirovic-Donev





I have the following code and I am not sure what's wrong or how to make it
work.

B - matrix(1,nrow=50,ncol=2)
for (i in 1:length(size.out)){  # length(size.out=2) these
are the two variables
X - var.range[i,1] #  min
Y - var.range[i,1] # min
ratio - size.out[,i]
for (j in 1:groups) # no.groups=50
A - 0
X - Y   # min
Y - X + span.group.size[i,1] # min + (max-min)/50
for (k in 1:length(ratio))  # there are
11065 observations per variable
if ((X = ratio[k])  (ratio[k] = Y))
A - A+1
B[j,i] - A
print(B)
 }

basically, what I want to do is obtain a range for the variables in
size.out data frame. I do this by computing min and max and getting a span.
Then I have

var.range is defined by row=variables from size.out and col=[min max]
span.group.size is defined as row=variables from size.out and col=[span]

Now I want to count how many values fall into defined range with if ((X =
ratio[k])  (ratio[k] = Y)). This count I need to store which I then later
on plot.

Thanks.

Ita Cirovic-Donev

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


Re: [R] Plot problems: xlim

2005-12-23 Thread Jim Lemon
Ronnie Babigumira wrote:
 Hi,
 Still fresh in R, tried to figure this out, now on my second day running with 
 no luck (and a pile of hair on my desk) so 
 I have thrown in the towel and would like to ask for some help.
 
 Here is what I am trying to do. I am trying to plot a distribution, I have 99 
 points, bound in the range
 
 xlim.min: -0.0173
 xlim.max: 0.02103
 
 However, I have a value outside this range (0.2454959) which I would like to 
 add to the plot as a line and to do this I 
 use abline(v=0.2454959)
 
 This is what I write
 
  xlim = c(-0.02, 0.3)
  denz - density(morp)
  plot.density(denz, xlim = xlim, ylim = c(0,70))
  hist(morp, freq=F, add= T)
  abline(v=0.2454959)
 
 Without any options, plot.density spreads out nicely, however, naturally, the 
 line I want to add is not plotted since it 
 is well outside the range automatically determined by plot.density hence the 
 need to add xlim however this produces 
 something I dont find aesthetically appealing. The plot is squeezed out into 
 a very lean bell shape.
 
 So (finally) my question, how can i widen the spread of my plot and yet also 
 be able to add my xline.
 
Hi Ronnie,

For only one line, it is probably easiest to stick in an axis break and 
label the line on the x axis. Notice that the position of the line is 
arbitrarily set to be far enough beyond the end of the density curve to 
allow room for the axis break.

testdata-rnorm(50,sd=0.01)
denz-density(testdata)
plot(denz,xlim=c(-0.02,0.04),axes=FALSE)
box()
axis(1,at=c(-0.02,0,0.02,0.039),labels=c(-0.02,0,0.02,0.2454959))
abline(v=0.039)
axis.break(1,breakpos=0.037)

This is probably a common enough problem for inclusion in the axis.break 
example.

Jim

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


Re: [R] for loop error

2005-12-23 Thread Petr Pikal
Hi

As we do not have your data and you did not specify what is wrong and 
your code is a bit messy I can not reproduce what you did and failed 
to do.
In each email there is statement

 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

You probably should look at

range? and apply?

 apply(barva[,4:21], 2, function(x) sum((x5) (x0), na.rm=T))

  tuny  fe2o3   vlhk  vodos  vodiv phzbazbb   olej dispRD 
pod1mi   tio2  l  a  b ce  h  DEcmc 
 1  0548548  0 75548  0  0  0 
11 63  0  0  0  0  0548

gives me number of values in data frame barva in 0,5 interval, if 
this is what you want.

HTH
Petr

On 23 Dec 2005 at 11:45, [EMAIL PROTECTED] wrote:

To: r-help@stat.math.ethz.ch
From:   [EMAIL PROTECTED]
Date sent:  Fri, 23 Dec 2005 11:45:02 +0100
Subject:[R] for loop error

 
 
 
 
 
 I have the following code and I am not sure what's wrong or how to
 make it work.
 
 B - matrix(1,nrow=50,ncol=2)
 for (i in 1:length(size.out)){  # length(size.out=2)
 these are the two variables
 X - var.range[i,1] #  min
 Y - var.range[i,1] # min
 ratio - size.out[,i]
 for (j in 1:groups) # no.groups=50
 A - 0
 X - Y   # min
 Y - X + span.group.size[i,1] # min +
 (max-min)/50
 for (k in 1:length(ratio))  # there
 are
 11065 observations per variable
 if ((X = ratio[k])  (ratio[k] = Y))
 A - A+1
 B[j,i] - A
 print(B)
  }
 
 basically, what I want to do is obtain a range for the variables in
 size.out data frame. I do this by computing min and max and getting a
 span. Then I have
 
 var.range is defined by row=variables from size.out and col=[min max]
 span.group.size is defined as row=variables from size.out and
 col=[span]
 
 Now I want to count how many values fall into defined range with if
 ((X = ratio[k])  (ratio[k] = Y)). This count I need to store which
 I then later on plot.
 
 Thanks.
 
 Ita Cirovic-Donev
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] for loop error

2005-12-23 Thread ecoinfo
I guess you missed {} after for ():

   for (j in 1:groups) # no.groups=50
## ?? for (j in 1:groups) {

   for (k in 1:length(ratio))
## ?? for () {


On 12/23/05, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:




 I have the following code and I am not sure what's wrong or how to make it
 work.

 B - matrix(1,nrow=50,ncol=2)
 for (i in 1:length(size.out)){  # length(size.out=2) these
 are the two variables
X - var.range[i,1] #  min
Y - var.range[i,1] # min
ratio - size.out[,i]
for (j in 1:groups) # no.groups=50
A - 0
X - Y   # min
Y - X + span.group.size[i,1] # min + (max-min)/50
for (k in 1:length(ratio))  # there are
 11065 observations per variable
if ((X = ratio[k])  (ratio[k] = Y))
A - A+1
B[j,i] - A
print(B)
 }

 basically, what I want to do is obtain a range for the variables in
 size.out data frame. I do this by computing min and max and getting a span.
 Then I have

 var.range is defined by row=variables from size.out and col=[min max]
 span.group.size is defined as row=variables from size.out and col=[span]

 Now I want to count how many values fall into defined range with if ((X =
 ratio[k])  (ratio[k] = Y)). This count I need to store which I then later
 on plot.

 Thanks.
 
 Ita Cirovic-Donev

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




--
Xiaohua Dai, Dr.

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


Re: [R] Plot problems: xlim

2005-12-23 Thread Haynes, Maurice \(NIH/NICHD\) [E]
Hi,

I believe Jim Lemon's solution requires his plotrix package.

Maurice Haynes
National Institutes of Health
Child and Family Research Section


-Original Message-
From: Jim Lemon [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 23, 2005 10:12 PM
To: Ronnie Babigumira
Cc: R Help
Subject: Re: [R] Plot problems: xlim

Ronnie Babigumira wrote:
 Hi,
 Still fresh in R, tried to figure this out, now on my second day
running with no luck (and a pile of hair on my desk) so 
 I have thrown in the towel and would like to ask for some help.
 
 Here is what I am trying to do. I am trying to plot a distribution, I
have 99 points, bound in the range
 
 xlim.min: -0.0173
 xlim.max: 0.02103
 
 However, I have a value outside this range (0.2454959) which I would
like to add to the plot as a line and to do this I 
 use abline(v=0.2454959)
 
 This is what I write
 
  xlim = c(-0.02, 0.3)
  denz - density(morp)
  plot.density(denz, xlim = xlim, ylim = c(0,70))
  hist(morp, freq=F, add= T)
  abline(v=0.2454959)
 
 Without any options, plot.density spreads out nicely, however,
naturally, the line I want to add is not plotted since it 
 is well outside the range automatically determined by plot.density
hence the need to add xlim however this produces 
 something I dont find aesthetically appealing. The plot is squeezed
out into a very lean bell shape.
 
 So (finally) my question, how can i widen the spread of my plot and
yet also be able to add my xline.
 
Hi Ronnie,

For only one line, it is probably easiest to stick in an axis break and 
label the line on the x axis. Notice that the position of the line is 
arbitrarily set to be far enough beyond the end of the density curve to 
allow room for the axis break.

testdata-rnorm(50,sd=0.01)
denz-density(testdata)
plot(denz,xlim=c(-0.02,0.04),axes=FALSE)
box()
axis(1,at=c(-0.02,0,0.02,0.039),labels=c(-0.02,0,0.02,0.2454959))
abline(v=0.039)
axis.break(1,breakpos=0.037)

This is probably a common enough problem for inclusion in the axis.break

example.

Jim

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

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


Re: [R] Plot problems: xlim

2005-12-23 Thread hadley wickham
 Without any options, plot.density spreads out nicely, however, naturally, the 
 line I want to add is not plotted since it
 is well outside the range automatically determined by plot.density hence the 
 need to add xlim however this produces
 something I dont find aesthetically appealing. The plot is squeezed out into 
 a very lean bell shape.


Using a broken axis is not a good solution to this problem (and there
are very few times that using a broken axis is a good idea)

It sounds like you are trying to compare a reference value to a
distribution.  To do this visually they both need to be on the same
scale, so that you can see the distance between the reference value
and the distribution.

Although it may not be aesthetically pleasing, it is true to the data.

Hadley

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


Re: [R] Plot problems: xlim

2005-12-23 Thread Ronnie Babigumira
Maurice, Indeed it does (tried to run it and got an error..however a quick 
search led me to it).

Jim, many thanks for your code...I am now trying out all the ideas and will get 
back with what works best for me

Ronnie
Haynes, Maurice (NIH/NICHD) [E] wrote:
 Hi,
 
 I believe Jim Lemon's solution requires his plotrix package.
 
 Maurice Haynes
 National Institutes of Health
 Child and Family Research Section
 
 
 -Original Message-
 From: Jim Lemon [mailto:[EMAIL PROTECTED] 
 Sent: Friday, December 23, 2005 10:12 PM
 To: Ronnie Babigumira
 Cc: R Help
 Subject: Re: [R] Plot problems: xlim
 
 Ronnie Babigumira wrote:
 Hi,
 Still fresh in R, tried to figure this out, now on my second day
 running with no luck (and a pile of hair on my desk) so 
 I have thrown in the towel and would like to ask for some help.

 Here is what I am trying to do. I am trying to plot a distribution, I
 have 99 points, bound in the range
 xlim.min: -0.0173
 xlim.max: 0.02103

 However, I have a value outside this range (0.2454959) which I would
 like to add to the plot as a line and to do this I 
 use abline(v=0.2454959)

 This is what I write

  xlim = c(-0.02, 0.3)
  denz - density(morp)
  plot.density(denz, xlim = xlim, ylim = c(0,70))
  hist(morp, freq=F, add= T)
  abline(v=0.2454959)

 Without any options, plot.density spreads out nicely, however,
 naturally, the line I want to add is not plotted since it 
 is well outside the range automatically determined by plot.density
 hence the need to add xlim however this produces 
 something I dont find aesthetically appealing. The plot is squeezed
 out into a very lean bell shape.
 So (finally) my question, how can i widen the spread of my plot and
 yet also be able to add my xline.
 Hi Ronnie,
 
 For only one line, it is probably easiest to stick in an axis break and 
 label the line on the x axis. Notice that the position of the line is 
 arbitrarily set to be far enough beyond the end of the density curve to 
 allow room for the axis break.
 
 testdata-rnorm(50,sd=0.01)
 denz-density(testdata)
 plot(denz,xlim=c(-0.02,0.04),axes=FALSE)
 box()
 axis(1,at=c(-0.02,0,0.02,0.039),labels=c(-0.02,0,0.02,0.2454959))
 abline(v=0.039)
 axis.break(1,breakpos=0.037)
 
 This is probably a common enough problem for inclusion in the axis.break
 
 example.
 
 Jim
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


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


Re: [R] Plot problems: xlim

2005-12-23 Thread Ronnie Babigumira
Hadley
Your point is valid and well taken. However, the break still shows how far off 
the value is from the distribution (I 
intend to add a note to draw a readers attention to this). Anyhow, like I said, 
I will try the two ideas shared on the 
list and make a note of what works best for me.

Many thanks

Ronnie
hadley wickham wrote:
 Without any options, plot.density spreads out nicely, however, naturally, 
 the line I want to add is not plotted since it
 is well outside the range automatically determined by plot.density hence the 
 need to add xlim however this produces
 something I dont find aesthetically appealing. The plot is squeezed out into 
 a very lean bell shape.
 
 
 Using a broken axis is not a good solution to this problem (and there
 are very few times that using a broken axis is a good idea)
 
 It sounds like you are trying to compare a reference value to a
 distribution.  To do this visually they both need to be on the same
 scale, so that you can see the distance between the reference value
 and the distribution.
 
 Although it may not be aesthetically pleasing, it is true to the data.
 
 Hadley


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


[R] maps package will not load

2005-12-23 Thread K.J.Mcconway
I recently installed the maps package, version 2.0-30, into an installation of 
R 2.2.1 on a rather ancient Pentium 3 PC under Windows NT4. When I try to load 
the library I get an error dialog with title 'Rgui.exe - Unable To Locate DLL', 
which says The dynamic link library R could not be found in the specified path 
(and then it lists the path, which does include the place that the DLL actually 
is). On dismissing this, I get the following in the console:

Error in dyn.load(x, as.logical(local), as.logical(now)) : 
unable to load shared library 
'C:/PROGRA~1/R/R-22~1.1/library/maps/libs/maps.dll':
  LoadLibrary failure:  The specified module could not be found. Error in 
library(maps) : .First.lib failed for 'maps'

maps.dll is indeed in the place from which R tells me it can't load it. Other 
packages with a .First.lib continue to work correctly. I have repeated the 
installation of the maps package, from several different mirrors, and the same 
thing happens.

(To be more precise, I originally did this installation a few days ago into R 
2.2.0, and got the results described above, and now I've installed R 2.2.1 and 
exactly the same thing happens, apart from the path being different of course.)

Any ideas?

Regards,

Kevin

Kevin McConway
Senior Lecturer in Statistics
Department of Statistics
The Open University
Walton Hall
Milton Keynes MK7 6AA, UK

Phone: +44-1908-653676
Fax:  +44-1908-655515
email:   [EMAIL PROTECTED]

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


[R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread Helmut Kudrnovsky
hi R-users,

a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. along the 
time i've installed a lot of contributed packages. my internet-connection is 
not very fast.

 so my question:  is it possible after installing R 2.2.1 to do copy/paste the 
contributed packages from the C:\Programme\R221 to the  C:\Programme\R2.2.1- 
location in the files system?

or have i to download and install the packages new?


greetings from the snowy austria
merry christmas
helli

system
R.2.2.0
win xp

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


Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread Ronnie Babigumira
Hi Helli, this came up last week, Here are some of the replys posted

1.
In http://cran.r-project.org/contrib/extra/batchfiles/batchfiles_0.2-5.zip

are two Windows XP batch files:

movedir.bat
copydir.bat

which will move the packages (which is much faster and suitable if you don't 
need the old version of R any more) or copy 
the packages (which takes longer but preserves the old version).

2.
x - installed.packages()[,1]
install.packages(x)


3.
This is one reason we normally recommend that you install into a separate 
library.  Then update.packages(checkBuilt = 
TRUE) is all that is needed. However,

foo - installed.packages()
as.vector(foo[is.na(foo[, Priority]), 1])

will give you a character vector which you can feed to install.packages(), so 
it's not complex to do manually.

4.
If the previous installation is still alive, fire it up and

pS - packageStatus()
pkgs - pS$inst$Package[!pS$inst$Priority %in% c(base, recommended)]
save(pkgs, file = foo)

In the new installation,

load(foo)
install.packages(pkgs)


Helmut Kudrnovsky wrote:
 hi R-users,
 
 a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. along the 
 time i've installed a lot of contributed packages. my internet-connection is 
 not very fast.
 
  so my question:  is it possible after installing R 2.2.1 to do copy/paste 
 the contributed packages from the C:\Programme\R221 to the  
 C:\Programme\R2.2.1- location in the files system?
 
 or have i to download and install the packages new?
 
 
 greetings from the snowy austria
 merry christmas
 helli
 
 system
 R.2.2.0
 win xp
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] convolution of the double exponential distribution

2005-12-23 Thread Matthias Kohl
Duncan Murdoch schrieb:

On 12/22/2005 7:56 PM, Bickel, David wrote:
  

Is there any R function that computes the convolution of the double
exponential distribution?

If not, is there a good way to integrate ((q+x)^n)*exp(-2x) over x from
0 to Inf for any value of q and for any positive integer n? I need to
perform the integration within a function with q and n as arguments. The
function integrate() is giving me this message:

evaluation of function gave a result of wrong length



Under the substitution of y = q+x, that looks like a gamma integral. 
The x = 0 to Inf range translates into y = q to Inf, so you'll need an 
incomplete gamma function, such as pgamma.  Be careful to get the 
constant multiplier right.

Duncan Murdoch

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


Hi,

you can use our package distr.

require(distr)
## define double exponential distribution
loc - 0 # location parameter
sca - 1 # scale parameter

rfun - function(n){ loc + scale * ifelse(runif(n)  0.5, 1, -1) * rexp(n) }
body(rfun) - substitute({ loc + scale * ifelse(runif(n)  0.5, 1, -1) * 
rexp(n) },
 list(loc = loc, scale = sca))

dfun - function(x){ exp(-abs(x-loc)/scale)/(2*scale) }
body(dfun) - substitute({ exp(-abs(x-loc)/scale)/(2*scale) }, list(loc 
= loc, scale = sca))

pfun - function(x){ 0.5*(1 + sign(x-loc)*(1-exp(-abs(x-loc)/scale))) }
body(pfun) - substitute({ 0.5*(1 + 
sign(x-loc)*(1-exp(-abs(x-loc)/scale))) },
 list(loc = loc, scale = sca))

qfun - function(x){ loc - scale*sign(x-0.5)*log(1 - 2*abs(x-0.5)) }
body(qfun) - substitute({ loc - scale*sign(x-0.5)*log(1 - 2*abs(x-0.5)) },
 list(loc = loc, scale = sca))

D1 - new(AbscontDistribution, r = rfun, d = dfun, p = pfun, q = qfun)
plot(D1)

D2 - D1 + D1 # convolution based on FFT
plot(D2)

hth,
Matthias

-- 
StaMatS - Statistik + Mathematik Service
Dipl.Math.(Univ.) Matthias Kohl
www.stamats.de

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


[R] Constant error messages with new R version

2005-12-23 Thread sp219
Hi I would be grateful if anyone could shed any light...
I usually import files into R with the read.csv command. This worked fine 
until I downloaded the latest version of R. Now, presumably it wont recognise 
the file as a data frame since I always get the error message:- 
The following object(s) are masked from package:base :
Any suggestions much appreciated,
Simon.




Simon Pickett
Centre for Ecology and Conservation Biology
University of Exeter in Cornwall
Tremough Campus
Penryn 
Cornwall
TR10 9EZ UK
Tel: 01326371852

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


Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread Uwe Ligges
Helmut Kudrnovsky wrote:

 hi R-users,
 
 a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. along the 
 time i've installed a lot of contributed packages. my internet-connection is 
 not very fast.
 
  so my question:  is it possible after installing R 2.2.1 to do copy/paste 
 the contributed packages from the C:\Programme\R221 to the  
 C:\Programme\R2.2.1- location in the files system?

It is safe to copy.

Uwe Ligges


 
 or have i to download and install the packages new?
 
 
 greetings from the snowy austria
 merry christmas
 helli
 
 system
 R.2.2.0
 win xp
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] Constant error messages with new R version

2005-12-23 Thread Uwe Ligges
sp219 wrote:

 Hi I would be grateful if anyone could shed any light...
 I usually import files into R with the read.csv command. This worked fine 
 until I downloaded the latest version of R. Now, presumably it wont recognise 
 the file as a data frame since I always get the error message:- 
 The following object(s) are masked from package:base :
 Any suggestions much appreciated,
 Simon.

1. This is a warning, no error.
2. Should be unrelated with the version of R (unless you last version 
was really ancient).

You have masked objects from base (i.e. you have objects in the search 
path prior to base that have the same names as some objects in base).

Uwe Ligges


 
 
 
 Simon Pickett
 Centre for Ecology and Conservation Biology
 University of Exeter in Cornwall
 Tremough Campus
 Penryn 
 Cornwall
 TR10 9EZ UK
 Tel: 01326371852
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] Plot problems: xlim

2005-12-23 Thread P Ehlers
While I appreciate the availability of axis.break, I agree with Hadley
in this case. I would provide two plots, with and without the special
point. Or just the density plot and some numbers. Broken axes require
interpretation which is often easier to do using numbers, e.g. the
mean or range (exclusive of x.special) and x.special. Sometimes
simple numbers really do provide a better 'picture'.

Peter Ehlers

Ronnie Babigumira wrote:
 Hadley
 Your point is valid and well taken. However, the break still shows how far 
 off the value is from the distribution (I 
 intend to add a note to draw a readers attention to this). Anyhow, like I 
 said, I will try the two ideas shared on the 
 list and make a note of what works best for me.
 
 Many thanks
 
 Ronnie
 hadley wickham wrote:
 
Without any options, plot.density spreads out nicely, however, naturally, 
the line I want to add is not plotted since it
is well outside the range automatically determined by plot.density hence the 
need to add xlim however this produces
something I dont find aesthetically appealing. The plot is squeezed out into 
a very lean bell shape.


Using a broken axis is not a good solution to this problem (and there
are very few times that using a broken axis is a good idea)

It sounds like you are trying to compare a reference value to a
distribution.  To do this visually they both need to be on the same
scale, so that you can see the distance between the reference value
and the distribution.

Although it may not be aesthetically pleasing, it is true to the data.

Hadley

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

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


Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread P Ehlers
This might not be the preferred way, but can one not also
do this by appropriately assigning .libPaths?

Peter Ehlers

Uwe Ligges wrote:

 Helmut Kudrnovsky wrote:
 
 
hi R-users,

a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. along the 
time i've installed a lot of contributed packages. my internet-connection is 
not very fast.

 so my question:  is it possible after installing R 2.2.1 to do copy/paste 
 the contributed packages from the C:\Programme\R221 to the  
 C:\Programme\R2.2.1- location in the files system?
 
 
 It is safe to copy.
 
 Uwe Ligges
 
 
 
or have i to download and install the packages new?


greetings from the snowy austria
merry christmas
helli

system
R.2.2.0
win xp

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

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


Re: [R] convolution of the double exponential distribution

2005-12-23 Thread Ravi Varadhan
Hi,

It is quite easy to integrate ((q+x)^n)*exp(-2x) over x from 0 to Inf, if
you are familiar with the following basic Laplace transform results:
(a) L_s[x^n] = \Gamma(n+1)/s^(n+1)
(b) L_s[f(x+q)] = exp(-qs) F(s)

Using (a) and (b) and substituting s=2, you get your desired integral, I:
I = exp(-2q) \Gamma(n+1) / 2^(n+1).

Hope this helps,
Ravi.

--
Ravi Varadhan, Ph.D.
Assistant Professor,  The Center on Aging and Health
Division of Geriatric Medicine and Gerontology
Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email:  [EMAIL PROTECTED]
--
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:r-help-
 [EMAIL PROTECTED] On Behalf Of Matthias Kohl
 Sent: Friday, December 23, 2005 10:09 AM
 To: Bickel, David
 Cc: r-help@stat.math.ethz.ch; Duncan Murdoch
 Subject: Re: [R] convolution of the double exponential distribution
 
 Duncan Murdoch schrieb:
 
 On 12/22/2005 7:56 PM, Bickel, David wrote:
 
 
 Is there any R function that computes the convolution of the double
 exponential distribution?
 
 If not, is there a good way to integrate ((q+x)^n)*exp(-2x) over x from
 0 to Inf for any value of q and for any positive integer n? I need to
 perform the integration within a function with q and n as arguments. The
 function integrate() is giving me this message:
 
 evaluation of function gave a result of wrong length
 
 
 
 Under the substitution of y = q+x, that looks like a gamma integral.
 The x = 0 to Inf range translates into y = q to Inf, so you'll need an
 incomplete gamma function, such as pgamma.  Be careful to get the
 constant multiplier right.
 
 Duncan Murdoch
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-
 guide.html
 
 
 
 Hi,
 
 you can use our package distr.
 
 require(distr)
 ## define double exponential distribution
 loc - 0 # location parameter
 sca - 1 # scale parameter
 
 rfun - function(n){ loc + scale * ifelse(runif(n)  0.5, 1, -1) * rexp(n)
 }
 body(rfun) - substitute({ loc + scale * ifelse(runif(n)  0.5, 1, -1) *
 rexp(n) },
  list(loc = loc, scale = sca))
 
 dfun - function(x){ exp(-abs(x-loc)/scale)/(2*scale) }
 body(dfun) - substitute({ exp(-abs(x-loc)/scale)/(2*scale) }, list(loc
 = loc, scale = sca))
 
 pfun - function(x){ 0.5*(1 + sign(x-loc)*(1-exp(-abs(x-loc)/scale))) }
 body(pfun) - substitute({ 0.5*(1 +
 sign(x-loc)*(1-exp(-abs(x-loc)/scale))) },
  list(loc = loc, scale = sca))
 
 qfun - function(x){ loc - scale*sign(x-0.5)*log(1 - 2*abs(x-0.5)) }
 body(qfun) - substitute({ loc - scale*sign(x-0.5)*log(1 - 2*abs(x-0.5))
 },
  list(loc = loc, scale = sca))
 
 D1 - new(AbscontDistribution, r = rfun, d = dfun, p = pfun, q = qfun)
 plot(D1)
 
 D2 - D1 + D1 # convolution based on FFT
 plot(D2)
 
 hth,
 Matthias
 
 --
 StaMatS - Statistik + Mathematik Service
 Dipl.Math.(Univ.) Matthias Kohl
 www.stamats.de
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-
 guide.html

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


Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread Gabor Grothendieck
Its possible and I have done this but found it difficult
to keep straight what is where and ultimately found
it simpler to have all the packages in the distribution's
tree.  As a result I went back to that simple setup.
The other problem with sharing them among distros
is the worry that updating them in a later version might break
them in an earlier version thus from a practical
viewpoint if you do that you may or may not be
able to continue to use the earlier version.  If you
are not going to use the earlier version anyways I
think its simplest just to use movedir.bat which is
very fast and keeps the setup simple or copydir.bat
which also does not require downloading the packages
again but takes substantially longer since the packages
must be physically copied from one place to another
on your disk.  If you are willing to reinstall them then
the suggestions of how to do that could be followed.

On 12/23/05, P Ehlers [EMAIL PROTECTED] wrote:
 This might not be the preferred way, but can one not also
 do this by appropriately assigning .libPaths?

 Peter Ehlers

 Uwe Ligges wrote:

  Helmut Kudrnovsky wrote:
 
 
 hi R-users,
 
 a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. along 
 the time i've installed a lot of contributed packages. my 
 internet-connection is not very fast.
 
  so my question:  is it possible after installing R 2.2.1 to do copy/paste 
  the contributed packages from the C:\Programme\R221 to the  
  C:\Programme\R2.2.1- location in the files system?
 
 
  It is safe to copy.
 
  Uwe Ligges
 
 
 
 or have i to download and install the packages new?
 
 
 greetings from the snowy austria
 merry christmas
 helli
 
 system
 R.2.2.0
 win xp
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html

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


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


Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread Uwe Ligges
P Ehlers wrote:

 This might not be the preferred way, but can one not also
 do this by appropriately assigning .libPaths?

But then better use a clean library of contributed packages and not 
another R version's standard library.

Uwe Ligges



 Peter Ehlers
 
 Uwe Ligges wrote:
 
 Helmut Kudrnovsky wrote:


 hi R-users,

 a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. 
 along the time i've installed a lot of contributed packages. my 
 internet-connection is not very fast.

 so my question:  is it possible after installing R 2.2.1 to do 
 copy/paste the contributed packages from the C:\Programme\R221 to 
 the  C:\Programme\R2.2.1- location in the files system?



 It is safe to copy.

 Uwe Ligges



 or have i to download and install the packages new?


 greetings from the snowy austria
 merry christmas
 helli

 system
 R.2.2.0
 win xp

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



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

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


Re: [R] maps package will not load

2005-12-23 Thread Prof Brian Ripley
The problem is a bug in your OS.  (Given that Microsoft no longer supports 
it, the bug is not going to get fixed.  Do you really want to be running 
an unsupported OS that was superseded in 1999?)

You will need to compile package maps from the sources, after altering 
maps/src/Makefile.win as follows

DLLLIBS = -L$(RHOME)/bin -L$(RHOME)/src/gnuwin32 -lR
   ^^  delete this

On Fri, 23 Dec 2005, K.J.Mcconway wrote:

 I recently installed the maps package, version 2.0-30, into an installation 
 of R 2.2.1 on a rather ancient Pentium 3 PC under Windows NT4. When I try to 
 load the library I get an error dialog with title 'Rgui.exe - Unable To 
 Locate DLL', which says The dynamic link library R could not be found in the 
 specified path (and then it lists the path, which does include the place that 
 the DLL actually is). On dismissing this, I get the following in the console:

 Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library 
 'C:/PROGRA~1/R/R-22~1.1/library/maps/libs/maps.dll':
  LoadLibrary failure:  The specified module could not be found. Error in 
 library(maps) : .First.lib failed for 'maps'

 maps.dll is indeed in the place from which R tells me it can't load it. Other 
 packages with a .First.lib continue to work correctly. I have repeated the 
 installation of the maps package, from several different mirrors, and the 
 same thing happens.

 (To be more precise, I originally did this installation a few days ago into R 
 2.2.0, and got the results described above, and now I've installed R 2.2.1 
 and exactly the same thing happens, apart from the path being different of 
 course.)

 Any ideas?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] Reading in large file in pieces

2005-12-23 Thread Sean Davis



On 12/23/05 2:41 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote:

 On Thu, 22 Dec 2005, Sean Davis wrote:
 
 I have a large file (millions of lines) and would like to read it in pieces.
 The file is logically separated into little modules, but these modules do
 not have a common size, so I have to scan the file to know where they are.
 They are independent, so I don't have to read one at the end to interpret
 one at the beginning.  Is there a way to read one line at a time and parse
 it on the fly and do so quickly, or do I need to read say 100k lines at a
 time and then work with those?  Only a small piece of each module will
 remain in memory after parsing is completed on each module.
 
 My direct question is:  Is there a fast way to parse one line at a time
 looking for breaks between modules, or am I better off taking large but
 manageable chunks from the file and parsing that chunk all at once?
 
 On any reasonable OS (you have not told us yours), it will make no
 difference as the file reads will be buffered.  Assuming you are doing
 something like opening a connection and calling readLines(n=1), of course.

Thanks.  That is indeed the answer, and you are correct that it is quite
fast on MacOS 10.4.4.  Most importantly, it does successfully reduce memory
usage for my program by an order of magnitude (+/-).

Sean

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


Re: [R] convolution of the double exponential distribution

2005-12-23 Thread Erich Neuwirth
Mathematica says

Assuming[q ∈ Reals  q  0, Integrate[(q + x)^n*Exp[-2*x], {x, 0,
Infinity}]]

2^(-1 - n)*Exp[2*q]*Gamma[1 + n, 2*q]

and 2-argument Gamma is the incomplete Gamma function
(integration starting at 2*q)


Duncan Murdoch wrote:
 On 12/22/2005 7:56 PM, Bickel, David wrote:
 
Is there any R function that computes the convolution of the double
exponential distribution?

If not, is there a good way to integrate ((q+x)^n)*exp(-2x) over x from
0 to Inf for any value of q and for any positive integer n? I need to
perform the integration within a function with q and n as arguments. The
function integrate() is giving me this message:

evaluation of function gave a result of wrong length
 
 
 Under the substitution of y = q+x, that looks like a gamma integral. 
 The x = 0 to Inf range translates into y = q to Inf, so you'll need an 
 incomplete gamma function, such as pgamma.  Be careful to get the 
 constant multiplier right.
 
 Duncan Murdoch
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 


-- 
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-38624 Fax: +43-1-4277-9386

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

Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread P Ehlers
Good point. I actually keep packages that aren't installed with
R in a separate directory. I set .libPaths via R_LIBS.

Peter Ehlers

Uwe Ligges wrote:
 P Ehlers wrote:
 
 
This might not be the preferred way, but can one not also
do this by appropriately assigning .libPaths?
 
 
 But then better use a clean library of contributed packages and not 
 another R version's standard library.
 
 Uwe Ligges
 
 
 
 
Peter Ehlers

Uwe Ligges wrote:


Helmut Kudrnovsky wrote:



hi R-users,

a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. 
along the time i've installed a lot of contributed packages. my 
internet-connection is not very fast.

so my question:  is it possible after installing R 2.2.1 to do 
copy/paste the contributed packages from the C:\Programme\R221 to 
the  C:\Programme\R2.2.1- location in the files system?



It is safe to copy.

Uwe Ligges




or have i to download and install the packages new?


greetings from the snowy austria
merry christmas
helli

system
R.2.2.0
win xp

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



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

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


[R] dse package problems

2005-12-23 Thread Fernando Saldanha
I am having problems with the package dse. I just installed R 2.2.1
and reinstalled all packages. I am running Windows XP Pro with all
updates.

Below there are two examples of error messages generated when trying
to execute some simple programs. The code was taken directly from the
package documentation.

Any help on this will be greatly appreciated.

Merry Christmas

Fernando


# First Example

 library(tframe)
Loading required package: setRNG
 library(dse1)

Attaching package: 'dse1'


The following object(s) are masked from package:stats :

 acf simulate

 library(dse2)

 fileName - system.file(otherdata, eg1.dat, package=dse1)
 eg1.DSE.data - t(matrix(scan(fileName),5, 364))[, 2:5]
Read 1820 items

 eg1.DSE.data - TSdata(input= eg1.DSE.data[,1,drop = F], output=
+ eg1.DSE.data[, 2:4, drop = F])

 eg1.DSE.data # this is the troublemaking command
input data:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?



# Second Example

rary(tframe)
Loading required package: setRNG
 library(dse1)

Attaching package: 'dse1'


The following object(s) are masked from package:stats :

 acf simulate

 library(dse2)

 AR - array(c(1, 0.5, 0.3, 0, 0.2, 0.1, 0, 0.2, 0.05, 1, 0.5, 0.3), c(3, 2,
+ 2))
 MA - array(c(1, 0.2, 0, 0.1, 0, 0, 1, 0.3), c(2, 2, 2))
 arma - ARMA(A = AR, B = MA, C = NULL)
 data.arma.sim - simulate(arma)

 data.arma.sim
output data:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?






#

##
# Second Example

library(tframe)
library(dse1)
library(dse2)

AR - array(c(1, 0.5, 0.3, 0, 0.2, 0.1, 0, 0.2, 0.05, 1, 0.5, 0.3), c(3, 2,
2))
MA - array(c(1, 0.2, 0, 0.1, 0, 0, 1, 0.3), c(2, 2, 2))
arma - ARMA(A = AR, B = MA, C = NULL)
data.arma.sim - simulate(arma)

data.arma.sim # R crashes here

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


[R] setting up a matrix structure

2005-12-23 Thread Erin Hodgess
Dear R People:

I have an n x (nm) matrix.

In the first row, there will be n ones, followed by n(m-1) zeros.
In the second row, there will be n zeros, n ones, and the rest zeros.
In the third row, 2n zeros, n 1 and the rest zeros.
.
.
.
In the nth row, n(m-1) zeros and n ones.

My question:  how can I do this elegantly and efficiently, please?

A loop will work just fine, but there must be a better way, please.

Thanks for any help!

R Version 2.2.0, Windows.

Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

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


Re: [R] setting up a matrix structure

2005-12-23 Thread Gabor Grothendieck
Try this:

n - 3; m - 2 # test values
kronecker(diag(n), matrix(1, 1, m))

On 12/23/05, Erin Hodgess [EMAIL PROTECTED] wrote:
 Dear R People:

 I have an n x (nm) matrix.

 In the first row, there will be n ones, followed by n(m-1) zeros.
 In the second row, there will be n zeros, n ones, and the rest zeros.
 In the third row, 2n zeros, n 1 and the rest zeros.
 .
 .
 .
 In the nth row, n(m-1) zeros and n ones.

 My question:  how can I do this elegantly and efficiently, please?

 A loop will work just fine, but there must be a better way, please.

 Thanks for any help!

 R Version 2.2.0, Windows.

 Sincerely,
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: [EMAIL PROTECTED]

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


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


Re: [R] dse package problems

2005-12-23 Thread Prof Brian Ripley
These are actually all the same thing, infinite recursion in a print() 
method.  (Even the third reports that for my system.)  It appears to be 
the print.tframed method inside print.TSdata which fails to change the 
class (and this looks like a candidate for NextMethod).

You need to take it up with the package maintainer.


On Fri, 23 Dec 2005, Fernando Saldanha wrote:

 I am having problems with the package dse. I just installed R 2.2.1
 and reinstalled all packages. I am running Windows XP Pro with all
 updates.

I suspect you updated the dse _bundle_ in doing so.

 Below there are two examples of error messages generated when trying
 to execute some simple programs. The code was taken directly from the
 package documentation.

 Any help on this will be greatly appreciated.

 Merry Christmas

 Fernando

 
 # First Example

 library(tframe)
 Loading required package: setRNG
 library(dse1)

 Attaching package: 'dse1'


The following object(s) are masked from package:stats :

 acf simulate

 library(dse2)

 fileName - system.file(otherdata, eg1.dat, package=dse1)
 eg1.DSE.data - t(matrix(scan(fileName),5, 364))[, 2:5]
 Read 1820 items

 eg1.DSE.data - TSdata(input= eg1.DSE.data[,1,drop = F], output=
 + eg1.DSE.data[, 2:4, drop = F])

 eg1.DSE.data # this is the troublemaking command
 input data:
 Error: evaluation nested too deeply: infinite recursion / 
 options(expressions=)?


 
 # Second Example

 rary(tframe)
 Loading required package: setRNG
 library(dse1)

 Attaching package: 'dse1'


The following object(s) are masked from package:stats :

 acf simulate

 library(dse2)

 AR - array(c(1, 0.5, 0.3, 0, 0.2, 0.1, 0, 0.2, 0.05, 1, 0.5, 0.3), c(3, 2,
 + 2))
 MA - array(c(1, 0.2, 0, 0.1, 0, 0, 1, 0.3), c(2, 2, 2))
 arma - ARMA(A = AR, B = MA, C = NULL)
 data.arma.sim - simulate(arma)

 data.arma.sim
 output data:
 Error: evaluation nested too deeply: infinite recursion / 
 options(expressions=)?






 #

 ##
 # Second Example

 library(tframe)
 library(dse1)
 library(dse2)

 AR - array(c(1, 0.5, 0.3, 0, 0.2, 0.1, 0, 0.2, 0.05, 1, 0.5, 0.3), c(3, 2,
 2))
 MA - array(c(1, 0.2, 0, 0.1, 0, 0, 1, 0.3), c(2, 2, 2))
 arma - ARMA(A = AR, B = MA, C = NULL)
 data.arma.sim - simulate(arma)

 data.arma.sim # R crashes here

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [R] copy contributed packages from R 2.2.0 to 2.2.1

2005-12-23 Thread Michael Prager
When I asked this question, I got some good answers.  Based on them, I 
wrote a pair of functions to accomplish this.  I have tested them in 
exactly ONE installation, and they worked.

Of course these are not needed by R gurus, but I attach them (with many 
more comment lines than actual source) for the use of anyone else who 
would like to use them.

MHP

Helmut Kudrnovsky wrote on 12/23/2005 9:43 AM:

hi R-users,

a few days ago R 2.2.1 came out. on my win xp i'installed R 2.2.0. along the 
time i've installed a lot of contributed packages. my internet-connection is 
not very fast.

 so my question:  is it possible after installing R 2.2.1 to do copy/paste the 
 contributed packages from the C:\Programme\R221 to the  C:\Programme\R2.2.1- 
 location in the files system?

or have i to download and install the packages new?

  

##
#  Functions to (1) save names of installed package from an R 
installation to#
#  a file and (2) install the same packages on a new R 
installation. #
##
#  HOW TO MOVE PACKAGES FROM ONE R INSTALLATION TO 
ANOTHER:  #
#  Put this file in your R working directory.  Source it.  Run 
SaveMyPackages()  #
#  under the old installation.  Save your workspace and exit.  Open the 
new  #
#  installation on the same directory.  Run InstallMyPackages().  The 
packages   #
#  will be installed.  You may now rm(SaveMyPackages,InstallMyPackages) 
if you   #
#  like.  Also, you may delete the file pkg.list in the working 
directory. #
##
#  M. H. Prager  
[EMAIL PROTECTED]#
#  with much from posted code of U. Ligges, H. Nilsson,  B. Ripley   
   #
#  December, 
2005#
##

SaveMyPackages - function(filename = pkg.list, savepkg = TRUE)
   {  #  Saves a character vector with names of non-default
  #  packages installed. Writes it to a dput ASCII file.
  #  --- Run this from old installation. ---
  #  Arguments:
  # filename --Character, name of file to write.
  # savepkg -- Logical, if TRUE save the file; if not, return
  #the vector of package names instead.
  foo - installed.packages()
  foo - as.vector(foo[is.na(foo[, Priority]), 1])
  if (savepkg) dput(foo, file = filename) else return(foo)
   }

InstallMyPackages - function(x = dget(file = filename), filename = 
pkg.list,
  install = TRUE)
   {  #  Install or print list of packages .
  #  --- Run this from new installation. ---
  #  Arguments:
  # x-- character, contains names of packages to 
install; default is
  # vector read from argument filename.
  # filename--  character, name of file containing vector (in 
dput format);
  # default is pkg.list as in SaveMyPackages.
  # install--   logical, should actual installation be done?  If 
not,
  # the vector of package names in x is returned instead
  # of being installed.
  if (install) install.packages(x) else return(x)
   }
##

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


Re: [R] System Reliability Metrics

2005-12-23 Thread Jon Stearley

On Dec 21, 2005, at 11:02 AM, Jon Stearley wrote:

 I need to calculate some metrics such as Mean Time Between Failure  
 (MTBF), etc (see http://www.cs.sandia.gov/~jrstear/ras for a more  
 complete list).  I have observations like

  start endstate
  1 2005-11-11 09:05:00 2005-11-11 12:20:00   Scheduled Downtime
  2 2005-11-12 13:42:00 2005-11-12 14:45:00 Unscheduled Downtime

 where each row describes the system state between start and end  
 times.  Time between observations indicates a Production state.   
 The metrics of interest involve simple ratios of total time spent  
 in various states, number of transitions, etc.  I'd like to plot  
 period MTBF values (eg monthly vertical bars), as well as a  
 cumulative MTBF (eg a line whose last value indicates MTBF for the  
 entire time range), etc.

 What is the best approach in R towards these results?

I have found that the zoo package fills most of my needs.  Thanks.

-jon

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