[R] graph label greek symbol failure

2009-08-17 Thread e-letter
Readers,

Previous questions about this requirement have been for m$ users, my
failure occurs using linux.

I have tried to add the delta (δ) symbol to the y axis label and the
result is &D, using the command:

...ylab="δt"...

Any advice please?

rh...@conference.jabber.org
mandriva 2008
r 251 (27-06-07)

__
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] postscript, options

2009-08-18 Thread e-letter
Readers,

I am not able to create a postscript file with the following command:

postscript("/pathto/filename.eps,horizontal=FALSE,onefile="FALSE")

A file is not created, instead the command terminal shows the plus
sign(+) on a new line:

+

What does this mean please?

rh...@conference.jabber.org
mandriva 2008
r 251 (27-06-07)

__
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] graph label greek symbol failure

2009-08-18 Thread e-letter
On 17/08/2009, Patrick Connolly  wrote:
> On Mon, 17-Aug-2009 at 11:51AM +0100, e-letter wrote:
>
> |> Readers,
> |>
> |> Previous questions about this requirement have been for m$ users, my
> |> failure occurs using linux.
> |>
> |> I have tried to add the delta (δ) symbol to the y axis label and the
> |> result is &D, using the command:
> |>
> |> ...ylab="δt"...
> |>
> |> Any advice please?
>
>
> ?plotmath
>
Is this an answer? Totally meaningless to me...

__
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] graph label greek symbol failure

2009-08-18 Thread e-letter
On 17/08/2009, Michael Knudsen  wrote:
> On Mon, Aug 17, 2009 at 12:51 PM, e-letter  wrote:
>
>> I have tried to add the delta (δ) symbol to the y axis label and the
>> result is &D, using the command:
>>
>> ...ylab="δt"...
>
> Try ylab = expression(delta*t) instead.
>
This does not work, the result is
expression(delta*t)

__
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] graph label greek symbol failure

2009-08-18 Thread e-letter
On 18/08/2009, Gavin Simpson  wrote:
> On Mon, 2009-08-17 at 11:51 +0100, e-letter wrote:
>> Readers,
>>
>> Previous questions about this requirement have been for m$ users, my
>> failure occurs using linux.
>>
>> I have tried to add the delta (δ) symbol to the y axis label and the
>> result is &D, using the command:
>>
>> ...ylab="δt"...
>
> Works for me on Fedora 11 with the font packages mentioned in R
> Installation and Admin manual.
>
>> sessionInfo()
> R version 2.9.1 Patched (2009-08-07 r49104)
> x86_64-unknown-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
>>
>> Any advice please?
>
> plot(1:10, ylab = expression(delta*t))
>
> ?plotmath
>
> If your question is rather why doesn't the "δ" glyph you enter at the
> keyboard show up in the plot, I'm afraid I can't help. Perhaps something
> to do with UTF-8 and locales and the available symbol set on the device
> you are plotting on, but you'll need to provide more information (of the
> sort requested in the posting guide) on your system and set-up.
>
my locale:
locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C

Doesn't seem that the locale is at fault?

I was plotting on the default x11 window.

__
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] postscript, options

2009-08-18 Thread e-letter
On 18/08/2009, Rodrigo Aluizio  wrote:
> I'm not shure but I guess that you miss a " and putted it in the wrong
> place!
> Try this: postscript("/pathto/filename.eps",horizontal=FALSE,onefile=FALSE)
>
> Hope It helps.

Thank you, that did help a little, but the eps file was faulty and I
could not open in either imagemagick or gimp. I found it easier and
quicker to copy the graph into gimp, save in png and use imagemagick
to convert to eps format.

__
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] postscript, options

2009-08-18 Thread e-letter
On 18/08/2009, Stefan Grosse  wrote:
> On Tue, 18 Aug 2009 13:52:58 +0100 e-letter  wrote:
>
> EL> On 18/08/2009, Rodrigo Aluizio  wrote:
> EL> > I'm not shure but I guess that you miss a " and putted it in the
> EL> > wrong place!
> EL> > Try this:
> EL> > postscript("/pathto/filename.eps",horizontal=FALSE,onefile=FALSE)
> EL> >
> EL> > Hope It helps.
> EL>
> EL> Thank you, that did help a little, but the eps file was faulty and I
> EL> could not open in either imagemagick or gimp. I found it easier and
> EL> quicker to copy the graph into gimp, save in png and use imagemagick
> EL> to convert to eps format.
>
> What an effort which also yields bad results regarding quality! EPS is
> vector oriented and I doubt that PNG to EPS gives nice results besides
> if you prefer it as such why not directly create a png using the png
> device?

I want eps for latex. Png not enabled in my installation of R.
Conversion to eps was good with imagemagick, poor with gimp.

>
> What do you mean with faulty? I suspect it was to large because you
> forgot the paper="special" option. Otherwise it creates an A4 plot.
>
The image was blank, on my screen a small window about 50 mm each side
(using imagemagick. In gimp, error dialogue window received, unable to
open file). This did not occur when I used gimp and imagemagick.

> postscript("/pathto/filename.eps",horizontal=FALSE,onefile=FALSE,paper="special")
>
This command created a small blank eps file.

> see
> ?grDevices::postscript
>
I tried that command, which shows content about double and triple
colon operators? Does not show anything about postscript?

> for the options.
>
> 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] graph label greek symbol failure

2009-08-19 Thread e-letter
On 18/08/2009, Gavin Simpson  wrote:
> On Tue, 2009-08-18 at 13:06 +0100, e-letter wrote:
>> On 17/08/2009, Michael Knudsen  wrote:
>> > On Mon, Aug 17, 2009 at 12:51 PM, e-letter  wrote:
>> >
>> >> I have tried to add the delta (δ) symbol to the y axis label and the
>> >> result is &D, using the command:
>> >>
>> >> ...ylab="δt"...
>> >
>> > Try ylab = expression(delta*t) instead.
>> >
>> This does not work, the result is
>> expression(delta*t)
>
> It works for the rest of us who suggested this.
>
> plot(1:10, ylab = expression(delta*t))
>
True, but the following commands fails:
plot(1:10,ylab="temperature expression(delta*t)")
plot(1:10,ylab="temperature" expression(delta*t))
Error: syntax error, unexpected SYMBOL, expecting ',' in
"plot(1:10,ylab="temperature" expression"

So I want to be able to have 'δt' and 'temperature δt' as a y-axis label.

__
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] graph label greek symbol failure

2009-08-19 Thread e-letter
On 19/08/2009, Gavin Simpson  wrote:
> On Wed, 2009-08-19 at 14:20 +0100, e-letter wrote:
>> On 18/08/2009, Gavin Simpson  wrote:
>> > On Tue, 2009-08-18 at 13:06 +0100, e-letter wrote:
>> >> On 17/08/2009, Michael Knudsen  wrote:
>> >> > On Mon, Aug 17, 2009 at 12:51 PM, e-letter  wrote:
>> >> >
>> >> >> I have tried to add the delta (δ) symbol to the y axis label and the
>> >> >> result is &D, using the command:
>> >> >>
>> >> >> ...ylab="δt"...
>> >> >
>> >> > Try ylab = expression(delta*t) instead.
>> >> >
>> >> This does not work, the result is
>> >> expression(delta*t)
>> >
>> > It works for the rest of us who suggested this.
>> >
>> > plot(1:10, ylab = expression(delta*t))
>> >
>> True, but the following commands fails:
>> plot(1:10,ylab="temperature expression(delta*t)")
>> plot(1:10,ylab="temperature" expression(delta*t))
>> Error: syntax error, unexpected SYMBOL, expecting ',' in
>> "plot(1:10,ylab="temperature" expression"
>>
>> So I want to be able to have 'δt' and 'temperature δt' as a y-axis label.
>
> Ah, but you never said that. We aren't mind readers you know ;-)
>
> What you need is an expression that will, when used, give you a text
> label containing "Temperature δt". What you have done is create a
> character string of the literal "...expression(delta*t)" which is of
> course why it is printed as the label - after all , you asked R to do
> this.
>
> I suggest you read the plotmath help page, accessed via:
>
> ?plotmath
>
> executed at the prompt.
>
> I found this expression stuff complicated when I first started out,
> until I realised that whatever gets passed to expression() has to be
> a syntactically valid R command. So for your particular example we need:
>
> plot(1:10, ylab = expression(Temperature ~ delta*t))
>
> Temperature is treated as the character string "Temperature"; the "~"
> means leave some space between the bits either side of "~"; delta is a
> special name that will get replaced by the relevant glyph; the "*"
> juxtaposes delta and "t", ie places them next to one another without any
> space in between.
>
Being familiar with latex, I interpret your description of the tilde
(~) as non-breaking space, therefore I used the command:
plot(1:10,ylab=expression(temperature~delta*t))
to give me the result I wanted; in other words the space characters
are not needed between temperature,~ and delta in your suggestion.

Thank you.

__
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] change default measurement unit to millimetre

2009-08-20 Thread e-letter
Readers,

How do I configure R so that all units of measurement are in
millimetres? For example if I want to set the width of a graph, I want
to write:
width=100
and R interprets this value as millimetres.

Yours,

rh...@conference.jabber.org
r 251
mandriva 2008

__
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] postscript, options

2009-08-20 Thread e-letter
On 18/08/2009, Stefan Grosse  wrote:
> On Tue, 18 Aug 2009 16:08:36 +0100 e-letter  wrote:
>
> EL> >
> postscript("/pathto/filename.eps",horizontal=FALSE,onefile=FALSE,paper="special")
> EL> >
> EL> This command created a small blank eps file.
>
> Its hard to say why without any example code.
>
> Does
> postscript("/pathto/filename.eps",width=8,height=8,horizontal=FALSE,onefile=FALSE,paper="special")
> hist(rnorm(100))
> dev.off()
> work?
>
Yes, using the following commands:
postscript("/pathto/filename.eps",width=4,height=4,horizontal=FALSE,onefile=FALSE,paper="special")
hist(rnorm(100))
dev.off()
Command terminal response:
X11
 2
I opened successfully the file. Thank you.

__
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] change default measurement unit to millimetre

2009-08-21 Thread e-letter
On 20/08/2009, Patrick Connolly  wrote:
> On Thu, 20-Aug-2009 at 10:25PM +1000, Jim Lemon wrote:
>
>> e-letter wrote:
>>> Readers,
>>>
>>> How do I configure R so that all units of measurement are in
>>> millimetres? For example if I want to set the width of a graph, I want
>>> to write:
>>> width=100
>>> and R interprets this value as millimetres.
>>>
>>>
>> Hi e-letter,
>> If you just want a quick hack:
>>
>> mm2in<-function(mm) return(mm/25.4)
>>
>> then
>>
>> width=mm2in(100)
>
> As a dedicated lazy typist, I've discovered that this is less typing:
>
> width=100/25.4
>
Thanks, but really I want to change the entire R installation to
accept millimetre as the default unit of measurement.

__
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] linear regression, exclude a datum

2009-09-14 Thread e-letter
Readers,

I have been reading the r book (Crawley) and tried to use the
influence measures function for linear regression, as described. I
have one datum that I wish to show in the graph but exclude from the
regression and ab line.

x   y
0   5
10  9
20  10
30  19
40  4

With the influence measures function I plot the graph but linear
regression includes the datum (40,4), which I want to show on the
graph but exclude from the linear regression ab line.

Is there an alternative package to perform this task please?

rhelp at conference.jabber.org
r 251
mandriva 2008

__
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] linear regression, exclude a datum

2009-09-14 Thread e-letter
On 14/09/2009, Steve Lianoglou  wrote:
> Hi,
>
> On Sep 14, 2009, at 9:47 AM, e-letter wrote:
>
>> Readers,
>>
>> I have been reading the r book (Crawley) and tried to use the
>> influence measures function for linear regression, as described. I
>> have one datum that I wish to show in the graph but exclude from the
>> regression and ab line.
>>
>> xy
>> 05
>> 10   9
>> 20   10
>> 30   19
>> 40   4
>>
>> With the influence measures function I plot the graph but linear
>> regression includes the datum (40,4), which I want to show on the
>> graph but exclude from the linear regression ab line.
>>
>> Is there an alternative package to perform this task please?
>
> Please post the code you're using to try and do the regression.
>
> I think you simply want to remove the data point when you build the
> regression model, then plot it later after you plot the regression.
>
Correct; below are my commands:

 x<-c(0,10,20,30)
 y<-c(5,9,12,19)
 fit<-lm(y~x)
 plot(y~x)
 abline(fit)

I try these commands as explained in section 12 (graphics) of the
introduction manual:

 points(40,4)
 plot(40,4,add=TRUE)
Warning messages:
1: "add" is not a graphical parameter in: plot.window(xlim, ylim, log,
asp, ...)
2: "add" is not a graphical parameter in: plot.xy(xy, type, pch, lty,
col, bg, cex, lwd, ...)
3: "add" is not a graphical parameter in: axis(side, at,
as.graphicsAnnot(labels), tick, line, pos, outer,
4: "add" is not a graphical parameter in: axis(side, at,
as.graphicsAnnot(labels), tick, line, pos, outer,
5: "add" is not a graphical parameter in: box(which = which, lty = lty, ...)
6: "add" is not a graphical parameter in: title(main, sub, xlab, ylab,
line, outer, ...)

The datum is not added to the original graph.

__
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] linear regression, exclude a datum

2009-09-15 Thread e-letter
On 15/09/2009, Uwe Ligges  wrote:
>
>
> e-letter wrote:
>> On 14/09/2009, Steve Lianoglou  wrote:
>>> Hi,
>>>
>>> On Sep 14, 2009, at 9:47 AM, e-letter wrote:
>>>
>>>> Readers,
>>>>
>>>> I have been reading the r book (Crawley) and tried to use the
>>>> influence measures function for linear regression, as described. I
>>>> have one datum that I wish to show in the graph but exclude from the
>>>> regression and ab line.
>>>>
>>>> x  y
>>>> 0  5
>>>> 10 9
>>>> 20 10
>>>> 30 19
>>>> 40 4
>>>>
>>>> With the influence measures function I plot the graph but linear
>>>> regression includes the datum (40,4), which I want to show on the
>>>> graph but exclude from the linear regression ab line.
>>>>
>>>> Is there an alternative package to perform this task please?
>>> Please post the code you're using to try and do the regression.
>>>
>>> I think you simply want to remove the data point when you build the
>>> regression model, then plot it later after you plot the regression.
>>>
>> Correct; below are my commands:
>>
>>  x<-c(0,10,20,30)
>>  y<-c(5,9,12,19)
>>  fit<-lm(y~x)
>>  plot(y~x)
>>  abline(fit)
>>
>> I try these commands as explained in section 12 (graphics) of the
>> introduction manual:
>
>
>
> Hope this example is not in Crawley's book as you cite it, because you
> need to make the plot large enough to include the value (40,4) already
> when you create the plot, e.g., by specifying xlim and ylim.
>
No, it is an example I made quickly to post to the mailing list. Which
section of the manual explains xlim please?

> Anyway, I'd rather explude the value from a data.frame as fol#ows:
>
> # whole data:
> dat <- data.frame(x = c(0,10,20,30,40), y = c(5,9,12,19,4))
> dat
> plot(y~x, data=dat)
> # fit the regression without the 5th observation:
> fit <- lm(y ~ x, data=dat[-5,])
> abline(fit)
>
Thank you. Please advise which section of the introduction manual
explains how to exclude a datum (the instruction '...dat[-5,]'. One of
my biggest difficulties is finding the relevant section of the
manual(s).

__
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] margin text warning message NAs coercion

2010-02-16 Thread e-letter
Readers,

I tried to the following commands:

plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D))
mtext(expression(A[1]~B[2]),"additional text",side=3,line=1)

I receive the text that I want, but the command terminal shows the
following response:

Warning message:
NAs introduced by coercion in: mtext(expression(A[1]~B[2]),"additional
text", side = 3,

What is my mistake please?

Yours,

r251
rhelpatconference.jabber.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] margin text warning message NAs coercion

2010-02-16 Thread e-letter
On 16/02/2010, Peter Ehlers  wrote:
> On 2010-02-16 9:21, e-letter wrote:
>> Readers,
>>
>> I tried to the following commands:
>>
>> plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D))
>> mtext(expression(A[1]~B[2]),"additional text",side=3,line=1)
>
> Your plot() call is not reproducible.
>
> Anyway, try
>
> mtext(expression(A[1]~B[2]~~"additional text"),side=3,line=1)
>
Thank you. I had seen the command (~~) in the help guide for the
package plotmath(grdevices), but there is no statement that this
command can be used to join the expression to literal text.

__
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] assessing data variation

2009-07-10 Thread e-letter
I have data like so:

timedatum
30  12
60  24
90  37
120 41
150 8

In addition to standard deviation, I want to measure the average of
the differences in data for each time interval, i.e. average of 24-12,
37-24, 41-37, 8-41. Is there a statistical term for this task? Which
package should I use please?

rh...@conference.jabber.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.


[R] Merge failure using zoo package

2010-04-02 Thread e-letter
Readers,

Please refer to attached example data files. It seems that the merge
function fails for the latter section of the data set. Command
terminal output:

> library(chron)
> library(zoo)
> x<-read.zoo("test1.csv",header=TRUE,sep=",",FUN=times)
> y<-read.zoo("test2.csv",header=TRUE,sep=",",FUN=times)
> z<-(na.approx(merge(x[,2],y[,2]),time(z1)))
> z
x[, 2]y[, 2]
01:01:01 0.5418645 0.1755847
01:01:30 0.3486081 0.2068249
01:01:42 0.4808362 0.2380651
01:02:00 0.6130642 0.4983712
01:02:23 0.3140116 0.7586773
01:19:00 0.8545863 0.8927112
01:24:00 0.965 0.1490374

To overcome this behaviour the files test3 and test4 were created by
removing data that had been merged previously. Command terminal output
below:

> x<-read.zoo("test3.csv",header=TRUE,sep=",",FUN=times)
> y<-read.zoo("test4.csv",header=TRUE,sep=",",FUN=times)
> z<-(na.approx(merge(x[,2],y[,2]),time(z1)))
> z
x[, 2]y[, 2]
01:03:06 0.4827475 0.7350236
01:03:30 0.6951390 0.8376028
01:03:50 0.5798283 0.9401821
01:04:00 0.4645176 0.8330635
01:04:30 0.6167257 0.7259450
01:19:00 0.8545863 0.8927112
01:24:00 0.965 0.1490374

The only way to obtain a more complete merge of the data sets is to
create manually new files where previously merged data is removed and
then put all the merged data into a new file. Surely this package
should merge the data sets completely?

yours,

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


Re: [R] Merge failure using zoo package

2010-04-02 Thread e-letter
Data files test1, ...2, ...3, ...4 respectively.

time1,dataset1
01:01:00,0.73512097
01:01:30,0.34860813
01:02:00,0.61306418
01:02:30,0.01495898
01:03:00,0.27035612
01:03:30,0.69513898
01:04:00,0.46451758
01:04:30,0.61672569
01:05:00,0.82496122
01:05:30,0.34766154
01:06:00,0.69618714
01:06:30,0.39035214
01:07:00,0.01680143
01:07:30,0.28576967
01:08:00,0.01205416
01:08:30,0.89637254
01:09:00,0.63147653
01:09:30,0.01522139
01:10:00,0.27661960
01:10:30,0.50974124
01:11:00,0.68141977
01:11:30,0.90725854
01:12:00,0.83823443
01:12:30,0.53360241
01:13:00,0.17769196
01:13:30,0.83438616
01:14:00,0.67248807
01:14:30,0.09991933
01:15:00,0.03334966
01:15:30,0.93292355
01:16:00,0.15990837
01:16:30,0.05354050
01:17:00,0.55281203
01:17:30,0.37845690
01:18:00,0.89051365
01:18:30,0.16674292
01:19:00,0.85458626
01:19:30,0.19278550
01:20:00,0.73240405
01:20:30,0.16417524
01:21:00,0.73878212
01:21:30,0.51790118
01:22:00,0.83076438
01:22:30,0.4704
01:23:00,0.02108640
01:23:30,0.82911053
01:24:00,0.9646
01:24:30,0.14493657
01:25:00,0.84422332
01:25:30,0.41589974
01:26:00,0.67606367
01:26:30,0.00606434
01:27:00,0.59951991
01:27:30,0.43949260
01:28:00,0.66297385
01:28:30,0.33131298
01:29:00,0.06102041
01:29:30,0.84722118
01:30:00,0.46841491
01:30:30,0.34200755
01:31:00,0.87386578
01:31:30,0.70737403
01:32:00,0.23978781
01:32:30,0.11787278
01:33:00,0.14679814
01:33:30,0.65217063
01:34:00,0.81355908
01:34:30,0.31583482
01:35:00,0.92167666
01:35:30,0.55931271
01:36:00,0.13641271
01:36:30,0.35048575
01:37:00,0.17243584
01:37:30,0.93645686
01:38:00,0.85356548
01:38:30,0.61399352
01:39:00,0.05910707
01:39:30,0.01721605
01:40:00,0.94845557
01:40:30,0.48117810
01:41:00,0.34752402
01:41:30,0.59295472
01:42:00,0.64267429
01:42:30,0.57859933
01:43:00,0.00201441
01:43:30,0.32530995
01:44:00,0.25474645
01:44:30,0.93187534
01:45:00,0.99361033
01:45:30,0.16591641

time2,dataset2
01:01:01,0.17558467
01:01:42,0.23806514
01:02:23,0.75867726
01:03:06,0.73502357
01:03:50,0.94018206
01:04:35,0.61882643
01:05:21,0.68417492
01:06:08,0.05744461
01:06:55,0.33344394
01:07:44,0.68752593
01:08:33,0.17270469
01:09:23,0.81522124
01:10:03,0.68304352
01:10:43,0.38774082
01:11:23,0.84176890
01:12:04,0.0936
01:12:44,0.13431965
01:13:25,0.92210721
01:14:06,0.33630635
01:14:47,0.56690294
01:15:29,0.09870816
01:16:11,0.77864105
01:16:53,0.61803441
01:17:35,0.09133728
01:18:17,0.08925487
01:19:00,0.89271117
01:19:42,0.56605742
01:20:25,0.98520534
01:21:08,0.66104843
01:21:51,0.96948589
01:22:34,0.05692690
01:23:17,0.71887456
01:24:00,0.14903741
01:24:43,0.86569445
01:25:26,0.27923513
01:26:09,0.98365033
01:26:53,0.08308399
01:27:36,0.87071027
01:28:19,0.26475705
01:29:03,0.76409811
01:29:47,0.59563256
01:30:31,0.23995054
01:31:14,0.00951054
01:31:59,0.21367270

time1,dataset1
01:02:30,0.01495898
01:03:00,0.27035612
01:03:30,0.69513898
01:04:00,0.46451758
01:04:30,0.61672569
01:05:00,0.82496122
01:05:30,0.34766154
01:06:00,0.69618714
01:06:30,0.39035214
01:07:00,0.01680143
01:07:30,0.28576967
01:08:00,0.01205416
01:08:30,0.89637254
01:09:00,0.63147653
01:09:30,0.01522139
01:10:00,0.27661960
01:10:30,0.50974124
01:11:00,0.68141977
01:11:30,0.90725854
01:12:00,0.83823443
01:12:30,0.53360241
01:13:00,0.17769196
01:13:30,0.83438616
01:14:00,0.67248807
01:14:30,0.09991933
01:15:00,0.03334966
01:15:30,0.93292355
01:16:00,0.15990837
01:16:30,0.05354050
01:17:00,0.55281203
01:17:30,0.37845690
01:18:00,0.89051365
01:18:30,0.16674292
01:19:00,0.85458626
01:19:30,0.19278550
01:20:00,0.73240405
01:20:30,0.16417524
01:21:00,0.73878212
01:21:30,0.51790118
01:22:00,0.83076438
01:22:30,0.4704
01:23:00,0.02108640
01:23:30,0.82911053
01:24:00,0.9646
01:24:30,0.14493657
01:25:00,0.84422332
01:25:30,0.41589974
01:26:00,0.67606367
01:26:30,0.00606434
01:27:00,0.59951991
01:27:30,0.43949260
01:28:00,0.66297385
01:28:30,0.33131298
01:29:00,0.06102041
01:29:30,0.84722118
01:30:00,0.46841491
01:30:30,0.34200755
01:31:00,0.87386578
01:31:30,0.70737403
01:32:00,0.23978781
01:32:30,0.11787278
01:33:00,0.14679814
01:33:30,0.65217063
01:34:00,0.81355908
01:34:30,0.31583482
01:35:00,0.92167666
01:35:30,0.55931271
01:36:00,0.13641271
01:36:30,0.35048575
01:37:00,0.17243584
01:37:30,0.93645686
01:38:00,0.85356548
01:38:30,0.61399352
01:39:00,0.05910707
01:39:30,0.01721605
01:40:00,0.94845557
01:40:30,0.48117810
01:41:00,0.34752402
01:41:30,0.59295472
01:42:00,0.64267429
01:42:30,0.57859933
01:43:00,0.00201441
01:43:30,0.32530995
01:44:00,0.25474645
01:44:30,0.93187534
01:45:00,0.99361033
01:45:30,0.16591641

time2,dataset2
01:03:06,0.73502357
01:03:50,0.94018206
01:04:35,0.61882643
01:05:21,0.68417492
01:06:08,0.05744461
01:06:55,0.33344394
01:07:44,0.68752593
01:08:33,0.17270469
01:09:23,0.81522124
01:10:03,0.68304352
01:10:43,0.38774082
01:11:23,0.84176890
01:12:04,0.0936
01:12:44,0.13431965
01:13:25,0.92210721
01:14:06,0.33630635
01:14:47,0.56690294
01:15:29,0.09870816
01:16:11,0.77864105
01:16:53,0.61803441
01:17:35,0.09133728
01:18:17,0.08925487
01:19:00,0.89271117
01:19:

Re: [R] Merge failure using zoo package

2010-04-02 Thread e-letter
On 02/04/2010, Gabor Grothendieck  wrote:
> The files only have one data column.  What is the meaning of x[,2],
> etc. ?   What is z1?
>
I only want to merge one column from one file with one column from
another file. With [x,2], I am trying to select the column of data.

> Please provide reproducible code and data all in a single file using
> this style so its clear what is what. Also please cut down the size of
> your data to the smallest size that will still illustrate the problem.
>
See other posting; each file that I used is separated by an empty
line. This error seems to occur with the data set size as shown in the
files.

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


Re: [R] Merge failure using zoo package

2010-04-02 Thread e-letter
On 02/04/2010, Gabor Grothendieck  wrote:
> The code does not run with the files.  I need the requested
> information, namely a single file containing code and data and that I
> can just copy into a session without editing and see the result you
> see.

I don't understand how I can combine the four csv files into a single
file of data and terminal commands? Anyway, further terminal output.

The following also occurs with correction of the commands. The data
merge is incomplete (to 1:27:30); data set 1 ends at time 1:45:30;
data set 2 1:31:59

> library(chron)
> library(zoo)
> z1<-read.zoo("test1.csv",header=TRUE,sep=",",FUN=times)
> z2<-read.zoo("test2.csv",header=TRUE,sep=",",FUN=times)
> z3<-(na.approx(merge(z1[,2],z2[,2]),time(z1)))
> z3
z1[, 2]z2[, 2]
01:01:01 0.54186455 0.17558467
01:01:30 0.34860813 0.20682491
01:01:42 0.48083615 0.23806514
01:02:00 0.61306418 0.49837120
01:02:23 0.31401158 0.75867726
01:02:30 0.01495898 0.75079270
01:03:00 0.27035612 0.74290813
01:03:06 0.48274755 0.73502357
01:03:30 0.69513898 0.83760282
01:03:50 0.57982828 0.94018206
01:04:00 0.46451758 0.83306352
01:04:30 0.61672569 0.72594497
01:04:35 0.72084346 0.61882643
01:05:00 0.82496122 0.65150068
01:05:21 0.58631138 0.68417492
01:05:30 0.34766154 0.47526482
01:06:00 0.69618714 0.26635471
01:06:08 0.54326964 0.05744461
01:06:30 0.39035214 0.19544428
01:06:55 0.20357679 0.33344394
01:07:00 0.01680143 0.45147127
01:07:30 0.28576967 0.56949860
01:07:44 0.14891191 0.68752593
01:08:00 0.01205416 0.51591885
01:08:30 0.89637254 0.34431177
01:08:33 0.76392454 0.17270469
01:09:00 0.63147653 0.49396296
01:09:23 0.32334896 0.81522124
01:09:30 0.01522139 0.77116200
01:10:00 0.27661960 0.72710276
01:10:03 0.39318042 0.68304352
01:10:30 0.50974124 0.53539217
01:10:43 0.59558051 0.38774082
01:11:00 0.68141977 0.61475486
01:11:23 0.79433915 0.84176890
01:11:30 0.90725854 0.59232742
01:12:00 0.83823443 0.34288594
01:12:04 0.68591842 0.0936
01:12:30 0.53360241 0.11388206
01:12:44 0.35564718 0.13431965
01:13:00 0.17769196 0.52821343
01:13:25 0.50603906 0.92210721
01:13:30 0.83438616 0.72684026
01:14:00 0.67248807 0.53157330
01:14:06 0.38620370 0.33630635
01:14:30 0.09991933 0.45160464
01:14:47 0.06663450 0.56690294
01:15:00 0.03334966 0.33280555
01:15:29 0.48313660 0.09870816
01:15:30 0.93292355 0.32535246
01:16:00 0.15990837 0.55199675
01:16:11 0.10672443 0.77864105
01:16:30 0.05354050 0.69833773
01:16:53 0.30317627 0.61803441
01:17:00 0.55281203 0.44246870
01:17:30 0.37845690 0.26690299
01:17:35 0.63448528 0.09133728
01:18:00 0.89051365 0.09029608
01:18:17 0.52862829 0.08925487
01:18:30 0.16674292 0.49098302
01:19:00 0.85458626 0.89271117
01:19:30 0.19278550 0.72938430
01:19:42 0.46259477 0.56605742
01:20:00 0.73240405 0.77563138
01:20:25 0.44828965 0.98520534
01:20:30 0.16417524 0.87715304
01:21:00 0.73878212 0.76910073
01:21:08 0.62834165 0.66104843
01:21:30 0.51790118 0.81526716
01:21:51 0.67433278 0.96948589
01:22:00 0.83076438 0.66529956
01:22:30 0.4704 0.36111323
01:22:34 0.24832072 0.05692690
01:23:00 0.02108640 0.38790073
01:23:17 0.42509847 0.71887456
01:23:30 0.82911053 0.43395599
01:24:00 0.9646 0.14903741
01:24:30 0.14493657 0.50736593
01:24:43 0.49457995 0.86569445
01:25:00 0.84422332 0.57246479
01:25:26 0.63006153 0.27923513
01:25:30 0.41589974 0.51404020
01:26:00 0.67606367 0.74884526
01:26:09 0.34106401 0.98365033
01:26:30 0.00606434 0.53336716
01:26:53 0.30279212 0.08308399
01:27:00 0.59951991 0.34562608
01:27:30 0.43949260 0.60816818
>

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


Re: [R] Merge failure using zoo package

2010-04-07 Thread e-letter
I tried your instructions, as shown.

> library(chron)
> library(zoo)
> z1<-read.zoo("test1.csv",header=TRUE,sep=",",FUN=times)
> z2<-read.zoo("test2.csv",header=TRUE,sep=",",FUN=times)
> z12<-merge(z1,z2)
> z3<-na.approx(z12,xout=time(z1))
Error in approx(along[!na], y[!na], along[na], ...) :
invalid interpolation method
In addition: Warning message:
the condition has length > 1 and only the first element will be used
in: if (is.na(method)) stop("invalid interpolation method")
> source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/zoo/R/na.approx.R?rev=676&root=zoo";)
> z3<-na.approx(z12,xout=time(z1))
> z3
 z1 z2
01:01:30 0.34860813 0.21977817
01:02:00 0.61306418 0.46662656
01:02:30 0.01495898 0.75482666
01:03:00 0.27035612 0.73832408
...

It looks that the data of z3 shows only values corresponding to times
in z1. In the previous merge, z3 consisted of values for times in both
z1 and z2, e.g.:

z1[, 2]z2[, 2]
01:01:01 0.54186455 0.17558467
01:01:30 0.34860813 0.20682491
01:01:42 0.48083615 0.23806514
01:02:00 0.61306418 0.49837120

With respect to advice about seeking help, I think it would be very
good if your comments about using the command 'textConnection()' were
added to the FAQ section or the posting guide, to help novices improve
the quality of asking for help.

__
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 specify only minimum ylim parameter for boxplot

2010-04-07 Thread e-letter
Readers,

For a command:

x<-a data matrix
y<-another data matrix
z<-and another data matrix
boxplot(c(x,y,z),las=1,xaxt="n",ylab="text",xlab="text",ylim=c(0,..?))

is it possible to specify only that the boxplot graph starts with
value 0 at the bottom of the ordinate (y axis) and the maximum value
is determined by data in x,y and z?

Yours,

rh...@conference.jabber.org
r251
mandriva2008

__
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] synchronisation of time series data using interpolation

2009-09-24 Thread e-letter
Readers,

I have data with different time stamps that I wish to plot (for example):

data set 1
time(hh:mm:ss),datum
01:00:00,500
01:00:15,600
01:00:30,750
01:00:45,720
01:01:00,700
01:01:15,725
01:01:30,640
01:01:45,710
data set 2
time,datum
01:00:12,20
01:01:01,55
01:01:55,22

The time interval in data set 1 does not change, but the time interval
in data set 2 does change, such that for a specific total time range
(e.g. 60 minutes) there will be more data in data set 1 than in data
set 2.

I thought I could solve this problem using interpolation, to create a
new data set using data from data set 2, interpolated to the time
stamps in data set 1:

data set 3
time,datum
01:00:00,18
01:00:15,23
01:00:30,30
01:00:45,41
01:01:00,53
01:01:15,46
01:01:30,38
01:01:45,29

Therefore I would then be able to plot the data in data set 1 against
the interpolated data in data set 3, because there would be equal
quantities of data in both data sets. I've looked at the interp
function in the help manual, but I don't understand if this function
can perform the task I want. Any advice please?

Yours,

rhelp at conference.jabber.org
r 251 (27-06-07)
mandriva 2008

__
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] synchronisation of time series data using interpolation

2009-09-26 Thread e-letter
I created separate text files for the 2 data sets. I enter the
following comands:

library(zoo)
library(chron)
z1<-read.zoo(textConnection("/path/to/test1.txt"),header=FALSE,sep=",",FUN=times)
z2<-read.zoo(textConnection("/path/to/test2.txt"),header=FALSE,sep=",",FUN=times)
z3<-window(na.approx(merge(z1,z2)),time(z1))
plot(z3$z1,z3$z2)
Error in plot.window(xlim, ylim, log, asp, ...) :
need finite 'xlim' values
In addition: Warning messages:
1: no non-missing arguments to min; returning Inf in: min(x)
2: no non-missing arguments to max; returning -Inf in: max(x)
3: no non-missing arguments to min; returning Inf in: min(x)
4: no non-missing arguments to max; returning -Inf in: max(x)

The resultant graph window was blank, so I entered the following command

plot(z3$z1,z3$z2,xlim=c(0,100),ylim=c(0,100))

The graph window showed y axis (labelled 'z3$z1') and x axis (labelled 'Index').

I do not understand the instruction "...to use window to pick off..."

__
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] synchronisation of time series data using interpolation

2009-09-26 Thread e-letter
Test1 file contained data set 1, test2 contained data set 2

__
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] synchronisation of time series data using interpolation

2009-09-28 Thread e-letter
I saved the data sets as files and then tried to refer to those files.
Therefore the instruction:

> z1<-read.zoo(textConnection("/path/to/test1.txt")

means that I wanted to replace the manual data entry for Lines1 with a
file containing the data. It seems that your instructions only work
when data is typed from the command terminal. I cannot use data stored
in separated files. Command terminal output below:

> lines1<-read.table("/path/to/test1.txt")
> lines2<-read.table("/path/to/test2.txt")
Warning message:
incomplete final line found by readTableHeader on '/path/to/test2.txt'
in: read.table("/path/to/test2.txt")

This is test1 file:

01:00:00,500
01:00:15,600
01:00:30,750
01:00:45,720
01:01:00,700
01:01:15,725
01:01:30,640
01:01:45,710

This is test2 file:

01:00:12,20
01:01:01,55
01:01:55,22

Then I added a carriage return in test2 file and saved it:

01:00:12,20
01:01:01,55
01:01:55,22


Then I repeated the command terminal entry for lines2:

> lines2<-read.table("/path/to/test2.txt")
> library(zoo)
> library(chron)
> z1<-read.zoo(textConnection(lines1),header=FALSE,sep=",",FUN=times)
Error in textConnection(lines1) : invalid 'text' argument

__
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 ᵒ C in graph axis label

2009-10-01 Thread e-letter
Readers,

I have tried to use a plotmath command to add the temperature degree
sign (i.e. ᵒ C) to the axis label of a graph:

> x<-(1:10)
> y<-(200:191)
> plot(x~y,ylab=expression(*degree~C))
Error: syntax error, unexpected '*', expecting ',' in
"plot(x~y,ylab=expression(*"

According to plotmath manual, the syntax is '*degree' and I am able to
use this command when a number precedes the asterisk (e.g.
ylab=expression(0*degree~C)). But I want to omit the need for a number
before the degree sign. Any advice 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] plot subscript text and percentage symbol in graph label axis

2009-10-02 Thread e-letter
Readers,

I am unable to plot a label consisting of both subscript text and
percentage (%) symbol:

x<-(1:10)
y<-(200:191)
plot(x~y,ylab=expression(~degree~C),xlab=expression(x[2]~%))
Error: syntax error, unexpected ERROR in
"plot(x~y,ylab=expression(~degree~C),xlab=expression(x~%)"

It seems that % is a special character in R? I have looked in the
introductory manual but can see no reference to reserved characters.

Yours,

rhelpatconference.jabber.org
r251
mandriva2008

__
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] exclude data for boxplot stats using mathematical operator

2009-10-26 Thread e-letter
Readers,

I have a data set as follows:

1,1
2,2
3,3
4,4
5,3
6,2
7,-10
8,-9
9,-3
10,2
11,3
12,4
13,5
14,4
15,3
16,2
17,1

I entered this data set using the command 'read.csv'. I want to
exclude values fewer than zero in column 2 so then I tried the
following command:

boxplot.stats(x[>0,2],do.conf=FALSE)
Error: syntax error, unexpected GT, expecting ',' in "boxplot.stats(x[>"

Any help please?

Yours,

rhelp at conference.jabber.org
r 251

__
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] whitespace with subscript text

2009-10-30 Thread e-letter
Readers,

I have the following command:

expression(A[1]B~"%")

but that causes an error so I changed to:

expression(A[1]~B~"%")

but the result is too much whitespace between subscript and B. Is
there a way to reduce this whitespace?

Yours,

rhelp at conference.jabber.org
r 251
mandriva 2008

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


[R] unable to use coplot function with zoo package

2009-11-23 Thread e-letter
Readers,

I have tried to use the zoo package to merge datasets and then use the
coplot function, but the graph is not fully created. Only the panel
data is shown. Command terminal output below, with csv files. What is
the meaning of the warning message? Can anyone help please?

rhelpatconference.jabber.org
r 251
mandriva 2008

> library(chron)
> library(zoo)
> z1<-read.zoo("test1.csv",header=FALSE,sep=",",FUN=times)
> z2<-read.zoo("test2.csv",header=FALSE,sep=",",FUN=times)
> z3<-read.zoo("test3.csv",header=FALSE,sep=",",FUN=times)
> z4<-(na.approx(merge(z1,z2,z3),time(z1)))
> coplot(z4$z2~z4$z1|z4$z3)
Warning messages:
1: Index vectors are of different classes: integer times in:
merge.zoo(e1, e2, all = FALSE, retclass = NULL)
2: Index vectors are of different classes: integer times in:
merge.zoo(e1, e2, all = FALSE, retclass = NULL)
3: Index vectors are of different classes: integer times in:
merge.zoo(e1, e2, all = FALSE, retclass = NULL)
4: Index vectors are of different classes: integer times in:
merge.zoo(e1, e2, all = FALSE, retclass = NULL)
5: Index vectors are of different classes: integer times in:
merge.zoo(e1, e2, all = FALSE, retclass = NULL)
6: Index vectors are of different classes: integer times in:
merge.zoo(e1, e2, all = FALSE, retclass = NULL)
> z4$z1
09:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10
  320.61   325.43   320.48   315.53   314.63   313.73   316.11   323.88
09:52:30 09:52:54
  331.65   328.48
> z4$z2
09:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10
404.7500 402.7450 400.7400 300.2450 199.7500 266.7867 333.8233 400.8600
09:52:30 09:52:54
402.8350 404.8100
> z4$z3
09:50:01 09:50:30 09:50:44 09:51:00 09:51:27 09:51:30 09:52:00 09:52:10
 166.120  175.770  185.420  198.395  211.370  214.820  218.270  221.720
09:52:30 09:52:54
 228.370  235.020
>
test1.csv:
09:50:00,315.79
09:50:30,325.43
09:51:00,315.53
09:51:30,313.73
09:52:00,316.11
09:52:30,331.65
09:53:00,325.31
09:53:30,334.33
09:54:00,334.54
09:54:30,336.55
09:55:00,339.34
09:55:30,341.93
test2.csv:
09:50:01,404.75
09:50:44,400.74
09:51:27,199.75
09:52:10,400.86
09:52:54,404.81
09:53:41,404.36
09:54:20,406.11
09:55:03,408.85
test3.csv:
09:50:01,166.12
09:50:44,185.42
09:51:27,211.37
09:52:10,221.72
09:52:54,235.02
09:53:41,262.85
09:54:20,306.64
09:55:03,346.3

__
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] write to file append by column

2009-11-24 Thread e-letter
Readers,

Scenario: data x consists of one column;
1
2
3

data y;
4
5
6

Is it possible to write to file such that the file is:
1,4
2,5
3,6

using the write.file function? I have tried the command:

write(x,file="file.csv",ncolumns=1,append=TRUE,sep=",")
write(y,file="file.csv",ncolumns=1,append=TRUE,sep=",")

but the result is:

1
2
3
4
5
6

yours,

rhelpatconference.jabber.org
r 251
mandriva 2008

__
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] write to file append by column

2009-11-24 Thread e-letter
On 24/11/2009, jim holtman  wrote:
> You can not append a column.  Best bet, read the old file in, do a
> 'cbind', write the object back out.
>
> On Tue, Nov 24, 2009 at 5:59 AM, e-letter  wrote:
>> Readers,
>>
>> Scenario: data x consists of one column;
>> 1
>> 2
>> 3
>>
>> data y;
>> 4
>> 5
>> 6
>>
>> Is it possible to write to file such that the file is:
>> 1,4
>> 2,5
>> 3,6
>>
>> using the write.file function? I have tried the command:
>>
>> write(x,file="file.csv",ncolumns=1,append=TRUE,sep=",")
>> write(y,file="file.csv",ncolumns=1,append=TRUE,sep=",")
>>
>> but the result is:
>>
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>>
>> yours,
>>
>> rhelpatconference.jabber.org
>> r 251
>> mandriva 2008
>>
>> __
>> 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.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>
This is the requested format:
1,4
2,5
3,6

The write functions described previously produce the following format:
1
2
3
4
5
6

__
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] selection of multiple subscripts

2010-01-13 Thread e-letter
Readers,

For a data set 'x':

1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i

How to select multiple subscripts to plot? For example to plot values
1:3 and 9:10:

plot(x[1:3,1],x[,2])

and

plot(x[9:10,1],x[,2])

into one plot?

Yours,

rhelpatconference.jabber.org
r251

__
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] selection of multiple subscripts

2010-01-13 Thread e-letter
On 13/01/2010, Duncan Murdoch  wrote:
> On 13/01/2010 7:36 AM, e-letter wrote:
>> Readers,
>>
>> For a data set 'x':
>>
>> 1 a
>> 2 b
>> 3 c
>> 4 d
>> 5 e
>> 6 f
>> 7 g
>> 8 h
>> 9 i
>>
>> How to select multiple subscripts to plot? For example to plot values
>> 1:3 and 9:10:
>>
>> plot(x[1:3,1],x[,2])
>>
>> and
>>
>> plot(x[9:10,1],x[,2])
>>
>> into one plot?
>
> Neither of those will work, because your x[,2] vector is longer than the
> other vector.
>
> What you want is something like this:
>
> plot(col2 ~ col1, data=x[c(1:3, 9:10),])
>
Thanks, I now understand the concatenate function would help but
forgot the syntax. Anyway I've just realised that the search database
for R yields no result for '?concatenate' which is surprising.

__
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] selection of multiple subscripts

2010-01-13 Thread e-letter
On 13/01/2010, e-letter  wrote:
> On 13/01/2010, Duncan Murdoch  wrote:
>> On 13/01/2010 7:36 AM, e-letter wrote:
>>> Readers,
>>>
>>> For a data set 'x':
>>>
>>> 1 a
>>> 2 b
>>> 3 c
>>> 4 d
>>> 5 e
>>> 6 f
>>> 7 g
>>> 8 h
>>> 9 i
>>>
>>> How to select multiple subscripts to plot? For example to plot values
>>> 1:3 and 9:10:
>>>
>>> plot(x[1:3,1],x[,2])
>>>
>>> and
>>>
>>> plot(x[9:10,1],x[,2])
>>>
>>> into one plot?
>>
>> Neither of those will work, because your x[,2] vector is longer than the
>> other vector.
>>
>> What you want is something like this:
>>
>> plot(col2 ~ col1, data=x[c(1:3, 9:10),])
>>
> Thanks, I now understand the concatenate function would help but
> forgot the syntax. Anyway I've just realised that the search database
> for R yields no result for '?concatenate' which is surprising.
>
For the benefit of other novices: for the data set, the subscripts
should have read:

1:3

and

8:9

Alternatively, the data set should have included:

10 j

:)

__
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] use zoo package with multiple column data sets

2010-01-29 Thread e-letter
Readers,

I am trying to use the zoo package with an array of data:

file1:
hh:mm:ss1
hh:mm:ss2
hh:mm:ss3
hh:mm:ss4

file2:
hh:mm:ss11  55
hh:mm:ss22  66
hh:mm:ss33  77
hh:mm:ss44  88

I wanted to merge these data set so I tried the following commands:

library(chron)
library(zoo)
z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
z2<-read.zoo("path/to/file2.csv",header=TRUE,sep=",",FUN=times)
z3<-(na.approx(merge(z1,z2),time(z1)))
plot(z3$z1,z3$z2[3])

Warning message:
some methods for “zoo” objects do not work if the index entries in
‘order.by’ are not unique in: zoo(rval, ix)
> z3<-(na.approx(merge(z1,z2),time(z1)))
Error in merge.zoo(z1, z2) : series cannot be merged with non-unique
index entries in a series

I have read the document vignette 'zoo' but section 2.1 does not show
an example of the syntax for the command 'order.by'.

How to use the zoo package where the variable z2 contains many columns of data?

Yours,

rhelpatconference.jabber.org
r251

__
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] use zoo package with multiple column data sets

2010-01-29 Thread e-letter
Assuming my documentation is correct, my version shows faq 1 to refer
to duplicate times but if file2 is:

01:01:0111  55
01:01:0422  66
01:01:0733  77
01:01:1044  88

I cannot see what is duplicate? If I create two new files:

file3:
01:01:0111
01:01:0422
01:01:0733
01:01:1044

file4:
01:01:0155
01:01:0466
01:01:0777
01:01:1088

The previous commands work:

z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
z2<-read.zoo("path/to/file3.csv",header=TRUE,sep=",",FUN=times)
z3<-(na.approx(merge(z1,z2),time(z1)))
plot(z3$z1,z3$z2)

and:

z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
z2<-read.zoo("path/to/file4.csv",header=TRUE,sep=",",FUN=times)
z3<-(na.approx(merge(z1,z2),time(z1)))
plot(z3$z1,z3$z2)

Shouldn't I be able to have one file containing all the columns I want
to make graphs, instead of having to create numerous files of only two
columns of data?

__
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] use zoo package with multiple column data sets

2010-01-30 Thread e-letter
> library(chron)
> library(zoo)
> z1<-read.zoo("~/path/to/test1.csv",header=TRUE,sep=",",FUN=times)
> z2<-read.zoo("~/path/to/test2.csv",header=TRUE,sep=",",FUN=times)
> z3<-(na.approx(merge(z1,z2),time(z1)))
Error in approx(along[!na], y[!na], along[na], ...) :
need at least two non-NA values to interpolate
> z3<-(na.approx(merge(z1,z2[,2]),time(z1)))
Error in approx(along[!na], y[!na], along[na], ...) :
need at least two non-NA values to interpolate
> z3<-(na.approx(merge(z1,z2[,3]),time(z1)))
Error in `[.zoo`(z2, , 3) : subscript out of bounds
> z4<-read.zoo(textConnection(z2),FUN=times)
Error in textConnection(z2) : invalid 'text' argument
__
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] syntax for very simple derivative function

2012-12-18 Thread e-letter
Readers,

Two variables 'M', 'T', each contain a column of numbers.

Have tried to create a derivative function to see how 'M' varies with
respect to 'T':

dm<-D(m)(dm/dt)~dt
dm(m=M,t=T)

but R returns an error:

Error: could not find function "dm"

What is my mistake please?

--
R2151

__
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] function approx interpolation of time series data sets

2013-01-16 Thread e-letter
Readers,

Am trying to use the function 'approx' to interpolate time series data sets:

data1:
01:23:40 5
01:23:45 10
01:23:50 12
01:23:55 7

data2:
01:23:42
01:23:47
01:23:51
01:23:54

The objective is to obtain interpolated values of 'data1' column 2 (5,
10, 12, 7) for the times shown in data2. Tried the following command
but received the error shown:

data3<-approx(data1,xout=data2)
Error in approx(data1, xout = data2) :
  (list) object cannot be coerced to type 'double'

What is my mistake please?

--
r2151

__
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 strptime handle milliseconds or AM/PM?

2013-01-17 Thread e-letter
Readers,

Responding to an old post
(http://tolstoy.newcastle.edu.au/R/e2/help/07/06/18850.html), and
using the example in the manual:

monthextract<-strptime("20/2/06 11:16:16.683", "%m")
monthextract
[1] NA

Why is the result 'NA' and not '2'?

--
r2151

__
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] function approx interpolation of time series data sets

2013-01-18 Thread e-letter
On 16/01/2013, Rui Barradas  wrote:
> Hello,
>
> Like this?
>
>
> data1 <- read.table(text = "
> 01:23:40 5
> 01:23:45 10
> 01:23:50 12
> 01:23:55 7
> ")
>
> data2 <- read.table(text = "
> 01:23:42
> 01:23:47
> 01:23:51
> 01:23:54
> ")
>
> approx(as.POSIXct(data1$V1, format = "%H:%M:%S"), y = data1$V2, xout =
> as.POSIXct(data2$V1, format = "%H:%M:%S"))
>

Thanks. I have later realised that if data frames are unequal (i.e. data2edit

01:23:42
01:23:47
01:23:51
01:23:54
01:23:58
01:23:59

the result for 'y' is

$y
[1] NA NA NA NA NA NA

Similar error occurs with the 'zoo' package.

Is it better to do interpolation/further manipulation in another software tool?

__
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] function approx interpolation of time series data sets

2013-01-18 Thread e-letter
On 18/01/2013, Gabor Grothendieck  wrote:
> On Fri, Jan 18, 2013 at 7:31 AM, e-letter  wrote:
>> On 16/01/2013, Rui Barradas  wrote:
>>> Hello,
>>>
>>> Like this?
>>>
>>>
>>> data1 <- read.table(text = "
>>> 01:23:40 5
>>> 01:23:45 10
>>> 01:23:50 12
>>> 01:23:55 7
>>> ")
>>>
>>> data2 <- read.table(text = "
>>> 01:23:42
>>> 01:23:47
>>> 01:23:51
>>> 01:23:54
>>> ")
>>>
>>> approx(as.POSIXct(data1$V1, format = "%H:%M:%S"), y = data1$V2, xout =
>>> as.POSIXct(data2$V1, format = "%H:%M:%S"))
>>>
>>
>> Thanks. I have later realised that if data frames are unequal (i.e.
>> data2edit
>>
>> 01:23:42
>> 01:23:47
>> 01:23:51
>> 01:23:54
>> 01:23:58
>> 01:23:59
>>
>> the result for 'y' is
>>
>> $y
>> [1] NA NA NA NA NA NA
>>
>> Similar error occurs with the 'zoo' package.
>
>
> its not clear precisely what you tried with zoo but have a look at this:
>
>> data1 <- "
> +  01:23:40 5
> +  01:23:45 10
> +  01:23:50 12
> +  01:23:55 7"
>>
>> data2 <- "
> +  01:23:42
> +  01:23:47
> +  01:23:51
> +  01:23:54"
>>
>> library(zoo)
>> library(chron)
>> z1 <- read.zoo(text = data1, FUN = times)
>> z2 <- read.zoo(text = data2, FUN = times)
>> na.approx(z1, xout = time(z2))
> 01:23:42 01:23:47 01:23:51 01:23:54
>  7.0 10.8 11.0  8.0
>

With respect to zoo package, looks like I tried to apply zoo package
to the vectors directly, not converting them to zoo objects using
'read.zoo ...'.

__
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] function approx interpolation of time series data sets

2013-01-18 Thread e-letter
On 18/01/2013, Gabor Grothendieck  wrote:
> On Fri, Jan 18, 2013 at 7:31 AM, e-letter  wrote:
>> On 16/01/2013, Rui Barradas  wrote:
>>> Hello,
>>>
>>> Like this?
>>>
>>>
>>> data1 <- read.table(text = "
>>> 01:23:40 5
>>> 01:23:45 10
>>> 01:23:50 12
>>> 01:23:55 7
>>> ")
>>>
>>> data2 <- read.table(text = "
>>> 01:23:42
>>> 01:23:47
>>> 01:23:51
>>> 01:23:54
>>> ")
>>>
>>> approx(as.POSIXct(data1$V1, format = "%H:%M:%S"), y = data1$V2, xout =
>>> as.POSIXct(data2$V1, format = "%H:%M:%S"))
>>>
>>
>> Thanks. I have later realised that if data frames are unequal (i.e.
>> data2edit
>>
>> 01:23:42
>> 01:23:47
>> 01:23:51
>> 01:23:54
>> 01:23:58
>> 01:23:59
>>
>> the result for 'y' is
>>
>> $y
>> [1] NA NA NA NA NA NA
>>
>> Similar error occurs with the 'zoo' package.
>
>
> its not clear precisely what you tried with zoo but have a look at this:
>
>> data1 <- "
> +  01:23:40 5
> +  01:23:45 10
> +  01:23:50 12
> +  01:23:55 7"
>>
>> data2 <- "
> +  01:23:42
> +  01:23:47
> +  01:23:51
> +  01:23:54"
>>
>> library(zoo)
>> library(chron)
>> z1 <- read.zoo(text = data1, FUN = times)
>> z2 <- read.zoo(text = data2, FUN = times)
>> na.approx(z1, xout = time(z2))
> 01:23:42 01:23:47 01:23:51 01:23:54
>  7.0 10.8 11.0  8.0
>

Latest error:

> data1
V1 V2
1 01:23:40  5
2 01:23:45 10
3 01:23:50 12
4 01:23:55  7

> data2
V1
1 01:23:42
2 01:23:47
3 01:23:51
4 01:23:54
5 01:23:58
6 01:23:59

> data1zoo<-read.zoo(text=data1,FUN=times)
Error in textConnection(text) : invalid 'text' argument

> data2zoo<-read.zoo(text=data2,FUN=times)
Error in textConnection(text) : invalid 'text' argument

Then I tried to create objects differently:

data1zoo<-read.zoo('test1.txt',FUN=times)
> data1zoo
01:23:40 01:23:45 01:23:50 01:23:55
   5   10   127

data2zoo<-read.zoo('test2.txt',FUN=times)
> data2zoo

01:23:42
01:23:47
01:23:51
01:23:54
01:23:58
01:23:59

> data3<-(na.approx(merge(data1zoo,data2zoo),time(data1zoo)))
Error in na.approx.default(object, x = x, xout = xout, na.rm = FALSE,  :
  x and index must have the same length

__
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] remove margin between plot and axis

2013-01-29 Thread e-letter
Readers,

Am trying to plot a graph with type 'h' and want to remove the white
space between the plot lines and the x axis. The help section 'par'
suggests that the option 'mai' controls this feature, but the syntax

plot(...mai=c(0,1,1))

is ineffective

Any advice please?

--
r2151

__
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] remove margin between plot and axis

2013-01-29 Thread e-letter
On 29/01/2013, Pascal Oettli  wrote:
> Hi,
>
> Please provide a reproducible example.
>

test<-seq(10:50)
plot(test,type='h',mai=c(0,1,1))

Tried

plot(test,type='h',yaxs='i')

but this has the non-wanted effect of removing white space from
between the highest peak and the upper (top) axis

__
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] remove label from specific axis

2013-01-30 Thread e-letter
Readers,

For a graph plot instruction:

plot(seq(10:50),type='h',yaxt='n',yaxs='i',lab=c(20,2,2),xlab='x axis
label',bty='l',main='graph title')

how to remove y-axis label and keep the x-axis label?

_
r2151

__
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] convert 12 time stamp to 24 hour

2013-02-08 Thread e-letter
Readers,

For a 12 hour time stamp:

> testtime<-("2013-01-01 01:00:01 PM")
> testtime
[1] "2013-01-01 01:00:01 PM"
> testtime24hour<-strftime(testtime,'%H:%M:%S')
> testtime24hour
[1] "01:00:01"

how to convert to 24 hour format so that the object 'testtime24hour' is:

'13:00:01'

Thanks.

--
r2151

__
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] add data symbol to axis label

2013-02-08 Thread e-letter
Readers,

Is it possible to add a data symbol (e.g. pch='21') to an axis label?
The objective is to plot a graph with two (2) y-axes and the plotting
character for data set 1 is added to the label of y1 axis (left); plot
character for data set 2 is added to label of y2 (right) axis.

Thanks.

--
r2151

__
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] convert 12 time stamp to 24 hour

2013-02-11 Thread e-letter
On 08/02/2013, e-letter  wrote:
> Readers,
>
> For a 12 hour time stamp:
>
>> testtime<-("2013-01-01 01:00:01 PM")
>> testtime
> [1] "2013-01-01 01:00:01 PM"
>> testtime24hour<-strftime(testtime,'%H:%M:%S')
>> testtime24hour
> [1] "01:00:01"
>

Have realised that the object is of type 'character'. When this
conversion is applied to a vector and then the 'plot' function applied
(i.e. plot another vector against the vector of 24-hour time series
values), receive an error.

How to convert the values "01:00:01" to 'ts' objects?

__
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] convert 12 time stamp to 24 hour

2013-02-11 Thread e-letter
Readers,

Have since tried to plot converted 24 hour data:

testtimedataset
V1
1 13:01:41
2 13:02:10
3 13:02:38
4 13:03:05
5 13:03259

> testdata<-seq(1:5)
> plot(testdata~testtimedataset)
Error in function (formula, data = NULL, subset = NULL, na.action = na.fail,  :
  invalid type (list) for variable 'testtimedataset'

Was expecting to see a graph with ordinate values 1:5 for the time
series values on the abscissa. What is the mistake please?

--
r2151

__
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] convert 12 time stamp to 24 hour

2013-02-11 Thread e-letter
On 11/02/2013, PIKAL Petr  wrote:
>
> str(testtimedataset)

With my real data set, revealed that after conversion, the time series
data consists of 'chr' which I guess means character type data,
reporting the following error:

Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf


Does this mean I must convert the 24-hour time series values to
POSIX*t type objects; if so how please?
>
> Anyway, by
>
> plot(testdata~testtimedataset$V1)
>
> you will get rid of error message but depending on testtimedataset mode you
> can get different one.
>

Confirmed, thanks.

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


[R] approxfun values

2013-02-14 Thread e-letter
Readers,

According to the help '?approxfun', the function can be used to obtain
the interpolated values. The following test was tried:

> testinterpolation<-read.csv('test.csv',header=FALSE)
> testinterpolation
V1 V2
1   10  2
2   20 NA
3   30  5
4   40  7
5   50 NA
6   60 NA
7   70  2
8   80  6
9   90  9
10 100 NA
> testinterpolationvalues<-approxfun(testinterpolation,y=NULL)
> testinterpolationvalues
function (v)
.C(C_R_approxfun, as.double(x), as.double(y), as.integer(n),
xout = as.double(v), as.integer(length(v)), as.integer(method),
as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE,
PACKAGE = "stats")$xout


> testinterpolationvalues<-approx(testinterpolation,y=NULL)
> testinterpolationvalues
$x
 [1] 10.0 11.63265 13.26531 14.89796 16.53061 18.16327 19.79592 21.42857
 [9] 23.06122 24.69388 26.32653 27.95918 29.59184 31.22449 32.85714 34.48980
[17] 36.12245 37.75510 39.38776 41.02041 42.65306 44.28571 45.91837 47.55102
[25] 49.18367 50.81633 52.44898 54.08163 55.71429 57.34694 58.97959 60.61224
[33] 62.24490 63.87755 65.51020 67.14286 68.77551 70.40816 72.04082 73.67347
[41] 75.30612 76.93878 78.57143 80.20408 81.83673 83.46939 85.10204 86.73469
[49] 88.36735 90.0

$y
 [1] 2.00 2.244898 2.489796 2.734694 2.979592 3.224490 3.469388 3.714286
 [9] 3.959184 4.204082 4.448980 4.693878 4.938776 5.244898 5.571429 5.897959
[17] 6.224490 6.551020 6.877551 6.829932 6.557823 6.285714 6.013605 5.741497
[25] 5.469388 5.197279 4.925170 4.653061 4.380952 4.108844 3.836735 3.564626
[33] 3.292517 3.020408 2.748299 2.476190 2.204082 2.163265 2.816327 3.469388
[41] 4.122449 4.775510 5.428571 6.061224 6.551020 7.040816 7.530612 8.020408
[49] 8.510204 9.00

How to obtain a vector consisting _only_ of the interpolated values?

It was expected that 'approx' would return both original and
interpolated values (which the above shows) and that 'approxfun' would
not show the original values.

--
r2151

__
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 custom x axis ticks values

2013-02-14 Thread e-letter
Readers,

For this data set:

testvalues<-c(10,20,30,40)

How to amend the plot instruction:

plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')

so that x axis ticks labels can be added to existing graph with
arbitrary value such as 0,100,200,300)?

Thanks in advance.

--
r2151

__
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 custom x axis ticks values

2013-02-14 Thread e-letter
On 14/02/2013, PIKAL Petr  wrote:
> Hi
>
> much quicker and better for you is to inspect help pages.
>
> ?axis
>
> axis(1, at=1:4, labels=c(letters[1:4]))

Had tried, but noticed that the labels created were not positioned
equally across the entire axis, but occupied about 50 % (the left
half) of the axis. How to change this 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.


Re: [R] plot custom x axis ticks values

2013-02-15 Thread e-letter
On 14/02/2013, MacQueen, Don  wrote:
>> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
>> par()$usr
> [1]  0.88  4.12  8.80 41.20
>
> The x axis range is from 0.88 to 4.12, so tick labels at 0, 100, 200, 300
> makes no sense.
>

True per se, but the purpose of the tick labels is to indicate
approximate correlation with another data set.

__
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 custom x axis ticks values

2013-02-15 Thread e-letter
On 15/02/2013, Jim Lemon  wrote:
> On 02/14/2013 09:41 PM, e-letter wrote:
>> Readers,
>>
>> For this data set:
>>
>> testvalues<-c(10,20,30,40)
>>
>> How to amend the plot instruction:
>>
>> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
>>
>> so that x axis ticks labels can be added to existing graph with
>> arbitrary value such as 0,100,200,300)?
>>
> Hi r2151,
> If you want the labels to fit on the axis you will have to include this
> information in the call to "plot":
>
> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n',ylim=c(0,300))
> axis(2,at=c(0,100,200,300))
>

plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n',xlim=c(0,300))
axis(1,at=c(0,100,200,300))

The use of 'xlim' makes the graph unacceptable. Instead, it would be
better to plot:

plot(testvalues,ann=FALSE,type='l',yaxt='n')

The x-axis shows tick marks '1.0', '1.5', ...

It is required to replace these values with custom values (e.g. 10, 20... etc.)

__
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 custom x axis ticks values

2013-02-15 Thread e-letter
On 15/02/2013, Duncan Murdoch  wrote:
> On 13-02-15 3:28 AM, e-letter wrote:
>> On 15/02/2013, Jim Lemon  wrote:
>>> On 02/14/2013 09:41 PM, e-letter wrote:
>>>> Readers,
>>>>
>>>> For this data set:
>>>>
>>>> testvalues<-c(10,20,30,40)
>>>>
>>>> How to amend the plot instruction:
>>>>
>>>> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n')
>>>>
>>>> so that x axis ticks labels can be added to existing graph with
>>>> arbitrary value such as 0,100,200,300)?
>>>>
>>> Hi r2151,
>>> If you want the labels to fit on the axis you will have to include this
>>> information in the call to "plot":
>>>
>>> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n',ylim=c(0,300))
>>> axis(2,at=c(0,100,200,300))
>>>
>>
>> plot(testvalues,ann=FALSE,type='l',yaxt='n',xaxt='n',xlim=c(0,300))
>> axis(1,at=c(0,100,200,300))
>>
>> The use of 'xlim' makes the graph unacceptable. Instead, it would be
>> better to plot:
>>
>> plot(testvalues,ann=FALSE,type='l',yaxt='n')
>>
>> The x-axis shows tick marks '1.0', '1.5', ...
>>
>> It is required to replace these values with custom values (e.g. 10, 20...
>> etc.)
>
> Why not rescale the values before plotting, and use the automatic ticks?
>   You can lie about the user scale, but it doesn't always give a helpful
> plot, e.g.
>
> axis(1, at=1:4, labels=c(100, 300, 400, 200))
>

Tried, but realised that this works when the vectors for 'at' and
'labels' are equal size. For a data set of e.g. 10 values, syntax
error returns.

__
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] mtext unicode failure

2013-02-18 Thread e-letter
Readers,

How to solve this unicode input error please?

> postscript("~/tmp/test.eps",width=100/25.4,height=100/25.4,horizontal=FALSE,onefile=TRUE,paper="special")
> testx<-seq(1:5)
> testy<-seq(1:5)
> plot(testy~testx)
> mtext('text (O₂)\n more text',side=3,line=1)
Warning messages:
1: In mtext("text (O₂)\n more text", side = 3, line = 1) :
  conversion failure on 'text (O₂)' in 'mbcsToSbcs': dot substituted for 
2: In mtext("text (O₂)\n more text", side = 3, line = 1) :
  conversion failure on 'text (O₂)' in 'mbcsToSbcs': dot substituted for <82>
3: In mtext("text (O₂)\n more text", side = 3, line = 1) :
  conversion failure on 'text (O₂)' in 'mbcsToSbcs': dot substituted for <82>
4: In mtext("text (O₂)\n more text", side = 3, line = 1) :
  conversion failure on 'text (O₂)' in 'mbcsToSbcs': dot substituted for 
5: In mtext("text (O₂)\n more text", side = 3, line = 1) :
  conversion failure on 'text (O₂)' in 'mbcsToSbcs': dot substituted for <82>
6: In mtext("text (O₂)\n more text", side = 3, line = 1) :
  conversion failure on 'text (O₂)' in 'mbcsToSbcs': dot substituted for <82>

If the command to print to postscript is omitted, a graph is viewed
successfully, with the title text:

text(O₂)
more text

Thanks.

--
r2151

__
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] mtext unicode failure

2013-02-19 Thread e-letter
On 19/02/2013, r-help-requ...@r-project.org
 wrote:
> --
>
> Message: 22
> Subject: Re: [R] mtext unicode failure
>
> On 18/02/2013 14:15, e-letter wrote:
>> Readers,
>>
>> How to solve this unicode input error please?
>
> On what system, in what locale?  And where is Unicode mentioned?
>

GNU/Linux; obtained locale settings like so:

Sys.localeconv()
decimal_point thousands_sep  grouping   int_curr_symbol
  ".""""""GBP "
  currency_symbol mon_decimal_point mon_thousands_sep  mon_grouping
  "£"   "."   ",""\003\003"
positive_sign negative_sign   int_frac_digits   frac_digits
   ""   "-"   "2"   "2"
p_cs_precedesp_sep_by_space n_cs_precedesn_sep_by_space
  "1"   "0"   "1"   "0"
  p_sign_posn   n_sign_posn
  "1"   "1"

The unicode was in the 'mtext...' command, but it seems that the
mailing list server does not accept UTF-8. Tried to set this encoding:

postscript([filename],encoding='UTF-8',...)
Error in postscript([filename], encoding = "UTF-8",  :
  failed to load encoding file in postscript()
In addition: Warning message:
In postscript([filename], encoding = "UTF-8",  :
  failed to load encoding file 'UTF-8'

> If you intended a subscript 2, use plotmath. That is not a character in
> the standard Postscript fonts, nor is in the encoding you selected.  We
> don't know what that is since it depends on your locale: see ?postscript.
>
> Or use the cairo_ps device.

Thanks, the result is adequate, although the position of the subscript
doesn't look pleasing personally.

__
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] create vector from indices interpolated values

2013-03-06 Thread e-letter
Readers,

Is it possible to create a plot command based upon the indices of
missing values in a data set?

dataset1<-read.table(text='
10 2
20 NA
30 5
40 7
50 NA
60 NA
70 2
80 6
90 NA
100 9
')

dataset2<-read.table(text='
0.2
0.4
0.1
0.9
0.2
0.3
1.1
0.7
0.9
0.6
0.4
')

The 'approx' function is used to obtain the interpolated values for
'NA' in dataset1.

dataset1interpolatedvalues<-approx(dataset1,y=NULL,xout=dataset1$V1[is.na(dataset1$V2)])

dataset1interpolatedvalues
$x
[1] 20 50 60 90

$y
[1] 3.50 5.33 3.67 7.50

x<-dataset1interpolatedvalues$y

How to create a vector 'y' by selecting the values in 'dataset2' using
the indices equivalent to interpolated values in 'dataset1' (i.e.
indices 2, 5, 6, 9 in dataset1)? The result of creating 'y' should be

y
0.4
0.2
0.3
0.9

Then the desired plot would be

plot(y~x)

Thanks.

--
r2151

__
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] create function to solve derivative

2012-11-16 Thread e-letter
On 16/11/2012, Rolf Turner  wrote:
>
> Your question makes little sense.  Functions have derivatives --- at
> least some of them do.  Data sets do not have derivatives.  The
> functions D(), deriv() etc. work on specified analytic expressions
> for functions --- data sets do not come into the picture.
>

Is the following procedure correct:

Plot data from data set.

Suppose the resultant graph was linear. The function could be y=mx+c,
so the R function 'lm' could be applied to fit a linear line.

The example in the manual for the help file '?D' shows:

dx2x <- deriv(~ x^2, "x") ; dx2x

So for this example it would be correct to write:

functionname<-deriv(~mx+c,"x");dx2x

What is the significance of ';dx2x'? It would be appreciated to be
referred to the relevant manual sections, thanks.

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


[R] apply calculations to elements in a vector

2012-11-16 Thread e-letter
Readers,

If a vector consists of:

10
20
30

how to create a new vector based upon the results of calculations to
the elements, e.g. addition of successive elements, so that a new
vector would be:

30
50

i.e. 10+20, then 20+30, etc.?

__
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] column name prefix 'x' after data import via read.delim

2012-11-23 Thread e-letter
Readers,

The function 'read.delim' was used to import data into R:

columnnamea columnnameb columnnamec
1 2 3
2 3 4
3 4 5

After import, the column names were:

X.columnnamea columnnameb columnnamec

Why did this occur?

--
r2151

__
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] remove last row of a data frame

2012-12-11 Thread e-letter
Readers,

For a data set 'a':

1
2
3
4

Please what is the syntax to remove the last row and create a new object 'b':

1
2
3

Thanks.

--
R2151

__
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] remove last row of a data frame

2012-12-12 Thread e-letter
On 12/12/2012, Daniel Nordlund  wrote:
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
>> On Behalf Of e-letter
>> Sent: Tuesday, December 11, 2012 11:45 PM
>> To: r-help@r-project.org
>> Subject: [R] remove last row of a data frame
>>
>> Readers,
>>
>> For a data set 'a':
>>
>> 1
>> 2
>> 3
>> 4
>>
>> Please what is the syntax to remove the last row and create a new object
>> 'b':
>>
>> 1
>> 2
>> 3
>>
>> Thanks.
>>
>
> If by data set a you mean a data frame called a, then something like this
> should work:
>
> b <- a[-nrow(a),]
>
> If you haven't already read the manual, "An Introduction to R", that ships
> with every copy of R, then now is the time.
>

Thanks, couldn't find quickly the relevant section in the html
document, but within R, the command 'nrow' is relevant.

__
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] abbreviate function using 'with'

2014-02-13 Thread e-letter
Readers,

A csv file was created:

column1,column2,column3,column4
1,10,3,2
2,20,6,4
3,30,12,16
4,40,24,256

The csv was imported:

testcsv<-read.csv('/path/to/test.csv')
testsum<-testcsv[2,2]+testcsv[2,3]+testcsv[2,4]

What is the correct syntax to abbreviate the following command using
the function 'with', to avoid repetitive use of the declaration
'testcsv'? Tried the following, but received the error shown:

with(testcsv,testsum<-[2,2]+[2,3]+[2,4])
Error: unexpected '[' in "with(testcsv,testsum<-["

and:

with(testcsv,{testsum<-[2,2]+[2,3]+[2,4]})
Error: unexpected '[' in "with(testcsv,{testsum<-["

__
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] abbreviate function using 'with'

2014-02-13 Thread e-letter
On 13/02/2014, Rolf Turner  wrote:
>
> What you've written is simply not (anything like!) R syntax.  You should
> learn to speak R if you are going to use R.
>

Agree; was reviewing the help text examples invoked by '?with'.

> In this particular instance
>
>   testsum <- sum(testcsv[2,2:4])
>
> should give what you want.   The use of with() is uncalled for in this
> context.  The with() function allows you to refer to (e.g.) columns of
> a data frame by name, as if these columns were objects in your workspace
> ("global environment").  That is *not* what you are doing, or need to do
> here.
>

Forgive the example. The objective is to use the function 'with' to
refer to specific indices of a dataframe. In retrospect, the example
given was poor because actually, I want to understand the syntax to
specify particular indices within a single dataframe, without having
to state the dataframe repeatedly.

>
> P. S.:  Please read fortune("people who don't exist") and change your
> modus operandi.
>

Never heard of fortune, but understand the latin:
http://www.michaeleisen.org/blog/?p=1554

__
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] Use generalised additive model to plot curve

2010-12-14 Thread e-letter
Readers,

I have been reading 'the r book' by Crawley and think that the
generalised additive model is appropriate for this problem. The
package 'gam' was installed using the command (as root)

install.package("gam")
...
library(gam)

> library(gam)
Loading required package: splines
Loading required package: akima
> library(mgcv)
This is mgcv 1.3-25

Attaching package: 'mgcv'


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

 gam,
 gam.control,
 gam.fit,
 plot.gam,
 predict.gam,
 s,
 summary.gam

> x<-c(30,50,80,90,100)
> y<-c(160,180,250,450,300)
> model<-gam(y~s(x))
Error in smooth.construct.tp.smooth.spec(object, data, knots) :
A term has fewer unique covariate combinations than specified
maximum degrees of freedom

The objective is to plot y against x, finally to produce a graph with
a smooth curve (and then remove the data points). What is my mistake
please?

yours,

r251
gnu/linux mandriva2008

__
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] dotchart for matrix data

2010-12-18 Thread e-letter
Readers,

I am trying to use the function dotchart. The data is:

> testdot
  category values1 values2 values3 values4
1a  10  27  56 709
2b   4  46  47 208
3c   5  17  18 109
4d   6  50  49 308

The following error occurs

> dotchart(testdot,groups=testdot[,2])
Error in dotchart(testdot, labels = testdot[, 1], groups = testdot[, 2]) :
'x' must be a numeric vector or matrix

According to my understanding (clearly wrong!) of the documentation
for dotchart (accessed from the manual in section 'graphics'), columns
of data can be selected by 'groups' for subsequent plotting. The
objective is to be able to create a dot chart where each row is
labelled according to the row names in the 'category' column and two
columns can be selected, e.g. 'values1' and 'values2'. Then I tried:

> testdot1<-testdot[,1]
> testdot2<-testdot[,2]
> testdot3<-testdot[,3]
> dotchart(c(testdot2,testdot3),labels=testdot1)

A graph is produced, but not as expected. Instead of 4 rows labelled
(descending order from top row) a,b,c,d, and each row containing two
data points, the graph shows 8 rows (?) with the top 4 rows
un-labelled and the bottom 4 rows labelled (descending order) d,c,b,a
and each row shows only 1 datum point.

How do I specify the order of labelling of the rows?
How do I write correct commands to obtain a dot chart with 4 rows,
each row containing the two (or if required three) data points?

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


Re: [R] dotchart for matrix data

2010-12-18 Thread e-letter
On 18/12/2010, David Winsemius  wrote:
>
> On Dec 18, 2010, at 7:01 AM, e-letter wrote:
>
>> Readers,
>>
>> I am trying to use the function dotchart. The data is:
>>
>>> testdot
>>  category values1 values2 values3 values4
>> 1a  10  27  56 709
>> 2b   4  46  47 208
>> 3c   5  17  18 109
>> 4d   6  50  49 308
>>
>> The following error occurs
>>
>>> dotchart(testdot,groups=testdot[,2])
>> Error in dotchart(testdot, labels = testdot[, 1], groups = testdot[,
>> 2]) :
>>'x' must be a numeric vector or matrix
>>
>> According to my understanding (clearly wrong!) of the documentation
>> for dotchart (accessed from the manual in section 'graphics'), columns
>> of data can be selected by 'groups' for subsequent plotting.
>
> The misunderstanding is in how you see the grouping information versus
> how R expects it. R generally expects such data in what is called
> "long" format, i.e. there will be one values columns and a category
> column. There are various ways to change the arrangement of your data.
> The function stack(), the function reshape(), or probably most
> commonly the function melt from reshape2 being the typical chosen
> routes.
>

Reshape and melt are not installed (version251) so for this task
manual rearrangement data is easier.

> require(reshape)
Loading required package: reshape
[1] FALSE
Warning message:
there is no package called 'reshape' in: library(package, lib.loc =
lib.loc, character.only = TRUE, logical = TRUE,
> library(reshape)
Error in library(reshape) : there is no package called 'reshape'
> mdot<-melt(dot)
Error: could not find function "melt"

However before doing so why this is relevant because of the
alternative creation objects 'testdot1'. Aren't these objects
suitable, since a (undesireable) graph was produced?

>> The
>> objective is to be able to create a dot chart where each row is
>> labelled according to the row names in the 'category' column and two
>> columns can be selected, e.g. 'values1' and 'values2'. Then I tried:
>>
>>> testdot1<-testdot[,1]
>>> testdot2<-testdot[,2]
>>> testdot3<-testdot[,3]
>>> dotchart(c(testdot2,testdot3),labels=testdot1)
>
> See if this is more to your liking:
>
> require(reshape)   # I'm not sure why I have reshape_0.8.3 rather than
> reshape2 loaded
> # I'm pretty sure Hadley would prefer that people
> use pkg:reshape2
>   mdot <- melt(dot)
> dotchart(mdot$value, groups=mdot$category, labels=mdot$variable)
> # OR more readable
> with(mdot, dotchart(value, groups=category, labels=variable)  )
>
> I'm not sure I got the roles of "values" and "category" correct, but
> it should be a simple matter to switch them in the dotcghart call if
> that is your pleasuRe.
>

I don't have dotcghart either.

__
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] dotchart for matrix data

2010-12-18 Thread e-letter
>Ben Bolker
>Sat, 18 Dec 2010 07:07:24 -0800
>David Winsemius  comcast.net> writes:
>
>>
>>
>> On Dec 18, 2010, at 7:01 AM, e-letter wrote:
>>
>> > Readers,
>> >
>> > I am trying to use the function dotchart. The data is:
>> >
>> >> testdot
>> >  category values1 values2 values3 values4
>> > 1a  10  27  56 709
>> > 2b   4  46  47 208
>> > 3c   5  17  18 109
>> > 4d   6  50  49 308
>> >
>> > The following error occurs
>> >
>> >> dotchart(testdot,groups=testdot[,2])
>> > Error in dotchart(testdot, labels = testdot[, 1], groups = testdot[,
>> > 2]) :
>> >'x' must be a numeric vector or matrix
>> >
>> > According to my understanding (clearly wrong!) of the documentation
>> > for dotchart (accessed from the manual in section 'graphics'), columns
>> > of data can be selected by 'groups' for subsequent plotting.
>>
>
>  Following up on David's response:
>
>
>d <- read.table(textConnection("category values1 values2 values3 values4
>1a  10  27  56 709
>2b   4  46  47 208
>3c   5  17  18 109
>4d   6  50  49 308"),
>header=TRUE)
>
>## Something like this is probably as close as you can get with
>## stock 'dotchart' -- it does *not* (as far as I can tell) put
>## different points on the same line, just groups lines
>

I am trying to create a chart like this
(http://www.b-eye-network.com/images/content/Fig4_3.jpg); so this is
not possible using R?

>dotchart(as.matrix(d[,-1]),labels=as.character(d[,1]))
>dotchart(as.matrix(d[,c("values1","values2")]),labels=as.character(d[,1]))
>
>## reshaping data:
>library(reshape)
>mdot <- melt(d)
>
>## using the lattice package
>
>library(lattice)
>dotplot(value~category,groups=variable,data=mdot)
>dotplot(value~variable,groups=category,data=mdot,auto.key=TRUE,
>scales=list(y=list(log=10)))
>
>## you could also use ggplot2 ...

> ?ggplot2

No documentation for 'ggplot2' in specified packages and libraries:
you could try 'help.search("ggplot2")'; seems I need to retrieve this
package first. Thanks for the suggestion.

__
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] dotchart for matrix data

2010-12-18 Thread e-letter
On 18/12/2010, Peter Ehlers  wrote:
> On 2010-12-18 07:50, e-letter wrote:
>>> Ben Bolker
>>> Sat, 18 Dec 2010 07:07:24 -0800
>
> [... snip ...]
>
>> I am trying to create a chart like this
>> (http://www.b-eye-network.com/images/content/Fig4_3.jpg); so this is
>> not possible using R?
>
> That looks an awful lot like what lattice's dotplot would
> produce. So: have you tried dotplot() as Ben has suggested?
>

Unfortunately I have been unable to use the "melt" package; 3 mirrors
have failed to install. What I don't understand is why the objects
created are not in the correct format, otherwise how would the plot be
created?

__
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] dotchart for matrix data

2010-12-18 Thread e-letter
On 18/12/2010, Peter Ehlers  wrote:
> On 2010-12-18 07:50, e-letter wrote:
>>> Ben Bolker
>>> Sat, 18 Dec 2010 07:07:24 -0800
>
> [... snip ...]
>
>> I am trying to create a chart like this
>> (http://www.b-eye-network.com/images/content/Fig4_3.jpg); so this is
>> not possible using R?
>
> That looks an awful lot like what lattice's dotplot would
> produce. So: have you tried dotplot() as Ben has suggested?
>

For the benefit of other novices, this is what I did (gnu/linux):

sign-in to a command terminal as root
start R
install.packages("reshape2")

In another terminal as normal user

require(reshape2)
mdot<-melt(testdot)
dotplot(value~category,groups=variable,data=mdot)

The resultant graph shows the categories on the abscissa and there
does not seem to be a way of selecting two columns from the original
matrix. It is not like the graph cited in the hyperlink quoted above,
but at least I have successfully followed instructions!

I changed the axes with the command:

dotplot(category~value,groups=variable,data=mdot)

I believe there is a command to select only certain rows of data which
I think will achieve the desired graph, if unable I'll ask again, so
thank you all.

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


Re: [R] dotchart for matrix data

2010-12-20 Thread e-letter
On 18/12/2010, e-letter  wrote:
> On 18/12/2010, Peter Ehlers  wrote:
>> On 2010-12-18 07:50, e-letter wrote:
>>>> Ben Bolker
>>>> Sat, 18 Dec 2010 07:07:24 -0800
>>
>> [... snip ...]
>>
>>> I am trying to create a chart like this
>>> (http://www.b-eye-network.com/images/content/Fig4_3.jpg); so this is
>>> not possible using R?
>>
>> That looks an awful lot like what lattice's dotplot would
>> produce. So: have you tried dotplot() as Ben has suggested?
>>
>

If one set of value ranges for 10-20 and another set ranges form
1000-1500, how to adjust the graph such that:

with categories on the ordinate (y-axis), can the bottom abscissa
(x-axis bottom) be set with a scale suitable for the data set of range
1000-1500?
can the top abscissa (x-top) be set with a scale 10-20?
or is it better practice to change the scale of the data set 1000-1500
by two orders of magnitude?
how is it possible to control the order of the category variables? For
example, if the graph shows:

a
b
c
d

Is it possible to change to

a
d
b
c

Thanks

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


Re: [R] dotchart for matrix data

2010-12-22 Thread e-letter
On 20/12/2010, e-letter  wrote:
> On 18/12/2010, e-letter  wrote:
>> On 18/12/2010, Peter Ehlers  wrote:
>>> On 2010-12-18 07:50, e-letter wrote:
>>>>> Ben Bolker
>>>>> Sat, 18 Dec 2010 07:07:24 -0800
>>>
>>> [... snip ...]
>>>
>>>> I am trying to create a chart like this
>>>> (http://www.b-eye-network.com/images/content/Fig4_3.jpg); so this is
>>>> not possible using R?
>>>
>>> That looks an awful lot like what lattice's dotplot would
>>> produce. So: have you tried dotplot() as Ben has suggested?
>>>
>>
>

A csv file is imported:

> testdot
  category values
1a 10
2b 44
3c 51
4d 65
5a 27
6b 64
7c 71
8d 49

A dotplot is produced with the command:

dotplot(category~values,data=testdot)

The csv file is adjusted to move the values of 'a':

> testdot
  category values
1b 44
2c 51
3d 65
4a 10
5b 64
6c 71
7d 49
8a 27

Why  does the order of the categories not change from d,c,b,a to
a,d,c,b (descending from top)?

__
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] dotchart for matrix data

2011-01-05 Thread e-letter
Readers,

The following commands were applied, to create a dot chart with black
dots and blue squares for data:

> library(lattice)
> testdot
  category values
1b 44
2c 51
3d 65
4a 10
5b 64
6c 71
7d 49
8a 27

dotplot(category~values,col=c("black","black","black","black","blue","blue","blue","blue"),bg=c("black","black","black","black","blue","blue","blue","blue"),pch=c(21,21,21,21,22,22,22,22),xlab=NULL,
data=testdot)

The resultant graph shows correctly coloured points, but not filled,
only the border is coloured. The documentation for the command 'pch'
(?pch) indicates that the commands shown above should show
appropriately coloured solid symbols. What is causing this error
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] percentage sign in expression

2010-08-24 Thread e-letter
Readers,

According to the documentation for the function 'plotmath' there is no
apparent possibility to add the percent sign (%) to a plot function,
e.g.

plot(a[,1]~b[,2],ylab=expression(x~%),xlab=expression(z))

How to achieve this please?

yours,

rh...@conference.jabber.org
r251
mandriva2009

__
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] percentage sign in expression

2010-08-24 Thread e-letter
On 24/08/2010, Henrique Dallazuanna  wrote:
> You've tried:
>
> plot(a[,1]~b[,2],ylab=expression(x~'%'),xlab=expression(z)) ?
>
This is successful for me, thank you. This instruction should be added
to the documentation for 'plotmath'.

__
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] percentage sign in expression

2010-08-25 Thread e-letter
On 24/08/2010, David Winsemius  wrote:
>
> On Aug 24, 2010, at 9:37 AM, e-letter wrote:
>
>> Readers,
>>
>> According to the documentation for the function 'plotmath' there is no
>> apparent possibility to add the percent sign (%) to a plot function,
>
> Where did you see an assertion made???
>
Within R I entered the command:

?plotmath

Also accessed using:

help.start(browser="opera")

Navigating the web browser page:

packages
packages in /usr/lib/R/library
grdevices
plotmath

In the list headed 'syntax' and 'meaning' within the section 'details'.

>> e.g.
>>
>> plot(a[,1]~b[,2],ylab=expression(x~%),xlab=expression(z))
>
>
>>
>> How to achieve this please?
>
> Read the plotmath helo page more carefully. The section immediatedly
> below the plotmath expressions points you to the use of the symbol()
> expression-function and to the points help page where generation of
> the available glyphs proceeds according to the advice on help(plotmath):
>
In my system the paragraph immediately after the list of features
(i.e. 'syntax','meaning') describes a note to TeX users. I cannot see
reference to 'symbol()'.

>  > TestChars <- function(sign=1, font=1, ...)
> + {
> +if(font == 5) { sign <- 1; r <- c(32:126, 160:254)
> +} else if (l10n_info()$MBCS) r <- 32:126 else r <- 32:255
> +if (sign == -1) r <- c(32:126, 160:255)
> +par(pty="s")
> +plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
> + xaxs="i", yaxs="i")
> +grid(17, 17, lty=1)
> +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...))
> + }
>  > TestChars(font=5)
>
> Notice that the "%" sign is three characters to the right (i.e.
> higher) of the "forall" symbol that is produced by the example code

I can't see 'forall' in the code above.

> they offer. (The numbering proceeds from bottom up which confused me
> at first.)
>
What numbering?

The documentation makes reference to the command:

demo(plotmath)

I applied this command and could not see an instruction to produce the
percent (%) symbol.

__
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] percentage sign in expression

2010-08-26 Thread e-letter
>On Wed, 2010-08-25 at 09:32 +0100, e-letter wrote:
>> On 24/08/2010, David Winsemius  wrote:
>> >
>> > On Aug 24, 2010, at 9:37 AM, e-letter wrote:
>> >
>> >> Readers,
>> >>
>> >> According to the documentation for the function 'plotmath' there is no
>> >> apparent possibility to add the percent sign (%) to a plot function,
>> >
>> > Where did you see an assertion made???
>> >
>> Within R I entered the command:
>>
>> ?plotmath
>
>Surely you don't expect the R help pages to document everything that
>*isn't* possible with a given function? They'd be infinitely long! ;-)
>
No, following previous advice it would be preferable to add the
following (or similar) to the documentation:

'syntax' 'meaning'
...
'%' %
...

>What you meant to say was, "?plotmath doesn't show me how to add a %
>symbol to a plot. How do I do it?"
>
>> Also accessed using:
>>
>> help.start(browser="opera")
>>
>> Navigating the web browser page:
>>
>> packages
>> packages in /usr/lib/R/library
>> grdevices
>> plotmath
>>
>> In the list headed 'syntax' and 'meaning' within the section 'details'.
>>
>
>> >  > TestChars <- function(sign=1, font=1, ...)
>> > + {
>> > +if(font == 5) { sign <- 1; r <- c(32:126, 160:254)
>> > +} else if (l10n_info()$MBCS) r <- 32:126 else r <- 32:255
>> > +if (sign == -1) r <- c(32:126, 160:255)
>> > +par(pty="s")
>> > +plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
>> > + xaxs="i", yaxs="i")
>> > +grid(17, 17, lty=1)
>> > +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...))
>> > + }
>> >  > TestChars(font=5)
>> >
>> > Notice that the "%" sign is three characters to the right (i.e.
>> > higher) of the "forall" symbol that is produced by the example code
>>
>> I can't see 'forall' in the code above.
>
>You need to run it in R. Then you will see a plot of the glyphs
>available in the symbol font. 'forall' is a mathematical symbol:
>
>http://en.wikipedia.org/wiki/Table_of_mathematical_symbols
>
>> > they offer. (The numbering proceeds from bottom up which confused me
>> > at first.)
>> >
>> What numbering?
>
>The numbering of the glyphs so you can use the number to draw the symbol
>you want. They are on the plot. You did run the code provided by David?
>
I did not read any instruction that it was code to apply! Anyway,
below is the result:

> TestChars <- function(sign=1, font=1, ...)
+ + {
+ +if(font == 5) { sign <- 1; r <- c(32:126, 160:254)
+ +} else if (l10n_info()$MBCS) r <- 32:126 else r <- 32:255
Error: syntax error, unexpected '}' in:
"
"
> +if (sign == -1) r <- c(32:126, 160:255)
Error in sign == -1 : comparison (1) is possible only for atomic and list types
> +par(pty="s")
Error in +par(pty = "s") : invalid argument to unary operator
> +plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
+ + xaxs="i", yaxs="i")
Error: syntax error, unexpected EQ_ASSIGN, expecting ',' in "+
plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="","
> +grid(17, 17, lty=1)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
> +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...))
Error: object "r" not found
> + }
Error: syntax error, unexpected '}' in "+ }"
> TestChars(font=5)
Error: could not find function "TestChars"

__
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] percentage sign in expression

2010-08-26 Thread e-letter
>It's possible that my help page is different than yours. Right after
>the syntax/meaning description on mine (which is a Mac OSX system) is
>a paragraph:
>
>"The symbol font uses Adobe Symbol encoding so, for example, a lower
>case mu can be obtained either by the special symbol mu or by
>symbol("m"). This provides access to symbols that have no special
>symbol name, for example, the universal, or forall, symbol is
>symbol("\042"). To see what symbols are available in this way
>useTestChars(font=5) as given in the examples for points: some are
>only available on some devices."
>
>(In this case I would be surprised if the help pages were different
>because this makes a cross-reference to the examples in points.  I am
>not surprised about cross-platform differences in descriptions of
>graphical devices  and would have included a caveat if I were
>corresponding on rhelp about such. I suppose the font issues could be
>platform specific so if you want to correct me on this point, I will
>try to file it away. I did, however, give you the code needed to to
>display Symbols and it sounds further on that it succeeded)
>
I agree and seems that in this example that the documentation for
graphical devices is platform dependent. This should be stated in the
manual if not already. Please see previous post for the errors trying
to apply the commands provided.

__
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] accessing a data frame with row names

2010-05-31 Thread e-letter
Readers,

I have entered a file into r:

,column1,column2
row1,0.1,0.2
row2,0.3,0.4

using the command:

dataframe<-read.table("/path/to/file.csv",header=T,row.names=1)

When I try the command:

dataframe[,2]

I receive the response:

NULL

I was expecting:

row1 0.2
row2 0.4

What is my error with the syntax please?

Yours,

r251
mandriva2009

__
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] accessing a data frame with row names

2010-06-01 Thread e-letter
On 31/05/2010, Gabor Grothendieck  wrote:
> Use read.csv or read.table(..., sep = ",").  Also note that if you
> delete the first comma of the header (as in the second example below)
> you won't have to specify row.names since it can figure it out from
> the fact that there is one fewer column name than data fields.
>
>> Lines <- ",column1,column2
> + row1,0.1,0.2
> + row2,0.3,0.4"
>>
>> read.csv(textConnection(Lines), row.names = 1)
>  column1 column2
> row1 0.1 0.2
> row2 0.3 0.4

Thank you. When I enter the command:

max(dataframe[,2])

The response is:

[1] 0.4

But I want to receive the row name, i.e.:

[1] row2 0.4

Is this possible?

__
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] data extrapolation function

2011-01-29 Thread e-letter
Readers,

Data was imported using the read csv command:

dataimport<-read.csv("/path/to/dataimport.csv")

10,2000
12,2001
13,2002
15,2003
17,2004

Using the help contents for 'predict.lm' (i.e. ?predict.lm) a new data
frame was created

dataimportextra<-data.frame(x=seq(1990,2010,1))
predict(lm(dataimport),dataimportextra[,2],se.fit=TRUE)
write.csv<-(dataimportextraout,"/path/to/dataimportextra.csv")

I was expecting to see in the file dataimportextra.csv something like:

1,1990
2,1991
3,1993
...
to previously known data
10,2000
...
final extrapolated value, e.g.
20,2010

I didn't ; this suggests that I chose the wrong function! Can someone
please advise me of the correct function to use for this extrapolation
task?

yours,
r251
mandriva2009

__
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] create data set from selection of rows

2011-03-15 Thread e-letter
Readers,

For a data set:

text1,23,text2,45
text1,23,text3,78
text1,23,text3,56
text1,23,text2,45

The following command was entered:

datasubset<-data.frame(dataset[,3]=="text3")

The result of

datasubset

is

TRUE
TRUE

The required result is

text1,23,text3,78
text1,23,text3,56

What is the correct command to use please?

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


Re: [R] create data set from selection of rows

2011-03-17 Thread e-letter
On 15/03/2011, Francisco Gochez  wrote:
> Hi,
>
> What you are after is:
>
> datasubset <- dataset[ dataset[,3] == "text3", ]

Thank you. For the set

text1,23,text2,45
text1,23,text3,78
text1,23,text3,56
text1,23,text2,45

Is it possible to write a function that selects rows containing
'text3' and applies the function 'sum' to values '78' and '56'? The
control statements described in the document 'an introduction to r'
(Venables and Smith, 2010) suggest that the if statement would return
'true', to prevent a sum function being applied to 'true' results.

__
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] histogram of time-stamp data

2012-07-16 Thread e-letter
Readers,

A data set consists of time-stamp values:

00:00:00
23:11:00
06:22:00

The data set was imported:

timestamps<-read.table("path/to/timestampsvalues")
hist(timestamps)

...error... x must be numeric

Then tried:

plot(timestamps).

How to adjust the graph to create a histogram where the intervals
ranges can be specified, e.g. intervals of 60 minutes?

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


Re: [R] histogram of time-stamp data

2012-07-16 Thread e-letter
On 16/07/2012, r-help-requ...@r-project.org
  wrote:
 > --
 >
 > Message: 77
 > Date: Mon, 16 Jul 2012 10:48:39 +0100
 > From: Rui Barradas 
 > To: e-letter 
 > Cc: r-help@r-project.org
 > Subject: Re: [R] histogram of time-stamp data
 > Message-ID: <5003e377.3000...@sapo.pt>
 > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 >
 >
 > timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE)
 >

 Why is it necessary to apply the sample to the current date? Looking
 at the dataframe, I noticed that values have been changed:

 file 'test.txt':
 12:19:00
 09:30:00
 16:56:00
 01:56:00
 10:44:00
 10:31:00
 02:14:00
 05:05:00
 12:52:00
 21:50:00

 R command terminal input:
 > timestamps<-read.table("test.txt")
 > timestamps
  V1
 1  12:19:00
 2  09:30:00
 3  16:56:00
 4  01:56:00
 5  10:44:00
 6  10:31:00
 7  02:14:00
 8  05:05:00
 9  12:52:00
 10 21:50:00
 > timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE)
 > write.csv(timestamps,file="test1.txt")

 test1.txt:
 "","x"
 "1",2012-07-16 04:52:48
 "2",2012-07-16 21:21:28
 "3",2012-07-16 18:58:27
 "4",2012-07-16 22:17:25
 "5",2012-07-16 11:13:52
 "6",2012-07-16 03:17:35
 "7",2012-07-16 02:14:17
 "8",2012-07-16 14:18:27
 "9",2012-07-16 14:39:16

 Why is this happening?

__
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 113, Issue 19

2012-07-16 Thread e-letter
On 16/07/2012, r-help-requ...@r-project.org
 wrote:
> --
>
> Message: 77
> Date: Mon, 16 Jul 2012 10:48:39 +0100
> From: Rui Barradas 
> To: e-letter 
> Cc: r-help@r-project.org
> Subject: Re: [R] histogram of time-stamp data
> Message-ID: <5003e377.3000...@sapo.pt>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
> timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE)
>

Why is it necessary to apply the sample to the current date? Looking
at the dataframe, I noticed that values have been changed:

file 'test.txt':
12:19:00
09:30:00
16:56:00
01:56:00
10:44:00
10:31:00
02:14:00
05:05:00
12:52:00
21:50:00

R command terminal input:
> timestamps<-read.table("test.txt")
> timestamps
 V1
1  12:19:00
2  09:30:00
3  16:56:00
4  01:56:00
5  10:44:00
6  10:31:00
7  02:14:00
8  05:05:00
9  12:52:00
10 21:50:00
> timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE)
> write.csv(timestamps,file="test1.txt")

test1.txt:
"","x"
"1",2012-07-16 04:52:48
"2",2012-07-16 21:21:28
"3",2012-07-16 18:58:27
"4",2012-07-16 22:17:25
"5",2012-07-16 11:13:52
"6",2012-07-16 03:17:35
"7",2012-07-16 02:14:17
"8",2012-07-16 14:18:27
"9",2012-07-16 14:39:16

Why is this happening?

__
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] histogram of time-stamp data

2012-07-16 Thread e-letter
On 16/07/2012, Rui Barradas  wrote:
> Hello,
>
> Em 16-07-2012 22:45, e-letter escreveu:
>> On 16/07/2012, r-help-requ...@r-project.org
>>wrote:
>>   > --
>>   >
>>   > Message: 77
>>   > Date: Mon, 16 Jul 2012 10:48:39 +0100
>>   > From: Rui Barradas 
>>   > To: e-letter 
>>   > Cc: r-help@r-project.org
>>   > Subject: Re: [R] histogram of time-stamp data
>>   > Message-ID: <5003e377.3000...@sapo.pt>
>>   > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>   >
>>   >
>>   > timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE)
>>   >
>>
>>   Why is it necessary to apply the sample to the current date? Looking
>>   at the dataframe, I noticed that values have been changed:
>
> No! That instruction is just to create a data example with more
> date/time values, in this case with a total of 1e3 different values.
> What's important is the way to plot the histogram, namely, the cut()
> with two example time periods, and that hist() needs numbers, not cut's
> levels.
>

With the original data provided, R reports an error, that "'x' must be numeric'.

__
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] histogram of time-stamp data

2012-07-17 Thread e-letter
On 17/07/2012, Rui Barradas  wrote:
> Hello,
>
> That's not the error I've had. You must be aware that read.table creates
> a data.frame and therefore the object 'timestamps' is NOT holding time
> stamps, it's holding a vector, 'V1', of time stamps.
>

Was not aware of the significance of the data frame of vector values.

> ..., stringsAsFactors=FALSE)
>

Can confirm the success of adding this parameter to the command 'read.table'

> timestamps <- as.POSIXct(timestamps$V1, format="%H:%M:%S")  # here
>
> h1 <- cut(timestamps, breaks="hour")
>
> And the rest works.
>

Confirmed, thanks.

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


[R] knapsack problem limitation

2011-07-06 Thread e-letter
Readers,

Attempting to solve the knapsack problem (e.g. see:
http://rosettacode.org/wiki/Knapsack_problem/Unbounded), the following
error occurred:

...
result would be too long a vector

Is this indicative that R is not suitable to solve this problem when
combinations are large?
Is there a known limit?
Is there an alternative, or better to use a different program?

Thanks.

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


[R] how to solve a power series linear coefficient equation

2008-04-29 Thread e-letter
Readers,

I am having difficulty understanding how to enter commands into r.

I have data arranged as:

100, 200, 300
5.6, 6.7, 7.8
8.9, 9.0, 0.1
1.2, 2.3, 3.4

The data is saved in csv format and I use the command 'read.table' to
import into r.

The values 5.6...3.4 are a function of values 100,...300, i.e.
100,...300 are independent variables (x). The function is a power
series:

y=a+bx+cx^2

How do I obtain the values of a,b,c by minimisation of the sum of
squares of deviations?

So far looking at the documentation 'r-intro' section 10, I tried the following:

functionname<-function(a,b,c){
+ a<-sum(a)
+ b<-sum(b)
+ c<-sum(c)
+ y<-(a+bx+cx^2)
+ x<-(x)
+ }

The documentation states: "...using a call such as...". What does this mean?

Yours,

[EMAIL PROTECTED]

gnu/linux mandriva 2008
r 251 (27-06-07)

__
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] Inconsistent linear model calculations

2008-05-15 Thread e-letter
Readers,

Using version 251 I tried the following command:

lm(y~a+b,data=datafile)

Resulting in, inter alia:
...
coefficients
(intercept) a
1.2 3.4

Packages installed:
acepack ace() and avas() for selecting regression
transformations
adlift  An adaptive lifting scheme algorithm
akima   Interpolation of irregularly spaced data
alr3Methods and data to accompany Applied Linear
Regression 3rd edition
car Companion to Applied Regression
codaOutput analysis and diagnostics for MCMC
drc Analysis of dose-response curves
EbayesThreshEmpirical Bayes thresholding and related
methods
emplik  Empirical likelihood ratio for
censored/truncated data
gllmGeneralised log-linear model
glmcFitting Generalized Linear Models Subject to
Constraints
glmmML  Generalized linear models with clustering
glmpath L1 Regularization Path for Generalized Linear
Models and Cox Proportional Hazards Model
HydroMe Estimation of Soil Hydraulic Parameters from
Experimental Data
JGR JGR - Java Gui for R
lmtest  Testing Linear Regression Models
locfit  Local Regression, Likelihood and Density
Estimation.
mvtnorm Multivariate Normal and t Distributions
NISTnls Nonlinear least squares examples from NIST
nlmeLinear and Nonlinear Mixed Effects Models
nlstoolsTools for nonlinear regression diagnostics
nlt A nondecimated lifting transform for signal
denoising
nlts(non)linear time series analysis
nnlsThe Lawson-Hanson algorithm for non-negative
least squares (NNLS)
plotrix Various plotting functions
quantregQuantile Regression
Rcmdr   ** No title available (pre-2.0.0 install?) **
sandwichRobust Covariance Matrix Estimators
SparseM Sparse Linear Algebra
sspline Smoothing Splines on the Sphere
zoo Z's ordered observations

Packages in library '/usr/lib/R/library':
baseThe R Base Package
bootBootstrap R (S-Plus) Functions (Canty)
class   Functions for Classification
cluster Cluster Analysis Extended Rousseeuw et al.
codetools   Code Analysis Tools for R
datasetsThe R Datasets Package
foreign Read Data Stored by Minitab, S, SAS, SPSS,
Stata, Systat, dBase, ...
graphicsThe R Graphics Package
grDevices   The R Graphics Devices and Support for Colours
and Fonts
gridThe Grid Graphics Package
KernSmooth  Functions for kernel smoothing for Wand & Jones
(1995)
lattice Lattice Graphics
MASSMain Package of Venables and Ripley's MASS
methods Formal Methods and Classes
mgcvGAMs with GCV smoothness estimation and GAMMs
by REML/PQL
nlmeLinear and Nonlinear Mixed Effects Models
nnetFeed-forward Neural Networks and Multinomial
Log-Linear Models
quadprogFunctions to solve Quadratic Programming
lattice Lattice Graphics
MASSMain Package of Venables and Ripley's MASS
methods Formal Methods and Classes
mgcvGAMs with GCV smoothness estimation and GAMMs
by REML/PQL
nlmeLinear and Nonlinear Mixed Effects Models
nnetFeed-forward Neural Networks and Multinomial
Log-Linear Models
quadprogFunctions to solve Quadratic Programming
Problems.
rcompgenCompletion generator for R
rpart   Recursive Partitioning
spatial Functions for Kriging and Point Pattern
Analysis
splines Regression Spline Functions and Classes
stats   The R Stats Package
stats4  Statistical Functions using S4 Classes
survivalSurvival analysis, including penalised
likelihood.
tcltk   Tcl/Tk Interface
tools   Tools for Package Development
utils   The R Utils Package

When using version 171 I entered the same command:

lm(y~a+b,data=datafile

Re: [R] Inconsistent linear model calculations

2008-05-15 Thread e-letter
2008/5/15 Douglas Bates <[EMAIL PROTECTED]>:
> Did you happen to notice the part at the bottom of every message about
> "provide commented, minimal, self-contained, reproducible code"?
>
Sorry, don't understand what that statement means in my context.

> Considering that the result you quote from "251" has 2 coefficients
> and the result from "171" has 3 coefficients one might contemplate the
> possibility that you are fitting different models or perhaps using
> different data.  However we can't verify anything about the causes
> because we have no data regarding the problem.

data below:

  yabcd   e f
1  300 39.87 39.85 39.90 39.87333  9
2  400 45.16 45.23 45.17 45.18667 16
3  500 50.72 51.03 50.90 50.88333 25
4  600 56.85 56.80 57.02 56.89000 36
5  700 63.01 63.09 63.14 63.08000 49
6  800 69.52 59.68 69.63 66.27667 64

so substitute a in my generic equation below for data column e (e.g.
39.87...) and b for f (e.g. 9e4).

>
> Perhaps you are Brian Ripley's evil twin trying to provoke him.  I
> would say that references to a nonexistent version "171" are
> deliberately provocative.

No idea and couldn't care less who br is:

R : Copyright 2003, The R Development Core Team
Version 1.7.1  (2003-06-16)

Get your facts correct before spouting further rubbish.

__
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] Inconsistent linear model calculations

2008-05-15 Thread e-letter
Professor Kubovy

As you instructed, below is the command terminal output:

sessionInfo()
R version 2.5.1 (2007-06-27)
i586-mandriva-linux-gnu

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

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

Yours,

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