[R] POSIXct: subtle difference in representation leads to error for "+"

2014-05-20 Thread Jens Scheidtmann
Dear all,

I have had a "weird" problem in R 3.0.2:

> x
[1] "2006-03-14 12:48:01 CET"  "2006-05-02 11:09:48 CEST"
> str(x)
 POSIXct[1:2], format: "2006-03-14 12:48:01" "2006-05-02 11:09:48"
> x + 6
Error in unclass(e1) + unclass(e2) :
  non-numeric argument to binary operator
> as.POSIXct(x) + 6
Error in unclass(e1) + unclass(e2) :
  non-numeric argument to binary operator

I was puzzled to the max and did not understand what's wrong:

> y <- c(as.POSIXct("2006-03-14 12:48:01 CET"), as.POSIXct("2006-05-02
11:09:48 CEST"))
> y
[1] "2006-03-14 12:48:01 CET"  "2006-05-02 11:09:48 CEST"
> str(y)
 POSIXct[1:2], format: "2006-03-14 12:48:01" "2006-05-02 11:09:48"
> y + 6
[1] "2006-03-14 12:48:07 CET"  "2006-05-02 11:09:54 CEST"

My immediate assumption was, that something was wrong with the internal
representation. After some googling I discovered dput and there it was:

> dput(x)
structure(c("1142336881", "1146560988"), class = c("POSIXct", "POSIXt"))
> dput(y)
structure(c(1142336881, 1146560988), class = c("POSIXct", "POSIXt"))

So on the inside "x" is a character vector, while "y" is a numeric vector.
Ok, seems I need to force conversion to the "sensible" representation:

> xx <- as.POSIXct(as.character(x))
> dput(xx)
structure(c(1142336881, 1146560988), class = c("POSIXct", "POSIXt"), tzone
= "")

Now my questions:

Shouldn't as.POSIXct() force the recommended or canonical internal
representation?
Would you regard this as a bug?
Or is the code, which created x in the first place to blame?

Thanks in advance,

Jens

[[alternative HTML version deleted]]

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


[R] bootstrapping for maxium data

2014-05-20 Thread 张以春
Dear friends,


I  have a numeric vector composed of 320 numbers.


Now, I want to do resample for 1 times. I want to get maxium number for 
every trial and get a 1 maxium numbers.


I have tried to use "boot" package such as follows.


results<-boot(data=nearshore1,statistic=max,R=1,stype="w")


But, surprising, the results shows that I got 1 A (A is the maxium number 
in "nearshore1")


It's a puzzle to me. I do not know how to do that. Thank you.


Yichun







[[alternative HTML version deleted]]

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


Re: [R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-20 Thread arun


Hi,

May be you can try ?twoord.plot from library(plotrix)
A.K.


On Tuesday, May 20, 2014 9:41 AM, Shane Carey  wrote:
Hi,

I amtrying to plot a cfd with a histogram on one plot. The problem is the
scale (y-axis) of the plots are hugely different and as a result the
histogram plot is hard to read. Are there any examples of plots like this
done in R:

http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg

Thanks



-- 
Shane

    [[alternative HTML version deleted]]

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


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


Re: [R] Voronoi-Diagrams in R

2014-05-20 Thread Rolf Turner



It sounds to me as though you are simply getting yourself flummoxed by 
the fact that the different packages produce their output in different 
formats.  The information in the output will be the same (as Boris has 
indicated) --- it will just be arranged differently.  Learn to interpret 
the output of each function (RTFM!) and you will find that there is no 
problem.


cheers,

Rolf Turner
(author of "deldir")

On 21/05/14 09:33, Raphael Päbst wrote:

Thanks for the answer!

I'll post a sample tomorrow, I have however found the following:
triang.list() gives me the coordinates of the triangle's vertices,
while delaunayn() gives me the indices of those coordinates. Thus it
should be more or less simple to convert the output of deldir() into
that of delaunayn()

Once again, thanks!

Raphael

On 5/20/14, Boris Steipe  wrote:

deldir() uses Lee and Schacter's algorithm, while the geometry package is a
(partial) implementation of Barber et. al's Quickhull. Since both algorithms
are correct, they should give the same results for the same data.

How about you post a small input dataset and list the output that you
need...


B.




On 2014-05-20, at 2:04 PM, Raphael Päbst wrote:


Thank you very much, this looks promising.

I have a follow-up question however, probably due to my thickness when
it comes to the underlying math.

I am translating (as closely as possible) some code that has
originally been written for Mathlab and uses the delaunay() function
there. Now, if I understand it correctly, Mathlab uses the same
Qhull-Library as a basis, as does the Geometry-Package. So in theory
delaunay(x) in Mathlab and delaunay(x) in R should give me the same
results for the same x, where x is a matrix of coordinates.

If I use deldir(x1, x2) where x1 and x2 are the first and second
column of that same matrix above, is there any chance to get the same
result as with delaunayn() or at least something similar in format to
the result of delaunayn()?

Many thanks again and please excuse my crude english.

Raphael
On 5/14/14, Boris Steipe  wrote:

Try:

install.packages("deldir")
library(deldir)
?deldir
set.seed(16180)
x <- runif(20); y <- runif(20); window <- c(0,1,0,1)
tess <- deldir(x, y, rw = window)
plot.deldir(tess, wpoints="real", wlines="tess")

Cheers,
Boris


On 2014-05-14, at 8:18 AM, Raphael Päbst wrote:


Hello everyone!
I have returned to R after a longish break and am currently working on
a project where I need Delaunay-Triangulations and Voronoi-Diagrams.
If I understood it correctly, the Geometry-Package only offers
functions for the Delaunay-Triangulation at the moment. Is this
correct and if so, what would be the best way to get Voronoi-Diagrams
as well?


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second axis on bottom of graph

2014-05-20 Thread peter dalgaard
Hm? Try

plot(0, mgp=c(3,2,0), las=2)


On 20 May 2014, at 19:41 , Hurr  wrote:

> I was able to put tck=-0.1 into either par() or 
> axis() and it made a tick difference I understood.
> As I understand it, default for mgp is c(3,1,0).
> When I put mgp=c(3,4,0) or mgp=c(3,7,0) into 
> either par() or axis() I see no difference.
> Hurr
> 
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690912.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [R] empty density plot for point pattern in spatstat

2014-05-20 Thread Adams, Jean
It works just fine for me ... using R-3.1.0 on Windows 7 and spatstat
version 1.37-0.

Jean


On Tue, May 20, 2014 at 3:31 PM, Christopher W Ryan wrote:

> I'm running R-3.0.3 on Windows XP Professional on an institutional PC.
> (My freedom to update to a more recent version of R is limited,
> although I might be able to prevail upon the powers that be, if that
> would solve the problem.)
>
> I installed spatstat via install.packages() and received version 1.37-0.
>
> Here is some code:
>
> library(spatstat)
> data(redwood)
> plot(redwoods)  # works OK
> plot(Kest(redwood))  # works OK
> plot(density(redwood))  # produces an "empty" plot as described above
>
> Any suggestions? What am I missing?
>
> Thanks.
>
> --Chris Ryan
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Voronoi-Diagrams in R

2014-05-20 Thread Raphael Päbst
Thanks for the answer!

I'll post a sample tomorrow, I have however found the following:
triang.list() gives me the coordinates of the triangle's vertices,
while delaunayn() gives me the indices of those coordinates. Thus it
should be more or less simple to convert the output of deldir() into
that of delaunayn()

Once again, thanks!

Raphael

On 5/20/14, Boris Steipe  wrote:
> deldir() uses Lee and Schacter's algorithm, while the geometry package is a
> (partial) implementation of Barber et. al's Quickhull. Since both algorithms
> are correct, they should give the same results for the same data.
>
> How about you post a small input dataset and list the output that you
> need...
>
>
> B.
>
>
>
>
> On 2014-05-20, at 2:04 PM, Raphael Päbst wrote:
>
>> Thank you very much, this looks promising.
>>
>> I have a follow-up question however, probably due to my thickness when
>> it comes to the underlying math.
>>
>> I am translating (as closely as possible) some code that has
>> originally been written for Mathlab and uses the delaunay() function
>> there. Now, if I understand it correctly, Mathlab uses the same
>> Qhull-Library as a basis, as does the Geometry-Package. So in theory
>> delaunay(x) in Mathlab and delaunay(x) in R should give me the same
>> results for the same x, where x is a matrix of coordinates.
>>
>> If I use deldir(x1, x2) where x1 and x2 are the first and second
>> column of that same matrix above, is there any chance to get the same
>> result as with delaunayn() or at least something similar in format to
>> the result of delaunayn()?
>>
>> Many thanks again and please excuse my crude english.
>>
>> Raphael
>> On 5/14/14, Boris Steipe  wrote:
>>> Try:
>>>
>>> install.packages("deldir")
>>> library(deldir)
>>> ?deldir
>>> set.seed(16180)
>>> x <- runif(20); y <- runif(20); window <- c(0,1,0,1)
>>> tess <- deldir(x, y, rw = window)
>>> plot.deldir(tess, wpoints="real", wlines="tess")
>>>
>>> Cheers,
>>> Boris
>>>
>>>
>>> On 2014-05-14, at 8:18 AM, Raphael Päbst wrote:
>>>
 Hello everyone!
 I have returned to R after a longish break and am currently working on
 a project where I need Delaunay-Triangulations and Voronoi-Diagrams.
 If I understood it correctly, the Geometry-Package only offers
 functions for the Delaunay-Triangulation at the moment. Is this
 correct and if so, what would be the best way to get Voronoi-Diagrams
 as well?

 Many Thanks in advance!

 Raphael

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 save with encoding...

2014-05-20 Thread David Winsemius


On May 19, 2014, at 1:40 PM, Alexsandro Cândido de Oliveira Silva wrote:


Hello everybody!!



I'm trying to plot a graphic with the title: INTERVALS λ.

But the special character λ can't be encoded using ISO8859-1.


For future reference the reason this went unanaswered as long as it  
did is bacause that "special character" did not show up a Greek lambda  
because you posted in HTML rather than plain text. (It did show up as  
a lambda when Frede Aakmann Tøgersen replied.) I looked at the "λ"  
and thought "who knows what that is?".


Which another encoding I need to choose?


There _is) another posting style you should choose




Att.

Alexsandro Cândido de Oliveira Silva

___

[[alternative HTML version deleted]]


--

David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Voronoi-Diagrams in R

2014-05-20 Thread Boris Steipe
deldir() uses Lee and Schacter's algorithm, while the geometry package is a 
(partial) implementation of Barber et. al's Quickhull. Since both algorithms 
are correct, they should give the same results for the same data.

How about you post a small input dataset and list the output that you need...


B.




On 2014-05-20, at 2:04 PM, Raphael Päbst wrote:

> Thank you very much, this looks promising.
> 
> I have a follow-up question however, probably due to my thickness when
> it comes to the underlying math.
> 
> I am translating (as closely as possible) some code that has
> originally been written for Mathlab and uses the delaunay() function
> there. Now, if I understand it correctly, Mathlab uses the same
> Qhull-Library as a basis, as does the Geometry-Package. So in theory
> delaunay(x) in Mathlab and delaunay(x) in R should give me the same
> results for the same x, where x is a matrix of coordinates.
> 
> If I use deldir(x1, x2) where x1 and x2 are the first and second
> column of that same matrix above, is there any chance to get the same
> result as with delaunayn() or at least something similar in format to
> the result of delaunayn()?
> 
> Many thanks again and please excuse my crude english.
> 
> Raphael
> On 5/14/14, Boris Steipe  wrote:
>> Try:
>> 
>> install.packages("deldir")
>> library(deldir)
>> ?deldir
>> set.seed(16180)
>> x <- runif(20); y <- runif(20); window <- c(0,1,0,1)
>> tess <- deldir(x, y, rw = window)
>> plot.deldir(tess, wpoints="real", wlines="tess")
>> 
>> Cheers,
>> Boris
>> 
>> 
>> On 2014-05-14, at 8:18 AM, Raphael Päbst wrote:
>> 
>>> Hello everyone!
>>> I have returned to R after a longish break and am currently working on
>>> a project where I need Delaunay-Triangulations and Voronoi-Diagrams.
>>> If I understood it correctly, the Geometry-Package only offers
>>> functions for the Delaunay-Triangulation at the moment. Is this
>>> correct and if so, what would be the best way to get Voronoi-Diagrams
>>> as well?
>>> 
>>> Many Thanks in advance!
>>> 
>>> Raphael
>>> 
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-20 Thread Adams, Jean
Shane,

Do you have code to create each plot separately?

If so, you can use par(new=TRUE) to overlay a second plot over the first
with a different y-axis scale.  See, for example,
http://robjhyndman.com/hyndsight/r-graph-with-two-y-axes/

Jean


On Tue, May 20, 2014 at 8:39 AM, Shane Carey  wrote:

> Hi,
>
> I amtrying to plot a cfd with a histogram on one plot. The problem is the
> scale (y-axis) of the plots are hugely different and as a result the
> histogram plot is hard to read. Are there any examples of plots like this
> done in R:
>
> http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg
>
> Thanks
>
>
>
> --
> Shane
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] empty density plot for point pattern in spatstat

2014-05-20 Thread Christopher W Ryan
I'm running R-3.0.3 on Windows XP Professional on an institutional PC.
(My freedom to update to a more recent version of R is limited,
although I might be able to prevail upon the powers that be, if that
would solve the problem.)

I installed spatstat via install.packages() and received version 1.37-0.

Here is some code:

library(spatstat)
data(redwood)
plot(redwoods)  # works OK
plot(Kest(redwood))  # works OK
plot(density(redwood))  # produces an "empty" plot as described above

Any suggestions? What am I missing?

Thanks.

--Chris Ryan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Voronoi-Diagrams in R

2014-05-20 Thread Raphael Päbst
Thank you very much, this looks promising.

I have a follow-up question however, probably due to my thickness when
it comes to the underlying math.

I am translating (as closely as possible) some code that has
originally been written for Mathlab and uses the delaunay() function
there. Now, if I understand it correctly, Mathlab uses the same
Qhull-Library as a basis, as does the Geometry-Package. So in theory
delaunay(x) in Mathlab and delaunay(x) in R should give me the same
results for the same x, where x is a matrix of coordinates.

If I use deldir(x1, x2) where x1 and x2 are the first and second
column of that same matrix above, is there any chance to get the same
result as with delaunayn() or at least something similar in format to
the result of delaunayn()?

Many thanks again and please excuse my crude english.

Raphael
On 5/14/14, Boris Steipe  wrote:
> Try:
>
> install.packages("deldir")
> library(deldir)
> ?deldir
> set.seed(16180)
> x <- runif(20); y <- runif(20); window <- c(0,1,0,1)
> tess <- deldir(x, y, rw = window)
> plot.deldir(tess, wpoints="real", wlines="tess")
>
> Cheers,
> Boris
>
>
> On 2014-05-14, at 8:18 AM, Raphael Päbst wrote:
>
>> Hello everyone!
>> I have returned to R after a longish break and am currently working on
>> a project where I need Delaunay-Triangulations and Voronoi-Diagrams.
>> If I understood it correctly, the Geometry-Package only offers
>> functions for the Delaunay-Triangulation at the moment. Is this
>> correct and if so, what would be the best way to get Voronoi-Diagrams
>> as well?
>>
>> Many Thanks in advance!
>>
>> Raphael
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
That's the solution I was working on. Design the function (the foo() in your 
example) to read the clipboard so you do not need to paste anything. That 
greatly reduces how generally the function can be used since it will fail if 
there is not a path in the clipboard, but it solves (ameliorates?) the 
immediate problem:

path.files <- function(...) { list.files(readClipboard(), ...) }

If I copy "C:\Rtools" to the clipboard:

> path.files()
[1] "bin"  "COPYING"  "gcc-4.6.3""README.txt"   "Rtools.txt"  
[6] "unins000.dat" "unins000.exe" "VERSION.txt"
> path.files(full.names=TRUE)
[1] "C:\\Rtools/bin"  "C:\\Rtools/COPYING" 
[3] "C:\\Rtools/gcc-4.6.3""C:\\Rtools/README.txt"  
[5] "C:\\Rtools/Rtools.txt"   "C:\\Rtools/unins000.dat"
[7] "C:\\Rtools/unins000.exe" "C:\\Rtools/VERSION.txt" 

David C


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Bert Gunter
Sent: Tuesday, May 20, 2014 12:15 PM
To: Duncan Murdoch
Cc: r-help@r-project.org
Subject: Re: [R] \ escape sequence and windows path

Duncan:

"...
If you want to solve the problem "I have a pathname in the clipboard,
and want to put it in a string", it's not hard to write
a function that essentially does readLines("clipboard")"

Does not the Windows version R function readClipboard() do this already?

-- Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Welch




On Tue, May 20, 2014 at 10:03 AM, Duncan Murdoch
 wrote:
> On 20/05/2014 12:04 PM, Knut Krueger wrote:
>>
>> Am 20.05.2014 17:32, schrieb Bert Gunter:
>>
>> >> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
>> > [1] "a\\b"
>> >> cat(paste("a","b",sep="\\"))
>> > a\b
>> >
>> > Does this help clarify? Or have i misunderstood you?
>>
>> @David and @Bert
>>
>> unfortunately yes. My question is more a system level question as about
>> any converting functions.
>>
>> The question is how to paste a windows path directly into an R script
>> (without readline() or readClipboard() and how could I convert this
>> string that it is usable in R. Means any function which is not using
>> escape characters
>>
>> it seems to be possible for readline() an  readClipboard().
>>
>> I do not want to use y=readline() I do want to use
>> y=foo("c:\foo1\foo2\") but this seems to be impossible because R is
>> interpreting one backslash as escape sequence. So how does readline()
>> and readClipboard() are working? Is there any other callback from utils
>> which is able to deal with this?
>
>
> The difference between the two cases is that you are trying to write
> something in the R language when you write
>
> y=foo("c:\foo1\foo2\")
>
> but that is not a legal R statement, since you never close the opening
> quote.  When using readLines() etc., you're just reading data, you're not
> trying to parse it as R code.
>
> I have no idea what you mean by a "callback from utils".
>
> If you want to solve the problem "I have a pathname in the clipboard, and
> want to put it in a string", it's not hard to write
> a function that essentially does readLines("clipboard").  It's a little
> harder to make that platform-neutral, but it sounds as if you're only
> working on Windows.
>
> If you want to solve the problem, "I want to write some R source code that
> contains a pathname, but I don't want to escape the backslashes", then I
> think you're out of luck.  There are ways to read data inline in your
> source, e.g. you can paste
>
> f <- scan(what="character")
> c:\foo1\foo2\
>
>
> into your console to read x, but that doesn't work with source(), so I'd
> avoid it.
>
> Duncan Murdoch
>
>>
>> I am afraid there is no way.
>>
>> The reason is to prevent errors for beginning windows R user. If the
>> path is long they either forget to convert one backslash or all and then
>> they are frustrated that it is not working. And telling them to use
>> search and replace ... Whatever they would replace it might be worse
>> than before ;-)
>>
>> regards Knut
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] dealing with missing values

2014-05-20 Thread arun
Also, if the dataset is `dat1`

 model.matrix(~X+Y,data=dat1)[,-1]
  Xdf Xrd Yas Yeq
1   1   0   1   0
2   1   0   0   0
3   0   0   1   0
4   0   0   0   1
5   0   1   0   0
6   0   1   0   1
A.K.





On Tuesday, May 20, 2014 1:32 PM, arun  wrote:
Hi,
It is better to show the data using ?dput().  It is not clear whether your 
missing values are read as "" or NA in the dataset.
Also, assuming that the function is from library(ade4)

#1st case. NAs

dat <-  structure(list(X = structure(c(1L, 1L, NA, NA, 2L, 2L), .Label = 
c("df", 
"rd"), class = "factor"), Y = structure(c(1L, NA, 1L, 2L, NA, 
2L), .Label = c("as", "eq"), class = "factor")), .Names = c("X", 
"Y"), class = "data.frame", row.names = c(NA, -6L))  

#2nd case ""

dat1 <- structure(list(X = structure(c(2L, 2L, 1L, 1L, 3L, 3L), .Label = c("", 
"df", "rd"), class = "factor"), Y = structure(c(2L, 1L, 2L, 3L, 
1L, 3L), .Label = c("", "as", "eq"), class = "factor")), .Names = c("X", 
"Y"), class = "data.frame", row.names = c(NA, -6L))



library(ade4)


 acm.disjonctif(dat)
#  X.df X.rd Y.as Y.eq
#1    1    0    1    0
#2    1    0    0    0
#3    0    0    1    0
#4    0    0    0    1
#5    0    1    0    0
#6    0    1    0    1
 acm.disjonctif(dat1)
#  X. X.df X.rd Y. Y.as Y.eq
#1  0    1    0  0    1    0
#2  0    1    0  1    0    0
#3  1    0    0  0    1    0
#4  1    0    0  0    0    1
#5  0    0    1  1    0    0
#6  0    0    1  0    0    1

#It seems that your data is similar to dat1
dat1[dat1==''] <- NA
 dat1 <- droplevels(dat1)
 acm.disjonctif(dat1)
#  X.df X.rd Y.as Y.eq
#1    1    0    1    0
#2    1    0    0    0
#3    0    0    1    0
#4    0    0    0    1
#5    0    1    0    0
#6    0    1    0    1

A.K.



I have missing values in my data:

    X   Y
   df    as
   df  
    as
    eq
   rd
   rd    eq


I am using the function ' acm.disjonctif' in R. But this function considers the 
missing values as factor (it assigned 1's):

  X. X.df X.rd Y. Y.as Y.eq
1  0    1    0  0    1    0
2  0    1    0  1    0    0
3  1    0    0  0    1    0
4  1    0    0  0    0    1
5  0    0    1  1    0    0
6  0    0    1  0    0    1


I want to use acm.disjonctif but I do not want to use the missing values (so 
columns X. and Y.) in this table. How can I solve this problem? 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second axis on bottom of graph

2014-05-20 Thread Hurr
I was able to put tck=-0.1 into either par() or 
axis() and it made a tick difference I understood.
As I understand it, default for mgp is c(3,1,0).
When I put mgp=c(3,4,0) or mgp=c(3,7,0) into 
either par() or axis() I see no difference.
Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690912.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread Duncan Murdoch

On 20/05/2014 1:15 PM, Bert Gunter wrote:

Duncan:

"...
If you want to solve the problem "I have a pathname in the clipboard,
and want to put it in a string", it's not hard to write
a function that essentially does readLines("clipboard")"

Does not the Windows version R function readClipboard() do this already?


Yes, it does.  I generally use the form I gave because it generalizes 
better:  read.csv("clipboard") is easier for me to type than 
read.csv(text = readClipboard()).


Duncan Murdoch


-- Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Welch




On Tue, May 20, 2014 at 10:03 AM, Duncan Murdoch
 wrote:
> On 20/05/2014 12:04 PM, Knut Krueger wrote:
>>
>> Am 20.05.2014 17:32, schrieb Bert Gunter:
>>
>> >> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
>> > [1] "a\\b"
>> >> cat(paste("a","b",sep="\\"))
>> > a\b
>> >
>> > Does this help clarify? Or have i misunderstood you?
>>
>> @David and @Bert
>>
>> unfortunately yes. My question is more a system level question as about
>> any converting functions.
>>
>> The question is how to paste a windows path directly into an R script
>> (without readline() or readClipboard() and how could I convert this
>> string that it is usable in R. Means any function which is not using
>> escape characters
>>
>> it seems to be possible for readline() an  readClipboard().
>>
>> I do not want to use y=readline() I do want to use
>> y=foo("c:\foo1\foo2\") but this seems to be impossible because R is
>> interpreting one backslash as escape sequence. So how does readline()
>> and readClipboard() are working? Is there any other callback from utils
>> which is able to deal with this?
>
>
> The difference between the two cases is that you are trying to write
> something in the R language when you write
>
> y=foo("c:\foo1\foo2\")
>
> but that is not a legal R statement, since you never close the opening
> quote.  When using readLines() etc., you're just reading data, you're not
> trying to parse it as R code.
>
> I have no idea what you mean by a "callback from utils".
>
> If you want to solve the problem "I have a pathname in the clipboard, and
> want to put it in a string", it's not hard to write
> a function that essentially does readLines("clipboard").  It's a little
> harder to make that platform-neutral, but it sounds as if you're only
> working on Windows.
>
> If you want to solve the problem, "I want to write some R source code that
> contains a pathname, but I don't want to escape the backslashes", then I
> think you're out of luck.  There are ways to read data inline in your
> source, e.g. you can paste
>
> f <- scan(what="character")
> c:\foo1\foo2\
>
>
> into your console to read x, but that doesn't work with source(), so I'd
> avoid it.
>
> Duncan Murdoch
>
>>
>> I am afraid there is no way.
>>
>> The reason is to prevent errors for beginning windows R user. If the
>> path is long they either forget to convert one backslash or all and then
>> they are frustrated that it is not working. And telling them to use
>> search and replace ... Whatever they would replace it might be worse
>> than before ;-)
>>
>> regards Knut
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] dealing with missing values

2014-05-20 Thread arun
Hi,
It is better to show the data using ?dput().  It is not clear whether your 
missing values are read as "" or NA in the dataset.
Also, assuming that the function is from library(ade4)

#1st case. NAs

dat <-  structure(list(X = structure(c(1L, 1L, NA, NA, 2L, 2L), .Label = 
c("df", 
"rd"), class = "factor"), Y = structure(c(1L, NA, 1L, 2L, NA, 
2L), .Label = c("as", "eq"), class = "factor")), .Names = c("X", 
"Y"), class = "data.frame", row.names = c(NA, -6L))  

#2nd case ""

dat1 <- structure(list(X = structure(c(2L, 2L, 1L, 1L, 3L, 3L), .Label = c("", 
"df", "rd"), class = "factor"), Y = structure(c(2L, 1L, 2L, 3L, 
1L, 3L), .Label = c("", "as", "eq"), class = "factor")), .Names = c("X", 
"Y"), class = "data.frame", row.names = c(NA, -6L))



library(ade4)


 acm.disjonctif(dat)
#  X.df X.rd Y.as Y.eq
#1    1    0    1    0
#2    1    0    0    0
#3    0    0    1    0
#4    0    0    0    1
#5    0    1    0    0
#6    0    1    0    1
 acm.disjonctif(dat1)
#  X. X.df X.rd Y. Y.as Y.eq
#1  0    1    0  0    1    0
#2  0    1    0  1    0    0
#3  1    0    0  0    1    0
#4  1    0    0  0    0    1
#5  0    0    1  1    0    0
#6  0    0    1  0    0    1

#It seems that your data is similar to dat1
dat1[dat1==''] <- NA
 dat1 <- droplevels(dat1)
 acm.disjonctif(dat1)
#  X.df X.rd Y.as Y.eq
#1    1    0    1    0
#2    1    0    0    0
#3    0    0    1    0
#4    0    0    0    1
#5    0    1    0    0
#6    0    1    0    1

A.K.



I have missing values in my data:

    X   Y
   df    as
   df  
    as
    eq
   rd
   rd    eq


I am using the function ' acm.disjonctif' in R. But this function considers the 
missing values as factor (it assigned 1's):

  X. X.df X.rd Y. Y.as Y.eq
1  0    1    0  0    1    0
2  0    1    0  1    0    0
3  1    0    0  0    1    0
4  1    0    0  0    0    1
5  0    0    1  1    0    0
6  0    0    1  0    0    1


I want to use acm.disjonctif but I do not want to use the missing values (so 
columns X. and Y.) in this table. How can I solve this problem? 


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] \ escape sequence and windows path

2014-05-20 Thread Bert Gunter
Duncan:

"...
If you want to solve the problem "I have a pathname in the clipboard,
and want to put it in a string", it's not hard to write
a function that essentially does readLines("clipboard")"

Does not the Windows version R function readClipboard() do this already?

-- Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Welch




On Tue, May 20, 2014 at 10:03 AM, Duncan Murdoch
 wrote:
> On 20/05/2014 12:04 PM, Knut Krueger wrote:
>>
>> Am 20.05.2014 17:32, schrieb Bert Gunter:
>>
>> >> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
>> > [1] "a\\b"
>> >> cat(paste("a","b",sep="\\"))
>> > a\b
>> >
>> > Does this help clarify? Or have i misunderstood you?
>>
>> @David and @Bert
>>
>> unfortunately yes. My question is more a system level question as about
>> any converting functions.
>>
>> The question is how to paste a windows path directly into an R script
>> (without readline() or readClipboard() and how could I convert this
>> string that it is usable in R. Means any function which is not using
>> escape characters
>>
>> it seems to be possible for readline() an  readClipboard().
>>
>> I do not want to use y=readline() I do want to use
>> y=foo("c:\foo1\foo2\") but this seems to be impossible because R is
>> interpreting one backslash as escape sequence. So how does readline()
>> and readClipboard() are working? Is there any other callback from utils
>> which is able to deal with this?
>
>
> The difference between the two cases is that you are trying to write
> something in the R language when you write
>
> y=foo("c:\foo1\foo2\")
>
> but that is not a legal R statement, since you never close the opening
> quote.  When using readLines() etc., you're just reading data, you're not
> trying to parse it as R code.
>
> I have no idea what you mean by a "callback from utils".
>
> If you want to solve the problem "I have a pathname in the clipboard, and
> want to put it in a string", it's not hard to write
> a function that essentially does readLines("clipboard").  It's a little
> harder to make that platform-neutral, but it sounds as if you're only
> working on Windows.
>
> If you want to solve the problem, "I want to write some R source code that
> contains a pathname, but I don't want to escape the backslashes", then I
> think you're out of luck.  There are ways to read data inline in your
> source, e.g. you can paste
>
> f <- scan(what="character")
> c:\foo1\foo2\
>
>
> into your console to read x, but that doesn't work with source(), so I'd
> avoid it.
>
> Duncan Murdoch
>
>>
>> I am afraid there is no way.
>>
>> The reason is to prevent errors for beginning windows R user. If the
>> path is long they either forget to convert one backslash or all and then
>> they are frustrated that it is not working. And telling them to use
>> search and replace ... Whatever they would replace it might be worse
>> than before ;-)
>>
>> regards Knut
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subset, period of days like one after another in a group

2014-05-20 Thread arun


Hi,

In your example the "wea", only showed "dw".  Suppose the data is like this:

dat1 <- structure(list(date = structure(c(15765, 15766, 15767, 15768, 
15769, 15770, 15771, 15772, 15773, 15780, 15781, 15782, 15788, 
15789, 15790, 15791, 15792, 15795, 15796, 15797, 15798, 15799, 
15800, 15801, 15803, 15804, 15805, 15806), class = "Date"), mon = 
structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Mrz", class = "factor"), 
    wea = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L), .Label = c("dw", "rw"), class = "factor")), .Names = c("date", 
"mon", "wea"), row.names = c("1156", "1157", "1158", "1159", 
"1160", "1161", "1162", "1163", "1164", "1171", "1172", "1173", 
"1179", "1180", "1181", "1182", "1183", "1186", "1187", "1188", 
"1189", "1190", "1191", "1192", "1193", "1194", "1195", "1196"
), class = "data.frame")


split(dat1,list(dat1$wea,cumsum(c(TRUE,diff(dat1$date)!=1))),drop=TRUE)
#or
 lapply(split(dat1,dat1$wea),function(x) 
split(x,cumsum(c(TRUE,diff(x$date)!=1
##if you want only "dw"
datdw <- droplevels(subset(dat1,wea=="dw"))  ##assuming that you wanted "wea" 
column to #be factor 
 split(datdw,cumsum(c(TRUE,diff(datdw$date)!=1)))
A.K.




On Tuesday, May 20, 2014 12:42 PM, arun  wrote:


Hi,
#if 'dat` is the dataset
May be this helps.
lst1 <- setNames(split(dat, cumsum(c(TRUE,diff(dat$date)!=1))),LETTERS[1:4])
A.K.




On Tuesday, May 20, 2014 12:17 PM, Christoph Schlächter 
 wrote:
Dear all,

I have a subset of a data frame with 3 columns and a few rows. The columns
are “date” [%Y %m %d], “mon” [%b]  and “wea” for type of weather with “dw”
dry weather “rw” rainy weather.

Here it is as a list:

structure(list(date = structure(c(15765, 15766, 15767, 15768,
15769, 15770, 15771, 15772, 15773, 15780, 15781, 15782, 15788,
15789, 15790, 15791, 15792, 15795), class = "Date"), mon = c("Mrz",
"Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz",
"Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz"), wea =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("dw", "rw"), class = "factor")), .Names = c("date",
"mon", "wea"), row.names = c(1156L, 1157L, 1158L, 1159L, 1160L,
1161L, 1162L, 1163L, 1164L, 1171L, 1172L, 1173L, 1179L, 1180L,
1181L, 1182L, 1183L, 1186L), class = "data.frame")

I want to get a period of days when it is dry weather and the difference
between days should be not more than one day.

For this example I need something to get:

Maybe as Group:

A:

2013-03-01 Mrz  dw
2013-03-02 Mrz  dw
2013-03-03 Mrz  dw
2013-03-04 Mrz  dw
2013-03-05 Mrz  dw
2013-03-06 Mrz  dw
2013-03-07 Mrz  dw
2013-03-08 Mrz  dw
2013-03-09 Mrz  dw

B

2013-03-16 Mrz  dw
2013-03-17 Mrz  dw
2013-03-18 Mrz  dw

C

2013-03-24 Mrz  dw
2013-03-25 Mrz  dw
2013-03-26 Mrz  dw
2013-03-27 Mrz  dw
2013-03-28 Mrz  dw

D

2013-03-31 Mrz  dw

How can I achive this. I really have only very few ideas like cast() or
melt() or both but i have trouble with the date format.

Thanks in advance.  

    [[alternative HTML version deleted]]

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

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread Duncan Murdoch

On 20/05/2014 12:04 PM, Knut Krueger wrote:

Am 20.05.2014 17:32, schrieb Bert Gunter:

>> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
> [1] "a\\b"
>> cat(paste("a","b",sep="\\"))
> a\b
>
> Does this help clarify? Or have i misunderstood you?

@David and @Bert

unfortunately yes. My question is more a system level question as about
any converting functions.

The question is how to paste a windows path directly into an R script
(without readline() or readClipboard() and how could I convert this
string that it is usable in R. Means any function which is not using
escape characters

it seems to be possible for readline() an  readClipboard().

I do not want to use y=readline() I do want to use
y=foo("c:\foo1\foo2\") but this seems to be impossible because R is
interpreting one backslash as escape sequence. So how does readline()
and readClipboard() are working? Is there any other callback from utils
which is able to deal with this?


The difference between the two cases is that you are trying to write 
something in the R language when you write


y=foo("c:\foo1\foo2\")

but that is not a legal R statement, since you never close the opening 
quote.  When using readLines() etc., you're just reading data, you're 
not trying to parse it as R code.


I have no idea what you mean by a "callback from utils".

If you want to solve the problem "I have a pathname in the clipboard, 
and want to put it in a string", it's not hard to write
a function that essentially does readLines("clipboard").  It's a little 
harder to make that platform-neutral, but it sounds as if you're only 
working on Windows.


If you want to solve the problem, "I want to write some R source code 
that contains a pathname, but I don't want to escape the backslashes", 
then I think you're out of luck.  There are ways to read data inline in 
your source, e.g. you can paste


f <- scan(what="character")
c:\foo1\foo2\


into your console to read x, but that doesn't work with source(), so I'd 
avoid it.


Duncan Murdoch



I am afraid there is no way.

The reason is to prevent errors for beginning windows R user. If the
path is long they either forget to convert one backslash or all and then
they are frustrated that it is not working. And telling them to use
search and replace ... Whatever they would replace it might be worse
than before ;-)

regards Knut

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


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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
Now I understand. Not really a solution, but you can instruct students to use 
only forward slashes in their paths since R will convert to backslash on 
Windows systems automatically. After a couple of broken commands, they should 
get the hang of it.

David C

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Knut Krueger
Sent: Tuesday, May 20, 2014 11:05 AM
To: r-help@r-project.org
Subject: Re: [R] \ escape sequence and windows path

Am 20.05.2014 17:32, schrieb Bert Gunter:

>> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
> [1] "a\\b"
>> cat(paste("a","b",sep="\\"))
> a\b
>
> Does this help clarify? Or have i misunderstood you?

@David and @Bert

unfortunately yes. My question is more a system level question as about 
any converting functions.

The question is how to paste a windows path directly into an R script 
(without readline() or readClipboard() and how could I convert this 
string that it is usable in R. Means any function which is not using 
escape characters

it seems to be possible for readline() an  readClipboard().

I do not want to use y=readline() I do want to use 
y=foo("c:\foo1\foo2\") but this seems to be impossible because R is 
interpreting one backslash as escape sequence. So how does readline() 
and readClipboard() are working? Is there any other callback from utils 
which is able to deal with this?


I am afraid there is no way.

The reason is to prevent errors for beginning windows R user. If the 
path is long they either forget to convert one backslash or all and then 
they are frustrated that it is not working. And telling them to use 
search and replace ... Whatever they would replace it might be worse 
than before ;-)

regards Knut

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

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


Re: [R] NppToR / RMySQL / loadNamespace() Error

2014-05-20 Thread Brian Ripley
We have no idea what NppToR Is.  But as a guess you ran 64-bit R and it ran 
32-bit or v.v.
Why don't you ask NppToR's help service?

The architecture of MySQL must match that of the R under which you installed 
RMySQL.


> On 20 May 2014, at 15:08, Peter Meissner  wrote:
> 
> Dear Listeners,
> 
> I finally managed to install RMySQL on my Win7(64Bit) machine with R.3.1.0.
> 
> Now, as long as I start R manually and load the package everything is
> working just fine: the package loads and I can connect to a database and
> query it.
> 
> But, when NppToR does start the R session for me something is going
> wrong and I have no clue where even to start.
> 
> The R-output reads like this:
> 
> 
> > require(RMySQL)
> Loading required package: RMySQL
> Loading required package: DBI
> Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
> call: utils::readRegistry("SOFTWARE\\MySQL AB", hive = "HLM",
> maxdepth = 2)
> error: Registry key 'SOFTWARE\MySQL AB' not found
> 
> 
> Does anybody have an idea how to fix or circumvent this?
> 
> 
> Best, Peter
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subset, period of days like one after another in a group

2014-05-20 Thread arun


Hi,
#if 'dat` is the dataset
May be this helps.
lst1 <- setNames(split(dat, cumsum(c(TRUE,diff(dat$date)!=1))),LETTERS[1:4])
A.K.



On Tuesday, May 20, 2014 12:17 PM, Christoph Schlächter 
 wrote:
Dear all,

I have a subset of a data frame with 3 columns and a few rows. The columns
are “date” [%Y %m %d], “mon” [%b]  and “wea” for type of weather with “dw”
dry weather “rw” rainy weather.

Here it is as a list:

structure(list(date = structure(c(15765, 15766, 15767, 15768,
15769, 15770, 15771, 15772, 15773, 15780, 15781, 15782, 15788,
15789, 15790, 15791, 15792, 15795), class = "Date"), mon = c("Mrz",
"Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz",
"Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz"), wea =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("dw", "rw"), class = "factor")), .Names = c("date",
"mon", "wea"), row.names = c(1156L, 1157L, 1158L, 1159L, 1160L,
1161L, 1162L, 1163L, 1164L, 1171L, 1172L, 1173L, 1179L, 1180L,
1181L, 1182L, 1183L, 1186L), class = "data.frame")

I want to get a period of days when it is dry weather and the difference
between days should be not more than one day.

For this example I need something to get:

Maybe as Group:

A:

2013-03-01 Mrz  dw
2013-03-02 Mrz  dw
2013-03-03 Mrz  dw
2013-03-04 Mrz  dw
2013-03-05 Mrz  dw
2013-03-06 Mrz  dw
2013-03-07 Mrz  dw
2013-03-08 Mrz  dw
2013-03-09 Mrz  dw

B

2013-03-16 Mrz  dw
2013-03-17 Mrz  dw
2013-03-18 Mrz  dw

C

2013-03-24 Mrz  dw
2013-03-25 Mrz  dw
2013-03-26 Mrz  dw
2013-03-27 Mrz  dw
2013-03-28 Mrz  dw

D

2013-03-31 Mrz  dw

How can I achive this. I really have only very few ideas like cast() or
melt() or both but i have trouble with the date format.

Thanks in advance.  

    [[alternative HTML version deleted]]

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

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


[R] Subset, period of days like one after another in a group

2014-05-20 Thread Christoph Schlächter
Dear all,

I have a subset of a data frame with 3 columns and a few rows. The columns
are “date” [%Y %m %d], “mon” [%b]  and “wea” for type of weather 
with “dw”
dry weather “rw” rainy weather.

Here it is as a list:

structure(list(date = structure(c(15765, 15766, 15767, 15768,
15769, 15770, 15771, 15772, 15773, 15780, 15781, 15782, 15788,
15789, 15790, 15791, 15792, 15795), class = "Date"), mon = c("Mrz",
"Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz",
"Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz", "Mrz"), wea =
structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("dw", "rw"), class = "factor")), .Names = c("date",
"mon", "wea"), row.names = c(1156L, 1157L, 1158L, 1159L, 1160L,
1161L, 1162L, 1163L, 1164L, 1171L, 1172L, 1173L, 1179L, 1180L,
1181L, 1182L, 1183L, 1186L), class = "data.frame")

I want to get a period of days when it is dry weather and the difference
between days should be not more than one day.

For this example I need something to get:

Maybe as Group:

A:

2013-03-01 Mrz  dw
2013-03-02 Mrz  dw
2013-03-03 Mrz  dw
2013-03-04 Mrz  dw
2013-03-05 Mrz  dw
2013-03-06 Mrz  dw
2013-03-07 Mrz  dw
2013-03-08 Mrz  dw
2013-03-09 Mrz  dw

B

2013-03-16 Mrz  dw
2013-03-17 Mrz  dw
2013-03-18 Mrz  dw

C

2013-03-24 Mrz  dw
2013-03-25 Mrz  dw
2013-03-26 Mrz  dw
2013-03-27 Mrz  dw
2013-03-28 Mrz  dw

D

2013-03-31 Mrz  dw

How can I achive this. I really have only very few ideas like cast() or
melt() or both but i have trouble with the date format.

Thanks in advance.  

[[alternative HTML version deleted]]

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


Re: [R] Variation Inflation factor for GLS

2014-05-20 Thread John Fox
Dear Laura,

There is no car::vif() method for gls objects, but the approach that 
car:::vif.lm() uses -- to compute VIFs (and generalized VIFs) from the 
correlation matrix of the coefficients -- should be applicable to models fit by 
gls().

I'll take a look a providing a vif.gls() method when I have some time, but, 
especially if you want VIFs, as opposed to GVIFs, you should be able to do the 
computations yourself.

I hope this helps,
 John


John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/


On Tue, 20 May 2014 13:26:58 +
 Laura Riggi  wrote:
> Dear all,
> I am running a gls and I would like to check the vif of my model. It seems 
> that the vif function in the car package and the vif.mer function available 
> online do not work for gls. Would you know of a method to measure variance 
> inflation factors for GLS?
> Thank you
> Laura
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread Knut Krueger

Am 20.05.2014 17:32, schrieb Bert Gunter:


paste("a","b",sep="\\") ## "\\" is the escaped single backslash

[1] "a\\b"

cat(paste("a","b",sep="\\"))

a\b

Does this help clarify? Or have i misunderstood you?


@David and @Bert

unfortunately yes. My question is more a system level question as about 
any converting functions.


The question is how to paste a windows path directly into an R script 
(without readline() or readClipboard() and how could I convert this 
string that it is usable in R. Means any function which is not using 
escape characters


it seems to be possible for readline() an  readClipboard().

I do not want to use y=readline() I do want to use 
y=foo("c:\foo1\foo2\") but this seems to be impossible because R is 
interpreting one backslash as escape sequence. So how does readline() 
and readClipboard() are working? Is there any other callback from utils 
which is able to deal with this?


I am afraid there is no way.

The reason is to prevent errors for beginning windows R user. If the 
path is long they either forget to convert one backslash or all and then 
they are frustrated that it is not working. And telling them to use 
search and replace ... Whatever they would replace it might be worse 
than before ;-)


regards Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Documenting docType data

2014-05-20 Thread Witold E Wolski
Thanks a lot. I still had an @export.

On 20 May 2014 14:34, Hadley Wickham  wrote:
> Don't export the dataset? (as mentioned in the answer to that
> question). If that doesn't help, please supply a minimal reproducible
> example.
>
> Hadley
>
> On Tue, May 20, 2014 at 3:35 AM, Witold E Wolski  wrote:
>> Hi,
>>
>> I am Trying to document data using roxygen2 by following the
>> stackoverflow question:
>> http://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2
>>
>>
>> And although my data resigin in mypackage/data
>> has extension .rda and .csv
>>
>> I am getting the same error as in the stackoverlfow issue:
>>
>> ** testing if installed package can be loaded
>> Error in namespaceExport(ns, exports) :
>>   undefined exports: feature_alignment_requant
>> Error: loading failed
>> Execution halted
>> ERROR: loading failed
>>
>> best regards
>> Witold
>>
>>
>> --
>> Witold Eryk Wolski
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> http://had.co.nz/



-- 
Witold Eryk Wolski

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second axis on bottom of graph

2014-05-20 Thread peter dalgaard

On 20 May 2014, at 16:34 , Hurr  wrote:

> I had asked How can I:
> 1) make ticks shorter or longer
> 2) make ticks cross the axis line
> 3) make ticks project toward the plot
> 4) make grid lines
> 5) make perpendicular labels be
>   close to the axis near ticks
>   projecting away from the plot 
> 
> I figured out that par(tck=..) solves three of the questions:
> 1) make ticks shorter or longer
> 3) make ticks project toward the plot
> 4) make grid lines
> But my how do I?
> 5) set the small distance I want the perdendicular 
> labels to be from the axis and from the ticks.
> 

2nd element of par(mgp=...), I think.


> Hurr
> 
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690888.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


[R] Large matrices and pairs/ggpairs

2014-05-20 Thread Tim Richter-Heitmann
Hi there,

i recently started to learn R to deal  with a huge data matrix to deal 
with with ecological data (about 40 observations in 360 samples, divided 
in 7 groups of similar samples). I want to do a simple pairs or ggpairs:

pairs(mydata, pch=20, col=brewer.pal(7, "Dark2")[unclass(all$group)])

ggpairs(mydata, colour="group") (preferred)



Of course, the plot margins are way to small to produce a 40x40 plot 
matrix (or is there a way to create poster-sized plots?), so i need to 
produce 39 x,y scatter-plots for each single column and arrange them 
somehow. Is there a way to do it automatically (without creating 39 
single plots one by one?)
Another option would be to only show plots with x,y pairs with 
correlation values above a certain treshold (i would need to create the 
cor-matrix first and identify those highly correlated pairs by myself, 
correct, or is there a way to tell R to do that?)
And finally, ggpairs is giving me fits because the font size of the 
upper part does not change despite me trying to tell R to do so 
(params=list(corSize=10) or just params=list(Size=10) or 
upper=list(params=c(Size=10)).


As i said i am a beginner and hopefully my questions are not too stupid.

-- 
Tim Richter-Heitmann (M.Sc.)
PhD Candidate



International Max-Planck Research School for Marine Microbiology
University of Bremen
Microbial Ecophysiology Group (AG Friedrich)
FB02 - Biologie/Chemie
Leobener Straße (NW2 A2130)
D-28359 Bremen
Tel.: 0049(0)421 218-63062
Fax: 0049(0)421 218-63069


[[alternative HTML version deleted]]

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


Re: [R] Rprintf not updating

2014-05-20 Thread blosloos
Hi

Could not make this example work, maybe because its missing
*rPercentComplete pointing at percentComplete. The above mentioned link has
been moved? to:
https://gist.github.com/KRD1/2503984

however, this worked for me:

*R side:*

/pBar <- txtProgressBar( min = 0, max = 100, style = 3)
blub<-.Call("FUBAR", 
as.matrix(blab),
as.matrix(blib),
...,
pBar,
PACKAGE="blob"
)   
close(pBar)/


*C side:*
/  
...
extern "C"{

SEXP FUBAR(
SEXP blab,
SEXP blib,
...,
   SEXP pBar
){

   ...

   SEXP utilsPackage; 
   PROTECT(utilsPackage = eval(lang2(install("getNamespace"),
ScalarString(mkChar("utils"))),R_GlobalEnv));
   SEXP percentComplete;
   PROTECT(percentComplete = NEW_NUMERIC(1));
   double *rPercentComplete;
   rPercentComplete = NUMERIC_POINTER(percentComplete);


   for(some loop on n){
   *rPercentComplete = n;
eval(lang4(install("setTxtProgressBar"), pBar, percentComplete,
R_NilValue), utilsPackage);
   }


   UNPROTECT(...)
   return ...
}

}/



--
View this message in context: 
http://r.789695.n4.nabble.com/Rprintf-not-updating-tp1751703p4690887.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] NppToR / RMySQL / loadNamespace() Error

2014-05-20 Thread Peter Meissner

Dear Listeners,

I finally managed to install RMySQL on my Win7(64Bit) machine with R.3.1.0.

Now, as long as I start R manually and load the package everything is
working just fine: the package loads and I can connect to a database and
query it.

But, when NppToR does start the R session for me something is going
wrong and I have no clue where even to start.

The R-output reads like this:


> require(RMySQL)
Loading required package: RMySQL
Loading required package: DBI
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
call: utils::readRegistry("SOFTWARE\\MySQL AB", hive = "HLM",
maxdepth = 2)
error: Registry key 'SOFTWARE\MySQL AB' not found


Does anybody have an idea how to fix or circumvent this?


Best, Peter

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


[R] Fitting multiple nonlinear regression lines with nlrob()

2014-05-20 Thread jlabo...@huskers.unl.edu
Greetings R community,


I would like to regress a nonlinear trend onto several subsets of data 
(representing different treatments) within a dataset.  In my case, I would like 
to fit a nonlinear trend to several different "Tillage" treatments.


model.global = nlrob(FinalBiomass ~ 
Wm[Tillage]*(1-exp((DVS/a[Tillage])^b[Tillage])),
  data=DATA,
 start = list(Wm=c(350,350,350), 
a=c(1.4,1.4,1.4),b=c(2.3,2.3,2.3) ),
trace=TRUE)?


I can do this no problem with nls(), however, when I try to do this with 
nlrob() I get the error message:


Error in nls(formula, data = data, start = start, algorithm = algorithm,  :
  parameters without starting value in 'data': Wm, a, b

?However, I thought I had defined the starting values for my parameters in my 
code (I have 3 "Tillage" treatments I am trying to fit).

I do get an output, but it is identical to the output I get when I run nls(). 
Is nlrob capable of performing this analysis??

Any thoughts would be appreciated.
Best,

John



John Laborde
Graduate Research Assistant
University of Nebraska-Lincoln
Department of Agronomy & Horticulture
jlabo...@huskers.unl.edu


[[alternative HTML version deleted]]

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


Re: [R] Using centers of hierarchical clustering for k-means

2014-05-20 Thread marioger
Thank you very much for your help. everything works great



--
View this message in context: 
http://r.789695.n4.nabble.com/Using-centers-of-hierarchical-clustering-for-k-means-tp4690704p4690870.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Variation Inflation factor for GLS

2014-05-20 Thread Laura Riggi
Dear all,
I am running a gls and I would like to check the vif of my model. It seems that 
the vif function in the car package and the vif.mer function available online 
do not work for gls. Would you know of a method to measure variance inflation 
factors for GLS?
Thank you
Laura



[[alternative HTML version deleted]]

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread Bert Gunter
On Tue, May 20, 2014 at 7:54 AM, Knut Krueger  wrote:
> Am 20.05.2014 15:22, schrieb Jeff Newmiller:
>>
>> Most importantly, "\\" is a string literal containing ONE backslash
>> character. Yes you can create strings in R source code that represent
>> Windows-style paths, but they must APPEAR different in that context. You may
>> find it helpful to know that the print function can output escaped strings
>> suitable for inclusion in R code, while the cat function can output those
>> same strings without the escaping.
>
>
> Thanks for your answer,
>
> I am familiar with the escape strings, but I was looking for a way to
> convert copied path from windows:

Well, if I understand you correctly, your response appear to belie
that claim.  "\" ,the **single** backslash character, is **shown** as
2 backslash characters at the console,"\\" by print() (which is called
silently) , and is **shown** as a single backslash character by cat().
viz.

> paste("a","b",sep="\\") ## "\\" is the escaped single backslash
[1] "a\\b"
> cat(paste("a","b",sep="\\"))
a\b

Does this help clarify? Or have i misunderstood you?

Cheers,
Bert

>
> working:
>
> y=readline()
> # paste f.e c:\foo1\foo2
> y
> [1] "c:\\foo1\\foo2"
>
>
> but I was looking for
>
> y=foo("c:\foo1\foo2").
> because it is annoying to change all \ to \\ or to /
>
> Regards Knut
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
Annoying but easy. Would this work for you?

y <- gsub("", "/", readline())
C:\foo1\foo2\
> y
[1] "C:/foo1/foo2/"

-
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Knut Krueger
Sent: Tuesday, May 20, 2014 9:54 AM
To: 'R R-help'
Subject: Re: [R] \ escape sequence and windows path

Am 20.05.2014 15:22, schrieb Jeff Newmiller:
> Most importantly, "\\" is a string literal containing ONE backslash 
> character. Yes you can create strings in R source code that represent 
> Windows-style paths, but they must APPEAR different in that context. You may 
> find it helpful to know that the print function can output escaped strings 
> suitable for inclusion in R code, while the cat function can output those 
> same strings without the escaping.

Thanks for your answer,

I am familiar with the escape strings, but I was looking for a way to 
convert copied path from windows:

working:

y=readline()
# paste f.e c:\foo1\foo2
y
[1] "c:\\foo1\\foo2"


but I was looking for

y=foo("c:\foo1\foo2").
because it is annoying to change all \ to \\ or to /

Regards Knut

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

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread Knut Krueger

Am 20.05.2014 15:22, schrieb Jeff Newmiller:

Most importantly, "\\" is a string literal containing ONE backslash character. 
Yes you can create strings in R source code that represent Windows-style paths, but they 
must APPEAR different in that context. You may find it helpful to know that the print 
function can output escaped strings suitable for inclusion in R code, while the cat 
function can output those same strings without the escaping.


Thanks for your answer,

I am familiar with the escape strings, but I was looking for a way to 
convert copied path from windows:


working:

y=readline()
# paste f.e c:\foo1\foo2
y
[1] "c:\\foo1\\foo2"


but I was looking for

y=foo("c:\foo1\foo2").
because it is annoying to change all \ to \\ or to /

Regards Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second axis on bottom of graph

2014-05-20 Thread Hurr
I had asked How can I:
1) make ticks shorter or longer
2) make ticks cross the axis line
3) make ticks project toward the plot
4) make grid lines
5) make perpendicular labels be
   close to the axis near ticks
   projecting away from the plot 

I figured out that par(tck=..) solves three of the questions:
1) make ticks shorter or longer
3) make ticks project toward the plot
4) make grid lines
But my how do I?
5) set the small distance I want the perdendicular 
labels to be from the axis and from the ticks.

Hurr




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690888.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] logLik in betareg()

2014-05-20 Thread ChrisR
Hi everyone,

I have estimated different models with the betareg() command from the
package 'betareg' (3.0-4). When I started to compare them using likelihood
ratio tests, it occured to me that the logLik() of the models increased with
increasing number of parameters. I confirmed this observations by repeating
the MockJurors example from the betareg vignette. 

Now my question is, why does the loglikelihood becomes bigger with more
explanatory variables included? (Applying logLik() to the standard glm()
command yields a negative loglikelihood which moves toward zero with each
additional predictor included.) 

Thanks for hints,
Chris



--
View this message in context: 
http://r.789695.n4.nabble.com/logLik-in-betareg-tp4690885.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-20 Thread Shane Carey
Hi,

I amtrying to plot a cfd with a histogram on one plot. The problem is the
scale (y-axis) of the plots are hugely different and as a result the
histogram plot is hard to read. Are there any examples of plots like this
done in R:

http://ej.iop.org/images/0952-4746/32/3/325/Full/jrp428239f9_online.jpg

Thanks



-- 
Shane

[[alternative HTML version deleted]]

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread Jeff Newmiller
Most importantly, "\\" is a string literal containing ONE backslash character. 
Yes you can create strings in R source code that represent Windows-style paths, 
but they must APPEAR different in that context. You may find it helpful to know 
that the print function can output escaped strings suitable for inclusion in R 
code, while the cat function can output those same strings without the escaping.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On May 20, 2014 5:28:50 AM PDT, peter dalgaard  wrote:
>
>On 20 May 2014, at 12:37 , Knut Krueger  wrote:
>
>> 
>> Is there any function to change the windows path to linux path?
>> 
>> especially I would like to have the possibility to use
>> f.e
>> path="C:\foo1\foo2\"
>> I can import those paths with
>> path = readline()  but not directly in a script
>> 
>
>In R string specifications, \ is an escape character. \n is newline, \b
>rings the bell, \" is a double quote, etc. So "C:\foo1\foo2\" is
>unterminated and containes 2 form feed characters. 
>
>There's no way around using \\ to specify a backslash in a string
>literal.  For file paths, you can also use the forward slash instead of
>the backslash.
>
>> Regards Knut
>> 
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Boxplots

2014-05-20 Thread Shane Carey
Thanks


On Tue, May 20, 2014 at 2:21 AM, William Dunlap  wrote:

> Another method uses the core boxplot() function but replaces the usual
> call to split() with a variant that puts all the data at the end of
> the list of splits:
>
> > splitPlusAll <- function(x, ...) c(split(x, ...), list(All=x))
> > boxplot(with(mtcars, splitPlusAll(wt, list(gear,am), drop=TRUE)))
> > boxplot(with(mtcars, split(wt, list(gear,am), drop=TRUE)))
>
> (It helps if you show what you have done when your question arose, as
> there are several R functions for drawing boxplots.)
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Mon, May 19, 2014 at 2:41 PM, Shane Carey  wrote:
> > Great,
> >
> > Thanks everyone :-)
> >
> > On Monday, May 19, 2014, Richard M. Heiberger  wrote:
> >
> >> tmp <- data.frame(y=c(rnorm(20), rnorm(20), c=rnorm(20)),
> >> g=rep(letters[1:3], each=20))
> >>
> >> library(lattice)
> >> library(latticeExtra)
> >> A <- bwplot(y ~ g, data=tmp)
> >> B <- bwplot(y ~ rep("Y",60), data=tmp, horizontal=FALSE)
> >>
> >> resizePanels(c(Individual=A, "All Together"=B, layout=c(2,1)), w=c(3,1))
> >>
> >>
> >> ## for even more options, you can look at the examples in
> >> ## the HH package
> >> ## install.packages("HH") ## if necessary
> >> library(HH)
> >> demo("bwplot.examples", package="HH")
> >> example("panel.bwplot.superpose", package="HH")
> >> ?panel.bwplot.intermediate.hh
> >> ?panel.bwplot.superpose
> >>
> >> On Mon, May 19, 2014 at 10:08 AM, Shane Carey  >
> >> wrote:
> >> > Hi,
> >> >
> >> > I have boxplots by factors for a dataset and trying to include a
> boxplot
> >> to
> >> > represent the entire dataset.
> >> >
> >> > Any idea how this would be done?
> >> >
> >> > Thanks
> >> >
> >> > --
> >> > Shane
> >> >
> >> > [[alternative HTML version deleted]]
> >> >
> >> > __
> >> > R-help@r-project.org  mailing list
> >> > https://stat.ethz.ch/mailman/listinfo/r-help
> >> > PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> > and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
> > --
> > Shane
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>



-- 
Shane

[[alternative HTML version deleted]]

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


Re: [R] Documenting docType data

2014-05-20 Thread Hadley Wickham
Don't export the dataset? (as mentioned in the answer to that
question). If that doesn't help, please supply a minimal reproducible
example.

Hadley

On Tue, May 20, 2014 at 3:35 AM, Witold E Wolski  wrote:
> Hi,
>
> I am Trying to document data using roxygen2 by following the
> stackoverflow question:
> http://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2
>
>
> And although my data resigin in mypackage/data
> has extension .rda and .csv
>
> I am getting the same error as in the stackoverlfow issue:
>
> ** testing if installed package can be loaded
> Error in namespaceExport(ns, exports) :
>   undefined exports: feature_alignment_requant
> Error: loading failed
> Execution halted
> ERROR: loading failed
>
> best regards
> Witold
>
>
> --
> Witold Eryk Wolski
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



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

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


Re: [R] \ escape sequence and windows path

2014-05-20 Thread peter dalgaard

On 20 May 2014, at 12:37 , Knut Krueger  wrote:

> 
> Is there any function to change the windows path to linux path?
> 
> especially I would like to have the possibility to use
> f.e
> path="C:\foo1\foo2\"
> I can import those paths with
> path = readline()  but not directly in a script
> 

In R string specifications, \ is an escape character. \n is newline, \b rings 
the bell, \" is a double quote, etc. So "C:\foo1\foo2\" is unterminated and 
containes 2 form feed characters. 

There's no way around using \\ to specify a backslash in a string literal.  For 
file paths, you can also use the forward slash instead of the backslash.

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

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [R] Spatial Quantile Regression: Extracting residuals

2014-05-20 Thread Roger Bivand
Marie-Line GLAESENER  uni.lu> writes:

> 
> Dear R users,
> 
> Could anyone tell me if there is a way to obtain the residuals from a
model fitted by
> 
> qregspiv(y ~  x,wmat=wmat,inst=NULL,tau=.5,rhomat =
seq(-1,1,.01),printsariv=T,silent=F,   nboot=300,data=)
> 
> in McSpatial, using the Chernozhukov and Hansen (2006) method.

This is a very specialised question, and even on the more appropriate list
R-sig-geo might not be answered. Writing to the package maintainer is one
possibility, but as you see from:

library(McSpatial)
example(qregspiv)
fit <- qregspiv(form, wmat=wmat, data=mdata, rhomat=seq(-1,1,0.01),
nboot=300, tau=0.5)
str(fit)

shows only:

 num [1:4, 1:4] 7.35 0.288 0.343 0.05 1.993 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:4] "(Intercept)" "lnland" "lnbldg" "WY"
  ..$ : chr [1:4] "Coef." "Std. Err." "Z-Values" "Pr(>|z|)"

so that apart from the coefficient values and their distribution summaries,
nothing else is returned. This means that you will have to put qregspiv into
debug() mode, and manipulate those internal objects that you need, but which
are not returned.

Hope this helps,

Roger

> 
> Many thanks in advance and kind regards,
> 
> Marie-Line
> 
> Ph.D. Candidate
> Institute of Geography and Spatial Planning
> 
> UNIVERSITÉ DU LUXEMBOURG
> CAMPUS WALFERDANGE
> Route de Diekirch / BP 2
> L-7201 Walferdange
> Luxembourg
> marie-line.glaesener  uni.lu
> www.geo.ipse.uni.lu
> 
> 
> 
> 
> Dear R users,
> 
> Could anyone tell me if there is a way to obtain the residuals from a
model fitted by
> 
> qregspiv(y ~  x,wmat=wmat,inst=NULL,tau=.5,rhomat =
seq(-1,1,.01),printsariv=T,silent=F,   nboot=300,data=)
> 
> in McSpatial, using the Chernozhukov and Hansen (2006) method.
> 
> Many thanks in advance and kind regards,
> 
> Marie-Line
> 
> Ph.D. Candidate
> Institute of Geography and Spatial Planning
> 
> UNIVERSITÉ DU LUXEMBOURG
> CAMPUS WALFERDANGE
> Route de Diekirch / BP 2
> L-7201 Walferdange
> Luxembourg
> marie-line.glaesener  uni.lu
> www.geo.ipse.uni.lu
> 
>   [[alternative HTML version deleted]]
> 
>

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


Re: [R] How to include static PDFs vignettes in an R package

2014-05-20 Thread Duncan Murdoch

On 20/05/2014, 2:51 AM, Luca Scrucca wrote:

Hi all,

prior to R version 3.0 I used to include a static PDF file as package vignette 
following the instructions in 
http://www.icesi.edu.co/CRAN/web/packages/R.rsp/vignettes/NonSweaveVignettes.pdf
 (I know this is a little bit old), except that the relevant files where in 
vignette/ directory of the package and not on inst/doc/.
This was recognized by the R build system, so the vignette appeared when 
calling browseVignettes() as well as in the 'Overview of user guides and 
package vignettes' section of the package HTML help page. However, this doesn't 
work anymore, and I have tried many different ways but with no success.
Did someone find another solution to include static PDF files as vignettes in R 
packages?
Thanks in advance.


You need to include the source, otherwise R doesn't consider it to be a 
vignette.


If this package is for your own use (not for CRAN), the "source" could 
simply be an instruction to copy the .pdf from somewhere -- see the 
current non-Sweave vignettes section of Writing R Extensions for how to 
set this up.  I don't think that would be acceptable on CRAN under their 
open source policy.


Duncan Murdoch

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


[R] \ escape sequence and windows path

2014-05-20 Thread Knut Krueger


Is there any function to change the windows path to linux path?

especially I would like to have the possibility to use
f.e
path="C:\foo1\foo2\"
I can import those paths with
path = readline()  but not directly in a script

Regards Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Variance of predictions from lme4 models at existing levels?

2014-05-20 Thread Julien Riou
Dear contributors,

I know that this has been widely discussed, but even after having read many
discussions on this matter, I'm still not sure if I'm understanding
properly.

So I have a dataset of studies reporting prevalence in several settings,
here is an exemple:

data<-data.frame(id_study=c("UK1","UK2","UK3","FRA1","FRA2","BEL1","GER1","GER2","GER3"),
 
country=c("UK","UK","UK","FRANCE","FRANCE","BELGIUM","GERMANY","GERMANY","GERMANY"),
 n_events=c(130,49,18,10,50,6,34,20,51),
 n_total=c(3041,580,252,480,887,256,400,206,300),
 study_median_age=c(25,50,58,30,42,26,27,28,36),
 pop_type=c(2,0,1,0,0,0,1,0,2))
data$prevalence<-data$n_events/data$n_total

Since the prevalence is linked to the sample age and type, the objective is
to estimate the predicted prevalence for each study for a sample with
standardized median age (30) and type ("A"). Then these predictions will be
pooled by country using a Dersimonian & Laird method.

This is the model I chose:

mod<-glmer(cbind(n_events, n_total-n_events) ~ study_median_age + pop_type +
(1|country) + (1|id_study), data=data, family="binomial"(link=logit))

I tried to adapt the method from the r-sig-mixed-models
FAQ in
order to get the variance of the estimate, which will be used in the
weighting of the Dersimonian & Laird meta-analysis:

newdat=data.frame(id_study=data$id_study,
  country=data$country,
  study_median_age=30,
  pop_type="A",
  n_events=0,
  n_total=data$n_total)

pred<-predict(mod,newdat[,1:4],type="link",REform=~(1|country) + (1|id_study))
mm <- model.matrix(terms(mod),newdat)
newdat$distance <- mm %*% fixef(mod)

pvar1 <- diag(mm %*% tcrossprod(vcov(mod),mm))
tvar1 <- pvar1 + VarCorr(mod)$country[1] + VarCorr(mod)$id_study[1]

If I understood correctly, tvar1 is an estimation of the variance of the
prediction, taking into account the uncertainty on the two random
intercepts. I can consider tvar1 as the variance of the prediction for the
further meta-analysis, and also for calculation of the confidence interval
of the prediction.

data$prediction<-mod@resp$family$linkinv(pred)
data$predictionSE2<-tvar1
data$predictionCI<-paste0("[",round(mod@resp$family$linkinv(pred-1.96*tvar1),4),";",
  round(mod@resp$family$linkinv(pred+1.96*tvar1),4),"]")
data

So my questions are:

   - Did I properly adapt the method for the calculation of the variance to
   this model with 2 random intercepts?
   - Can I use this variance in the meta-analysis?

Thank you!

[[alternative HTML version deleted]]

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


[R] Documenting docType data

2014-05-20 Thread Witold E Wolski
Hi,

I am Trying to document data using roxygen2 by following the
stackoverflow question:
http://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2


And although my data resigin in mypackage/data
has extension .rda and .csv

I am getting the same error as in the stackoverlfow issue:

** testing if installed package can be loaded
Error in namespaceExport(ns, exports) :
  undefined exports: feature_alignment_requant
Error: loading failed
Execution halted
ERROR: loading failed

best regards
Witold


-- 
Witold Eryk Wolski

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second axis on bottom of graph

2014-05-20 Thread Hurr
How can I:
1) make ticks shorter or longer 
2) make ticks cross the axis line
3) make ticks project toward the plot 
4) make grid lines 
5) make perpendicular labels be 
   close to the axis near ticks 
   projecting away from the plot 




--
View this message in context: 
http://r.789695.n4.nabble.com/Second-axis-on-bottom-of-graph-tp4690696p4690867.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Subsets of a function

2014-05-20 Thread ONKELINX, Thierry
Another option is the plyr package.

library(plyr)
result <- dlply(size, ~ Year +Season, function(.sub){
with(.sub, smooth.spline(Size, Prop, spar = 0.25))
}


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure 
that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens 
jim holtman
Verzonden: dinsdag 20 mei 2014 2:44
Aan: Marlin Keith Cox
CC: r-help@r-project.org
Onderwerp: Re: [R] Subsets of a function

It would have been nice if you at least supplied a subset of the data, but here 
is a try at it:

myList <- split(size, list(size$Year, size$Season)) result <- lapply(myList, 
function(.sub){
smooth.spline(.sub$Size, spar = 0.25)
})




Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Mon, May 19, 2014 at 8:34 PM, Marlin Keith Cox wrote:

> Hi all, this is a reoccurring theme in my programming and I need some
> help with it.  When I use a built in function and need to use it on a
> subset of my data frame, I always end up using the subset function
> first, but this seems very clunky.  For example, if I have years 2003:2013 
> with season "a"
> and "b" within each year, and I want to create a smooth.spline, I end
> up creating a subset for each year and season, and then have a smooth
> spline function for each year and season.  Can I do this more efficiently?
>
>
> The subsets are below:
>
>
> size.2003<-subset(size,Year==2003&Season=="a")
>
> size.2004<-subset(size,Year==2004&Season=="a")
>
> size.2005<-subset(size,Year==2005&Season=="a")
>
> size.2006<-subset(size,Year==2006&Season=="a")
>
> size.2007<-subset(size,Year==2007&Season=="a")
>
> size.2008<-subset(size,Year==2008&Season=="a")
>
> size.2009<-subset(size,Year==2009&Season=="a")
>
> size.2010<-subset(size,Year==2010&Season=="a")
>
> size.2011<-subset(size,Year==2011&Season=="a")
>
> size.2012<-subset(size,Year==2012&Season=="a")
>
> size.2013<-subset(size,Year==2013&Season=="a")
>
> size.2003b<-subset(size,Year==2003&Season=="b")
>
> size.2004b<-subset(size,Year==2004&Season=="b")
>
> size.2005b<-subset(size,Year==2005&Season=="b")
>
> size.2006b<-subset(size,Year==2006&Season=="b")
>
> size.2007b<-subset(size,Year==2007&Season=="b")
>
> size.2008b<-subset(size,Year==2008&Season=="b")
>
> size.2009b<-subset(size,Year==2009&Season=="b")
>
> size.2010b<-subset(size,Year==2010&Season=="b")
>
> size.2011b<-subset(size,Year==2011&Season=="b")
>
> size.2012b<-subset(size,Year==2012&Season=="b")
>
> size.2013b<-subset(size,Year==2013&Season=="b")
>
> The smooth.spline is below
>
> 2003<-with(size.2003,smooth.spline(Size,Prop,spar=0.25))
>
> 2004<-with(size.2004,smooth.spline(Size,Prop,spar=0.25))
> 2005<-with(size.2005,smooth.spline(Size,Prop,spar=0.25))
> etc. etc.
>
> M. Keith Cox, Ph.D.
> Principal
> MKConsulting
> 17105 Glacier Hwy
> Juneau, AK 99801
> U.S. 907.957.4606
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the 
writer and may not be regarded as stating an official position of INBO, as long 
as the message is not confirmed by a duly signed document.

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