This website works better with JavaScript.
Home
Explore
Help
Register
Sign In
hrbrmstr
/
cdcfluview
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
3
Wiki
Activity
Browse Source
get_flu_data() will choose current flu season if years parameter is set to the current year but has no return data (i.e. the "next year's" flu season hasn't started)
tags/v0.5.2
boB Rudis
4 years ago
parent
0f7a77204d
commit
0912f15f1c
3 changed files
with
22 additions
and
4 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+2
-2
DESCRIPTION
+7
-1
NEWS.md
+13
-1
R/get_flu_data.r
+ 2
- 2
DESCRIPTION
View File
@ -1,8 +1,8 @@
Package: cdcfluview
Type: Package
Title: Retrieve U.S. Flu Season Data from the CDC FluView Portal
Version: 0.5.
1
Date: 201
6-12-06
Version: 0.5.
2
Date: 201
7-01-02
Author: Bob Rudis (bob@rud.is)
Maintainer: Bob Rudis <bob@rud.is>
Encoding: UTF-8
+ 7
- 1
NEWS.md
View File
@ -1,4 +1,10 @@
# cscfluview 0.5.1
# cdcfluview 0.5.2
* Modified behavior of
`get_flu_data()`
to actually grab current flu season year
if a single year was specified and it is the current year and the return is a 0 length
data frame
#7
# cdcfluview 0.5.1
* Replaced
`http`
URLs with
`https`
as
`http`
ones no longer work (fixes
#6
)
* Fixed State data download (CDC changed the hidden API)
+ 13
- 1
R/get_flu_data.r
View File
@ -98,7 +98,19 @@ get_flu_data <- function(region="hhs", sub_region=1:10,
names
(
file_list
)
<-
substr
(
basename
(
files
)
,
1
,
3
)
if
(
length
(
file_list
)
==
1
)
{
return
(
file_list
[
[1
]
]
)
file_list
<-
file_list
[
[1
]
]
if
(
(
nrow
(
file_list
)
==
0
)
&
(
length
(
years
)
==
1
)
&
(
years
==
(
as.numeric
(
format
(
Sys.Date
(
)
,
"
%Y"
)
)
-1960
)
)
)
{
message
(
"
Adjusting [years] to get current season..."
)
return
(
get_flu_data
(
region
=
region
,
sub_region
=
sub_region
,
data_source
=
data_source
,
years
=
years
+1960
-1
)
)
}
else
{
return
(
file_list
)
}
}
else
{
return
(
file_list
)
}
Write
Preview
Loading…
Cancel
Save