Re: [R] R shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-24 Thread Berwin A Turlach
G'day Peter,

On Thu, 23 Aug 2018 08:45:37 -0700
Peter Langfelder  wrote:

> The manual, specifically
> 
> https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Installation
> 
> documents this way of choosing the installation directory.

Yes, with the caveat that one needs GNU or Solaris make (which would be
the case on Ubuntu).  So it is hardly the recommended way.  

As I read the R Administration Manual, the recommended way is to specify
the location at which you want to install R via ./configure.

Cheers,

Berwin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unclear about the output from summary of ca.jo from package urca

2018-08-24 Thread Ashim Kapoor
Dear Bert,

I have read some of the references. I do understand what the 2 matrices(
the cointegrating relationships and the alpha / loading matrix which gives
the speed of the mean reversion)  are. What I do not understand is the
format of the output of the package. My main query is that why do we have
.l2 in the cointegrating relationships. They are contemporaneous
relationships , they should not have .l2 in the end. That's my query.

Many thanks,
Ashim

On Thu, Aug 23, 2018 at 7:52 PM Bert Gunter  wrote:

> This is about statistics , not R programming, and so is off topic here.
> Your first port of call for this sort of thing should be the package docs,
> **including any references** . There are references given. Have you studied
> them??
>
> Cheers,
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Thu, Aug 23, 2018 at 2:12 AM Ashim Kapoor 
> wrote:
>
>> Dear All,
>>
>> I am not sure about the summary of the function ca.jo. I have posted my
>> query here :-
>>
>>
>> https://stats.stackexchange.com/questions/363188/interpreting-the-names-used-in-the-output-of-johansen-test-in-package-urca-in-r
>>
>> I did not receive any reply so I am posting my query here.
>>
>> Many thanks and best regards,
>> Ashim
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unclear about the output from summary of ca.jo from package urca

2018-08-24 Thread peter dalgaard
Well, reading the code is not much harder than reading the papers (not that 
that helps much, been there...)

I don't actually know the answer, but the notation comes from this bit in 
ca.jo():

if (spec == "longrun") {
ZK <- cbind(x[-c((N - K + 1):N), ], 1)
Lnotation <- K
}
else if (spec == "transitory") {
ZK <- cbind(x[-N, ], 1)[K:(N - 1), ]
Lnotation <- 1
}
colnames(ZK) <- c(paste(colnames(x), ".l", Lnotation, 
sep = ""), "constant")

(actually there are several such bits). 

K=2 by default, so you get .l2 for the "longrun" spec and ".l1" for 
"transitory". So I would guess that studying the two specification formats from 
the help page might give the solution to the riddle eventually.

(Another issue is that the column names are clearly rubbish, only the row names 
make sense. The columns are eigenvectors sorted by eigenvalues which has no 
relation to the input columns. Presumably, they are just an artifact of the 
matrix operations.)

-pd

> On 24 Aug 2018, at 11:31 , Ashim Kapoor  wrote:
> 
> Dear Bert,
> 
> I have read some of the references. I do understand what the 2 matrices(
> the cointegrating relationships and the alpha / loading matrix which gives
> the speed of the mean reversion)  are. What I do not understand is the
> format of the output of the package. My main query is that why do we have
> .l2 in the cointegrating relationships. They are contemporaneous
> relationships , they should not have .l2 in the end. That's my query.
> 
> Many thanks,
> Ashim
> 
> On Thu, Aug 23, 2018 at 7:52 PM Bert Gunter  wrote:
> 
>> This is about statistics , not R programming, and so is off topic here.
>> Your first port of call for this sort of thing should be the package docs,
>> **including any references** . There are references given. Have you studied
>> them??
>> 
>> Cheers,
>> 
>> Bert Gunter
>> 
>> "The trouble with having an open mind is that people keep coming along and
>> sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>> 
>> 
>> On Thu, Aug 23, 2018 at 2:12 AM Ashim Kapoor 
>> wrote:
>> 
>>> Dear All,
>>> 
>>> I am not sure about the summary of the function ca.jo. I have posted my
>>> query here :-
>>> 
>>> 
>>> https://stats.stackexchange.com/questions/363188/interpreting-the-names-used-in-the-output-of-johansen-test-in-package-urca-in-r
>>> 
>>> I did not receive any reply so I am posting my query here.
>>> 
>>> Many thanks and best regards,
>>> Ashim
>>> 
>>>[[alternative HTML version deleted]]
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Algorithm Net Analyte Signal (NAS) in R

2018-08-24 Thread Vittorio Colagrande via R-help
 Dear R-group
I would like to ask a possible algorithm in R and related documetation for 

the development of analysis "Net Analyte Signal" (NAS) in order to solve 

of problem of spectral interference in Analytical Chemistry. 

 

I will greatly appreciate any clarification you could provide.

Best regards.

Vittorio Colagrande
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 add a geom_smooth() line

2018-08-24 Thread Jeff Reichman
Got it thank you

 

From: Riley Finn  
Sent: Thursday, August 23, 2018 10:24 PM
To: reichm...@sbcglobal.net
Cc: R-help@r-project.org
Subject: Re: [R] How to add a geom_smooth() line

 

Jeff,

 

You need to reshape your data frame.  If you use ggplot, you will often have to 
present your data in "long format"

 

Use the reshape2 package.

 

I made a sample data frame because you didn't provide one.  I also change your 
x and y labels because they made no sense.  

 

data <- data.frame(
  timeline = 1:10,
  launches = sample(10:20, 10),
  deliveries = sample(10:20, 10)
)

library(reshape2)
dataNew <- melt(data = data, id.vars = 'timeline', 
variable.name   = 'launchOrDelivery')

ggplot(data=dataNew, aes(x=timeline, y=value), color= launchOrDelivery) +
  geom_point(aes(color= launchOrDelivery)) + 
  geom_smooth(aes(group = launchOrDelivery, color= launchOrDelivery), se = 
FALSE) + 
  xlab("timeline") +
  ylab("Launches/Deliveries") +
  ggtitle("Scatterplot of Launches vs. Deliveries")

 

On Thu, Aug 23, 2018 at 9:39 PM Jeff Reichman mailto:reichm...@sbcglobal.net> > wrote:

R-help



I want to add two smooth lines (geom_smooth()) for each scatter plot.  How
do I do that?



ggplot() +

  geom_point(data=data, aes(x=timeline, y=deliveries), color="blue") +

  geom_point(data=data, aes(x=timeline, y=launches), color="red") +

  xlab("Deliveries") +

  ylab("Launches") +

  ggtitle("Scatterplot of Launches vs. Deliveries")



Jeff


[[alternative HTML version deleted]]

__
R-help@r-project.org   mailing list -- To 
UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-24 Thread Ista Zahn
On Thu, Aug 23, 2018 at 6:57 AM Rolf Turner  wrote:
>
>
> I *think* that this is an R question (and *not* an RStudio question!)

I think this is actually and Ubuntu question, and probably belongs on
R-sig-debian.

>
> I have, somewhat against my better judgement, decided to experiment with
> using RStudio.
>
> I downloaded and install RStudio.  Easy-peasy.  Nice lucid instructions.
>
> Then I tried to start RStudio ("rstudio" from the command line)
> and got a pop-up window with the error message:
>
> > R shared library (/usr/lib64/R/lib/libR.so) not found. If this
> > is a custom build of R, was it built with the --enable-R-shlib option?
>
> Oops, no, I guess it wasn't.  So I carefully did a
>
>  sudo make uninstall
>  make clean
>  make distclean
>
> and then did
>
>  ./R-3.5.1/configure 
>
> making sure I added the --enable-R-shlib flag.
>
> Then I did make and sudo make install.

IMO if you are compiling and installing software yourself on Linux
your are Doing It Wrong. Use the package manager, that is what it is
there for.

--Ista

It all seemed to go ...
> but then I did
>
>  rstudio
>
> again and got the same popup error.
>
> There is indeed *no* libR.so in /usr/lib64/R/lib.
>
> There *is* a libR.so in /usr/lib/R/lib, but (weirdly) ls -l reveals that
> it dates from the my previous install of R-3.5.1 for which I *did not*
> configure with --enable-R-shlib.
>
> Can anyone explain to me WTF is going on?
>
> What should I do?  Just make a symbolic link from /usr/lib/R/lib/libR.so
> to /usr/lib64/R/lib/libR.so?
>
> It bothers me that /usr/lib/R/lib/libR.so was not "refreshed" from my
> most recent install of R.
>
> I plead for enlightenment.
>
> cheers,
>
> Rolf Turner
>
> P.S. I'm running Ubuntu 18.04.  And the previous install of R was done
> under Ubuntu 18.04.
>
> R. T.
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Cant schedule R job using taskscheduleR

2018-08-24 Thread Christofer Bogaso
Hi,

I am trying to schedule an R job using taskscheduler_create() function
available in package taskscheduleR.

Below is my code:

> library(taskscheduleR)
Warning message:
package ‘taskscheduleR’ was built under R version 3.5.1
> taskscheduler_create(taskname = "ABC", rscript = paste("C:\\ABC.R"),
startdate = format(Sys.Date() + 1, "%d/%m/%Y"), schedule = "WEEKLY",
starttime = "16:30", days = c("MON", "TUE", "WED", "THU", "FRI")[1])
[1] "ERROR: Incorrect Start Date."
attr(,"status")
[1] 16389
Warning message:
In system(cmd, intern = TRUE) :
  running command 'schtasks /Create /TN "ABC" /TR "cmd /c
C:/PROGRA~1/R/R-35~1.0/bin/Rscript.exe \"C:\ABC.R\"  >> \"C:\ABC.log\"
2>&1" /SC WEEKLY /ST 16:30 /SD "25/08/2018" /D MON ' had status 16389


However it fails with stating Incorrect Start Date.

Any help to understand what went wrong?

I am using R in Windows. Below is Session Information :

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252LC_MONETARY=English_United States.1252 LC_NUMERIC=C
 LC_TIME=English_United States.1252

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

other attached packages:
[1] taskscheduleR_1.1

loaded via a namespace (and not attached):
[1] compiler_3.5.0tools_3.5.0   data.table_1.11.4

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Multiple counters in a single for loop

2018-08-24 Thread Deepa
Hello,

Is there an option to include multiple counters in a single for loop in R?

For instance, in python there is

for i,j in zip(x,range(0,len(x))):


Any suggestions?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Plots in ioslides and R markdown

2018-08-24 Thread Jeff Newmiller
a) Keep the mailing list in the conversation... someone else may have useful 
input, and others may benefit from reading the discussion.

b) If the issue can be reproduced on your end with something like a basic 
plot(mpg~disk, data=mtcars) call, then you should use that instead of your 
complicated example. If the problem only appears when you use certain plotting 
functions hidden inside your plot1 through plot6 functions, we can't tell that 
from here. Sorting that out is part of making your example minimal as the 
Posting Guide requests.

c) If you can only reproduce with certain data, then you can use dput to give 
us the necessary data.[1][2] It is up to you to determine what the minimal data 
needed to demo the problem is, but we don't want to sift through some large 
data blob only to find out that it was not relevant so you need to do that. 

d) Interactions with data files are hard to make reproducible on someone else's 
computer... saving data with different filenames will not help fix that problem.

e) Note that this is the R-help mailing list, not the RStudio-help mailing list 
nor the rmarkdown-package-help mailing list. We can and often do provide help 
on using contributed packages anyway, but you should be aware that not everyone 
here uses RStudio so doing your best to provide a reproducible example is in 
your interest if you want readers to consider your question on topic.

There are many discussions online of how to communicate R examples, such as 
[1][2][3]. In particular I think [3] is useful because it forces you to confirm 
that the example will run in a fresh R environment which is the first step to 
insuring it will run on our computers and we can dig into the problem. in this 
case you could use it to help confirm that your R code should work for us 
without the rmarkdown.

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html

[3] https://cran.r-project.org/web/packages/reprex/index.html (read the 
vignette) 


On August 24, 2018 3:13:17 AM PDT, Patrick Connolly 
 wrote:
>On Thu, 23-Aug-2018 at 07:23AM -0700, Jeff Newmiller wrote:
>
>|> This is not reproducible because you have not provided the plot
>|> code or sample data. Output of sessionInfo would probably be
>|> appropriate as well.
>
>I took it as read that the plotting functions themselves aren't an
>issue since they operate as intended outside of the Rmarkdown
>space. Any function that uses the function plot() successfully will
>do.  I was trying to ascertain how I should be setting up the scaling.
>
>|> As to whether needing to load objects is typical... yes, rmarkdown
>|> runs from a fresh environment to emphasize reproducibility, but
>|> your load command is bypassing that for us.
>
>The objects loaded from .RData took hours of simulating and it's out
>of the question to run them again inside Rmarkdown.  Though the script
>used in the creation of .RData is reproducable, perhaps it would be
>clearer for me to have saved the objects to a file by a different
>name.
>
>Is there a better way to do that??
>
>
>
>|> On August 23, 2018 2:15:19 AM PDT, Patrick Connolly
> wrote:
>|> >I'm having difficulty getting plots into ioslides.  It seems to me
>|> >that the scale is completely out, but I can't figure out what to do
>|> >about it.  Whatever I try, I get the title slide, then a second
>with a
>|> >horizontal line and a vertical line in the bottom right corner.  It
>|> >looks like a badly scaled plot about 25 times the size of the
>plotting
>|> >area, so only a fragment is visible.
>|> >
>|> >This is the code I've tried:
>|> >
>|> >---
>|> >title: "Barking up the wrong tree"
>|> >author: "Patrick Connolly"
>|> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
>|> >output: ioslides_presentation
>|> >---
>|> >
>|> >```{r global_options, echo=FALSE}
>|> >knitr::opts_chunk$set(tidy=TRUE,
>|> >  warning=FALSE, 
>|> >  message=FALSE,
>|> >  cache=FALSE,
>|> >  dpi=600)
>|> >```
>|> >
>|> >```{r use these functions, echo= FALSE}
>|> >  load(".RData") ## code for 6 plotting functions
>|> >
>|> >``
>|> >## 6 different Trees
>|> >
>|> >```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width =
>7,
>|> >fig.height = 5}
>|> >
>|> >###  par(mfrow = c(2, 3))
>|> >plot1()
>|> >plot2()
>|> >plot3()
>|> >plot4()
>|> >plot5()
>|> >plot6()
>|> >}
>|> >```
>|> >
>|> >If I run the plot functions in the Console, it all works and
>displays
>|> >correctly in Rstudiio's plot panel, even the mfrow bit.  But I
>haven't
>|> >worked out how to include the code into Rmarkdown.  I thought it
>might
>|> >be less taxing to not try putting the 6 plots on the same slide,
>but
>|> >it makes no difference when I commented out the mfrow bit.
>|> >
>|> >I'm not very familiar with the workings of Markdown or Rstudio, but
>it
>|> >does seem strange to me that I need to specifically load the

Re: [R] Multiple counters in a single for loop

2018-08-24 Thread Bert Gunter
Sort of, but you typically wouldn't need to in R because of vectorization,
which buries the iteration in the underlying C code. Here's an example that
may clarify what I mean:

x <- cbind(1:5,6:10)
x ## a 2 column matrix
## get squares of all elements of x
## method 1
m1 <-x^2

##method 2: square the column vectors
m2 <- x
for (i in 1:2)m2[,i] <- m2[,i]^2
identical(m1,m2)
## of course, one could do this by row vectors, too

## method 3: loop through each element
m3 <- x
ix <- as.matrix(expand.grid(1:5,1:2))
ix
m3[ix]^2 ## matrix indexing of an array. This produces a vector,though.

Note also that there is an "iterators" package in R which implements
python-like iterators.I don't know how efficient it is, however.

My overall advice would be that you should try to program in R's native
paradigms, which emphasize whole object manipulation through vectorization,
rather than trying to use Python's, especially if efficiency is a
consideration. Feel free to ignore of course.

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Aug 24, 2018 at 6:44 AM Deepa  wrote:

> Hello,
>
> Is there an option to include multiple counters in a single for loop in R?
>
> For instance, in python there is
>
> for i,j in zip(x,range(0,len(x))):
>
>
> Any suggestions?
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Multiple counters in a single for loop

2018-08-24 Thread MacQueen, Don via R-help
I don't know of any such option, but it's easy enough to achieve something more 
or less equivalent.

x <- runif(5)

for (ir in seq(nrow(myi <- cbind(x, 1:length(x) {
  i <- myi[ir,1]
  j <- myi[ir,2]
  cat(i,j,'\n')
}

I consider that for() statement to be ugly and unreadable. Normally I would 
build the matrix myi before constructing the loop, and make other changes for 
clarity. But in this instance I wanted to make it a one-liner, just to more or 
less mimic the python.

And having now read Bert's reply, he makes a good point. For many things one 
might want to do with such a loop, R can do them without an explicit loop.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 8/24/18, 6:44 AM, "R-help on behalf of Deepa"  wrote:

Hello,

Is there an option to include multiple counters in a single for loop in R?

For instance, in python there is

for i,j in zip(x,range(0,len(x))):


Any suggestions?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Need some help with data-wrangling in R

2018-08-24 Thread Amit Govil
Hi,

I have log data in which one of the columns have IP ranges and the next
column is corresponding ports. Eg:


IPRange Port
10.78.64.0-10.78.66.255 D, A, C

I need to expand the IPRange column into a list of network blocks till 3rd
octet:

IPRange IP Port
192.100.176.0-192.100.179.255 192.100.176.0/24 A, B, C
192.100.176.0-192.100.179.255 192.100.177.0/24 A, B, C
192.100.176.0-192.100.179.255 192.100.178.0/24 A, B, C
192.100.176.0-192.100.179.255 192.100.179.0/24 A, B, C

How do I do this data transformation in R?

Please assist.

Thanks
Amit

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Need some help with data-wrangling in R

2018-08-24 Thread Bert Gunter
" list of network blocks till 3rd octet:"

This is incomprehensible to me. If that is so for others, also, I suggest
that you provide a reproducible example (see posting guide) to explain what
you mean.

-- Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Aug 24, 2018 at 9:41 AM Amit Govil  wrote:

> Hi,
>
> I have log data in which one of the columns have IP ranges and the next
> column is corresponding ports. Eg:
>
>
> IPRange Port
> 10.78.64.0-10.78.66.255 D, A, C
>
> I need to expand the IPRange column into a list of network blocks till 3rd
> octet:
>
> IPRange IP Port
> 192.100.176.0-192.100.179.255 192.100.176.0/24 A, B, C
> 192.100.176.0-192.100.179.255 192.100.177.0/24 A, B, C
> 192.100.176.0-192.100.179.255 192.100.178.0/24 A, B, C
> 192.100.176.0-192.100.179.255 192.100.179.0/24 A, B, C
>
> How do I do this data transformation in R?
>
> Please assist.
>
> Thanks
> Amit
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Need some help with data-wrangling in R

2018-08-24 Thread Rui Barradas

Hello,

Cross-posting is not very well seen by R-Help. Please wait for an answer 
to one of your posts before posting somewhere else.


https://stackoverflow.com/questions/52008756/how-to-get-a-list-of-ip-addresses-from-an-ip-range-using-r

Rui Barradas

On 24/08/2018 17:34, Amit Govil wrote:

Hi,

I have log data in which one of the columns have IP ranges and the next
column is corresponding ports. Eg:


IPRange Port
10.78.64.0-10.78.66.255 D, A, C

I need to expand the IPRange column into a list of network blocks till 3rd
octet:

IPRange IP Port
192.100.176.0-192.100.179.255 192.100.176.0/24 A, B, C
192.100.176.0-192.100.179.255 192.100.177.0/24 A, B, C
192.100.176.0-192.100.179.255 192.100.178.0/24 A, B, C
192.100.176.0-192.100.179.255 192.100.179.0/24 A, B, C

How do I do this data transformation in R?

Please assist.

Thanks
Amit

[[alternative HTML version deleted]]

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



---
This email has been checked for viruses by AVG.
https://www.avg.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Obtaining Complete Dataset with Imputed Values

2018-08-24 Thread Paul Bernal
Dear friends, hope all is well with you,

I am working with package mi for data inputation. Currently working with R
version 3.5.0 (64-bit).

Say my data is  defined as dat, and I do the following:

datimputations <- mi(dat[2:5], n.iter=50)
completedat <- complete(datimputations)

After using the complete function, I get the following error message:

Error in complete(datimputations, m = 1) : 'data' not of class 'mids'

How can I retrieve the processed dataframe (along with the imputed values)?

Here is my dput() for you to see

> dput(head(dat,100))
structure(list(TransitDate = structure(c(496990800, 499669200,
502261200, 504939600, 507618000, 510037200, 512715600, 515307600,
517986000, 520578000, 523256400, 525934800, 528526800, 531205200,
533797200, 536475600, 539154000, 541573200, 544251600, 546843600,
549522000, 552114000, 554792400, 557470800, 560062800, 562741200,
565333200, 568011600, 57069, 573195600, 575874000, 578466000,
581144400, 583736400, 586414800, 589093200, 591685200, 594363600,
596955600, 599634000, 602312400, 604731600, 60741, 610002000,
612680400, 615272400, 617950800, 620629200, 623221200, 625899600,
628491600, 63117, 633848400, 636267600, 638946000, 641538000,
644216400, 646808400, 649486800, 652165200, 654757200, 657435600,
660027600, 662706000, 665384400, 667803600, 670482000, 673074000,
675752400, 678344400, 681022800, 683701200, 686293200, 688971600,
691563600, 694242000, 696920400, 699426000, 702104400, 704696400,
707371200, 709963200, 712641600, 71532, 717912000, 720590400,
723182400, 725860800, 728539200, 730958400, 733636800, 736232400,
738910800, 741502800, 744181200, 746859600, 749451600, 75213,
754722000, 757400400), class = c("POSIXct", "POSIXt"), tzone = ""),
Transits = c(14L, 14L, 13L, 10L, 11L, 14L, 14L, 14L, 16L,
6L, 8L, 6L, 6L, 7L, 7L, 9L, 7L, 9L, 3L, 12L, 7L, 8L, 10L,
9L, 10L, 11L, 9L, 9L, 5L, 11L, 12L, 7L, 12L, 10L, 9L, 13L,
7L, 7L, 8L, 4L, 4L, 7L, 5L, 7L, 7L, 6L, 9L, 4L, 7L, 9L, 5L,
5L, 10L, 6L, 6L, 13L, 6L, 7L, 10L, 7L, 8L, 5L, 6L, 7L, 6L,
9L, 8L, 10L, 9L, 9L, 12L, 5L, 9L, 6L, 7L, 10L, 10L, 9L, 14L,
14L, 15L, 14L, 16L, 17L, 18L, 11L, 15L, 14L, 8L, 13L, 10L,
9L, 12L, 8L, 12L, 10L, 11L, 10L, 9L, 10L), CargoTons = c(154973L,
129636L, 136884L, 86348L, 109907L, 154506L, 144083L, 152794L,
124861L, 60330L, 65221L, 61718L, 53997L, 83536L, 63218L,
98222L, 54719L, 98470L, 18263L, 104255L, 62869L, 62523L,
75344L, 81476L, 92818L, 87457L, 85231L, 77897L, 57699L, 96989L,
109361L, 59799L, 91116L, 82241L, 74251L, 124361L, 68751L,
61719L, 68017L, 37760L, 32513L, 56359L, 51333L, 80859L, 75852L,
65760L, 96043L, 38820L, 63202L, 102647L, 49104L, 53482L,
121305L, 71795L, 76704L, 146097L, 73047L, 68557L, 110642L,
77616L, 97767L, 52059L, 58658L, 66350L, 69303L, 76013L, 91909L,
108445L, 94454L, 101249L, 112131L, 56290L, 118342L, 70618L,
64783L, 112839L, 120506L, 94243L, 130768L, 133643L, 146321L,
140736L, 147234L, 158953L, 189888L, 93819L, 130021L, 130124L,
55088L, 114783L, 95184L, 82205L, 80321L, 65422L, 98933L,
93713L, 98417L, 97210L, 88464L, 94659L), RcnstPCUMS = c(229914L,
214547L, 215890L, 158695L, 173125L, 222533L, 212490L, 222125L,
266913L, 94268L, 112967L, 95480L, 87654L, 108996L, 97973L,
139247L, 93817L, 133197L, 40020L, 169749L, 102590L, 112121L,
140241L, 122989L, 144592L, 144979L, 123748L, 123249L, 70081L,
155218L, 168096L, 104743L, 163384L, 142648L, 129188L, 183170L,
99299L, 99873L, 111648L, 55890L, 59183L, 95568L, 72550L,
104562L, 100478L, 92665L, 130625L, 54786L, 105900L, 135833L,
70932L, 73247L, 149632L, 94317L, 87926L, 181989L, 92778L,
107097L, 153246L, 105175L, 126393L, 81976L, 95518L, 109019L,
95370L, 140492L, 125795L, 157978L, 138424L, 138160L, 180320L,
78757L, 135860L, 85921L, 114847L, 151965L, 152561L, 132841L,
204839L, 209567L, 224436L, 210209L, 227143L, 245968L, 264969L,
158648L, 51L, 194335L, 111618L, 189643L, 137438L, 124953L,
163155L, 107633L, 164525L, 135102L, 152072L, 126636L, 121008L,
137824L), TotalToll = c(420742L, 392621L, 395078L, 290411L,
316818L, 407235L, 388856L, 406488L, 482774L, 172510L, 206729L,
174728L, 160406L, 199462L, 179290L, 254822L, 171685L, 243750L,
73236L, 310640L, 187739L, 205181L, 249438L, 225069L, 264603L,
265311L, 226458L, 225545L, 128248L, 284048L, 296023L, 184934L,
298992L, 261045L, 236414L, 335201L, 181717L, 182767L, 204315L,
102278L, 108304L, 174889L, 132766L, 191348L, 183874L, 169576L,
239043L, 100258L, 212859L, 273024L, 142573L, 147226L, 300760L,
189577L, 176731L, 365797L, 186483L, 215264L, 308024L, 211401L,
254049L, 164771L, 191991L, 219128L, 191693L, 282388L, 252847L,
317535L, 278232L, 277701L, 356022L, 158301L, 273078L, 172701L,
230842L, 305449L, 306647L, 267010L, 406202L, 421229L, 451116L,
422520L, 456557L, 494395L, 582202L, 350612L, 491174L, 429480L,
239858L, 419111L, 303737L, 276146L, 360572L, 237868L, 35

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard

On Wed, 22 Aug 2018, Rich Shepard wrote:


 More when I have results.


  Almost there. I've read the auto.key section in ?barchart and looked at
examples from stackoverflow on the web without seeing my syntax errors. I
would like help on two issues:

  1. What I want is to have the legend text in black and the colored
rectangles match the black and grey of the bars. Instead, I get the legend
text colored and have no idea where the default colors in the rectangles got
there.

  2. I've not found how to have the years (rather than the sequence of
years) as the x-axis labels.

  Here are the dput() output and the script:

structure(list(year = c(1989L, 1989L, 1990L, 1990L, 1991L, 1991L, 
1993L, 1993L, 1994L, 1994L, 1995L, 1995L, 1996L, 1996L, 1997L, 
1997L, 1998L, 1998L, 1999L, 1999L, 2000L, 2000L, 2001L, 2001L, 
2002L, 2002L, 2003L, 2003L, 2004L, 2004L, 2005L, 2005L, 2006L, 
2006L, 2007L, 2007L, 2008L, 2008L, 2009L, 2009L, 2010L, 2010L, 
2011L, 2011L, 2012L, 2012L, 2013L, 2013L, 2014L, 2014L, 2015L, 
2015L, 2016L, 2016L, 2017L, 2017L, 2018L, 2018L), value = c(91.17, 
93.32, 91.22, 93.43, 91.24, 92.89, 91.14, 93.02, 93.92, 95.74, 
94.34, 96.85, 91.32, 95.86, 91.36, 94.25, 91.24, 93.67, 94.33, 
97.42, 94.33, 97.42, 94, 94.99, 94.32, 96.58, 94.02, 96.57, 94.19, 
96.32, 94.05, 95.96, 94.21, 97.4, 94.21, 97.28, 94.32, 96.72, 
94.13, 97.43, 94.27, 95.95, 94.34, 97.82, 94.23, 97, 94.25, 96.6, 
94.15, 96.24, 94.01, 96.68, 94.09, 96.96, 94.31, 96.39, 94.35, 
96.95), type = structure(c(2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 
1L), .Label = c("Max", "Med"), class = "factor")), class = "data.frame", row.names = c(NA, 
-58L))


med_max <- barchart(value ~ year, data=stage_heights,
panel = lattice.getOption("panel.barchart"),
default.prepanel = 
lattice.getOption("prepanel.default.barchart"),
box.ratio = 2, horizontal=FALSE, 
auto.key=list(space='right',
   
col=c('black', 'grey')),
groups=factor(type,labels=c('Median','Maximum')), 
beside=TRUE,
col = c('grey','black'), labels=list(c(1989,1990,1991,1992, 
1993,1994,
   
1995,1996,1997,1998,1999,2000,2001,
   
2002,2003,2004,2005,2006,2007,2008,
   
2009,2010,2011,2012,2013,2014,2015,
   2016,2017,2018),
 
scales=list(x=list(rot=90)),
 main = 'Median and 
Maximum Stage Heights',
 ylab = 'Elevation 
(masl)', xlab = 'Year')
print(med_max)

Rich

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


Re: [R] lattice barchart() with two variables

2018-08-24 Thread Richard M. Heiberger
color for the legend comes from trellis.par.get

You can control that for an individual plot with the par.settings argument.

tmp <- data.frame(y=sample(10),
  group=rep(c("Median", "Maximum"), each=5),
  year=factor(rep(1998:1999, length=10)))

barchart(y ~ year, data=tmp, group=group, auto.key=TRUE, main="default legend",
 col = c('grey','black'))

barchart(y ~ year, data=tmp, group=group, auto.key=TRUE, main="what you want",
 par.settings=list(superpose.polygon=list(col=c('grey','black'

names(trellis.par.get())
trellis.par.get()$superpose.polygon



On Fri, Aug 24, 2018 at 3:37 PM, Rich Shepard  wrote:
> On Wed, 22 Aug 2018, Rich Shepard wrote:
>
>>  More when I have results.
>
>
>   Almost there. I've read the auto.key section in ?barchart and looked at
> examples from stackoverflow on the web without seeing my syntax errors. I
> would like help on two issues:
>
>   1. What I want is to have the legend text in black and the colored
> rectangles match the black and grey of the bars. Instead, I get the legend
> text colored and have no idea where the default colors in the rectangles got
> there.
>
>   2. I've not found how to have the years (rather than the sequence of
> years) as the x-axis labels.
>
>   Here are the dput() output and the script:
>
> structure(list(year = c(1989L, 1989L, 1990L, 1990L, 1991L, 1991L, 1993L,
> 1993L, 1994L, 1994L, 1995L, 1995L, 1996L, 1996L, 1997L, 1997L, 1998L, 1998L,
> 1999L, 1999L, 2000L, 2000L, 2001L, 2001L, 2002L, 2002L, 2003L, 2003L, 2004L,
> 2004L, 2005L, 2005L, 2006L, 2006L, 2007L, 2007L, 2008L, 2008L, 2009L, 2009L,
> 2010L, 2010L, 2011L, 2011L, 2012L, 2012L, 2013L, 2013L, 2014L, 2014L, 2015L,
> 2015L, 2016L, 2016L, 2017L, 2017L, 2018L, 2018L), value = c(91.17, 93.32,
> 91.22, 93.43, 91.24, 92.89, 91.14, 93.02, 93.92, 95.74, 94.34, 96.85, 91.32,
> 95.86, 91.36, 94.25, 91.24, 93.67, 94.33, 97.42, 94.33, 97.42, 94, 94.99,
> 94.32, 96.58, 94.02, 96.57, 94.19, 96.32, 94.05, 95.96, 94.21, 97.4, 94.21,
> 97.28, 94.32, 96.72, 94.13, 97.43, 94.27, 95.95, 94.34, 97.82, 94.23, 97,
> 94.25, 96.6, 94.15, 96.24, 94.01, 96.68, 94.09, 96.96, 94.31, 96.39, 94.35,
> 96.95), type = structure(c(2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
> 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
> 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L), .Label = c("Max", "Med"), class =
> "factor")), class = "data.frame", row.names = c(NA, -58L))
>
> med_max <- barchart(value ~ year, data=stage_heights,
> panel = lattice.getOption("panel.barchart"),
> default.prepanel =
> lattice.getOption("prepanel.default.barchart"),
> box.ratio = 2, horizontal=FALSE,
> auto.key=list(space='right',
>
> col=c('black', 'grey')),
> groups=factor(type,labels=c('Median','Maximum')),
> beside=TRUE,
> col = c('grey','black'),
> labels=list(c(1989,1990,1991,1992, 1993,1994,
>
> 1995,1996,1997,1998,1999,2000,2001,
>
> 2002,2003,2004,2005,2006,2007,2008,
>
> 2009,2010,2011,2012,2013,2014,2015,
>2016,2017,2018),
>
> scales=list(x=list(rot=90)),
>  main = 'Median and
> Maximum Stage Heights',
>  ylab = 'Elevation
> (masl)', xlab = 'Year')
> print(med_max)
>
>
> Rich
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lattice barchart() with two variables

2018-08-24 Thread Bert Gunter
For the legend, you can use the full "key" argument for more control. The
docs in ?xyplot for "key" Should answer your questions.  "col" controls
text color within the "text" component and rectangle color within the
"rectangle" component , for example. I think this should work as an
alternative to specifying the par.settings components, but I haven't
checked.

For the scales, again, the docs provide the answer:  the "at" and "labels"
components of "x" component of the scales lists can explicitly control the
x -labels, e.g.

scales = list( x = list( at = ..., labels = ...)etc.

If you are uncomfortable with the R lattice help docs, and you intend to
continue to use lattice plots (a good idea; ggplot is an alternative of
course), Deepayan has written a book that you might wish to get:

http://lmdvr.r-forge.r-project.org/figures/figures.html

There are also numerous web tutorials.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Aug 24, 2018 at 12:38 PM Rich Shepard 
wrote:

> On Wed, 22 Aug 2018, Rich Shepard wrote:
>
> >  More when I have results.
>
>Almost there. I've read the auto.key section in ?barchart and looked at
> examples from stackoverflow on the web without seeing my syntax errors. I
> would like help on two issues:
>
>1. What I want is to have the legend text in black and the colored
> rectangles match the black and grey of the bars. Instead, I get the legend
> text colored and have no idea where the default colors in the rectangles
> got
> there.
>
>2. I've not found how to have the years (rather than the sequence of
> years) as the x-axis labels.
>
>Here are the dput() output and the script:
>
> structure(list(year = c(1989L, 1989L, 1990L, 1990L, 1991L, 1991L,
> 1993L, 1993L, 1994L, 1994L, 1995L, 1995L, 1996L, 1996L, 1997L,
> 1997L, 1998L, 1998L, 1999L, 1999L, 2000L, 2000L, 2001L, 2001L,
> 2002L, 2002L, 2003L, 2003L, 2004L, 2004L, 2005L, 2005L, 2006L,
> 2006L, 2007L, 2007L, 2008L, 2008L, 2009L, 2009L, 2010L, 2010L,
> 2011L, 2011L, 2012L, 2012L, 2013L, 2013L, 2014L, 2014L, 2015L,
> 2015L, 2016L, 2016L, 2017L, 2017L, 2018L, 2018L), value = c(91.17,
> 93.32, 91.22, 93.43, 91.24, 92.89, 91.14, 93.02, 93.92, 95.74,
> 94.34, 96.85, 91.32, 95.86, 91.36, 94.25, 91.24, 93.67, 94.33,
> 97.42, 94.33, 97.42, 94, 94.99, 94.32, 96.58, 94.02, 96.57, 94.19,
> 96.32, 94.05, 95.96, 94.21, 97.4, 94.21, 97.28, 94.32, 96.72,
> 94.13, 97.43, 94.27, 95.95, 94.34, 97.82, 94.23, 97, 94.25, 96.6,
> 94.15, 96.24, 94.01, 96.68, 94.09, 96.96, 94.31, 96.39, 94.35,
> 96.95), type = structure(c(2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L), .Label = c("Max", "Med"), class = "factor")), class = "data.frame",
> row.names = c(NA,
> -58L))
>
> med_max <- barchart(value ~ year, data=stage_heights,
>  panel = lattice.getOption("panel.barchart"),
>  default.prepanel =
> lattice.getOption("prepanel.default.barchart"),
>  box.ratio = 2, horizontal=FALSE,
> auto.key=list(space='right',
>
> col=c('black', 'grey')),
>  groups=factor(type,labels=c('Median','Maximum')),
> beside=TRUE,
>  col = c('grey','black'),
> labels=list(c(1989,1990,1991,1992, 1993,1994,
>
> 1995,1996,1997,1998,1999,2000,2001,
>
> 2002,2003,2004,2005,2006,2007,2008,
>
> 2009,2010,2011,2012,2013,2014,2015,
>
> 2016,2017,2018),
>
> scales=list(x=list(rot=90)),
>   main = 'Median
> and Maximum Stage Heights',
>   ylab =
> 'Elevation (masl)', xlab = 'Year')
> print(med_max)
>
> Rich
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unclear about the output from summary of ca.jo from package urca

2018-08-24 Thread John C Frain
I have posted a reply to your original quesstion  on Cross Validated
explaining how the notation arises.
John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.com


On Thu, 23 Aug 2018 at 10:12, Ashim Kapoor  wrote:

> Dear All,
>
> I am not sure about the summary of the function ca.jo. I have posted my
> query here :-
>
>
> https://stats.stackexchange.com/questions/363188/interpreting-the-names-used-in-the-output-of-johansen-test-in-package-urca-in-r
>
> I did not receive any reply so I am posting my query here.
>
> Many thanks and best regards,
> Ashim
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard

On Fri, 24 Aug 2018, Bert Gunter wrote:


For the legend, you can use the full "key" argument for more control.


Bert,

  This I did.


For the scales, again, the docs provide the answer:  the "at" and "labels"
components of "x" component of the scales lists can explicitly control the
x -labels, e.g.


  A bit of trial-and-error got this working, too. Now the plot command works
as desired:

barchart(value ~ year, data=stage_heights,
panel = lattice.getOption("panel.barchart"),
default.prepanel = 
lattice.getOption("prepanel.default.barchart"),
box.ratio = 2, horizontal=FALSE, key=list(c(0.2,0.3), 
columns=2,
  
text=list(c('Median','Maximum')),
  
rect=list(col=c('black', 'grey'))),
groups=factor(type,labels=c('Median','Maximum')), 
beside=TRUE,
col = c('grey','black'), scales=list(x=list(at=rep(1:29),

labels=rep(1989:2018),rot=90)),
main = 'Median and Maximum Stage Heights',
ylab = 'Elevation (masl)', xlab = 'Year')

(Emacs w/ESS does the formatting). I suppose that the Maximum bar is plotted
to the left because alphabetically it preceeds Medium. I can live with this.

  Deepayan's book was one of the first I bought years ago. I've not before
had plots that required more in-depth knowledge of panels, keys, and scales
so I do appreciate your patient mentoring.

Best regards,

Rich

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


Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard

On Fri, 24 Aug 2018, Richard M. Heiberger wrote:


color for the legend comes from trellis.par.get
You can control that for an individual plot with the par.settings argument.
tmp <- data.frame(y=sample(10),
 group=rep(c("Median", "Maximum"), each=5),
 year=factor(rep(1998:1999, length=10)))

barchart(y ~ year, data=tmp, group=group, auto.key=TRUE, main="default legend",
col = c('grey','black'))

barchart(y ~ year, data=tmp, group=group, auto.key=TRUE, main="what you want",
par.settings=list(superpose.polygon=list(col=c('grey','black'

names(trellis.par.get())
trellis.par.get()$superpose.polygon


  Thanks, Richard!

  Before venturing into par.settings I worked off of Bert's advice and
careful reading of the ?xyplot details allowed me to fix the two remaining
issues. Your suggestions will definitely be of value when I have other
complex lattice plots to properly display.

Best regards,

Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 shared library (/usr/lib64/R/lib/libR.so) not found.

2018-08-24 Thread Rolf Turner



See in-line below.

On 08/25/2018 01:10 AM, Ista Zahn wrote:


On Thu, Aug 23, 2018 at 6:57 AM Rolf Turner  wrote:



I *think* that this is an R question (and *not* an RStudio question!)


I think this is actually and Ubuntu question, and probably belongs on
R-sig-debian.


Well, it's about installing R --- *could* be independent of OS.



I have, somewhat against my better judgement, decided to experiment with
using RStudio.

I downloaded and install RStudio.  Easy-peasy.  Nice lucid instructions.

Then I tried to start RStudio ("rstudio" from the command line)
and got a pop-up window with the error message:


R shared library (/usr/lib64/R/lib/libR.so) not found. If this
is a custom build of R, was it built with the --enable-R-shlib option?


Oops, no, I guess it wasn't.  So I carefully did a

  sudo make uninstall
  make clean
  make distclean

and then did

  ./R-3.5.1/configure 

making sure I added the --enable-R-shlib flag.

Then I did make and sudo make install.


IMO if you are compiling and installing software yourself on Linux
your are Doing It Wrong. Use the package manager, that is what it is
there for.


I was pretty sure that the foregoing was a complete red herring.  And I 
was right.


I have been told by younger and wiser heads that installing from source 
is The Right Thing to Do.  Moreover I'd always had the impression that 
the version of R provided by the package manager persistently lags one 
or two releases behind the current version.  However, given that the 
suggestion had been made, I decided I'd try it.


The process for installing R using the package manager is far from 
straightforward and few people give clear instructions on this issue.
(Instructions are usually incomplete and full of jargon and acronyms 
that the instructors blithely assume assume that the instructees 
understand.  (They *don't*! In this instance (mirabile dictu!) I managed 
(using Uncle Google) to find very clear and explicit instructions at:


https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04-quickstart

I followed these instructions, and everything went swimmingly.  I indeed 
got the current version of R (3.5.1, "Feather Spray").  So my previous 
impression was incorrect (given that one carefully follows the rather 
complex installation procedures, at least).


Interestingly (???) the "new" R was installed in /usr/bin and not in 
/usr/local/bin.


I then tried issuing the command:

rstudio

Exactly the same pop-up error.  No help at all, as I expected.

I then tried

sudo apt install r-base-dev

thinking that this might be needed to get the libR.so created (in the 
right place).  No joy.


I then tried the symlink strategy that I had previously suggested.  No 
joy there either.


Then finally, in desperation, I copied libR.so from /usr/lib/R/lib to
/usr/lib64/R/lib.  Bingo!!!  I can now start Rstudio!!!

It remains mysterious to me why the symlink procedure did not work, 
whereas making a copy of libR.so *did* work.


However I guess this really doesn't matter.  It's now working.

cheers,

Rolf


--Ista

It all seemed to go ...

but then I did

  rstudio

again and got the same popup error.

There is indeed *no* libR.so in /usr/lib64/R/lib.

There *is* a libR.so in /usr/lib/R/lib, but (weirdly) ls -l reveals that
it dates from the my previous install of R-3.5.1 for which I *did not*
configure with --enable-R-shlib.

Can anyone explain to me WTF is going on?

What should I do?  Just make a symbolic link from /usr/lib/R/lib/libR.so
to /usr/lib64/R/lib/libR.so?

It bothers me that /usr/lib/R/lib/libR.so was not "refreshed" from my
most recent install of R.

I plead for enlightenment.

cheers,

Rolf Turner

P.S. I'm running Ubuntu 18.04.  And the previous install of R was done
under Ubuntu 18.04.

R. T.

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

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


[R] installing R 3.5.1

2018-08-24 Thread Bogdan Tanasa
Dear all,

I am trying to install R 3.5.1 on my Ubuntu 14.04 system; however, I am
getting the following message :

sudo apt-get install r-base
[...]
The following packages have unmet dependencies:
 r-base : Depends: r-recommended (= 3.5.1-1trusty) but it is not going to
be installed
E: Unable to correct problems, you have held broken packages.

In the file /etc/apt/sources.list , I have set up :

deb https://cloud.r-project.org/bin/linux/ubuntu trusty/
deb https://cloud.r-project.org/bin/linux/ubuntu trusty-cran35/

Would you please advise, what shall I do next ? Thanks a lot !

-- bogdan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] looking for formula parser that allows coefficients

2018-08-24 Thread Gabor Grothendieck
Also here is a solution that uses formula processing rather than
string processing.
No packages are used.

Parse <- function(e) {
  if (length(e) == 1) {
if (is.numeric(e)) return(e)
else setNames(1, as.character(e))
  } else {
if (isChar(e[[1]], "*")) {
   x1 <- Recall(e[[2]])
   x2 <- Recall(e[[3]])
   setNames(unname(x1 * x2), paste0(names(x1), names(x2)))
} else if (isChar(e[[1]], "+")) c(Recall(e[[2]]), Recall(e[[3]]))
else if (isChar(e[[1]], "-")) {
  if (length(e) == 2) -1 * Recall(e[[2]])
  else c(Recall(e[[2]]), -Recall(e[[3]]))
} else if (isChar(e[[1]], ":")) setNames(1, paste(e[-1], collapse = ":"))
  }
}

# test
fo <- y ~ 2 - 1.1 * x1 + x3 - x1:x3 + 0.2 * x2:x2
Parse(fo[[3]])

giving:

 x1x3 x1:x3 x2:x2
  2.0  -1.1   1.0  -1.0   0.2
On Wed, Aug 22, 2018 at 11:50 AM Paul Johnson  wrote:
>
> Thanks as usual.  I owe you more KU decorations soon.
> On Wed, Aug 22, 2018 at 2:34 AM Gabor Grothendieck
>  wrote:
> >
> > Some string manipulation can convert the formula to a named vector such as
> > the one shown at the end of your post.
> >
> > library(gsubfn)
> >
> > # input
> > fo <- y ~ 2 - 1.1 * x1 + x3 - x1:x3 + 0.2 * x2:x2
> >
> > pat <- "([+-])? *(\\d\\S*)? *\\*? *([[:alpha:]]\\S*)?"
> > ch <- format(fo[[3]])
> > m <- matrix(strapplyc(ch, pat)[[1]], 3)
> > m <- m[, colSums(m != "") > 0]
> > m[2, m[2, ] == ""] <- 1
> > m[3, m[3, ] == ""] <- "(Intercept)"
> > co <- as.numeric(paste0(m[1, ], m[2, ]))
> > v <- m[3, ]
> > setNames(co, v)
> > ## (Intercept)  x1  x3   x1:x3   x2:x2
> > ## 2.0-1.1 1.0-1.0 0.2
> > On Tue, Aug 21, 2018 at 6:46 PM Paul Johnson  wrote:
> > >
> > > Can you point me at any packages that allow users to write a
> > > formula with coefficients?
> > >
> > > I want to write a data simulator that has a matrix X with lots
> > > of columns, and then users can generate predictive models
> > > by entering a formula that uses some of the variables, allowing
> > > interactions, like
> > >
> > > y ~ 2 + 1.1 * x1 + 3 * x3 + 0.1 * x1:x3 + 0.2 * x2:x2
> > >
> > > Currently, in the rockchalk package, I have a function simulates
> > > data (genCorrelatedData2), but my interface to enter the beta
> > > coefficients is poor.  I assumed user would always enter 0's as
> > > place holder for the unused coefficients, and the intercept is
> > > always first. The unnamed vector is too confusing.  I have them specify:
> > >
> > > c(2, 1.1, 0, 3, 0, 0, 0.2, ...)
> > >
> > > I the documentation I say (ridiculously) it is easy to figure out from
> > > the examples, but it really isnt.
> > > It function prints out the equation it thinks you intended, thats
> > > minimum protection against user error, but still not very good:
> > >
> > > dat <- genCorrelatedData2(N = 10, rho = 0.0,
> > >   beta = c(1, 2, 1, 1, 0, 0.2, 0, 0, 0),
> > >   means = c(0,0,0), sds = c(1,1,1), stde = 0)
> > > [1] "The equation that was calculated was"
> > > y = 1 + 2*x1 + 1*x2 + 1*x3
> > >  + 0*x1*x1 + 0.2*x2*x1 + 0*x3*x1
> > >  + 0*x1*x2 + 0*x2*x2 + 0*x3*x2
> > >  + 0*x1*x3 + 0*x2*x3 + 0*x3*x3
> > >  + N(0,0) random error
> > >
> > > But still, it is not very good.
> > >
> > > As I look at this now, I realize expect just the vech, not the whole 
> > > vector
> > > of all interaction terms, so it is even more difficult than I thought to 
> > > get the
> > > correct input.Hence, I'd like to let the user write a formula.
> > >
> > > The alternative for the user interface is to have named coefficients.
> > > I can more or less easily allow a named vector for beta
> > >
> > > beta = c("(Intercept)" = 1, "x1" = 2, "x2" = 1, "x3" = 1, "x2:x1" = 0.1)
> > >
> > > I could build a formula from that.  That's not too bad. But I still think
> > > it would be cool to allow formula input.
> > >
> > > Have you ever seen it done?
> > > pj
> > > --
> > > Paul E. Johnson   http://pj.freefaculty.org
> > > Director, Center for Research Methods and Data Analysis 
> > > http://crmda.ku.edu
> > >
> > > To write to me directly, please address me at pauljohn at ku.edu.
> > >
> > > __
> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide 
> > > http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> >
> >
> > --
> > Statistics & Software Consulting
> > GKX Group, GKX Associates Inc.
> > tel: 1-877-GKX-GROUP
> > email: ggrothendieck at gmail.com
>
>
>
> --
> Paul E. Johnson   http://pj.freefaculty.org
> Director, Center for Research Methods and Data Analysis http://crmda.ku.edu
>
> To write to me directly, please address me at pauljohn at ku.edu.



-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

_

Re: [R] looking for formula parser that allows coefficients

2018-08-24 Thread Gabor Grothendieck
The isChar function used in Parse is:

  isChar <- function(e, ch) identical(e, as.symbol(ch))
On Fri, Aug 24, 2018 at 10:06 PM Gabor Grothendieck
 wrote:
>
> Also here is a solution that uses formula processing rather than
> string processing.
> No packages are used.
>
> Parse <- function(e) {
>   if (length(e) == 1) {
> if (is.numeric(e)) return(e)
> else setNames(1, as.character(e))
>   } else {
> if (isChar(e[[1]], "*")) {
>x1 <- Recall(e[[2]])
>x2 <- Recall(e[[3]])
>setNames(unname(x1 * x2), paste0(names(x1), names(x2)))
> } else if (isChar(e[[1]], "+")) c(Recall(e[[2]]), Recall(e[[3]]))
> else if (isChar(e[[1]], "-")) {
>   if (length(e) == 2) -1 * Recall(e[[2]])
>   else c(Recall(e[[2]]), -Recall(e[[3]]))
> } else if (isChar(e[[1]], ":")) setNames(1, paste(e[-1], collapse = ":"))
>   }
> }
>
> # test
> fo <- y ~ 2 - 1.1 * x1 + x3 - x1:x3 + 0.2 * x2:x2
> Parse(fo[[3]])
>
> giving:
>
>  x1x3 x1:x3 x2:x2
>   2.0  -1.1   1.0  -1.0   0.2
> On Wed, Aug 22, 2018 at 11:50 AM Paul Johnson  wrote:
> >
> > Thanks as usual.  I owe you more KU decorations soon.
> > On Wed, Aug 22, 2018 at 2:34 AM Gabor Grothendieck
> >  wrote:
> > >
> > > Some string manipulation can convert the formula to a named vector such as
> > > the one shown at the end of your post.
> > >
> > > library(gsubfn)
> > >
> > > # input
> > > fo <- y ~ 2 - 1.1 * x1 + x3 - x1:x3 + 0.2 * x2:x2
> > >
> > > pat <- "([+-])? *(\\d\\S*)? *\\*? *([[:alpha:]]\\S*)?"
> > > ch <- format(fo[[3]])
> > > m <- matrix(strapplyc(ch, pat)[[1]], 3)
> > > m <- m[, colSums(m != "") > 0]
> > > m[2, m[2, ] == ""] <- 1
> > > m[3, m[3, ] == ""] <- "(Intercept)"
> > > co <- as.numeric(paste0(m[1, ], m[2, ]))
> > > v <- m[3, ]
> > > setNames(co, v)
> > > ## (Intercept)  x1  x3   x1:x3   x2:x2
> > > ## 2.0-1.1 1.0-1.0 0.2
> > > On Tue, Aug 21, 2018 at 6:46 PM Paul Johnson  wrote:
> > > >
> > > > Can you point me at any packages that allow users to write a
> > > > formula with coefficients?
> > > >
> > > > I want to write a data simulator that has a matrix X with lots
> > > > of columns, and then users can generate predictive models
> > > > by entering a formula that uses some of the variables, allowing
> > > > interactions, like
> > > >
> > > > y ~ 2 + 1.1 * x1 + 3 * x3 + 0.1 * x1:x3 + 0.2 * x2:x2
> > > >
> > > > Currently, in the rockchalk package, I have a function simulates
> > > > data (genCorrelatedData2), but my interface to enter the beta
> > > > coefficients is poor.  I assumed user would always enter 0's as
> > > > place holder for the unused coefficients, and the intercept is
> > > > always first. The unnamed vector is too confusing.  I have them specify:
> > > >
> > > > c(2, 1.1, 0, 3, 0, 0, 0.2, ...)
> > > >
> > > > I the documentation I say (ridiculously) it is easy to figure out from
> > > > the examples, but it really isnt.
> > > > It function prints out the equation it thinks you intended, thats
> > > > minimum protection against user error, but still not very good:
> > > >
> > > > dat <- genCorrelatedData2(N = 10, rho = 0.0,
> > > >   beta = c(1, 2, 1, 1, 0, 0.2, 0, 0, 0),
> > > >   means = c(0,0,0), sds = c(1,1,1), stde = 0)
> > > > [1] "The equation that was calculated was"
> > > > y = 1 + 2*x1 + 1*x2 + 1*x3
> > > >  + 0*x1*x1 + 0.2*x2*x1 + 0*x3*x1
> > > >  + 0*x1*x2 + 0*x2*x2 + 0*x3*x2
> > > >  + 0*x1*x3 + 0*x2*x3 + 0*x3*x3
> > > >  + N(0,0) random error
> > > >
> > > > But still, it is not very good.
> > > >
> > > > As I look at this now, I realize expect just the vech, not the whole 
> > > > vector
> > > > of all interaction terms, so it is even more difficult than I thought 
> > > > to get the
> > > > correct input.Hence, I'd like to let the user write a formula.
> > > >
> > > > The alternative for the user interface is to have named coefficients.
> > > > I can more or less easily allow a named vector for beta
> > > >
> > > > beta = c("(Intercept)" = 1, "x1" = 2, "x2" = 1, "x3" = 1, "x2:x1" = 0.1)
> > > >
> > > > I could build a formula from that.  That's not too bad. But I still 
> > > > think
> > > > it would be cool to allow formula input.
> > > >
> > > > Have you ever seen it done?
> > > > pj
> > > > --
> > > > Paul E. Johnson   http://pj.freefaculty.org
> > > > Director, Center for Research Methods and Data Analysis 
> > > > http://crmda.ku.edu
> > > >
> > > > To write to me directly, please address me at pauljohn at ku.edu.
> > > >
> > > > __
> > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide 
> > > > http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal, self-contained, reproducible code.
> > >
> > >
> > >
> > > --
> > > Statistics & Software Consulting
> > > GKX Group, GKX Associates Inc.
> > > tel: 1-877-GKX-G

Re: [R] Plots in ioslides and R markdown

2018-08-24 Thread Patrick Connolly
On Thu, 23-Aug-2018 at 07:23AM -0700, Jeff Newmiller wrote:

|> This is not reproducible because you have not provided the plot
|> code or sample data. Output of sessionInfo would probably be
|> appropriate as well.

I took it as read that the plotting functions themselves aren't an
issue since they operate as intended outside of the Rmarkdown
space. Any function that uses the function plot() successfully will
do.  I was trying to ascertain how I should be setting up the scaling.

|> As to whether needing to load objects is typical... yes, rmarkdown
|> runs from a fresh environment to emphasize reproducibility, but
|> your load command is bypassing that for us.

The objects loaded from .RData took hours of simulating and it's out
of the question to run them again inside Rmarkdown.  Though the script
used in the creation of .RData is reproducable, perhaps it would be
clearer for me to have saved the objects to a file by a different
name.

Is there a better way to do that??



|> On August 23, 2018 2:15:19 AM PDT, Patrick Connolly 
 wrote:
|> >I'm having difficulty getting plots into ioslides.  It seems to me
|> >that the scale is completely out, but I can't figure out what to do
|> >about it.  Whatever I try, I get the title slide, then a second with a
|> >horizontal line and a vertical line in the bottom right corner.  It
|> >looks like a badly scaled plot about 25 times the size of the plotting
|> >area, so only a fragment is visible.
|> >
|> >This is the code I've tried:
|> >
|> >---
|> >title: "Barking up the wrong tree"
|> >author: "Patrick Connolly"
|> >date: "`r format(Sys.time(), '%a %d/%m/%Y %H:%M')`"
|> >output: ioslides_presentation
|> >---
|> >
|> >```{r global_options, echo=FALSE}
|> >knitr::opts_chunk$set(tidy=TRUE,
|> >  warning=FALSE, 
|> >  message=FALSE,
|> >  cache=FALSE,
|> >  dpi=600)
|> >```
|> >
|> >```{r use these functions, echo= FALSE}
|> >  load(".RData") ## code for 6 plotting functions
|> >
|> >``
|> >## 6 different Trees
|> >
|> >```{r 6 different Trees, echo = FALSE, messages=FALSE, fig.width = 7,
|> >fig.height = 5}
|> >
|> >###  par(mfrow = c(2, 3))
|> >plot1()
|> >plot2()
|> >plot3()
|> >plot4()
|> >plot5()
|> >plot6()
|> >}
|> >```
|> >
|> >If I run the plot functions in the Console, it all works and displays
|> >correctly in Rstudiio's plot panel, even the mfrow bit.  But I haven't
|> >worked out how to include the code into Rmarkdown.  I thought it might
|> >be less taxing to not try putting the 6 plots on the same slide, but
|> >it makes no difference when I commented out the mfrow bit.
|> >
|> >I'm not very familiar with the workings of Markdown or Rstudio, but it
|> >does seem strange to me that I need to specifically load the global
|> >environment otherwise it's not visible.  Is that to be expected?
|> >
|> >Ideas welcome, particularly about scaling.
|> 
|> -- 
|> Sent from my phone. Please excuse my brevity.

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

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