[R] dplyr - add/expand rows

2017-11-25 Thread Hutchinson, David (EC)
I have a returned tibble of station operational record similar to the following:

> data.collection
# A tibble: 5 x 4
  STATION_NUMBER YEAR_FROM YEAR_TO RECORD
 
107EA001  19601960QMS
207EA001  19611970QMC
307EA001  19711971QMM
407EA001  19721976QMC
507EA001  19771983QRC

I would like to reshape this to one operational record (row) per year per 
station. Something like:

07EA001  1960  QMS
07EA001  1961  QMC
07EA001  1962  QMC
07EA001  1963  QMC
...
07EA001  1971  QMM

Can this be done in dplyr easily?

Thanks in advance,

David

[[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-14 Thread Hutchinson, David (EC)
Karline, 

You may want to explore Green Kenue 
(http://www.nrc-cnrc.gc.ca/eng/solutions/advisory/green_kenue_index.html). It 
is freely available (download through an email request) and supports 3D data 
visualization and I believe it now has a python API to allow some automation.
 
Unfortunately it is only supported for Windows-based OS.

Dave

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Duncan Murdoch
Sent: October 13, 2016 2:11 PM
To: Thomas Adams
Cc: r-help mailing list; Karline Soetaert
Subject: Re: [R] can we visualize water flows with 3d in R?

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/Conferen
> ce_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_R
> AS/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