Displaying 11 results from an estimated 11 matches for "07ea001".
2017 Nov 28
0
dplyr - add/expand rows
On 11/26/2017 08:42 PM, jim holtman wrote:
> try this:
>
> ##########################################
>
> library(dplyr)
>
> input <- tribble(
> ~station, ~from, ~to, ~record,
> "07EA001" , 1960 , 1960 , "QMS",
> "07EA001" , 1961 , 1970 , "QMC",
> "07EA001" , 1971 , 1971 , "QMM",
> "07EA001" , 1972 , 1976 , "QMC",
> "07EA001" , 1977 , 1983 , "Q...
2017 Nov 27
2
dplyr - add/expand rows
try this:
##########################################
library(dplyr)
input <- tribble(
~station, ~from, ~to, ~record,
"07EA001" , 1960 , 1960 , "QMS",
"07EA001" , 1961 , 1970 , "QMC",
"07EA001" , 1971 , 1971 , "QMM",
"07EA001" , 1972 , 1976 , "QMC",
"07EA001" , 1977 , 1983 , "QRC"
)
result <-...
2017 Nov 28
2
dplyr - add/expand rows
Or with the Bioconductor IRanges package:
df <- with(input, DataFrame(station, year=IRanges(from, to), record))
expand(df, "year")
DataFrame with 24 rows and 3 columns
station year record
<character> <integer> <character>
1 07EA001 1960 QMS
2 07EA001 1961 QMC
3 07EA001 1962 QMC
4 07EA001 1963 QMC
5 07EA001 1964 QMC
... ... ... ...
20 07EA001 1979 QRC
21 07EA001 1980 QRC
22 07E...
2017 Nov 29
0
dplyr - add/expand rows
...Ranges package:
>
> df <- with(input, DataFrame(station, year=IRanges(from, to), record))
> expand(df, "year")
>
> DataFrame with 24 rows and 3 columns
> station year record
> <character> <integer> <character>
> 1 07EA001 1960 QMS
> 2 07EA001 1961 QMC
> 3 07EA001 1962 QMC
> 4 07EA001 1963 QMC
> 5 07EA001 1964 QMC
> ... ... ... ...
> 20 07EA001 1979 QRC
> 21 07EA00...
2017 Nov 29
2
dplyr - add/expand rows
...gt; df <- with(input, DataFrame(station, year=IRanges(from, to), record))
>> expand(df, "year")
>>
>> DataFrame with 24 rows and 3 columns
>> ???????? station???? year????? record
>> ???? <character> <integer> <character>
>> 1?????? 07EA001????? 1960???????? QMS
>> 2?????? 07EA001????? 1961???????? QMC
>> 3?????? 07EA001????? 1962???????? QMC
>> 4?????? 07EA001????? 1963???????? QMC
>> 5?????? 07EA001????? 1964???????? QMC
>> ...???????? ...?????? ...???????? ...
>> 20????? 07EA001????? 1979????????...
2017 Nov 29
0
dplyr - add/expand rows
...DataFrame(station, year=IRanges(from, to), record))
>>> expand(df, "year")
>>>
>>> DataFrame with 24 rows and 3 columns
>>> station year record
>>> <character> <integer> <character>
>>> 1 07EA001 1960 QMS
>>> 2 07EA001 1961 QMC
>>> 3 07EA001 1962 QMC
>>> 4 07EA001 1963 QMC
>>> 5 07EA001 1964 QMC
>>> ... ... ... ...
>>> 20 0...
2017 Nov 26
3
dplyr - add/expand rows
...canada.ca> wrote:
> 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
> <chr> <int> <int> <chr>
> 1 07EA001 1960 1960 QMS
> 2 07EA001 1961 1970 QMC
> 3 07EA001 1971 1971 QMM
> 4 07EA001 1972 1976 QMC
> 5 07EA001 1977 1983 QRC
>
> I would like to reshape this to one operational record (row) per year per
&g...
2017 Nov 26
0
dplyr - add/expand rows
...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
> > <chr> <int> <int> <chr>
> > 1 07EA001 1960 1960 QMS
> > 2 07EA001 1961 1970 QMC
> > 3 07EA001 1971 1971 QMM
> > 4 07EA001 1972 1976 QMC
> > 5 07EA001 1977 1983 QRC
> >
> > I would like to reshape this to one operationa...
2017 Nov 28
1
dplyr - add/expand rows
...operational record similar to the
>> > following:
>> >
>> > > data.collection
>> > # A tibble: 5 x 4
>> > STATION_NUMBER YEAR_FROM YEAR_TO RECORD
>> > <chr> <int> <int> <chr>
>> > 1 07EA001 1960 1960 QMS
>> > 2 07EA001 1961 1970 QMC
>> > 3 07EA001 1971 1971 QMM
>> > 4 07EA001 1972 1976 QMC
>> > 5 07EA001 1977 1983 QRC
>> >
>> > I would like to reshap...
2017 Nov 25
0
dplyr - add/expand rows
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
<chr> <int> <int> <chr>
1 07EA001 1960 1960 QMS
2 07EA001 1961 1970 QMC
3 07EA001 1971 1971 QMM
4 07EA001 1972 1976 QMC
5 07EA001 1977 1983 QRC
I would like to reshape this to one operational record (row) per year per station. Something like:
07EA0...
2017 Nov 26
0
dplyr - add/expand rows
...at canada.ca> wrote:
>
> 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
> <chr> <int> <int> <chr>
> 1 07EA001 1960 1960 QMS
> 2 07EA001 1961 1970 QMC
> 3 07EA001 1971 1971 QMM
> 4 07EA001 1972 1976 QMC
> 5 07EA001 1977 1983 QRC
>
> I would like to reshape this to one operational record (row) per year per s...