Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tkdm
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etl
tkdm
Commits
6e641327
Commit
6e641327
authored
Feb 28, 2017
by
mengdongxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update BootStarpMedian.R
parent
22455beb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
14 deletions
+0
-14
BootStarpMedian.R
BootStarpMedian.R
+0
-14
No files found.
BootStarpMedian.R
View file @
6e641327
# BootStarpMedian function
# BootStarpMedian function
BootStarpMedian
<-
function
(
x
)
{
BootStarpMedian
<-
function
(
x
)
{
x
<-
as.vector
(
x
)
x
<-
as.vector
(
x
)
...
@@ -11,9 +9,7 @@ BootStarpMedian <- function(x) {
...
@@ -11,9 +9,7 @@ BootStarpMedian <- function(x) {
#----------------------
#----------------------
# app std
# app std
#----------------------
#----------------------
# loading data
# loading data
app_query_sql
<-
"select appid,
app_query_sql
<-
"select appid,
category_id,
category_id,
isgame ,
isgame ,
...
@@ -23,7 +19,6 @@ app_query_sql <- "select appid,
...
@@ -23,7 +19,6 @@ app_query_sql <- "select appid,
where ds between '2017-02-20' and '2017-02-26'
where ds between '2017-02-20' and '2017-02-26'
group by appid,category_id,isgame,ds
group by appid,category_id,isgame,ds
"
"
# app_query_result
# app_query_result
app_query_result
<-
sql
(
app_query_sql
)
app_query_result
<-
sql
(
app_query_sql
)
#
#
...
@@ -37,15 +32,12 @@ app <- gapply(x=app_query_result,
...
@@ -37,15 +32,12 @@ app <- gapply(x=app_query_result,
data.frame
(
key
,
BootStarpMedian
(
x
$
ins_rate
),
stringsAsFactors
=
FALSE
)
data.frame
(
key
,
BootStarpMedian
(
x
$
ins_rate
),
stringsAsFactors
=
FALSE
)
},
},
schema
=
app_schema
)
schema
=
app_schema
)
# collect(yy)
# collect(yy)
app_output
<-
join
(
x
=
app_query_result
,
app_output
<-
join
(
x
=
app_query_result
,
y
=
app
,
y
=
app
,
joinExpr
=
app_query_result
$
category_id
==
app
$
category_id_app
&
app_query_result
$
isgame
==
app
$
isgame_app
,
joinExpr
=
app_query_result
$
category_id
==
app
$
category_id_app
&
app_query_result
$
isgame
==
app
$
isgame_app
,
joinType
=
'inner'
joinType
=
'inner'
)
)
app_output
<-
select
(
app_output
,
'appid'
,
'category_id'
,
'isgame'
,
'ins_rate_std'
,
'ds'
)
app_output
<-
select
(
app_output
,
'appid'
,
'category_id'
,
'isgame'
,
'ins_rate_std'
,
'ds'
)
#----------------------
#----------------------
...
@@ -60,7 +52,6 @@ cid_query_sql <- "select appid,
...
@@ -60,7 +52,6 @@ cid_query_sql <- "select appid,
ins_rate
ins_rate
from tkdm.tkdm_data_active_detial_day
from tkdm.tkdm_data_active_detial_day
where ds between '2017-02-20' and '2017-02-26'
where ds between '2017-02-20' and '2017-02-26'
"
"
# result of query sql
# result of query sql
aa
<-
sql
(
cid_query_sql
)
aa
<-
sql
(
cid_query_sql
)
...
@@ -76,13 +67,9 @@ cid <- gapply(x=aa,
...
@@ -76,13 +67,9 @@ cid <- gapply(x=aa,
data.frame
(
key
,
BootStarpMedian
(
x
$
ins_rate
),
stringsAsFactors
=
FALSE
)
data.frame
(
key
,
BootStarpMedian
(
x
$
ins_rate
),
stringsAsFactors
=
FALSE
)
},
},
schema
=
cid_schema
)
schema
=
cid_schema
)
# collect(cid)
# collect(cid)
cid_output
<-
join
(
x
=
aa
,
y
=
cid
,
cid_output
<-
join
(
x
=
aa
,
y
=
cid
,
joinExpr
=
aa
$
category_id
==
cid
$
category_id_cid
&
aa
$
isgame
==
cid
$
isgame_cid
&
aa
$
cid
==
cid
$
cid_cid
,
joinExpr
=
aa
$
category_id
==
cid
$
category_id_cid
&
aa
$
isgame
==
cid
$
isgame_cid
&
aa
$
cid
==
cid
$
cid_cid
,
joinType
=
'inner'
joinType
=
'inner'
)
)
# cid_output <- cid_output[,c('appid','cid','category_id','isgame','ins_rate_std')]
cid_output
<-
select
(
cid_output
,
'appid'
,
'cid'
,
'category_id'
,
'isgame'
,
'ins_rate_std'
,
'ds'
)
cid_output
<-
select
(
cid_output
,
'appid'
,
'cid'
,
'category_id'
,
'isgame'
,
'ins_rate_std'
,
'ds'
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment