[R] Sweave: Incorporating warnings into a Sweave output chunck

2017-01-03 Thread Duncan Mackay
Dear All

There are some occasions I have run code in R without warning. 
After incorporating the code into an .Rnw file and running by Sweave I find
there are  warnings sent to the screen.  

On some occasions when I use Sweave(...)  I would like to incorporate the
warnings into the resulting tex file.
Until now I have done it manually which is a bit of a pain.

Does anyone know of a way?  It would be nice to have a Sweave option to
include it.

The only reference I can find is 

https://stat.ethz.ch/pipermail/r-help/2006-December/121892.html

which had no replies except this one on Nabble

http://r.789695.n4.nabble.com/R-Sweave-and-warning-messages-td814182.html

I have got the code from the attached Rnw file working in R version 3.3.1 
But there are some problems with it.

Below is  the code including some of the options and setup with the function
in one chunck
 
<>=
  options(warn = 1)
  cons <- showConnections(all = TRUE)
 # .CurFileName <- get("file", env = parent.frame(3)) # modified by next
line
  .CurFileName <-
  as.vector(unlist(
  subset(data.frame(cons), class == "file" & nchar(description) > 0)[1]) )
  .PrefixName <- strsplit(.CurFileName, "\\.")[[1]][1]
  .LatexFileName <- paste(.PrefixName, "tex", sepo = ".")
  .LatexFileCon <-
  getConnection(what = as.integer(rownames(cons)[which(cons[,1] ==
.LatexFileName)]))
  sink(file = .LatexFileCon, append = TRUE, type = "message")

warningbck <- warning
warning <-
function (..., call. = TRUE, immediate. = FALSE, domain = NULL){

  args <- list(...)

  if (length(args) == 1 && inherits(args[[1]], "condition")) {

cond <- args[[1]]
message <- conditionMessage(cond)
call <- conditionCall(cond)

withRestarts({
  .Internal(.signalCondition(cond, message, call))
  .Internal(.dfltStop(message, call))
},
muffleWarning = function() NULL)

invisible(message)

  }  else {

if (length(args) > 0) {

  args <- lapply(list(...), as.character)

  if (is.null(domain) || !is.na(domain))
args <- .Internal(gettext(domain, unlist(args)))
message <- paste(args, collapse = "")

} else{

  message <- ""
}

writeLines(text = "\n\\end{Sinput}\n\\begin{Soutput}", con =
.LatexFileCon)
.Internal(warning(as.logical(call.), as.logical(immediate.), message))

writeLines(text = "\\end{Soutput}\n\\begin{Sinput}", con =
.LatexFileCon)
  }
}

This puts the warning into the input chunck directly after the R command
e.g. as shown below

\begin{Sinput}
  clust.hw <- svydesign(ids = ~Patient, data = hw.dat)Warning in
svydesign.default(ids = ~Patient, data = hwd) :
  No weights or probabilities supplied, assuming equal probability

\end{Sinput}

I think that there also needs to be an argument about closing connections
somewhere in the code.

 Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

__
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] getTimeLimit?

2017-01-03 Thread Henrik Bengtsson
On Tue, Jan 3, 2017 at 2:43 PM, William Dunlap via R-help
 wrote:
> I am interested in measuring the time it takes to run an expression.
>  system.time(expr) does this but I would like to have it report just 'more
> than xxx seconds', where xxx is a argument to the timing function, when it
> takes a long time.  This is useful automating the process of seeing how
> processing time grows with the size of a dataset.
>
> My latest attempt is the following function, which adds a 'censored=TRUE'
> attribute when the cpu or elapsed time exceeds some limit:
>
> system.time2 <- function (expr, gcFirst = TRUE, cpu = Inf, elapsed = Inf)
> {
> setTimeLimit(cpu = cpu, elapsed = elapsed, transient = TRUE)
> censored <- NULL
> time <- system.time(gcFirst = gcFirst, tryCatch(expr, error =
> function(e) if (grepl("reached (CPU|elapsed) time limit",
> conditionMessage(e)))
> censored <<- conditionMessage(e)
> else stop(e)))
> attr(time, "censored") <- censored
> time
> }
>
> It would be used as
>
>> system.time(times <- lapply(10^(1:7), function(n)system.time2(for(i in
> 1:n)lgamma(1:i), elapsed=10) ))
>user  system elapsed
>   33.550.25   33.82
>> vapply(times, function(t)t[["elapsed"]], 0)
> [1]  0.02  0.00  0.03  3.08 10.02 10.14 10.18
>> # following gives which times are valid
>> vapply(times, function(t)is.null(attr(t,"censored")), NA)
> [1]  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE
>
> I have two questions.
> * Is this a reasonable way to compute such a censored time?
> * Is there a getTimeLimit()-like function?

I also wanted such a function, but I don't think it exists.
Internally in R the timeout is set in global variables 'cpuLimitValue'
and 'elapsedLimitValue'.  Grepping the source for it doesn't reveal
any external access to it, e.g.

$ grep -F "cpuLimitValue" -r --include="*.h" src/
src/include/Defn.h:extern0 double cpuLimitValue INI_as(-1.0);

$ grep -F "cpuLimitValue" -r --include="*.c" src/
src/main/sysutils.c:cpuLimit = (cpuLimitValue > 0) ? data[0] +
data[1] + cpuLimitValue : -1.0;
src/main/sysutils.c:cpuLimit = (cpuLimitValue > 0) ? data[0] +
data[1] + data[3] + data[4] + cpuLimitValue : -1.0;
src/main/sysutils.c:double cpu, elapsed, old_cpu = cpuLimitValue,
src/main/sysutils.c:if (R_FINITE(cpu) && cpu > 0) cpuLimitValue =
cpu; else cpuLimitValue = -1;
src/main/sysutils.c: cpuLimitValue = old_cpu;

Similar for 'elapsedLimitValue'.

>
> Also, I think it would be nice if the error thrown when timing out had a
> special class so I didn't have to rely on grepping the error message, but
> that is true of lots of errors.

FYI, R.utils::withTimeout() greps the error message (for any language;
https://github.com/HenrikBengtsson/R.utils/blob/2.5.0/R/withTimeout.R#L113-L114)
this way and returns an error of class TimeoutException.

FYI 2, there is as 'Working group for standard error (condition)
classes' proposal to the RConsortium "wishlist", cf.
https://github.com/RConsortium/wishlist/issues/6.

/Henrik

>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> [[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.


Re: [ESS] feature request : completion of available packages name

2017-01-03 Thread Charles C. Berry

On Tue, 3 Jan 2017, Martin Maechler wrote:


On Tue, Jan 3, 2017 at 6:30 PM, Samuel BARRETO
 wrote:

Hi,

Do you think it would be difficult to add some kind of completion backend
to complete the package names when typing `library(` ?


[deleted]



More seriously: We do something like that already in ESS for quite a
while now but I don't recall the details.


I suspect Martin knows this, but ...

C-c C-e C-l

runs ess-load-library.

With `ido' enabled, it puts a list in the minibuffer where fuzzy matching 
will narrow it down to the package one wants. Hitting TAB will 
display all the package names that fuzzily match in a completion buffer.


Thanks for reminding me of the nifty feature!

Chuck

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


[R] getTimeLimit?

2017-01-03 Thread William Dunlap via R-help
I am interested in measuring the time it takes to run an expression.
 system.time(expr) does this but I would like to have it report just 'more
than xxx seconds', where xxx is a argument to the timing function, when it
takes a long time.  This is useful automating the process of seeing how
processing time grows with the size of a dataset.

My latest attempt is the following function, which adds a 'censored=TRUE'
attribute when the cpu or elapsed time exceeds some limit:

system.time2 <- function (expr, gcFirst = TRUE, cpu = Inf, elapsed = Inf)
{
setTimeLimit(cpu = cpu, elapsed = elapsed, transient = TRUE)
censored <- NULL
time <- system.time(gcFirst = gcFirst, tryCatch(expr, error =
function(e) if (grepl("reached (CPU|elapsed) time limit",
conditionMessage(e)))
censored <<- conditionMessage(e)
else stop(e)))
attr(time, "censored") <- censored
time
}

It would be used as

> system.time(times <- lapply(10^(1:7), function(n)system.time2(for(i in
1:n)lgamma(1:i), elapsed=10) ))
   user  system elapsed
  33.550.25   33.82
> vapply(times, function(t)t[["elapsed"]], 0)
[1]  0.02  0.00  0.03  3.08 10.02 10.14 10.18
> # following gives which times are valid
> vapply(times, function(t)is.null(attr(t,"censored")), NA)
[1]  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE

I have two questions.
* Is this a reasonable way to compute such a censored time?
* Is there a getTimeLimit()-like function?

Also, I think it would be nice if the error thrown when timing out had a
special class so I didn't have to rely on grepping the error message, but
that is true of lots of errors.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

[[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-es] Consulta mapas

2017-01-03 Thread Francisco Rodriguez Sanchez

Hola Santiago,

Bienvenido al fascinante mundo de los mapas en R. Es un campo en intenso 
desarrollo actualmente, con elevada proliferación de paquetes y el 
consiguiente desconcierto para los nuevos usuarios. Pero ya verás cómo 
enseguida le encuentras mucha utilidad.


Para mapas temáticos como los que indicas (información por provincias o 
países), paquetes como tmap 
(https://cran.r-project.org/web/packages/tmap/), cartography 
(https://cran.r-project.org/web/packages/cartography/index.html), 
cloroplethr 
(https://cran.r-project.org/web/packages/choroplethr/index.html) o 
rworldmap (https://cran.r-project.org/web/packages/rworldmap/index.html) 
pueden ir muy bien. Todos ellos tienen tutoriales (vignettes) para hacer 
mapas como los que sugieres.


Hace tiempo colgué online un tutorial para hacer mapas y usar R como SIG 
(http://pakillo.github.io/R-GIS-tutorial/), pero ya está algo obsoleto. 
Un par de buenos tutoriales:


http://oscarperpinan.github.io/spacetime-vis/spatial.html

https://github.com/Robinlovelace/Creating-maps-in-R/raw/master/intro-spatial-rl.pdf

Suerte,

Paco


El 03/01/2017 a las 18:59, Santiago Repetto escribió:

Hola!

Quiero empezar a georeferenciar en mapas con R. En blogs se encuentra
bastante información pero veo que no hay unanimidad respecto a las
librerías a utilizar ni tampoco la información es muy clara ni abarcativa.

¿Alguno/a trabaja con mapas en R y me puede indicar por donde encarar?
En principio mi interés es realizar mapas sencillos con información por
provincias y departamentos de Argentina.
(En cuanto a los shapefiles de Argentina tomé uno de aquí
http://www.gadm.org/ que no incluye las Islas Malvinas y el correcto del
Instituto Geográfico Nacional pero que al incluir el territorio antártico
lo hace menos practico).

Se agradece cualquier apunte o pista de por donde empezar a paso seguro.

Saludos y buen año!

Santiago

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


--
Dr Francisco Rodriguez-Sanchez
Integrative Ecology Group
Estacion Biologica de Doñana - CSIC
Avda. Americo Vespucio s/n
41092 Sevilla (Spain)
http://bit.ly/frod_san

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Error when trying to install rzmq continued

2017-01-03 Thread Paul Bernal
Dear friends,

Thanks to all of you who took a a time to try to guide me. I get this error
message.

> install_github('armstrtw/rzmq')
Error in curl::curl_fetch_disk(url, x$path, handle = handle) :
  Couldn't connect to server

Any other way to work this out? My final goal is to get Jupyter to work
with R (be able to use R notebooks not just Python notebooks).

Best of regards and happy new year to all,

Paul

[[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] [FORGED] Re: Problems when trying to install and load package "rzmq"

2017-01-03 Thread Rolf Turner

On 04/01/17 08:45, Paul Bernal wrote:

Hello Petr,

Is it possible to compile the package (rzmq) from Ubuntu for Windows?


No.  At least in my understanding, if you want a package to run on 
Windoze, you have to compile it for Windoze, on Windoze, using compilers 
that are adapted to Windoze.


A feasible approach for you would be to use the win-builder facility.
See the URL:

https://win-builder.r-project.org/

You would have to be able to

* un-tar the source package
* edit the DESCRIPTION file so as to insert *your* email address
  under "maintainer"
* rebuild the (edited) package

To do this you would probably need to work on a Linux system.

Good luck.

cheers,

Rolf Turner

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


Re: [ESS] feature request : completion of available packages name

2017-01-03 Thread Martin Maechler
On Tue, Jan 3, 2017 at 6:30 PM, Samuel BARRETO
 wrote:
> Hi,
>
> Do you think it would be difficult to add some kind of completion backend
> to complete the package names when typing `library(` ?
> I was thinking that the list of packages could be populated by calling
> something like :
>
> names(installed.packages()[,2])
>
> But I don't know enough elisp to implement it myself…

Don't do it the way Rstudio does (it has very slow startup time, in
parts of its interface, because it not only wants to know the package
names of all my many thousand packages in my dozen of libraries in
.libPaths(), but it also want to prepare all the help pages ... or
something close to that).

More seriously: We do something like that already in ESS for quite a
while now but I don't recall the details.
You also may want to give more details about the kind of completion..
notably as emacs / ESS have quite a few different completion
possibilities, as we have been told recently here.

Martin Maechler
ETH Zurich

>
> Thanks !
> Samuel Barreto
>

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: [R] Problems when trying to install and load package "rzmq"

2017-01-03 Thread Paul Bernal
Hello Petr,

Is it possible to compile the package (rzmq) from Ubuntu for Windows?

Best regards,

Paul

2017-01-03 10:28 GMT-05:00 PIKAL Petr :

> Hi
>
> It is clearly seen from CRAN that there is no binary for windows. So you
> either need to migrate to linux or you need to compile the package from
> source or maybe both.
>
> You need to study how to compile a package as it is usually not trivial
> task, especially for somebody who does not compile packages regularly, as
> myself.
>
> Cheers
> Petr
>
>
>
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Paul
> > Bernal
> > Sent: Tuesday, January 3, 2017 1:51 PM
> > To: Paulo Moniz 
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Problems when trying to install and load package "rzmq"
> >
> > Hello Paulo,
> >
> > Thanks for the reply. As a matter of fact, I used the command
> > install.packages("rzmq"), however, the error message kept showing.
> >
> > Best regards,
> >
> > Paul
> >
> > 2016-12-29 16:26 GMT-05:00 Paulo Moniz :
> >
> > > hi Bernal, wouldn't the right  command be - install.packages("rzmq")
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > *De:* R-help  em nome de Paul Bernal <
> > > paulberna...@gmail.com>
> > > *Enviado:* quinta-feira, 29 de dezembro de 2016 20:23
> > > *Para:* r-help@r-project.org; r-de...@r-project.org
> > > *Assunto:* [R] Problems when trying to install and load package "rzmq"
> > >
> > > After connecting to a mirror, I typed the following command:
> > >
> > > install.packages("rzqm")
> > >
> > > but I received the following message:
> > >
> > > ERROR: compilation failed for package 'rzmq'
> > >
> > > removing 'E:/Documents/R/win-library/3.3/rzmq'
> > >
> > > package which is only available in source form, and may need
> > > compilation of
> > > C/C++/Fortran: 'rzmq'
> > > These will not be installed
> > >
> > > The computer environment is Windows 8 64x bits
> > >
> > >
> > > Any help and/or guidance will be greatly appreciated
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > __
> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > R-help -- Main R Mailing List: Primary help - Homepage - SfS
> > > 
> > > stat.ethz.ch
> > > The main R mailing list, for announcements about the development of R
> > > and the availability of new code, questions and answers about problems
> > > and solutions using R ...
> > >
> > > 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.
>
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie
> vymažte ze svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email
> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
> či zpožděním přenosu e-mailu.
>
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout;
> Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany
> příjemce s dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
> výslovným dosažením shody na všech jejích náležitostech.
> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
> společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn
> nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto
> emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich
> existence je adresátovi či osobě jím zastoupené známá.
>
> This e-mail and any documents attached to it may be confidential and are
> intended only for its intended recipients.
> If you received this e-mail by mistake, please immediately inform its
> sender. Delete the contents of this e-mail with all attachments and its
> copies from your system.
> If you are not the intended recipient of 

Re: [R] XML to CSV

2017-01-03 Thread Ben Tupper
Hi,

It's hard to know what to advise - much depends upon the XML data you have and 
what you want to extract from it. Without knowing about those two things there 
is little anyone could do to help.  Can you post to the internet a to example 
data and provide the link here?  Then state explicitly what you want to have in 
hand at the end.

If you are just starting out I suggest that you try xml2 package ( 
https://cran.r-project.org/web/packages/xml2/ ) rather than XML package ( 
https://cran.r-project.org/web/packages/XML/ ). I have been using it much more 
since the authors added the ability to create xml nodes (rather than just 
extracting data from existing xml nodes).  

Cheers,
Ben

P.S.  Hello to my niece Olivia S on the Bates EMS team.


> On Jan 3, 2017, at 11:27 AM, Andrew Lachance  wrote:
> 
> up votdown votefavorite
> 
> 
> I am completely new to R and have tried to use several functions within the
> xml packages to convert an XML to a csv and have had little success. Since
> I am so new, I am not sure what the necessary steps are to complete this
> conversion without a lot of NA.
> 
> -- 
> Andrew D. Lachance
> Chief of Service, Bates Emergency Medical Service
> Residence Coordinator, Hopkins House
> Bates College Class of 2017
> alach...@bates.edu 
> (207) 620-4854
> 
>   [[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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
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] machine learning goal (new to R )

2017-01-03 Thread Sarah Goslee
There are a lot of machine learning options in R:
https://cran.r-project.org/web/views/MachineLearning.html

It sounds like you need to back up a step, and do some reading on the
statistical underpinnings of machine learning before you try to figure
out how to implement a particular method.

There are an enormous number of references online, from brief articles
to full courses. Here's one possible starting point:
https://statweb.stanford.edu/~tibs/ElemStatLearn/

The options are far too complex and numerous for anyone here to be
able to tell you the "right method" to use.

Sarah

On Tue, Jan 3, 2017 at 12:15 PM, Chuck Snell
 wrote:
> Hello,
>
> I am new to R, a computer programmer friend of mine recommended R for a
> project I have on my plate.
>
> (He is not a R guy but knows I need to consider it for the problem I
> described to him)
>
> Frist, I have plenty of data
>
> I have been doing this task with regression models but was asked to try to
> improve my accuracy.
>
> I am forecasting an "output" which is numerical based upon forecasted
> weather.
>
> for extreme weather and stable weather my regression does decent. Meaning,
> really cold and hot weather that has been cold or hot for a while.
>
> What I miss is when things change, meaning if we have had mild weather then
> a sudden change, intuitively we know things won't behave as if it had been
> cold (or hot) for the last week or so but my regression obviously does not
> consider the "history" or patterns.
>
> What was suggested to me was consider some machine learning to identify the
> patterns and so forth.
>
> I have R installed and started searching around the libraries - seems
> overwhelming.
>
> I have found an example of machine learning for R that did "categories" -
> maybe of flowers not sure.
>
> What I need is not categories but a number for an estimate / forecast,
>
> Can you recommend some routines / libraries / techniques to consider?
>
> Thanks
>
-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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-es] Consulta mapas

2017-01-03 Thread javier.ruben.marcuzzi
Estimados

Buen 2017

No se mucho de trabajo sobre información geográfica, pero sí me encontré con 
tener que ubicar información a un lugar geográfico, desconozco la referencia 
que usted da, pero no encontré ninguna base de datos con información 
confiables, ya que piensa en mapas de Argentina, yo me encontré con falta de 
por ejemplo de la ciudad de Santa Fe (capital de una provincia), cuándo había 
más de 1 GB de referencias geográficas (hasta los campos de petróleo, nombre de 
estancias…), en otro caso estaban las calles de una colonia agrícola, pero no 
el nombre de la colonia, en pocas palabras, lo único confiable es utilizar las 
coordenadas de GPS.

Si encuentra una base de datos confiable avise. Yo no uso nombres, sino 
coordenadas, pero es algo muy particular, no es trasladable sin un algoritmo ni 
leíble por usuarios comunes.

Javier Rubén Marcuzzi

De: Carlos Ortega
Enviado: martes, 3 de enero de 2017 15:42
Para: Santiago Repetto
CC: Lista R
Asunto: Re: [R-es] Consulta mapas

Hola,

Disculpa se me pasó darte esta otra referencia, que te puede ser más fácil
de seguir que esas otras referencias que te he incluido anteriormente:

http://madrid.r-es.org/martes-29-octubre-de-2013/

Se trata de un taller sobre cómo tratar con mapas que se hizo en el "Grupo
de R de Madrid".
Puedes ver los videos, tener la presentación y acceder al código en la
misma página.

Saludos,
Carlos Ortega
www.qualityexcellence.es

El 3 de enero de 2017, 19:33, Carlos Ortega 
escribió:

> Hola,
>
> Estas referencias te pueden ser útiles:
>
> https://procomun.wordpress.com/2012/02/18/maps_with_r_1/
> https://procomun.wordpress.com/2012/02/20/maps_with_r_2/
>
>
> http://blog.revolutionanalytics.com/2014/01/easy-data-maps-with-r-the-
> choroplethr-package-.html
> http://blog.revolutionanalytics.com/2011/12/mapping-prosperity-in-
> france-with-r.html
>
> http://www.milanor.net/blog/maps-in-r-choropleth-maps/
>
> http://www.everydayanalytics.ca/2016/03/plotting-
> choropleths-from-shapefiles-in-R.html
>
> https://amywhiteheadresearch.wordpress.com/2014/05/01/shp2raster/
>
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>
> El 3 de enero de 2017, 18:59, Santiago Repetto 
> escribió:
>
>> Hola!
>>
>> Quiero empezar a georeferenciar en mapas con R. En blogs se encuentra
>> bastante información pero veo que no hay unanimidad respecto a las
>> librerías a utilizar ni tampoco la información es muy clara ni abarcativa.
>>
>> ¿Alguno/a trabaja con mapas en R y me puede indicar por donde encarar?
>> En principio mi interés es realizar mapas sencillos con información por
>> provincias y departamentos de Argentina.
>> (En cuanto a los shapefiles de Argentina tomé uno de aquí
>> http://www.gadm.org/ que no incluye las Islas Malvinas y el correcto del
>> Instituto Geográfico Nacional pero que al incluir el territorio antártico
>> lo hace menos practico).
>>
>> Se agradece cualquier apunte o pista de por donde empezar a paso seguro.
>>
>> Saludos y buen año!
>>
>> Santiago
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>
>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

[R] XML to CSV

2017-01-03 Thread Andrew Lachance
up votdown votefavorite


I am completely new to R and have tried to use several functions within the
xml packages to convert an XML to a csv and have had little success. Since
I am so new, I am not sure what the necessary steps are to complete this
conversion without a lot of NA.

-- 
Andrew D. Lachance
Chief of Service, Bates Emergency Medical Service
Residence Coordinator, Hopkins House
Bates College Class of 2017
alach...@bates.edu 
(207) 620-4854

[[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] machine learning goal (new to R )

2017-01-03 Thread Chuck Snell
Hello,

I am new to R, a computer programmer friend of mine recommended R for a
project I have on my plate.

(He is not a R guy but knows I need to consider it for the problem I
described to him)

Frist, I have plenty of data

I have been doing this task with regression models but was asked to try to
improve my accuracy.

I am forecasting an "output" which is numerical based upon forecasted
weather.

for extreme weather and stable weather my regression does decent. Meaning,
really cold and hot weather that has been cold or hot for a while.

What I miss is when things change, meaning if we have had mild weather then
a sudden change, intuitively we know things won't behave as if it had been
cold (or hot) for the last week or so but my regression obviously does not
consider the "history" or patterns.

What was suggested to me was consider some machine learning to identify the
patterns and so forth.

I have R installed and started searching around the libraries - seems
overwhelming.

I have found an example of machine learning for R that did "categories" -
maybe of flowers not sure.

What I need is not categories but a number for an estimate / forecast,

Can you recommend some routines / libraries / techniques to consider?

Thanks

[[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] How to check R kernel (IRkernel) version used in Jupyter

2017-01-03 Thread Paul Bernal
Dear friends,

I would like to know how can I do to check which IRkernel version I am
currently using?

Thanks beforehand for any valuable information you can share,

Best regards,

Paul

[[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-es] Consulta mapas

2017-01-03 Thread Carlos Ortega
Hola,

Disculpa se me pasó darte esta otra referencia, que te puede ser más fácil
de seguir que esas otras referencias que te he incluido anteriormente:

http://madrid.r-es.org/martes-29-octubre-de-2013/

Se trata de un taller sobre cómo tratar con mapas que se hizo en el "Grupo
de R de Madrid".
Puedes ver los videos, tener la presentación y acceder al código en la
misma página.

Saludos,
Carlos Ortega
www.qualityexcellence.es

El 3 de enero de 2017, 19:33, Carlos Ortega 
escribió:

> Hola,
>
> Estas referencias te pueden ser útiles:
>
> https://procomun.wordpress.com/2012/02/18/maps_with_r_1/
> https://procomun.wordpress.com/2012/02/20/maps_with_r_2/
>
>
> http://blog.revolutionanalytics.com/2014/01/easy-data-maps-with-r-the-
> choroplethr-package-.html
> http://blog.revolutionanalytics.com/2011/12/mapping-prosperity-in-
> france-with-r.html
>
> http://www.milanor.net/blog/maps-in-r-choropleth-maps/
>
> http://www.everydayanalytics.ca/2016/03/plotting-
> choropleths-from-shapefiles-in-R.html
>
> https://amywhiteheadresearch.wordpress.com/2014/05/01/shp2raster/
>
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>
> El 3 de enero de 2017, 18:59, Santiago Repetto 
> escribió:
>
>> Hola!
>>
>> Quiero empezar a georeferenciar en mapas con R. En blogs se encuentra
>> bastante información pero veo que no hay unanimidad respecto a las
>> librerías a utilizar ni tampoco la información es muy clara ni abarcativa.
>>
>> ¿Alguno/a trabaja con mapas en R y me puede indicar por donde encarar?
>> En principio mi interés es realizar mapas sencillos con información por
>> provincias y departamentos de Argentina.
>> (En cuanto a los shapefiles de Argentina tomé uno de aquí
>> http://www.gadm.org/ que no incluye las Islas Malvinas y el correcto del
>> Instituto Geográfico Nacional pero que al incluir el territorio antártico
>> lo hace menos practico).
>>
>> Se agradece cualquier apunte o pista de por donde empezar a paso seguro.
>>
>> Saludos y buen año!
>>
>> Santiago
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>
>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R-es] Consulta mapas

2017-01-03 Thread Santiago Repetto
Hola!

Quiero empezar a georeferenciar en mapas con R. En blogs se encuentra
bastante información pero veo que no hay unanimidad respecto a las
librerías a utilizar ni tampoco la información es muy clara ni abarcativa.

¿Alguno/a trabaja con mapas en R y me puede indicar por donde encarar?
En principio mi interés es realizar mapas sencillos con información por
provincias y departamentos de Argentina.
(En cuanto a los shapefiles de Argentina tomé uno de aquí
http://www.gadm.org/ que no incluye las Islas Malvinas y el correcto del
Instituto Geográfico Nacional pero que al incluir el territorio antártico
lo hace menos practico).

Se agradece cualquier apunte o pista de por donde empezar a paso seguro.

Saludos y buen año!

Santiago

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Fitting Hastie's principal surfaces in R

2017-01-03 Thread Hall, Mark
Did you search for the princurve package?  Sounds like it may be what you
want.
See https://cran.r-project.org/web/packages/princurve/index.html

Best, MEH

Mark E. Hall, PhD
Assistant Field Manager
Black Rock Field Office
Winnemucca District Office
775-623-1529.

On Sun, Jan 1, 2017 at 2:56 AM, Neverstop .  wrote:

> Hello,
>
> I need to summarize a three-dimensional dataset through a principal
> surface that passes through the middle of the data. Principal surfaces are
> non-linear generalization of the plane created by the first two principal
> components and provide a non-linear summary of p-dimensional dataset.
> Principal surfaces are described in this 1989 article by Hastie and
> Stuetzle: https://web.stanford.edu/~hastie/Papers/Principal_Curves.pdf .
> They were introduced by Trevor Hastie in his Ph.D dissertation:
> http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-r-276.pdf
>
> I'm looking for a package to fit principal surfaces with R.
> I've come across the package princurve created by TrevorHastie, but it
> allows to fit principal curves only. How can I fit two-dimensional
> principal surfaces in R?
>
> Thank you.
>
> [[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] Problems when trying to install and load package "rzmq"

2017-01-03 Thread PIKAL Petr
Hi

It is clearly seen from CRAN that there is no binary for windows. So you either 
need to migrate to linux or you need to compile the package from source or 
maybe both.

You need to study how to compile a package as it is usually not trivial task, 
especially for somebody who does not compile packages regularly, as myself.

Cheers
Petr



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Paul
> Bernal
> Sent: Tuesday, January 3, 2017 1:51 PM
> To: Paulo Moniz 
> Cc: r-help@r-project.org
> Subject: Re: [R] Problems when trying to install and load package "rzmq"
>
> Hello Paulo,
>
> Thanks for the reply. As a matter of fact, I used the command
> install.packages("rzmq"), however, the error message kept showing.
>
> Best regards,
>
> Paul
>
> 2016-12-29 16:26 GMT-05:00 Paulo Moniz :
>
> > hi Bernal, wouldn't the right  command be - install.packages("rzmq")
> >
> >
> >
> >
> >
> >
> > --
> > *De:* R-help  em nome de Paul Bernal <
> > paulberna...@gmail.com>
> > *Enviado:* quinta-feira, 29 de dezembro de 2016 20:23
> > *Para:* r-help@r-project.org; r-de...@r-project.org
> > *Assunto:* [R] Problems when trying to install and load package "rzmq"
> >
> > After connecting to a mirror, I typed the following command:
> >
> > install.packages("rzqm")
> >
> > but I received the following message:
> >
> > ERROR: compilation failed for package 'rzmq'
> >
> > removing 'E:/Documents/R/win-library/3.3/rzmq'
> >
> > package which is only available in source form, and may need
> > compilation of
> > C/C++/Fortran: 'rzmq'
> > These will not be installed
> >
> > The computer environment is Windows 8 64x bits
> >
> >
> > Any help and/or guidance will be greatly appreciated
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > R-help -- Main R Mailing List: Primary help - Homepage - SfS
> > 
> > stat.ethz.ch
> > The main R mailing list, for announcements about the development of R
> > and the availability of new code, questions and answers about problems
> > and solutions using R ...
> >
> > 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 

Re: [R] [Rd] Problems when trying to install and load package "rzmq"

2017-01-03 Thread Paul Bernal
Dear Whit,

Thank you for your valuable and kind reply. I will take a look at the link
you provided, however, I would also like to try to compile libzmq sources
for windows with R´s mingw, how can I do this? Or where can I find any
documents or guidance to try this?

Any help will be greatly appreciated,

Best regards,

Paul

2017-01-03 9:53 GMT-05:00 Whit Armstrong :

> Hi, Paul.
>
> I maintian the rzmq project.
>
> love to get it running on windows, but zmq doesn't play nicely with R's
> mingw.
>
> These guys have taken the approach of building the entire zmq library
> inside the R package:
> https://github.com/snoweye/pbdZMQ
>
> I suggest you give it a try. or if you want to attempt to compile libzmq
> sources for windows w/ R's mingw, that would be welcome.
>
> -Whit
>
>
> On Tue, Jan 3, 2017 at 9:36 AM, peter dalgaard  wrote:
>
>> Possibly so.
>>
>> However, the ZeroMQ libraries do exist for Windows, so it might be
>> possible to get the package working there. However, CRAN probably won't
>> have the libraries, so cannot produce a binary package, and it is also
>> quite possible that the package author is not a Windows person.
>>
>> At the very least, you'll need some familiarity with the Windows
>> toolchain and be prepared to apply a fair amount of elbow grease.
>>
>> -pd
>>
>> (crosspost to r-help removed)
>>
>> On 29 Dec 2016, at 22:04 , Paul Bernal  wrote:
>>
>> > Dear Jeff,
>> >
>> > Thank you for your fast and kind reply. When you say that you do not
>> think
>> > this can be done on windows, then I would have to use something like
>> Ubuntu
>> > or Linux?
>> >
>> > Best regards
>> >
>> > Paul
>> >
>> > 2016-12-29 16:00 GMT-05:00 Jeff Newmiller :
>> >
>> >> Read the system requirements [1]. I don't think you can do this on
>> windows.
>> >>
>> >> [1] https://cran.r-project.org/web/packages/rzmq/index.html
>> >> --
>> >> Sent from my phone. Please excuse my brevity.
>> >>
>> >> On December 29, 2016 12:23:26 PM PST, Paul Bernal <
>> paulberna...@gmail.com>
>> >> wrote:
>> >>> After connecting to a mirror, I typed the following command:
>> >>>
>> >>> install.packages("rzqm")
>> >>>
>> >>> but I received the following message:
>> >>>
>> >>> ERROR: compilation failed for package 'rzmq'
>> >>>
>> >>> removing 'E:/Documents/R/win-library/3.3/rzmq'
>> >>>
>> >>> package which is only available in source form, and may need
>> >>> compilation of
>> >>> C/C++/Fortran: 'rzmq'
>> >>> These will not be installed
>> >>>
>> >>> The computer environment is Windows 8 64x bits
>> >>>
>> >>>
>> >>> Any help and/or guidance will be greatly appreciated
>> >>>
>> >>>  [[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/posti
>> ng-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-de...@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>

[[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] Network validation (of sorts) using granger Causality in R

2017-01-03 Thread Erdogan CEVHER
1. Describe better the distributions of obs to time series; i.e., describe
clearly the time series and obs with math'l notation briefly.

2. Use Conditional G-causality and/or partial G-causality, you can exceed
"the limit of max. number of variables = 11" in a VAR structure.

3. You can use R's FIAR package for CGC / PGC calculations. I advise
version 3 of that package.

4. Kamamoto Oscillators for "Graphical" GC methods perhaps may well suit to
your case.

5. Matlab's GCCA and MVGC packages cannot handle cointegration (in case
cointegrated vars exist) whereas you can handle cointegrated cases via CGC
and PGC.

2017-01-03 9:20 GMT+03:00 PWD7052 via R-help :

> Hi Everyone,
>
> We have a question about whether one can to do a particular type of
> Granger Causality (GC) network validation in R. We hope you'll agree it's
> an interesting problem and that someone's figured out how to solve it.
>
> We have a cellular network with n nodes (proteins).  We have two different
> n x s x k time series matrices that describe the network activity under two
> mutually exclusive conditions, C (cancerous cell) and H (healthy cell),
> where s is the length of the time series data, and k is the number of
> observations.
> Using the time series matrices, we calculated two different n x n GC
> matrices, one for healthy cells and one for cancerous cells, so that ij th
> element in each matrix represents the GC influence of node i on node j.
> Using the various standard tests, we know that many of the GC values are
> extremely significant.
> Now we’re given a brand-new observation in the form of a n x s x 1 time
> series matrix Y that represents the activity of the same n nodes (we don’t
> know a priori whether the new data come from a healthy cell or a cancerous
> cell).
> Given this matrix Y :
> (1) How can we go about determining if Y comes from a cancerous cell
> (condition C) or a healthy cell (condition H)?
> (2) Is there a package in R that we can use for this purpose?
>
> Thank you very much!
> Pat
>
> [[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] Network validation (of sorts) using granger Causality in R

2017-01-03 Thread Bert Gunter
Have you searched?!

"Granger causality" at rseek.org brought up what appeared to be many
relevant hits.

-- 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 Mon, Jan 2, 2017 at 10:20 PM, PWD7052 via R-help
 wrote:
> Hi Everyone,
>
> We have a question about whether one can to do a particular type of Granger 
> Causality (GC) network validation in R. We hope you'll agree it's an 
> interesting problem and that someone's figured out how to solve it.
>
> We have a cellular network with n nodes (proteins).  We have two different n 
> x s x k time series matrices that describe the network activity under two 
> mutually exclusive conditions, C (cancerous cell) and H (healthy cell), where 
> s is the length of the time series data, and k is the number of observations.
> Using the time series matrices, we calculated two different n x n GC 
> matrices, one for healthy cells and one for cancerous cells, so that ij th 
> element in each matrix represents the GC influence of node i on node j.  
> Using the various standard tests, we know that many of the GC values are 
> extremely significant.
> Now we’re given a brand-new observation in the form of a n x s x 1 time 
> series matrix Y that represents the activity of the same n nodes (we don’t 
> know a priori whether the new data come from a healthy cell or a cancerous 
> cell).
> Given this matrix Y :
> (1) How can we go about determining if Y comes from a cancerous cell 
> (condition C) or a healthy cell (condition H)?
> (2) Is there a package in R that we can use for this purpose?
>
> Thank you very much!
> Pat
>
> [[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.

Re: [R] Problems when trying to install and load package "rzmq"

2017-01-03 Thread Paul Bernal
Hello Paulo,

Thanks for the reply. As a matter of fact, I used the command
install.packages("rzmq"), however, the error message kept showing.

Best regards,

Paul

2016-12-29 16:26 GMT-05:00 Paulo Moniz :

> hi Bernal, wouldn't the right  command be - install.packages("rzmq")
>
>
>
>
>
>
> --
> *De:* R-help  em nome de Paul Bernal <
> paulberna...@gmail.com>
> *Enviado:* quinta-feira, 29 de dezembro de 2016 20:23
> *Para:* r-help@r-project.org; r-de...@r-project.org
> *Assunto:* [R] Problems when trying to install and load package "rzmq"
>
> After connecting to a mirror, I typed the following command:
>
> install.packages("rzqm")
>
> but I received the following message:
>
> ERROR: compilation failed for package 'rzmq'
>
> removing 'E:/Documents/R/win-library/3.3/rzmq'
>
> package which is only available in source form, and may need compilation of
> C/C++/Fortran: 'rzmq'
> These will not be installed
>
> The computer environment is Windows 8 64x bits
>
>
> Any help and/or guidance will be greatly appreciated
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> R-help -- Main R Mailing List: Primary help - Homepage - SfS
> 
> stat.ethz.ch
> The main R mailing list, for announcements about the development of R and
> the availability of new code, questions and answers about problems and
> solutions using R ...
>
> 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.


[R] Difference in Generalized Extreme Value distribution parameter estimations using lmom and fExtremes

2017-01-03 Thread Amelia Marsh via R-help
Dear R forum

I have following dataset

amounts = 
c(2803102.248,1088675.278,10394575.14,1007368.396,1004871.328,1092956.088,1020110.818,997371.4487,1000904.154,998105.9744,997434.3006,1080067.258,997594.7992,1000871.015,1001321.094,1000713.448,997591.2307,1469501.54,1066924.393,1074918.566,998628.6216,1002538.482,1056969.243,997386.2638,1.36951E+11,997996.9907,1001257.498,998297.1517,5253186.541,1005503.303,997785.7993,997327.4303,1037039.271,997353.5027,998297.0299,1072558.563,2713147.593,997679.0361,1015856.216,1424576097,999165.4936,998038.8554,3221340.057,1009576.799,5.84277E+12,18595873.96,1054794.099,1005800.558,997533.8031,997347.4897,2208865120,4224689.441,997660.4156,997325.1814,46809107.76,1200682.819,998921.9662,997540.1311,997594.3338,1109023.716,1007961.274,1939821.599,998260.2296,175808356.8,1005375.437,997412.0361,997383.9452,998863.5354,1554312.55,997791.3639,997355.1921,997476.2689,14557283.34,997937.3784,1013997.695,1006244.593,999265.8925,1052001.211,1005484.306,1258924.294,998740.9426,997896.56!
 
31,3613729.605,1000823.697,1656621.398,997874.4055,1056353.896,1000380.152,997576.3836,997442.5109,998563.4918,1032782.759,1010023.106,998578.6725,997344.4766,997310.5771,1002905.434,86902124.97,998396.3911,1245564.907)
 


Using this dataset, I am trying to estimate the parameter values of Extreme 
Value Distribution. I am using the libraries lmom and fExtremes as follows:


library(lmom) 
library(fExtremes)

# 


# Parameter estimation : Using lmom 


lmom <- samlmu(amounts) 
(parameters_of_GEV_lmom <- pelgev(lmom)) 


# OUTPUT: 

> parameters_of_GEV_lmom <- pelgev(lmom); parameters_of_GEV_lmom 


xi  # Location Parameter
8.883402e+06

alpha # Scale Paramter
5.692228e+07 

k   # Shape Parameter
-9.990491e-01 



# 



# Parameter estimation : Using fExtremes

(parameters_of_GEV_fExtremes <- gevFit(amounts, type = "pwm")) 

# OUTPUT: 

Title: 
GEV Parameter Estimation 

Call: 
gevFit(x = amounts, type = "pwm") 

Estimation Type: 
gev pwm 

Estimated Parameters: 


xi# Shape Parameter
9.990479e-01


mu   # Location Parameter
8.855115e+06


beta  # Scale paramter
5.699583e+07 



# __

While it is obvious that the parameter values will differ as lmom is using L 
moments and fExtremes is using Probability Weighted Moment, my concern is about 
the shape parameter. The value of shape parameter is same across all methods 
except the sign.

While lmom estimates shape parameter = -0.99905, fExtremes estimates shape 
parameter = 0.99905. When I have used Statistical software to estimate the 
parameters, I got the parameter values exactly tallying with what lmom is 
generating but scale parameter was equal to 0.99905 (Positive value same as 
fExtremes value) and not -0.99905 which is generated by lmom libraray.

Can some one guide me.


With regards

Amelia

__
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] Network validation (of sorts) using granger Causality in R

2017-01-03 Thread PWD7052 via R-help
Hi Everyone,

We have a question about whether one can to do a particular type of Granger 
Causality (GC) network validation in R. We hope you'll agree it's an 
interesting problem and that someone's figured out how to solve it.

We have a cellular network with n nodes (proteins).  We have two different n x 
s x k time series matrices that describe the network activity under two 
mutually exclusive conditions, C (cancerous cell) and H (healthy cell), where s 
is the length of the time series data, and k is the number of observations.
Using the time series matrices, we calculated two different n x n GC matrices, 
one for healthy cells and one for cancerous cells, so that ij th element in 
each matrix represents the GC influence of node i on node j.  Using the various 
standard tests, we know that many of the GC values are extremely significant.
Now we’re given a brand-new observation in the form of a n x s x 1 time series 
matrix Y that represents the activity of the same n nodes (we don’t know a 
priori whether the new data come from a healthy cell or a cancerous cell).
Given this matrix Y :
(1) How can we go about determining if Y comes from a cancerous cell (condition 
C) or a healthy cell (condition H)?
(2) Is there a package in R that we can use for this purpose?

Thank you very much!
Pat

[[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] Reg. odds ratio for Nested logit model

2017-01-03 Thread Suja Sekhar C
Hi,

I am new to R. I find that I can get the odds ratio of a logit regression
by typing exp(coef(result)) . However for a nested logit model with an
inclusive value parameter, I am not sure how to get the odds ratio.
My code is below, with m1 containing my results. Please help me to get the
odds-ratios from the coefficients.

library(mlogit)
> dat1<- read.csv("Desktop/me.csv")
> dat1$id <- 1:11304
> dat1$mode <- as.character(dat1$choice_t)
# choice_t is my variable that takes a value 0 ,1 or 2. Here 0 is the only
branch for option A and 1 and 2 are sub-branches of option B.

mdat1 <- subset(dat1, select = c("mode”,”x1”,”x2”, “x3”,”x4”, ”id"))
> ndat1 <- mlogit.data(mdat1, shape="wide", choice="mode")
# This creates 2 other alternatives as per the requirement of Nested Logit
model. There should be a set of variables for all the options 0, 1, and 2.
File ndat1 has therefore 3*11304 = 33912 firm- year observations.

Mode variable =1 for the choice that the firm makes in that year. So if the
firm has made a choice of 2 in an year it will take the value 1 for only
that firm-year observation.
> m1 <- mlogit(mode ~ 1| x1+x2+x3+x4, data=ndat1, + nests =
list(optionA=c("0"), optionB=c("1","2")),un.nest.el=TRUE )

> summary(m1)


Thank you,

Suja

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