[R] regarding predicted value from xgboost package

2016-10-13 Thread Ranjana Girish
hai everyone.

i am using model building  function xgboost() using code :

fit <- xgboost(data =sparse_matrix , label = trainSet$OutputClass,
max.depth = 4,eta = 1, nthread = 2, nround = 10, eval_metric =
"merror",objective = "multi:softmax",num_class = 45)

when i use the prediction function:

Prediction <- predict(fit,sparse_matrixtestSet)

the above code gave output as below( instead of class names its giving
numerical equivalent value eventhough  "*label = trainSet$OutputClass*"
contain class names)

*output:*
[1]  1  1  1  1  1 35  3  3  3  4 31  7  7  7  3  3  9  9  9  9  9  9  9 10
10 11
 [27] 11 11 11 11 11 11 11 11 11 13 13 13 13 13 13 13 13 13 14 14 14 14 14
14 10 10
 [53] 15 15 15 15 15 15 15 15 15 15 15 16 16 16 16 16 16 16 16 16 16 16 16
18 18 18
 [79] 18 18 18 18 35 35 35 18 21 21 21 21 32  1  1 25 25 25 25 26 27 27 27
27 27 27
[105] 27 27 29 29 29 29 29 30 30 30 30 30 30 30 30 30 30 35 35 32 32 32 43
43 32 32
[131] 32 32 32 32 32 32 43 32 32 32 32 32 33

i have also set *stringsAsFactors=FALSE* while reading data set

could some one please help, how to get prediction in term of class name
instead of numerical equivalent value.

Thanks in advance

[[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] Subclass Prediction

2016-10-13 Thread TJUN KIAT TEO
I am trying to work clustering problem where I actually know the sublcass. For 
example


Suppose I am trying to predict cluster patients a group of people into male and 
female where I actually know the label male and female but I take it I don't 
know


Suppose my clustering method produces subclasses label 1 and 2. Is there a 
quick method of how to assign which labels 1 and 2 to male or female to 
maximize my prediction accuracy? Obvious in this case since there are only two 
cases it is trivial but when the number of subclasses gets big it, trying all 
the possible combinations can be very time consuming.


Regards


Tjun Kiat


[[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-es] Grupo de R de Madrid - 38 - Reunión Grupo de R: Jueves 13 de octubre

2016-10-13 Thread Carlos Ortega
Hola,

Por si es de vuestro interés, acabamos de subir el material (videos y
presentaciones) de la sesión que hemos celebrado hoy.

• Manuel Pérez :
" Análisis con herramientas R de la página Meetup del Grupo de R de
Madrid ". Manuel mostrará los resultados de diferentes análisis sobre la
página de Meetup del Grupo: número de participantes, frecuencia de
asistencia, intereses en otros grupos. Este análisis puede servir de base
para proyectar asistencia futura, temas de interés, etc.

• Francisco Rodríguez
:
"Introducción a los SVM con R". Francisco nos hará una introducción a las
"Support Vector Machines - Máquinas Vectoriales de Soporte" desde un punto
de vista matemático, significado geométrico, etc. Realizará varios ejemplos
de aplicación con R.
http://madrid.r-es.org/38-jueves-13-de-octubre-2016/


Gracias,
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

Re: [R] sort()ing strings

2016-10-13 Thread peter dalgaard

> On 13 Oct 2016, at 13:00 , Martin Maechler  wrote:
> 
> which I do find strange, indeed, given your sessionInfo which
> contains
>   LC_COLLATE=en_US.UTF-8
> 

One of the _really_ strange things about localization is that there is no 
standardization. Names don't necessarily mean the same thing cross-platform. 

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


Re: [R] Function Distributions does not exist in package stats

2016-10-13 Thread Jim Lemon
Hi Hugo,
If you look at the help page for "distributions", you will see that it
describes a number of functions that return density functions, etc.
for specific distributions. If you are looking for something that
informs you which distribution might approximate an existing set of
values, try the "fitdistr" function in the MASS package.

Jim


On Fri, Oct 14, 2016 at 3:42 AM, hugo  wrote:
> I was looking function Distribution into stats package: it does not exist!
>
> I am working with:
>
> version
>_
> platform   x86_64-pc-linux-gnu
> arch   x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status
> major  3
> minor  3.1
> year   2016
> month  06
> day21
> svn rev70800
> language   R
> version.string R version 3.3.1 (2016-06-21)
> nickname   Bug in Your Hair
>
> Sincerely
>
> __
> 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] (no subject)

2016-10-13 Thread Jim Lemon
The crucial thing is probably:

"... they are translated to UTF-8 before comparison."

Although the first 127 characters seem to be identical to ASCII, in
which punctuation marks sorted before digits or letters, the encoding
to UTF-8 may make that impractical.

Jim


On Thu, Oct 13, 2016 at 8:55 PM, Bob O'Hara  wrote:
> Yes, thanks. That seems to be it:
>
> thing <- c("M1", "M2", "M.1", "M.2")
>> sort(thing)
> [1] "M1"  "M.1" "M2"  "M.2"
>
> The only documentation I can find is from ?Comparison:
> "Collation of non-letters (spaces, punctuation signs, hyphens,
> fractions and so on) is even more problematic."
>
> Indeed.
>
> Bob
>
> On 13 October 2016 at 11:26, PIKAL Petr  wrote:
>> Hi
>>
>> Just a wild guess. Dot is ignored and the output is alphabetically sorted.
>>
>> You could try sort it yourself by
>>
>> sort(ls())
>>
>> Cheers
>> Petr
>>
>>> -Original Message-
>>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bob
>>> O'Hara
>>> Sent: Thursday, October 13, 2016 10:29 AM
>>> To: r-help 
>>> Subject: [R] (no subject)
>>>
>>> I've just come across an odd problem with sorting in ls(): it doesn't seem 
>>> to
>>> order the object names correctly. If I do the following, the order isn't 
>>> what I
>>> expect:
>>>
>>> > ls(sorted=TRUE)
>>>  [1] "AridData"  "AridDataToBUGS""Arid.df"
>>> "Arid.hpd"  "AridPrecip.sd" "Break.df"
>>>  [7] "Break.hpd" "Cols"  "Data"
>>> "DataFrames""DataToBUGS""DataToBUGS.nonlog"
>>> [13] "FitBRugs"  "Fixed.df"  "Fixed.hpd"
>>> "FormatData""GetCol""GetHPD"
>>> [19] "GetMCMC"   "GetRow""HPDIs"
>>> "Int.alpha12"   "Int.alpha21"   "ModisData"
>>> [25] "ModisDataToBUGS"   "Modis.df"  "ModisFixed.df"
>>> "ModisFixed.hpd""Modis.hpd" "ModisPrecip.sd"
>>> [31] "ModisShrink.df""ModisShrink.hpd"   "ModisYears"
>>> "OrigData"  "OrigDataToBUGS""Orig.df"
>>> [37] "Orig.hpd"  "OrigPrecip.sd" "OrigYears"
>>> "PlotChecks""PlotEff"   "plothpd"
>>> [43] "ProvinceNames" "ResNames"  "ResNamesOrder"
>>> "Shrink.df" "Shrink.hpd""SimInits"
>>>
>>> Specifically, the Modis* objects are sorted like this:
>>>
>>> > ls(sorted=TRUE)[26:30]
>>> [1] "Modis.df"   "ModisFixed.df"  "ModisFixed.hpd" "Modis.hpd"
>>>  "ModisPrecip.sd"
>>>
>>> With Modis.* coming both before and after ModisF*. I can't see why there
>>> would be any odd problems with character sets changing (this was all done
>>> on a single computer with no weird locale switching), and the objects are 
>>> all
>>> created within a single R session:
>>>
>>> > sessionInfo()
>>> R version 3.2.5 (2016-04-14)
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> Running under: Ubuntu 16.04.1 LTS
>>>
>>> locale:
>>>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>>> LC_TIME=en_GB.UTF-8LC_COLLATE=en_US.UTF-8
>>>  [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_US.UTF-8
>>> LC_PAPER=en_GB.UTF-8   LC_NAME=C
>>>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
>>> LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats graphics  grDevices utils datasets  methods   base
>>>
>>> other attached packages:
>>> [1] MCMCglmm_2.22.1ape_3.5Matrix_1.2-7.1
>>> RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
>>>
>>> loaded via a namespace (and not attached):
>>> [1] cubature_1.1-2  corpcor_1.6.8   tools_3.2.5 Rcpp_0.12.7
>>> nlme_3.1-128grid_3.2.5  knitr_1.14
>>> [8] tensorA_0.36lattice_0.20-34
>>>
>>> Can anyone explain what's going on?
>>>
>>> Bob
>>>
>>> --
>>> Bob O'Hara
>>>
>>> Biodiversity and Climate Research Centre Senckenberganlage 25
>>> D-60325 Frankfurt am Main,
>>> Germany
>>>
>>> Tel: +49 69 798 40226
>>> Mobile: +49 1515 888 5440
>>> WWW:   http://www.bik-f.de/root/index.php?page_id=219
>>> Blog: http://occamstypewriter.org/boboh/
>>> Journal of Negative Results - EEB: www.jnr-eeb.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.
>>
>> 
>> 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.
>>
>> 

Re: [R] can we visualize water flows with 3d in R?

2016-10-13 Thread Duncan Murdoch

On 13/10/2016 11:14 AM, Thomas Adams wrote:

Duncan,

Oh, to be sure, with a fair amount of work, you're probably correct that
one could mash up something. Here are some examples:

http://www.illinoisfloods.org/documents/2013_IAFSM_Conference/Conference_Presentations/5C-1_HEC-GeoRAS_Part1.pdf
<--- lots of graphics

http://rivergis.com/

also...
http://www2.egr.uh.edu/~aleon3/courses/Transient_flows/Tutorials/Geo_RAS/georastutorial.pdf
-- pages 35->
https://www.crwr.utexas.edu/reports/pdf/1999/rpt99-1.pdf -- pages 70->
(figures 4-17, 4-18), p. 147


Thanks.  I guess it's up to Marna to say whether any of those figures 
are like what she wants to produce from her data.


Duncan Murdoch



Best,
Tom

On Thu, Oct 13, 2016 at 9:20 AM, Duncan Murdoch
> wrote:

On 13/10/2016 8:35 AM, Thomas Adams wrote:

All,

Very respectfully, there are no R packages that can do what
Marna desires.


I would guess that's not literally true, in that there are several
graphics packages that are very flexible.   You could well be right
that there are none that are designed specifically for this purpose,
so she's probably going to have to do some work to get what she wants.

His/Her data, undoubtably, comes from a 1-D hydraulic model
simulation -- where output is generated at channel
cross-sections -- representing the sloping water surface
elevation of the centerline of flow in a stream or river. With
mapping software for such problems, the assumption is made that
the water surface intersects the topography (within or beyond
the stream channel) perpendicular to the direction of flow.
Hydrodynamically, this is generally not correct, but it's a
reasonable approximation. To do this, typically, the topography
-- in the from of a raster digital elevation model (DEM) -- is
converted to a triangular irregular network (TIN) to facilitate
the creation of a smoother line of intersection between the
water surface and topography. Because, the water surface slopes
in a downstream direction, contour lines are crossed. Hydraulic
modeling software usually is accompanied by this mapping
capability, such as with HEC-RAS with RAS-Mapper, developed by
the US Army Corps of Engineers, or with HEC-GeoRAS, which
requires ESRI ARC GIS; but, there is also a QGIS plugin module
that can do this, I believe. These software packages do
facilitate representing the flow in 3D.


Do you know any sample figures online that would show the type of
graph that is usually used here?

Duncan Murdoch


Tom


On Wed, Oct 12, 2016 at 6:12 PM, David Winsemius

>>
wrote:


> On Oct 12, 2016, at 4:28 AM, Duncan Murdoch

>> wrote:
>
> On 12/10/2016 4:49 AM, Marna Wagley wrote:
>> Hi R Users,
>> Is it possible to visualize river flow in 3D (latitude,
longitude with
>> respect to depth)?
>> The example of my data looks like. Any suggestions?
>>
>>> dat1
>>long lat depth flow
>> 1 1015.9 857  1.00 1.50
>> 2 1015.9 857  1.25 1.23
>> 3 1015.9 857  0.50 2.00
>> 4 1015.9 858  0.10 1.95
>> 5 1015.9 858  0.20 1.50
>> 6 1025.0 858  0.30 1.20
>> 7 1025.0 858  0.40 0.50
>> 8 1025.0 858  0.35 0.70
>> 9 1025.0 858  0.24 1.20
>>
>> Thanks for your help.
>
> It may be, but it's hard to give a nice looking graphic of
that
small dataset.  You could try the rgl package and use plot3d to
show spheres with radius depending on the flow rate, for example
>
> plot3d(cbind(long, lat, depth), type="s", col="blue",
radius=flow/5)

A complementary option is to install the plot3D package which I
see also has a plot3Drgl "co-package". The advantage to this
option is the association with beautiful modeling packages that
Karline Soetaert, Peter M. J. Herman, and Thomas Petzoldt have
been offering to ecologists for the last decade. (Packages:
deSolve, marelac, seacarb, AquaEnv) A lot of her work has
been on
flows within systems.

I usually think of "flows" in rivers as being vector fields
in an
incompressible fluid (water) with 6 components per point,
but 

Re: [R] Function Distributions does not exist in package stats

2016-10-13 Thread Rui Barradas

Hello,

'Distribution' is not the name of a function in package stats.
At an R prompt type ?Distributions. In that help page you will read

"Distributions {stats} R Documentation
Distributions in the stats package
Description

Density, cumulative distribution function, quantile function and random 
variate generation for many standard probability distributions are 
available in the stats package. "


followed by the available distributions. There are also many other 
distributions available in the many packages on CRAN.


Hope this helps,

Rui Barradas

Em 13-10-2016 17:42, hugo escreveu:

I was looking function Distribution into stats package: it does not exist!

I am working with:

version
_
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  3
minor  3.1
year   2016
month  06
day21
svn rev70800
language   R
version.string R version 3.3.1 (2016-06-21)
nickname   Bug in Your Hair

Sincerely

__
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] Function Distributions does not exist in package stats

2016-10-13 Thread hugo

I was looking function Distribution into stats package: it does not exist!

I am working with:

version
   _
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  3
minor  3.1
year   2016
month  06
day21
svn rev70800
language   R
version.string R version 3.3.1 (2016-06-21)
nickname   Bug in Your Hair

Sincerely

__
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 reproducing this boxplot

2016-10-13 Thread Ryan Treacy
I am trying to reproduce the style of boxplot pictured in the attached
image.  The code below is close but I cannot get the control values the
correct color.

library(ggplot2)

box.print <- function(C1M,C1, D2, QCDC2, QCSDT4, num){
  NAME <- names(D2[num])
  adjsdt4 <- C1M[,num]
  sdt4 <- C1[,num]
  disco2 <- D2[,num]
  qcdc <- QCDC2[,num]
  qcsdt4 <- QCSDT4[,num]
  adj <- data.frame(Intensity=c(adjsdt4,qcsdt4),
Study= rep("adjSDT4",length(adjsdt4)+length(qcsdt4)),
QC=
c(rep("cases",length(adjsdt4)),rep("QC",length(qcsdt4)))

  )
  nadj <- data.frame(Intensity=c(sdt4,qcsdt4),
 Study= rep("SDT4",length(sdt4)+length(qcsdt4)),
 QC=
c(rep("cases",length(sdt4)),rep("QC",length(qcsdt4)))

  )
  disco <- data.frame(Intensity=c(disco2,qcdc),
  Study= rep("DISCO2",length(disco2)+length(qcdc)),
  QC=
c(rep("cases",length(disco2)),rep("QC",length(qcdc)))

  )
  full <- rbind(adj,nadj,disco)

  g1 <- ggplot(full, aes(x=Study, y=Intensity))+geom_boxplot(outlier.shape
= NA)+ggtitle(NAME)+
geom_jitter(alpha=0.5, aes(color=Study,label=Study,shape=QC),position =
position_jitter(width = .8),size=2)
  g1 = g1+theme(panel.grid.major= element_blank(),
panel.grid.minor= element_blank(),
panel.background= element_blank(),
panel.border= element_rect(colour="black",fill=NA),
legend.position="none")
  g1= g1+scale_shape_manual(values=c(19,1))+scale_fill_discrete(guide=FALSE)
  print(g1)
}

A <- data.frame(1.557, 1.663, 1.637, 1.740, 1.597, 1.473, 1.399 ,1.403,
1.210, 1.375, 1.387, 1.515, 1.456,
  1.121, 1.211, 1.165, 1.428, 1.749, 1.231, 1.209, 1.272, 1.580, 1.254,
1.099, 1.151, 1.239,
  1.753, 1.415, 1.653, 1.555, 1.748, 1.951, 1.734, 1.519, 1.397, 1.391,
1.825, 1.722, 1.715,
  1.777, 2.014, 1.676, 1.803, 1.332, 1.560, 1.605, 1.564, 1.588, 1.583,
1.701, 1.297, 1.583,
  1.778, 1.343, 1.427, 1.472, 1.663, 1.472, 1.726, 1.327, 1.466, 1.890,
1.601, 1.474, 1.671,
  1.492, 1.277, 1.524, 1.394, 1.477, 1.525, 1.502, 1.371, 1.479, 0.966,
1.239, 1.415, 1.316,
  1.336, 1.244, 2.040, 1.823, 1.853, 1.712, 1.805, 1.593, 1.630, 1.578,
1.648, 1.581, 1.661,
  1.731, 1.360, 1.572, 1.788, 1.668, 1.663, 1.519)
A <- t(A)
B <- A*.3
C <- A*2
QA <- data.frame(1.951, 1.734, 1.519, 1.397, 1.391, 1.825)
QA <- t(QA)
QC <- QA*1.5

box.print(A,B,C,QA,QC,1)
__
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] Maybe OT: Forking in R scripts?

2016-10-13 Thread Greg Snow
I don't know if the parallel approach would work or not, but a
possibly simpler approach would be to use the tclTaskSchedule function
from the tcltk package.  You could use this to schedule your update
code to run on a regular basis, then you have access to the command
line between times that it runs.

You just need to be careful, if you are accessing a data object at the
same time that the update code runs on that same object, then there
could be problems.



On Thu, Oct 13, 2016 at 12:02 AM, K. Elo  wrote:
> Dear all,
>
> I am currently working a research project on social media interaction. As a
> part of this project, mostly for teaching purposes, I should develop a
> R-based approach for real-time visualisation of streamed data (from
> Twitter).
>
> My idea is simple (and working :) ): A Python-script stream Twitter for
> selected keywords/hashtags/users and redirects the output as JSON in a text
> file. My R-script reads the new entries from this text file every 5-10
> minutes, process the input and updates network and other graphical
> presentations.
>
> Thus far everything is working fine. However, I would like to have the
> possibility to work with my data when my script is sleeping. I just wonder
> whether a simple 'mcparallel({ Sys.sleep(300); TRUE})' (from 'parallel')
> would solve my problem? Or is there something I have to take into account
> when using 'parallel'?
>
> My R environment runs on Linux, so forking should work...
>
> Best regrads and thanks in advance,
> Kimmo
>
> --
> Åbo Akademi University, Finland
> Dep. for German studies
>
> __
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@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] ERROR : unable to start device PNG on server

2016-10-13 Thread Aanchal Sharma
Hi

I realize that this question has been asked earlier also, but my problem is
slightly different.
I am running a rscript which runs for multiple datasets in loop and
generates png for every file in the loop. When I run this only local
machine (mac) it runs fine, just that that it takes very long to finish. I
am running it on server, it runs fine till some files but then starts
throwing the following error:

ERROR : unable to start device PNG

before firing the rscript when I check the status for capabilities it gives
me following:

> capabilities()
   jpeg pngtiff   tcltk X11aqua
  FALSETRUE   FALSETRUETRUE   FALSE
   http/ftp sockets  libxmlfifo  cledit   iconv
   TRUETRUETRUETRUETRUETRUE
NLS profmem   cairo ICU long.double libcurl
   TRUE   FALSE   FALSE   FALSETRUETRUE

When I run it and it terminates giving above error, then the capabilities()
gives following:


> capabilities()
   jpeg pngtiff   tcltk X11aqua
  FALSE   FALSE   FALSETRUE   FALSE   FALSE
   http/ftp sockets  libxmlfifo  cledit   iconv
   TRUETRUETRUETRUETRUETRUE
NLS profmem   cairo ICU long.double libcurl
   TRUE   FALSE   FALSE   FALSETRUETRUE

Note that png and X11 are turned FALSE once it terminates.

Why does this happen automatically? How can I rescue this?
For information, I am using R version 3.3.1 (2016-06-21).

-- 
Anchal Sharma, PhD
Postdoctoral Fellow
195, Little Albany street,
Cancer Institute of New Jersey
Rutgers University
NJ-08901

[[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] can we visualize water flows with 3d in R?

2016-10-13 Thread Thomas Adams
Duncan,

Oh, to be sure, with a fair amount of work, you're probably correct that
one could mash up something. Here are some examples:

http://www.illinoisfloods.org/documents/2013_IAFSM_Conference/Conference_Presentations/5C-1_HEC-GeoRAS_Part1.pdf
<--- lots of graphics

http://rivergis.com/

also...
http://www2.egr.uh.edu/~aleon3/courses/Transient_flows/Tutorials/Geo_RAS/georastutorial.pdf
-- pages 35->
https://www.crwr.utexas.edu/reports/pdf/1999/rpt99-1.pdf -- pages 70->
(figures 4-17, 4-18), p. 147

Best,
Tom

On Thu, Oct 13, 2016 at 9:20 AM, Duncan Murdoch 
wrote:

> On 13/10/2016 8:35 AM, Thomas Adams wrote:
>
>> All,
>>
>> Very respectfully, there are no R packages that can do what Marna desires.
>>
>
> I would guess that's not literally true, in that there are several
> graphics packages that are very flexible.   You could well be right that
> there are none that are designed specifically for this purpose, so she's
> probably going to have to do some work to get what she wants.
>
> His/Her data, undoubtably, comes from a 1-D hydraulic model simulation --
>> where output is generated at channel cross-sections -- representing the
>> sloping water surface elevation of the centerline of flow in a stream or
>> river. With mapping software for such problems, the assumption is made that
>> the water surface intersects the topography (within or beyond the stream
>> channel) perpendicular to the direction of flow. Hydrodynamically, this is
>> generally not correct, but it's a reasonable approximation. To do this,
>> typically, the topography -- in the from of a raster digital elevation
>> model (DEM) -- is converted to a triangular irregular network (TIN) to
>> facilitate the creation of a smoother line of intersection between the
>> water surface and topography. Because, the water surface slopes in a
>> downstream direction, contour lines are crossed. Hydraulic modeling
>> software usually is accompanied by this mapping capability, such as with
>> HEC-RAS with RAS-Mapper, developed by the US Army Corps of Engineers, or
>> with HEC-GeoRAS, which requires ESRI ARC GIS; but, there is also a QGIS
>> plugin module that can do this, I believe. These software packages do
>> facilitate representing the flow in 3D.
>>
>
> Do you know any sample figures online that would show the type of graph
> that is usually used here?
>
> Duncan Murdoch
>
>>
>> Tom
>>
>>
>> On Wed, Oct 12, 2016 at 6:12 PM, David Winsemius > > wrote:
>>
>>
>> > On Oct 12, 2016, at 4:28 AM, Duncan Murdoch
>> > wrote:
>> >
>> > On 12/10/2016 4:49 AM, Marna Wagley wrote:
>> >> Hi R Users,
>> >> Is it possible to visualize river flow in 3D (latitude,
>> longitude with
>> >> respect to depth)?
>> >> The example of my data looks like. Any suggestions?
>> >>
>> >>> dat1
>> >>long lat depth flow
>> >> 1 1015.9 857  1.00 1.50
>> >> 2 1015.9 857  1.25 1.23
>> >> 3 1015.9 857  0.50 2.00
>> >> 4 1015.9 858  0.10 1.95
>> >> 5 1015.9 858  0.20 1.50
>> >> 6 1025.0 858  0.30 1.20
>> >> 7 1025.0 858  0.40 0.50
>> >> 8 1025.0 858  0.35 0.70
>> >> 9 1025.0 858  0.24 1.20
>> >>
>> >> Thanks for your help.
>> >
>> > It may be, but it's hard to give a nice looking graphic of that
>> small dataset.  You could try the rgl package and use plot3d to
>> show spheres with radius depending on the flow rate, for example
>> >
>> > plot3d(cbind(long, lat, depth), type="s", col="blue", radius=flow/5)
>>
>> A complementary option is to install the plot3D package which I
>> see also has a plot3Drgl "co-package". The advantage to this
>> option is the association with beautiful modeling packages that
>> Karline Soetaert, Peter M. J. Herman, and Thomas Petzoldt have
>> been offering to ecologists for the last decade. (Packages:
>> deSolve, marelac, seacarb, AquaEnv) A lot of her work has been on
>> flows within systems.
>>
>> I usually think of "flows" in rivers as being vector fields in an
>> incompressible fluid (water) with 6 components per point, but you
>> can also think of them as being scalar state variables. So I
>> suppose you could be modeling something other than mass flows.
>> (See Package::ReacTran for the R portal to that mathematical world.)
>>
>> Best;
>> David Winsemius
>>
>>
>> >
>> > Duncan Murdoch
>> >
>> > __
>> > 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 

[R] download multiple files in one file

2016-10-13 Thread Debasish Pai Mazumder
Hi All,
I have downloaded single file from the web using following scripts

gribfile<-"
http://nomads.ncdc.noaa.gov/thredds/ncss/grid/modeldata/cfsv2_forecast_ts_9mon/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2?north=47.0126=-114.841=-112.641=44.8534_start=2011-06-01_end=2011-06-31=netcdf=Maximum_temperature
"

download.file(gribfile,basename('file.nc'),mode = "wb")
File <- nc_open('file.nc')
str(File)
lat = ncvar_get(File, "lat") # coordinate variable
temp =ncvar_get(File, "Maximum_temperature")

Now I have multiple files and they are

/2011/201104/20110401/2011040100/tmax.01.2011040100.daily.grb2
/2011/201104/20110401/2011040106/tmax.01.2011040106.daily.grb2
/2011/201104/20110401/2011040112/tmax.01.2011040112.daily.grb2
/2011/201104/20110401/2011040118/tmax.01.2011040118.daily.grb2

Is there any way to read them together and store them in file.nc

sincerely
-Deb

[[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] sort()ing strings

2016-10-13 Thread Bob O'Hara
Thanks - strangely capabilities("ICU") is FALSE (I'm using ubuntu
16.04, and icu-devtools is installed). So I guess I'll conclude that
there's something odd, but I don't want to delve into these issues (a
new locale & new computer for me in a couple of months).

Bob

On 13 October 2016 at 13:00, Martin Maechler  wrote:
>> Bob O'Hara 
>> on Thu, 13 Oct 2016 11:55:04 +0200 writes:
>
> > Yes, thanks. That seems to be it:
> > thing <- c("M1", "M2", "M.1", "M.2")
> >> sort(thing)
> > [1] "M1" "M.1" "M2" "M.2"
>
> which I do find strange, indeed, given your sessionInfo which
> contains
> LC_COLLATE=en_US.UTF-8
>
> > The only documentation I can find is from ?Comparison:
> > "Collation of non-letters (spaces, punctuation signs,
> > hyphens, fractions and so on) is even more problematic."
>
> Well.  That help page contains more information further down,
> notably about ICU.  If
>
>  capabilities("ICU")
>
> gives TRUE for you (I assume it will as you use a modern ubuntu version),
> you can tweak the behavior to be more "reasonable" than above
>
> via R functions icu(Set|Get)Collate()
>
> BTW, I say "strange" above, because for me - also on modern
> Linux (Fedora 24), I "always" see
>
>> sort( c("M1", "M2", "M.1", "M.2") )
> [1] "M.1" "M.2" "M1"  "M2"
>
>
>> Sys.setlocale("LC_COLLATE", "de_CH.UTF-8")
> [1] "de_CH.UTF-8"
>> sort( c("M1", "M2", "M.1", "M.2") )
> [1] "M.1" "M.2" "M1"  "M2"
>> Sys.setlocale("LC_COLLATE", "en_US.UTF-8")
> [1] "en_US.UTF-8"
>> sort( c("M1", "M2", "M.1", "M.2") )
> [1] "M.1" "M.2" "M1"  "M2"
>
>> Sys.setlocale("LC_COLLATE", "C") # <--> ASCII ("the ole' time default)
> [1] "C"
>> sort( c("M1", "M2", "M.1", "M.2") )
> [1] "M.1" "M.2" "M1"  "M2"
>>
>
> I do use a newer R version (3.3.1 patched)
> but would not have expected that to matter here.
>
> Martin
>
>
> > Indeed.
>
> > Bob
>
> > On 13 October 2016 at 11:26, PIKAL Petr
> >  wrote:
> >> Hi
> >>
> >> Just a wild guess. Dot is ignored and the output is
> >> alphabetically sorted.
> >>
> >> You could try sort it yourself by
> >>
> >> sort(ls())
> >>
> >> Cheers Petr
> >>
> >>> -Original Message- From: R-help
> >>> [mailto:r-help-boun...@r-project.org] On Behalf Of Bob
> >>> O'Hara Sent: Thursday, October 13, 2016 10:29 AM To:
> >>> r-help  Subject: [R] (no subject)
> >>>
> >>> I've just come across an odd problem with sorting in
> >>> ls(): it doesn't seem to order the object names
> >>> correctly. If I do the following, the order isn't what I
> >>> expect:
> >>>
> >>> > ls(sorted=TRUE) [1] "AridData" "AridDataToBUGS"
> >>> "Arid.df" "Arid.hpd" "AridPrecip.sd" "Break.df" [7]
> >>> "Break.hpd" "Cols" "Data" "DataFrames" "DataToBUGS"
> >>> "DataToBUGS.nonlog" [13] "FitBRugs" "Fixed.df"
> >>> "Fixed.hpd" "FormatData" "GetCol" "GetHPD" [19]
> >>> "GetMCMC" "GetRow" "HPDIs" "Int.alpha12" "Int.alpha21"
> >>> "ModisData" [25] "ModisDataToBUGS" "Modis.df"
> >>> "ModisFixed.df" "ModisFixed.hpd" "Modis.hpd"
> >>> "ModisPrecip.sd" [31] "ModisShrink.df" "ModisShrink.hpd"
> >>> "ModisYears" "OrigData" "OrigDataToBUGS" "Orig.df" [37]
> >>> "Orig.hpd" "OrigPrecip.sd" "OrigYears" "PlotChecks"
> >>> "PlotEff" "plothpd" [43] "ProvinceNames" "ResNames"
> >>> "ResNamesOrder" "Shrink.df" "Shrink.hpd" "SimInits"
> >>>
> >>> Specifically, the Modis* objects are sorted like this:
> >>>
> >>> > ls(sorted=TRUE)[26:30] [1] "Modis.df" "ModisFixed.df"
> >>> "ModisFixed.hpd" "Modis.hpd" "ModisPrecip.sd"
> >>>
> >>> With Modis.* coming both before and after ModisF*. I
> >>> can't see why there would be any odd problems with
> >>> character sets changing (this was all done on a single
> >>> computer with no weird locale switching), and the
> >>> objects are all created within a single R session:
> >>>
> >>> > sessionInfo() R version 3.2.5 (2016-04-14) Platform:
> >>> x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu
> >>> 16.04.1 LTS
> >>>
> >>> locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> >>> LC_TIME=en_GB.UTF-8 LC_COLLATE=en_US.UTF-8 [5]
> >>> LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_US.UTF-8
> >>> LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C
> >>> LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8
> >>> LC_IDENTIFICATION=C
> >>>
> >>> attached base packages: [1] stats graphics grDevices
> >>> utils datasets methods base
> >>>
> >>> other attached packages: [1] MCMCglmm_2.22.1 ape_3.5
> >>> Matrix_1.2-7.1 RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
> >>>
> >>> loaded via a namespace (and not attached): [1]
> >>> cubature_1.1-2 corpcor_1.6.8 tools_3.2.5 Rcpp_0.12.7
> >>> nlme_3.1-128 grid_3.2.5 knitr_1.14 [8] tensorA_0.36
> >>> lattice_0.20-34
>  

Re: [R] can we visualize water flows with 3d in R?

2016-10-13 Thread Karline Soetaert
... and maybe she can find some inspiration at this website:
http://www.rforscience.com/rpackages/visualisation/oceanview/


Karline

-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] 
Sent: donderdag 13 oktober 2016 15:20
To: Thomas Adams ; David Winsemius 
Cc: r-help mailing list ; Karline Soetaert 

Subject: Re: [R] can we visualize water flows with 3d in R?

On 13/10/2016 8:35 AM, Thomas Adams wrote:
> All,
>
> Very respectfully, there are no R packages that can do what Marna desires.

I would guess that's not literally true, in that there are several 
graphics packages that are very flexible.   You could well be right that 
there are none that are designed specifically for this purpose, so she's 
probably going to have to do some work to get what she wants.

> His/Her data, undoubtably, comes from a 1-D hydraulic model simulation
> -- where output is generated at channel cross-sections -- representing 
> the sloping water surface elevation of the centerline of flow in a 
> stream or river. With mapping software for such problems, the 
> assumption is made that the water surface intersects the topography 
> (within or beyond the stream channel) perpendicular to the direction 
> of flow. Hydrodynamically, this is generally not correct, but it's a 
> reasonable approximation. To do this, typically, the topography -- in 
> the from of a raster digital elevation model (DEM) -- is converted to 
> a triangular irregular network (TIN) to facilitate the creation of a 
> smoother line of intersection between the water surface and 
> topography. Because, the water surface slopes in a downstream 
> direction, contour lines are crossed. Hydraulic modeling software 
> usually is accompanied by this mapping capability, such as with 
> HEC-RAS with RAS-Mapper, developed by the US Army Corps of Engineers, 
> or with HEC-GeoRAS, which requires ESRI ARC GIS; but, there is also a 
> QGIS plugin module that can do this, I believe. These software 
> packages do facilitate representing the flow in 3D.

Do you know any sample figures online that would show the type of graph that is 
usually used here?

Duncan Murdoch
>
> Tom
>
>
> On Wed, Oct 12, 2016 at 6:12 PM, David Winsemius 
> > wrote:
>
>
> > On Oct 12, 2016, at 4:28 AM, Duncan Murdoch
> > wrote:
> >
> > On 12/10/2016 4:49 AM, Marna Wagley wrote:
> >> Hi R Users,
> >> Is it possible to visualize river flow in 3D (latitude,
> longitude with
> >> respect to depth)?
> >> The example of my data looks like. Any suggestions?
> >>
> >>> dat1
> >>long lat depth flow
> >> 1 1015.9 857  1.00 1.50
> >> 2 1015.9 857  1.25 1.23
> >> 3 1015.9 857  0.50 2.00
> >> 4 1015.9 858  0.10 1.95
> >> 5 1015.9 858  0.20 1.50
> >> 6 1025.0 858  0.30 1.20
> >> 7 1025.0 858  0.40 0.50
> >> 8 1025.0 858  0.35 0.70
> >> 9 1025.0 858  0.24 1.20
> >>
> >> Thanks for your help.
> >
> > It may be, but it's hard to give a nice looking graphic of that
> small dataset.  You could try the rgl package and use plot3d to
> show spheres with radius depending on the flow rate, for example
> >
> > plot3d(cbind(long, lat, depth), type="s", col="blue", 
> radius=flow/5)
>
> A complementary option is to install the plot3D package which I
> see also has a plot3Drgl "co-package". The advantage to this
> option is the association with beautiful modeling packages that
> Karline Soetaert, Peter M. J. Herman, and Thomas Petzoldt have
> been offering to ecologists for the last decade. (Packages:
> deSolve, marelac, seacarb, AquaEnv) A lot of her work has been on
> flows within systems.
>
> I usually think of "flows" in rivers as being vector fields in an
> incompressible fluid (water) with 6 components per point, but you
> can also think of them as being scalar state variables. So I
> suppose you could be modeling something other than mass flows.
> (See Package::ReacTran for the R portal to that mathematical 
> world.)
>
> Best;
> David Winsemius
>
>
> >
> > Duncan Murdoch
> >
> > __
> > 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.
>
> David Winsemius
> Alameda, CA, USA
>
> __
> R-help@r-project.org 

Re: [R] can we visualize water flows with 3d in R?

2016-10-13 Thread Duncan Murdoch

On 13/10/2016 8:35 AM, Thomas Adams wrote:

All,

Very respectfully, there are no R packages that can do what Marna desires.


I would guess that's not literally true, in that there are several 
graphics packages that are very flexible.   You could well be right that 
there are none that are designed specifically for this purpose, so she's 
probably going to have to do some work to get what she wants.


His/Her data, undoubtably, comes from a 1-D hydraulic model simulation 
-- where output is generated at channel cross-sections -- representing 
the sloping water surface elevation of the centerline of flow in a 
stream or river. With mapping software for such problems, the 
assumption is made that the water surface intersects the topography 
(within or beyond the stream channel) perpendicular to the direction 
of flow. Hydrodynamically, this is generally not correct, but it's a 
reasonable approximation. To do this, typically, the topography -- in 
the from of a raster digital elevation model (DEM) -- is converted to 
a triangular irregular network (TIN) to facilitate the creation of a 
smoother line of intersection between the water surface and 
topography. Because, the water surface slopes in a downstream 
direction, contour lines are crossed. Hydraulic modeling software 
usually is accompanied by this mapping capability, such as with 
HEC-RAS with RAS-Mapper, developed by the US Army Corps of Engineers, 
or with HEC-GeoRAS, which requires ESRI ARC GIS; but, there is also a 
QGIS plugin module that can do this, I believe. These software 
packages do facilitate representing the flow in 3D.


Do you know any sample figures online that would show the type of graph 
that is usually used here?


Duncan Murdoch


Tom


On Wed, Oct 12, 2016 at 6:12 PM, David Winsemius 
> wrote:



> On Oct 12, 2016, at 4:28 AM, Duncan Murdoch
> wrote:
>
> On 12/10/2016 4:49 AM, Marna Wagley wrote:
>> Hi R Users,
>> Is it possible to visualize river flow in 3D (latitude,
longitude with
>> respect to depth)?
>> The example of my data looks like. Any suggestions?
>>
>>> dat1
>>long lat depth flow
>> 1 1015.9 857  1.00 1.50
>> 2 1015.9 857  1.25 1.23
>> 3 1015.9 857  0.50 2.00
>> 4 1015.9 858  0.10 1.95
>> 5 1015.9 858  0.20 1.50
>> 6 1025.0 858  0.30 1.20
>> 7 1025.0 858  0.40 0.50
>> 8 1025.0 858  0.35 0.70
>> 9 1025.0 858  0.24 1.20
>>
>> Thanks for your help.
>
> It may be, but it's hard to give a nice looking graphic of that
small dataset.  You could try the rgl package and use plot3d to
show spheres with radius depending on the flow rate, for example
>
> plot3d(cbind(long, lat, depth), type="s", col="blue", radius=flow/5)

A complementary option is to install the plot3D package which I
see also has a plot3Drgl "co-package". The advantage to this
option is the association with beautiful modeling packages that
Karline Soetaert, Peter M. J. Herman, and Thomas Petzoldt have
been offering to ecologists for the last decade. (Packages:
deSolve, marelac, seacarb, AquaEnv) A lot of her work has been on
flows within systems.

I usually think of "flows" in rivers as being vector fields in an
incompressible fluid (water) with 6 components per point, but you
can also think of them as being scalar state variables. So I
suppose you could be modeling something other than mass flows.
(See Package::ReacTran for the R portal to that mathematical world.)

Best;
David Winsemius


>
> Duncan Murdoch
>
> __
> 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.

David Winsemius
Alameda, CA, USA

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

Re: [R] (no subject)

2016-10-13 Thread peter dalgaard
Collating orders are a weird and wooly bunch...  

My hunch is that you have one of those that ignore punctuation and sorts 
AaBbCc, so that you are seeing Modis{d-F-F-h-P}. ?Comparison for details.

-pd

> On 13 Oct 2016, at 10:29 , Bob O'Hara  wrote:
> 
> I've just come across an odd problem with sorting in ls(): it doesn't
> seem to order the object names correctly. If I do the following, the
> order isn't what I expect:
> 
>> ls(sorted=TRUE)
> [1] "AridData"  "AridDataToBUGS""Arid.df"
> "Arid.hpd"  "AridPrecip.sd" "Break.df"
> [7] "Break.hpd" "Cols"  "Data"
> "DataFrames""DataToBUGS""DataToBUGS.nonlog"
> [13] "FitBRugs"  "Fixed.df"  "Fixed.hpd"
> "FormatData""GetCol""GetHPD"
> [19] "GetMCMC"   "GetRow""HPDIs"
> "Int.alpha12"   "Int.alpha21"   "ModisData"
> [25] "ModisDataToBUGS"   "Modis.df"  "ModisFixed.df"
> "ModisFixed.hpd""Modis.hpd" "ModisPrecip.sd"
> [31] "ModisShrink.df""ModisShrink.hpd"   "ModisYears"
> "OrigData"  "OrigDataToBUGS""Orig.df"
> [37] "Orig.hpd"  "OrigPrecip.sd" "OrigYears"
> "PlotChecks""PlotEff"   "plothpd"
> [43] "ProvinceNames" "ResNames"  "ResNamesOrder"
> "Shrink.df" "Shrink.hpd""SimInits"
> 
> Specifically, the Modis* objects are sorted like this:
> 
>> ls(sorted=TRUE)[26:30]
> [1] "Modis.df"   "ModisFixed.df"  "ModisFixed.hpd" "Modis.hpd"
> "ModisPrecip.sd"
> 
> With Modis.* coming both before and after ModisF*. I can't see why
> there would be any odd problems with character sets changing (this was
> all done on a single computer with no weird locale switching), and the
> objects are all created within a single R session:
> 
>> sessionInfo()
> R version 3.2.5 (2016-04-14)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 16.04.1 LTS
> 
> locale:
> [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
> LC_TIME=en_GB.UTF-8LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_US.UTF-8
> LC_PAPER=en_GB.UTF-8   LC_NAME=C
> [9] LC_ADDRESS=C   LC_TELEPHONE=C
> LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> other attached packages:
> [1] MCMCglmm_2.22.1ape_3.5Matrix_1.2-7.1
> RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
> 
> loaded via a namespace (and not attached):
> [1] cubature_1.1-2  corpcor_1.6.8   tools_3.2.5 Rcpp_0.12.7
> nlme_3.1-128grid_3.2.5  knitr_1.14
> [8] tensorA_0.36lattice_0.20-34
> 
> Can anyone explain what's going on?
> 
> Bob
> 
> -- 
> Bob O'Hara
> 
> Biodiversity and Climate Research Centre
> Senckenberganlage 25
> D-60325 Frankfurt am Main,
> Germany
> 
> Tel: +49 69 798 40226
> Mobile: +49 1515 888 5440
> WWW:   http://www.bik-f.de/root/index.php?page_id=219
> Blog: http://occamstypewriter.org/boboh/
> Journal of Negative Results - EEB: www.jnr-eeb.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.

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


Re: [R] can we visualize water flows with 3d in R?

2016-10-13 Thread Thomas Adams
All,

Very respectfully, there are no R packages that can do what Marna desires.
His/Her data, undoubtably, comes from a 1-D hydraulic model simulation --
where output is generated at channel cross-sections -- representing the
sloping water surface elevation of the centerline of flow in a stream or
river. With mapping software for such problems, the assumption is made that
the water surface intersects the topography (within or beyond the stream
channel) perpendicular to the direction of flow. Hydrodynamically, this is
generally not correct, but it's a reasonable approximation. To do this,
typically, the topography -- in the from of a raster digital elevation
model (DEM) -- is converted to a triangular irregular network (TIN) to
facilitate the creation of a smoother line of intersection between the
water surface and topography. Because, the water surface slopes in a
downstream direction, contour lines are crossed. Hydraulic modeling
software usually is accompanied by this mapping capability, such as with
HEC-RAS with RAS-Mapper, developed by the US Army Corps of Engineers, or
with HEC-GeoRAS, which requires ESRI ARC GIS; but, there is also a QGIS
plugin module that can do this, I believe. These software packages do
facilitate representing the flow in 3D.

Tom


On Wed, Oct 12, 2016 at 6:12 PM, David Winsemius 
wrote:

>
> > On Oct 12, 2016, at 4:28 AM, Duncan Murdoch 
> wrote:
> >
> > On 12/10/2016 4:49 AM, Marna Wagley wrote:
> >> Hi R Users,
> >> Is it possible to visualize river flow in  3D (latitude, longitude with
> >> respect to depth)?
> >> The example of my data looks like. Any suggestions?
> >>
> >>> dat1
> >>long lat depth flow
> >> 1 1015.9 857  1.00 1.50
> >> 2 1015.9 857  1.25 1.23
> >> 3 1015.9 857  0.50 2.00
> >> 4 1015.9 858  0.10 1.95
> >> 5 1015.9 858  0.20 1.50
> >> 6 1025.0 858  0.30 1.20
> >> 7 1025.0 858  0.40 0.50
> >> 8 1025.0 858  0.35 0.70
> >> 9 1025.0 858  0.24 1.20
> >>
> >> Thanks for your help.
> >
> > It may be, but it's hard to give a nice looking graphic of that small
> dataset.  You could try the rgl package and use plot3d to show spheres with
> radius depending on the flow rate, for example
> >
> > plot3d(cbind(long, lat, depth), type="s", col="blue", radius=flow/5)
>
> A complementary option is to install the plot3D package which I see also
> has a plot3Drgl "co-package". The advantage to this option is the
> association with beautiful modeling packages that Karline Soetaert, Peter
> M. J. Herman, and Thomas Petzoldt have been offering to ecologists for the
> last decade. (Packages: deSolve, marelac, seacarb, AquaEnv) A lot of her
> work has been on flows within systems.
>
> I usually think of "flows" in rivers as being vector fields in an
> incompressible fluid (water) with 6 components per point, but you can also
> think of them as being scalar state variables. So I suppose you could be
> modeling something other than mass flows.  (See Package::ReacTran for the R
> portal to that mathematical world.)
>
> Best;
> David Winsemius
>
>
> >
> > Duncan Murdoch
> >
> > __
> > 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.
>
> David Winsemius
> Alameda, CA, USA
>
> __
> 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.


[R] Antwort: Re: Antwort: Re: Visibility of libraries called from within functions

2016-10-13 Thread G . Maubach
Von:Duncan Murdoch 
An: g.maub...@weinwolf.de, r-help@r-project.org, 
Datum:  13.10.2016 12:34
Betreff:Re: Antwort: Re: [R] Visibility of libraries called from 
within functions



On 13/10/2016 6:21 AM, g.maub...@weinwolf.de wrote:
> Hi Duncan,
>
> many thanks for your reply.
>
> Your suggestion of using requireNamespace() together with explicit
> namespace calling using the "::" operator is what I was looking for:
>
> -- cut --
>
> f_test <- function() {
> requireNamespace("openxlsx")
> cat("Loaded packages AFTER loading library")
> print(search())
> xlsx::read.xlsx(file = "c:/temp/test.xlsx",
> sheetName = "test")
> }

Not sure if that's a typo in your message or a real error, but you 
require "openxlsx" and then use "xlsx".

It's a typo!


>
> cat("Loaded packages BEFORE function call ")
> search()
>
> f_test()
>
> cat("Loaded packages AFTER function call -")
> search()
>
> -- cut  --
>
> When reading ?requireNamespace I did not really get how R operates 
behind
> the scenes.
>
> Using "library" attaches the namespace to the search path. Using
> "requireNamespace" does not do that.
>
> But how does R find the namespace then? What kind of list or directory
> used R to to store the namespace and lookup the correct function or
> methods of this namespace?

R has an internal list of packages that are loaded.  Functions in them 
are only visible to user code if the package is *also* on the search 
list, or if the package name prefix is used with ::.

Can I have a look at this internal list like I can do with search() for 
pachages or ls() for objects?

If xlsx is loaded, xlsx::read.xlsx will just use it; if it is not 
loaded, the package will be loaded to make the call.  So you don't need 
the requireNamespace call if you can be sure that xlsx will be found. 
You would normally use its return value (FALSE if the package is not 
found) to test whether it will be safe to make the xlsx::read.xlsx call.

Got it!



Duncan Murdoch

>
> Kind regards
>
> Georg
>
>
>
>
> Von:Duncan Murdoch 
> An: g.maub...@weinwolf.de, r-help@r-project.org,
> Datum:  13.10.2016 10:43
> Betreff:Re: [R] Visibility of libraries called from within
> functions
>
>
>
> On 13/10/2016 4:18 AM, g.maub...@weinwolf.de wrote:
>> Hi All,
>>
>> in my R programs I use different libraries to work with Excel sheets, 
i.
>> e. xlsx, excel.link.
>>
>> When running chunks of code repeatedly and not always in the order the
>> program should run for development purposes I ran into trouble. There
> were
>> conflicts between the methods within these functions causing R to 
crash.
>>
>> I thought about defining functions for the different task and calling
> the
>> libraries locally to there functions. Doing this test
>>
>> -- cut --
>>
>> f_test <- function() {
>> library(xlsx)
>> cat("Loaded packages AFTER loading library")
>> print(search())
>> }
>>
>> cat("Loaded packages BEFORE function call 
")
>> search()
>>
>> f_test()
>>
>> cat("Loaded packages AFTER function call 
-")
>> search()
>>
>> -- cut --
>>
>> showed that the library "xlsx" was loaded into the global environment
> and
>> stayed there although I had expected R to unload the library when
> leaving
>> the function. Thus confilics can occur more often.
>>
>> I had a look into ?library and saw that there is no argument telling R
> to
>> hold the library in the calling environment.
>>
>> How can I load libraries locally to the calling functions?
>
> You can detach at the end of your function, but that's tricky to get
> right:  the package might have been on the search list before your
> function was called.  It's better not to touch the search list at all.
>
> The best solution is to use :: notation to get functions without putting
> them on the search list.  For example, use
>
> xlsx::write.xlsx(data, file)
>
> If you are not sure if your user has xlsx installed, you can use
> requireNamespace() to check.
>
> Duncan Murdoch
>
>
>
>
>

__
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] sort()ing strings

2016-10-13 Thread Martin Maechler
> Bob O'Hara 
> on Thu, 13 Oct 2016 11:55:04 +0200 writes:

> Yes, thanks. That seems to be it: 
> thing <- c("M1", "M2", "M.1", "M.2")
>> sort(thing)
> [1] "M1" "M.1" "M2" "M.2"

which I do find strange, indeed, given your sessionInfo which
contains
LC_COLLATE=en_US.UTF-8

> The only documentation I can find is from ?Comparison:
> "Collation of non-letters (spaces, punctuation signs,
> hyphens, fractions and so on) is even more problematic."

Well.  That help page contains more information further down,
notably about ICU.  If

 capabilities("ICU")

gives TRUE for you (I assume it will as you use a modern ubuntu version),
you can tweak the behavior to be more "reasonable" than above

via R functions icu(Set|Get)Collate()

BTW, I say "strange" above, because for me - also on modern
Linux (Fedora 24), I "always" see

> sort( c("M1", "M2", "M.1", "M.2") )
[1] "M.1" "M.2" "M1"  "M2" 


> Sys.setlocale("LC_COLLATE", "de_CH.UTF-8")
[1] "de_CH.UTF-8"
> sort( c("M1", "M2", "M.1", "M.2") )
[1] "M.1" "M.2" "M1"  "M2" 
> Sys.setlocale("LC_COLLATE", "en_US.UTF-8")
[1] "en_US.UTF-8"
> sort( c("M1", "M2", "M.1", "M.2") )
[1] "M.1" "M.2" "M1"  "M2" 

> Sys.setlocale("LC_COLLATE", "C") # <--> ASCII ("the ole' time default)
[1] "C"
> sort( c("M1", "M2", "M.1", "M.2") )
[1] "M.1" "M.2" "M1"  "M2" 
> 

I do use a newer R version (3.3.1 patched)
but would not have expected that to matter here.

Martin


> Indeed.

> Bob

> On 13 October 2016 at 11:26, PIKAL Petr
>  wrote:
>> Hi
>> 
>> Just a wild guess. Dot is ignored and the output is
>> alphabetically sorted.
>> 
>> You could try sort it yourself by
>> 
>> sort(ls())
>> 
>> Cheers Petr
>> 
>>> -Original Message- From: R-help
>>> [mailto:r-help-boun...@r-project.org] On Behalf Of Bob
>>> O'Hara Sent: Thursday, October 13, 2016 10:29 AM To:
>>> r-help  Subject: [R] (no subject)
>>> 
>>> I've just come across an odd problem with sorting in
>>> ls(): it doesn't seem to order the object names
>>> correctly. If I do the following, the order isn't what I
>>> expect:
>>> 
>>> > ls(sorted=TRUE) [1] "AridData" "AridDataToBUGS"
>>> "Arid.df" "Arid.hpd" "AridPrecip.sd" "Break.df" [7]
>>> "Break.hpd" "Cols" "Data" "DataFrames" "DataToBUGS"
>>> "DataToBUGS.nonlog" [13] "FitBRugs" "Fixed.df"
>>> "Fixed.hpd" "FormatData" "GetCol" "GetHPD" [19]
>>> "GetMCMC" "GetRow" "HPDIs" "Int.alpha12" "Int.alpha21"
>>> "ModisData" [25] "ModisDataToBUGS" "Modis.df"
>>> "ModisFixed.df" "ModisFixed.hpd" "Modis.hpd"
>>> "ModisPrecip.sd" [31] "ModisShrink.df" "ModisShrink.hpd"
>>> "ModisYears" "OrigData" "OrigDataToBUGS" "Orig.df" [37]
>>> "Orig.hpd" "OrigPrecip.sd" "OrigYears" "PlotChecks"
>>> "PlotEff" "plothpd" [43] "ProvinceNames" "ResNames"
>>> "ResNamesOrder" "Shrink.df" "Shrink.hpd" "SimInits"
>>> 
>>> Specifically, the Modis* objects are sorted like this:
>>> 
>>> > ls(sorted=TRUE)[26:30] [1] "Modis.df" "ModisFixed.df"
>>> "ModisFixed.hpd" "Modis.hpd" "ModisPrecip.sd"
>>> 
>>> With Modis.* coming both before and after ModisF*. I
>>> can't see why there would be any odd problems with
>>> character sets changing (this was all done on a single
>>> computer with no weird locale switching), and the
>>> objects are all created within a single R session:
>>> 
>>> > sessionInfo() R version 3.2.5 (2016-04-14) Platform:
>>> x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu
>>> 16.04.1 LTS
>>> 
>>> locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>>> LC_TIME=en_GB.UTF-8 LC_COLLATE=en_US.UTF-8 [5]
>>> LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_US.UTF-8
>>> LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C
>>> LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8
>>> LC_IDENTIFICATION=C
>>> 
>>> attached base packages: [1] stats graphics grDevices
>>> utils datasets methods base
>>> 
>>> other attached packages: [1] MCMCglmm_2.22.1 ape_3.5
>>> Matrix_1.2-7.1 RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
>>> 
>>> loaded via a namespace (and not attached): [1]
>>> cubature_1.1-2 corpcor_1.6.8 tools_3.2.5 Rcpp_0.12.7
>>> nlme_3.1-128 grid_3.2.5 knitr_1.14 [8] tensorA_0.36
>>> lattice_0.20-34
>>> 
>>> Can anyone explain what's going on?
>>> 
>>> Bob
>>> --
>>> Bob O'Hara
>>> 
>>> Biodiversity and Climate Research Centre
>>> Senckenberganlage 25 D-60325 Frankfurt am Main, Germany
>>> 
>>> Tel: +49 69 798 40226 Mobile: +49 1515 888 5440 WWW:
>>> http://www.bik-f.de/root/index.php?page_id=219 Blog:
>>> http://occamstypewriter.org/boboh/ Journal of Negative
>>> Results - EEB: www.jnr-eeb.org

__
R-help@r-project.org mailing list -- To 

Re: [R] Antwort: Re: Visibility of libraries called from within functions

2016-10-13 Thread Duncan Murdoch

On 13/10/2016 6:21 AM, g.maub...@weinwolf.de wrote:

Hi Duncan,

many thanks for your reply.

Your suggestion of using requireNamespace() together with explicit
namespace calling using the "::" operator is what I was looking for:

-- cut --

f_test <- function() {
requireNamespace("openxlsx")
cat("Loaded packages AFTER loading library")
print(search())
xlsx::read.xlsx(file = "c:/temp/test.xlsx",
sheetName = "test")
}


Not sure if that's a typo in your message or a real error, but you 
require "openxlsx" and then use "xlsx".





cat("Loaded packages BEFORE function call ")
search()

f_test()

cat("Loaded packages AFTER function call -")
search()

-- cut  --

When reading ?requireNamespace I did not really get how R operates behind
the scenes.

Using "library" attaches the namespace to the search path. Using
"requireNamespace" does not do that.

But how does R find the namespace then? What kind of list or directory
used R to to store the namespace and lookup the correct function or
methods of this namespace?


R has an internal list of packages that are loaded.  Functions in them 
are only visible to user code if the package is *also* on the search 
list, or if the package name prefix is used with ::.


If xlsx is loaded, xlsx::read.xlsx will just use it; if it is not 
loaded, the package will be loaded to make the call.  So you don't need 
the requireNamespace call if you can be sure that xlsx will be found. 
You would normally use its return value (FALSE if the package is not 
found) to test whether it will be safe to make the xlsx::read.xlsx call.


Duncan Murdoch



Kind regards

Georg




Von:Duncan Murdoch 
An: g.maub...@weinwolf.de, r-help@r-project.org,
Datum:  13.10.2016 10:43
Betreff:Re: [R] Visibility of libraries called from within
functions



On 13/10/2016 4:18 AM, g.maub...@weinwolf.de wrote:

Hi All,

in my R programs I use different libraries to work with Excel sheets, i.
e. xlsx, excel.link.

When running chunks of code repeatedly and not always in the order the
program should run for development purposes I ran into trouble. There

were

conflicts between the methods within these functions causing R to crash.

I thought about defining functions for the different task and calling

the

libraries locally to there functions. Doing this test

-- cut --

f_test <- function() {
library(xlsx)
cat("Loaded packages AFTER loading library")
print(search())
}

cat("Loaded packages BEFORE function call ")
search()

f_test()

cat("Loaded packages AFTER function call -")
search()

-- cut --

showed that the library "xlsx" was loaded into the global environment

and

stayed there although I had expected R to unload the library when

leaving

the function. Thus confilics can occur more often.

I had a look into ?library and saw that there is no argument telling R

to

hold the library in the calling environment.

How can I load libraries locally to the calling functions?


You can detach at the end of your function, but that's tricky to get
right:  the package might have been on the search list before your
function was called.  It's better not to touch the search list at all.

The best solution is to use :: notation to get functions without putting
them on the search list.  For example, use

xlsx::write.xlsx(data, file)

If you are not sure if your user has xlsx installed, you can use
requireNamespace() to check.

Duncan Murdoch







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

2016-10-13 Thread Rui Barradas

Hello,

You must run the code to create x1 first, part 1), then part 2).
I've tested with your data and all went well, the result is the following.

> dput(dat)
structure(list(y1 = c(39958L, 40058L, 40105L, 40294L, 40332L,
40471L, 40493L, 40533L, 40718L, 40771L, 40829L, 40892L, 41056L,
41110L, 41160L, 41222L, 41250L, 41289L, 41324L, 41355L, 41415L,
41562L, 41562L, 41586L), flag = structure(c(3L, 2L, 4L, 1L, 3L,
2L, 2L, 4L, 1L, 3L, 2L, 4L, 1L, 3L, 2L, 2L, 2L, 2L, 4L, 2L, 4L,
4L, 1L, 3L), .Label = c("H", "R", "S", "X"), class = "factor"),
x1 = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), z2 = c(0L, 100L,
147L, 336L, 0L, 139L, 161L, 201L, 386L, 0L, 58L, 121L, 285L,
0L, 50L, 112L, 140L, 179L, 214L, 245L, 305L, 452L, 452L,
0L)), .Names = c("y1", "flag", "x1", "z2"), row.names = c(NA,
-24L), class = "data.frame")


Rui Barradas

Em 12-10-2016 21:53, Val escreveu:

Rui,
Thank You!

the second one gave me NULL.
dat$z2 <- unlist(tapply(dat$y1, dat$x1, function(y) y - y[1]))

dat$z2
NULL



On Wed, Oct 12, 2016 at 3:34 PM, Rui Barradas  wrote:

Hello,

Seems simple:


# 1)
dat$x1 <- cumsum(dat$flag == "S")

# 2)
dat$z2 <- unlist(tapply(dat$y1, dat$x1, function(y) y - y[1]))

Hope this helps,

Rui Barradas


Em 12-10-2016 21:15, Val escreveu:


Hi all,

I have a data set like
dat<-read.table(text=" y1, flag
39958,S
40058,R
40105,X
40294,H
40332,S
40471,R
40493,R
40533,X
40718,H
40771,S
40829,R
40892,X
41056,H
41110,S
41160,R
41222,R
41250,R
41289,R
41324,X
41355,R
41415,X
41562,X
41562,H
41586,S
",sep=",",header=TRUE)

First sort the data by y1.
Then
I want to create two columns .
1. the first new column is  (x1):  if flag is "S"  then  x1=1  and
assign the following/subsequent rows 1 as well.   When we reach to
the next "S"  then  x1=2 and the subsequent rows will be assigned to
2.

2. the second variable (z2). Within each x1 find the difference
between the first y1 and subsequent y1 values

Example  for the first few rows
y1,   flag, x1, z2
39958, S, 1,0  z2 is calculated as z2=(39958, 39958)
40058, R, 1, 100 z2 is calculated as z2=(40058, 39958)
40105, X, 1, 147 z2 is calculated as z2=(40105, 39958)
40294, H, 1, 336 z2 is calculated as z2=(40294, 39958)
40332, S, 2,  0z2 is calculated as z2=(40332, 40332)
etc

Here is the complete output for the sample  data
39958,S,1,0
40058,R,1,100
40105,X,1,147
40294,H,1,336
40332,S,2,0
40471,R,2,139
40493,R,2,161
40533,X,2,201
40718,H,2,386
40771,S,3,0
40829,R,3,58
40892,X,3,121
41056,H,3,285
41110,S,4,0
41160,R,4,50
41222,R,4,112
41250,R,4,140
41289,R,4,179
41324,X,4,214
41355,R,4,245
41415,X,4,305
41562,X,4,452
41562,H,4,452
41586,S,5,0

Val

__
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] Antwort: Re: Visibility of libraries called from within functions

2016-10-13 Thread G . Maubach
Hi Duncan,

many thanks for your reply.

Your suggestion of using requireNamespace() together with explicit 
namespace calling using the "::" operator is what I was looking for:

-- cut --

f_test <- function() {
requireNamespace("openxlsx")
cat("Loaded packages AFTER loading library")
print(search())
xlsx::read.xlsx(file = "c:/temp/test.xlsx",
sheetName = "test")
}

cat("Loaded packages BEFORE function call ")
search()

f_test()

cat("Loaded packages AFTER function call -")
search()

-- cut  --

When reading ?requireNamespace I did not really get how R operates behind 
the scenes.

Using "library" attaches the namespace to the search path. Using 
"requireNamespace" does not do that.

But how does R find the namespace then? What kind of list or directory 
used R to to store the namespace and lookup the correct function or 
methods of this namespace?

Kind regards

Georg




Von:Duncan Murdoch 
An: g.maub...@weinwolf.de, r-help@r-project.org, 
Datum:  13.10.2016 10:43
Betreff:Re: [R] Visibility of libraries called from within 
functions



On 13/10/2016 4:18 AM, g.maub...@weinwolf.de wrote:
> Hi All,
>
> in my R programs I use different libraries to work with Excel sheets, i.
> e. xlsx, excel.link.
>
> When running chunks of code repeatedly and not always in the order the
> program should run for development purposes I ran into trouble. There 
were
> conflicts between the methods within these functions causing R to crash.
>
> I thought about defining functions for the different task and calling 
the
> libraries locally to there functions. Doing this test
>
> -- cut --
>
> f_test <- function() {
> library(xlsx)
> cat("Loaded packages AFTER loading library")
> print(search())
> }
>
> cat("Loaded packages BEFORE function call ")
> search()
>
> f_test()
>
> cat("Loaded packages AFTER function call -")
> search()
>
> -- cut --
>
> showed that the library "xlsx" was loaded into the global environment 
and
> stayed there although I had expected R to unload the library when 
leaving
> the function. Thus confilics can occur more often.
>
> I had a look into ?library and saw that there is no argument telling R 
to
> hold the library in the calling environment.
>
> How can I load libraries locally to the calling functions?

You can detach at the end of your function, but that's tricky to get 
right:  the package might have been on the search list before your 
function was called.  It's better not to touch the search list at all.

The best solution is to use :: notation to get functions without putting 
them on the search list.  For example, use

xlsx::write.xlsx(data, file)

If you are not sure if your user has xlsx installed, you can use 
requireNamespace() to check.

Duncan Murdoch

__
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] (no subject)

2016-10-13 Thread Bob O'Hara
Yes, thanks. That seems to be it:

thing <- c("M1", "M2", "M.1", "M.2")
> sort(thing)
[1] "M1"  "M.1" "M2"  "M.2"

The only documentation I can find is from ?Comparison:
"Collation of non-letters (spaces, punctuation signs, hyphens,
fractions and so on) is even more problematic."

Indeed.

Bob

On 13 October 2016 at 11:26, PIKAL Petr  wrote:
> Hi
>
> Just a wild guess. Dot is ignored and the output is alphabetically sorted.
>
> You could try sort it yourself by
>
> sort(ls())
>
> Cheers
> Petr
>
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bob
>> O'Hara
>> Sent: Thursday, October 13, 2016 10:29 AM
>> To: r-help 
>> Subject: [R] (no subject)
>>
>> I've just come across an odd problem with sorting in ls(): it doesn't seem to
>> order the object names correctly. If I do the following, the order isn't 
>> what I
>> expect:
>>
>> > ls(sorted=TRUE)
>>  [1] "AridData"  "AridDataToBUGS""Arid.df"
>> "Arid.hpd"  "AridPrecip.sd" "Break.df"
>>  [7] "Break.hpd" "Cols"  "Data"
>> "DataFrames""DataToBUGS""DataToBUGS.nonlog"
>> [13] "FitBRugs"  "Fixed.df"  "Fixed.hpd"
>> "FormatData""GetCol""GetHPD"
>> [19] "GetMCMC"   "GetRow""HPDIs"
>> "Int.alpha12"   "Int.alpha21"   "ModisData"
>> [25] "ModisDataToBUGS"   "Modis.df"  "ModisFixed.df"
>> "ModisFixed.hpd""Modis.hpd" "ModisPrecip.sd"
>> [31] "ModisShrink.df""ModisShrink.hpd"   "ModisYears"
>> "OrigData"  "OrigDataToBUGS""Orig.df"
>> [37] "Orig.hpd"  "OrigPrecip.sd" "OrigYears"
>> "PlotChecks""PlotEff"   "plothpd"
>> [43] "ProvinceNames" "ResNames"  "ResNamesOrder"
>> "Shrink.df" "Shrink.hpd""SimInits"
>>
>> Specifically, the Modis* objects are sorted like this:
>>
>> > ls(sorted=TRUE)[26:30]
>> [1] "Modis.df"   "ModisFixed.df"  "ModisFixed.hpd" "Modis.hpd"
>>  "ModisPrecip.sd"
>>
>> With Modis.* coming both before and after ModisF*. I can't see why there
>> would be any odd problems with character sets changing (this was all done
>> on a single computer with no weird locale switching), and the objects are all
>> created within a single R session:
>>
>> > sessionInfo()
>> R version 3.2.5 (2016-04-14)
>> Platform: x86_64-pc-linux-gnu (64-bit)
>> Running under: Ubuntu 16.04.1 LTS
>>
>> locale:
>>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>> LC_TIME=en_GB.UTF-8LC_COLLATE=en_US.UTF-8
>>  [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_US.UTF-8
>> LC_PAPER=en_GB.UTF-8   LC_NAME=C
>>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
>> LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats graphics  grDevices utils datasets  methods   base
>>
>> other attached packages:
>> [1] MCMCglmm_2.22.1ape_3.5Matrix_1.2-7.1
>> RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
>>
>> loaded via a namespace (and not attached):
>> [1] cubature_1.1-2  corpcor_1.6.8   tools_3.2.5 Rcpp_0.12.7
>> nlme_3.1-128grid_3.2.5  knitr_1.14
>> [8] tensorA_0.36lattice_0.20-34
>>
>> Can anyone explain what's going on?
>>
>> Bob
>>
>> --
>> Bob O'Hara
>>
>> Biodiversity and Climate Research Centre Senckenberganlage 25
>> D-60325 Frankfurt am Main,
>> Germany
>>
>> Tel: +49 69 798 40226
>> Mobile: +49 1515 888 5440
>> WWW:   http://www.bik-f.de/root/index.php?page_id=219
>> Blog: http://occamstypewriter.org/boboh/
>> Journal of Negative Results - EEB: www.jnr-eeb.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.
>
> 
> 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 

Re: [R] (no subject)

2016-10-13 Thread PIKAL Petr
Hi

Just a wild guess. Dot is ignored and the output is alphabetically sorted.

You could try sort it yourself by

sort(ls())

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bob
> O'Hara
> Sent: Thursday, October 13, 2016 10:29 AM
> To: r-help 
> Subject: [R] (no subject)
>
> I've just come across an odd problem with sorting in ls(): it doesn't seem to
> order the object names correctly. If I do the following, the order isn't what 
> I
> expect:
>
> > ls(sorted=TRUE)
>  [1] "AridData"  "AridDataToBUGS""Arid.df"
> "Arid.hpd"  "AridPrecip.sd" "Break.df"
>  [7] "Break.hpd" "Cols"  "Data"
> "DataFrames""DataToBUGS""DataToBUGS.nonlog"
> [13] "FitBRugs"  "Fixed.df"  "Fixed.hpd"
> "FormatData""GetCol""GetHPD"
> [19] "GetMCMC"   "GetRow""HPDIs"
> "Int.alpha12"   "Int.alpha21"   "ModisData"
> [25] "ModisDataToBUGS"   "Modis.df"  "ModisFixed.df"
> "ModisFixed.hpd""Modis.hpd" "ModisPrecip.sd"
> [31] "ModisShrink.df""ModisShrink.hpd"   "ModisYears"
> "OrigData"  "OrigDataToBUGS""Orig.df"
> [37] "Orig.hpd"  "OrigPrecip.sd" "OrigYears"
> "PlotChecks""PlotEff"   "plothpd"
> [43] "ProvinceNames" "ResNames"  "ResNamesOrder"
> "Shrink.df" "Shrink.hpd""SimInits"
>
> Specifically, the Modis* objects are sorted like this:
>
> > ls(sorted=TRUE)[26:30]
> [1] "Modis.df"   "ModisFixed.df"  "ModisFixed.hpd" "Modis.hpd"
>  "ModisPrecip.sd"
>
> With Modis.* coming both before and after ModisF*. I can't see why there
> would be any odd problems with character sets changing (this was all done
> on a single computer with no weird locale switching), and the objects are all
> created within a single R session:
>
> > sessionInfo()
> R version 3.2.5 (2016-04-14)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 16.04.1 LTS
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
> LC_TIME=en_GB.UTF-8LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_US.UTF-8
> LC_PAPER=en_GB.UTF-8   LC_NAME=C
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] MCMCglmm_2.22.1ape_3.5Matrix_1.2-7.1
> RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
>
> loaded via a namespace (and not attached):
> [1] cubature_1.1-2  corpcor_1.6.8   tools_3.2.5 Rcpp_0.12.7
> nlme_3.1-128grid_3.2.5  knitr_1.14
> [8] tensorA_0.36lattice_0.20-34
>
> Can anyone explain what's going on?
>
> Bob
>
> --
> Bob O'Hara
>
> Biodiversity and Climate Research Centre Senckenberganlage 25
> D-60325 Frankfurt am Main,
> Germany
>
> Tel: +49 69 798 40226
> Mobile: +49 1515 888 5440
> WWW:   http://www.bik-f.de/root/index.php?page_id=219
> Blog: http://occamstypewriter.org/boboh/
> Journal of Negative Results - EEB: www.jnr-eeb.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.


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 

Re: [R] Visibility of libraries called from within functions

2016-10-13 Thread Duncan Murdoch

On 13/10/2016 4:18 AM, g.maub...@weinwolf.de wrote:

Hi All,

in my R programs I use different libraries to work with Excel sheets, i.
e. xlsx, excel.link.

When running chunks of code repeatedly and not always in the order the
program should run for development purposes I ran into trouble. There were
conflicts between the methods within these functions causing R to crash.

I thought about defining functions for the different task and calling the
libraries locally to there functions. Doing this test

-- cut --

f_test <- function() {
library(xlsx)
cat("Loaded packages AFTER loading library")
print(search())
}

cat("Loaded packages BEFORE function call ")
search()

f_test()

cat("Loaded packages AFTER function call -")
search()

-- cut --

showed that the library "xlsx" was loaded into the global environment and
stayed there although I had expected R to unload the library when leaving
the function. Thus confilics can occur more often.

I had a look into ?library and saw that there is no argument telling R to
hold the library in the calling environment.

How can I load libraries locally to the calling functions?


You can detach at the end of your function, but that's tricky to get 
right:  the package might have been on the search list before your 
function was called.  It's better not to touch the search list at all.


The best solution is to use :: notation to get functions without putting 
them on the search list.  For example, use


xlsx::write.xlsx(data, file)

If you are not sure if your user has xlsx installed, you can use 
requireNamespace() to check.


Duncan Murdoch

__
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] (no subject)

2016-10-13 Thread Bob O'Hara
I've just come across an odd problem with sorting in ls(): it doesn't
seem to order the object names correctly. If I do the following, the
order isn't what I expect:

> ls(sorted=TRUE)
 [1] "AridData"  "AridDataToBUGS""Arid.df"
"Arid.hpd"  "AridPrecip.sd" "Break.df"
 [7] "Break.hpd" "Cols"  "Data"
"DataFrames""DataToBUGS""DataToBUGS.nonlog"
[13] "FitBRugs"  "Fixed.df"  "Fixed.hpd"
"FormatData""GetCol""GetHPD"
[19] "GetMCMC"   "GetRow""HPDIs"
"Int.alpha12"   "Int.alpha21"   "ModisData"
[25] "ModisDataToBUGS"   "Modis.df"  "ModisFixed.df"
"ModisFixed.hpd""Modis.hpd" "ModisPrecip.sd"
[31] "ModisShrink.df""ModisShrink.hpd"   "ModisYears"
"OrigData"  "OrigDataToBUGS""Orig.df"
[37] "Orig.hpd"  "OrigPrecip.sd" "OrigYears"
"PlotChecks""PlotEff"   "plothpd"
[43] "ProvinceNames" "ResNames"  "ResNamesOrder"
"Shrink.df" "Shrink.hpd""SimInits"

Specifically, the Modis* objects are sorted like this:

> ls(sorted=TRUE)[26:30]
[1] "Modis.df"   "ModisFixed.df"  "ModisFixed.hpd" "Modis.hpd"
 "ModisPrecip.sd"

With Modis.* coming both before and after ModisF*. I can't see why
there would be any odd problems with character sets changing (this was
all done on a single computer with no weird locale switching), and the
objects are all created within a single R session:

> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
LC_TIME=en_GB.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_US.UTF-8
LC_PAPER=en_GB.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] MCMCglmm_2.22.1ape_3.5Matrix_1.2-7.1
RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1

loaded via a namespace (and not attached):
[1] cubature_1.1-2  corpcor_1.6.8   tools_3.2.5 Rcpp_0.12.7
nlme_3.1-128grid_3.2.5  knitr_1.14
[8] tensorA_0.36lattice_0.20-34

Can anyone explain what's going on?

Bob

-- 
Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 798 40226
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://occamstypewriter.org/boboh/
Journal of Negative Results - EEB: www.jnr-eeb.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.


[R] Visibility of libraries called from within functions

2016-10-13 Thread G . Maubach
Hi All,

in my R programs I use different libraries to work with Excel sheets, i. 
e. xlsx, excel.link.

When running chunks of code repeatedly and not always in the order the 
program should run for development purposes I ran into trouble. There were 
conflicts between the methods within these functions causing R to crash.

I thought about defining functions for the different task and calling the 
libraries locally to there functions. Doing this test

-- cut --

f_test <- function() {
library(xlsx)
cat("Loaded packages AFTER loading library")
print(search())
}

cat("Loaded packages BEFORE function call ")
search()

f_test()

cat("Loaded packages AFTER function call -")
search()

-- cut --

showed that the library "xlsx" was loaded into the global environment and 
stayed there although I had expected R to unload the library when leaving 
the function. Thus confilics can occur more often.

I had a look into ?library and saw that there is no argument telling R to 
hold the library in the calling environment.

How can I load libraries locally to the calling functions?

Kind regards

Georg

__
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] can we visualize water flows with 3d in R?

2016-10-13 Thread Duncan Mackay
Hi

With a small data set 3D is not really an option;  reduce the number of
dimensions-- 2D conditional

library(lattice)
xyplot(flow ~ depth|factor(long), dat1, groups = lat, type = c("p","r"), pch
= 16)

I had started with lat and long reversed doing EDA gave the above
? latitude effect

Regards

Duncan


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

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marna Wagley
Sent: Wednesday, 12 October 2016 19:49
To: r-help mailing list
Subject: [R] can we visualize water flows with 3d in R?

Hi R Users,
Is it possible to visualize river flow in  3D (latitude, longitude with
respect to depth)?
The example of my data looks like. Any suggestions?

> dat1
long lat depth flow
1 1015.9 857  1.00 1.50
2 1015.9 857  1.25 1.23
3 1015.9 857  0.50 2.00
4 1015.9 858  0.10 1.95
5 1015.9 858  0.20 1.50
6 1025.0 858  0.30 1.20
7 1025.0 858  0.40 0.50
8 1025.0 858  0.35 0.70
9 1025.0 858  0.24 1.20

Thanks for your help.
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-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] Maybe OT: Forking in R scripts?

2016-10-13 Thread K. Elo

Dear all,

I am currently working a research project on social media interaction. 
As a part of this project, mostly for teaching purposes, I should 
develop a R-based approach for real-time visualisation of streamed data 
(from Twitter).


My idea is simple (and working :) ): A Python-script stream Twitter for 
selected keywords/hashtags/users and redirects the output as JSON in a 
text file. My R-script reads the new entries from this text file every 
5-10 minutes, process the input and updates network and other graphical 
presentations.


Thus far everything is working fine. However, I would like to have the 
possibility to work with my data when my script is sleeping. I just 
wonder whether a simple 'mcparallel({ Sys.sleep(300); TRUE})' (from 
'parallel') would solve my problem? Or is there something I have to take 
into account when using 'parallel'?


My R environment runs on Linux, so forking should work...

Best regrads and thanks in advance,
Kimmo

--
Åbo Akademi University, Finland
Dep. for German studies

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