Displaying 12 results from an estimated 12 matches for "year_from".
2017 Nov 26
3
dplyr - add/expand rows
dplyr may have something for this, but in base R I think the following does
what you want. I've shortened the name of your data set to 'd'.
i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sat, Nov 25, 2017 at 11:18 AM, Hutchinson, David (EC) <
david.hutchinson at canada.ca> wrote:
> I have a returned tibble of st...
2017 Nov 26
0
dplyr - add/expand rows
...2017 at 4:49 PM, William Dunlap via R-help <
r-help at r-project.org> wrote:
> dplyr may have something for this, but in base R I think the following does
> what you want. I've shortened the name of your data set to 'd'.
>
> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Sat, Nov 25, 2017 at 11:18 AM, Hutchinson, David (EC) <
> david.hutchinson at canada.ca&...
2017 Nov 28
1
dplyr - add/expand rows
...ia R-help <
> r-help at r-project.org> wrote:
>
>> dplyr may have something for this, but in base R I think the following
>> does
>> what you want. I've shortened the name of your data set to 'd'.
>>
>> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
>> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
>> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>>
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>> On Sat, Nov 25, 2017 at 11:18 AM, Hutchinson, David (EC) <...
2017 Nov 27
2
dplyr - add/expand rows
...ia R-help <
> r-help at r-project.org> wrote:
>
> > dplyr may have something for this, but in base R I think the following
> does
> > what you want. I've shortened the name of your data set to 'd'.
> >
> > i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
> > j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
> > transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
> >
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com
> >
> > On Sat, Nov 25, 2017 at 11:18 AM, Hutchinson, David...
2017 Nov 28
0
dplyr - add/expand rows
...r-help at r-project.org> wrote:
>>
>>> dplyr may have something for this, but in base R I think the following
>> does
>>> what you want. I've shortened the name of your data set to 'd'.
>>>
>>> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
>>> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
>>> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>>>
>>>
>>> Bill Dunlap
>>> TIBCO Software
>>> wdunlap tibco.com
>>>
>>> On Sat, Nov 25, 2017 at 1...
2017 Nov 28
2
dplyr - add/expand rows
...t;>> dplyr may have something for this, but in base R I think the following
>>>>
>>> does
>>>
>>>> what you want. I've shortened the name of your data set to 'd'.
>>>>
>>>> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
>>>> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
>>>> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>>>>
>>>>
>>>> Bill Dunlap
>>>> TIBCO Software
>>>> wdunlap tibco.com
>>>>
>&g...
2017 Nov 29
0
dplyr - add/expand rows
...e something for this, but in base R I think the following
>>>>>
>>>> does
>>>>
>>>>> what you want. I've shortened the name of your data set to 'd'.
>>>>>
>>>>> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
>>>>> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
>>>>> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>>>>>
>>>>>
>>>>> Bill Dunlap
>>>>> TIBCO Software
>>>>> wdunlap tibco...
2017 Nov 29
2
dplyr - add/expand rows
...t in base R I think the following
>>>>>>
>>>>> does
>>>>>
>>>>>> what you want.? I've shortened the name of your data set to 'd'.
>>>>>>
>>>>>> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
>>>>>> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
>>>>>> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>>>>>>
>>>>>>
>>>>>> Bill Dunlap
>>>>>> TIBCO Software
>>&g...
2017 Nov 29
0
dplyr - add/expand rows
...following
>>>>>>>
>>>>>> does
>>>>>>
>>>>>>> what you want. I've shortened the name of your data set to 'd'.
>>>>>>>
>>>>>>> i <- rep(seq_len(nrow(d)), d$YEAR_TO-d$YEAR_FROM+1)
>>>>>>> j <- sequence(d$YEAR_TO-d$YEAR_FROM+1)
>>>>>>> transform(d[i,], YEAR=YEAR_FROM+j-1, YEAR_FROM=NULL, YEAR_TO=NULL)
>>>>>>>
>>>>>>>
>>>>>>> Bill Dunlap
>>>>>>> T...
2018 Jan 19
1
Web scraping different levels of a website
...e. I broke the url in smaller chunks for
readability and because its easier to substitute some query
paramaters.
# load libs
library("rvest")
library("httr")
library("glue")
library("magrittr")
# number of studies to pull from catalogue
num_studies <- 42
year_from <- 1890
year_to <- 2017
# build up the url
url <-
glue(
"http://catalog.ihsn.org/index.php/catalog/",
"search?view=s&",
"ps={num_studies}&",
"page=1&repo=&repo_ref=&sid=&_r=&sk=&vk=&",
"...
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...
2017 Nov 26
0
dplyr - add/expand rows
> On Nov 25, 2017, at 11:18 AM, Hutchinson, David (EC) <david.hutchinson 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...