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
8 years ago
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
(
x
)
{
x
<-
as.vector
(
x
)
...
...
@@ -11,9 +9,7 @@ BootStarpMedian <- function(x) {
#----------------------
# app std
#----------------------
# loading data
app_query_sql
<-
"select appid,
category_id,
isgame ,
...
...
@@ -23,7 +19,6 @@ app_query_sql <- "select appid,
where ds between '2017-02-20' and '2017-02-26'
group by appid,category_id,isgame,ds
"
# app_query_result
app_query_result
<-
sql
(
app_query_sql
)
#
...
...
@@ -37,15 +32,12 @@ app <- gapply(x=app_query_result,
data.frame
(
key
,
BootStarpMedian
(
x
$
ins_rate
),
stringsAsFactors
=
FALSE
)
},
schema
=
app_schema
)
# collect(yy)
app_output
<-
join
(
x
=
app_query_result
,
y
=
app
,
joinExpr
=
app_query_result
$
category_id
==
app
$
category_id_app
&
app_query_result
$
isgame
==
app
$
isgame_app
,
joinType
=
'inner'
)
app_output
<-
select
(
app_output
,
'appid'
,
'category_id'
,
'isgame'
,
'ins_rate_std'
,
'ds'
)
#----------------------
...
...
@@ -60,7 +52,6 @@ cid_query_sql <- "select appid,
ins_rate
from tkdm.tkdm_data_active_detial_day
where ds between '2017-02-20' and '2017-02-26'
"
# result of query sql
aa
<-
sql
(
cid_query_sql
)
...
...
@@ -76,13 +67,9 @@ cid <- gapply(x=aa,
data.frame
(
key
,
BootStarpMedian
(
x
$
ins_rate
),
stringsAsFactors
=
FALSE
)
},
schema
=
cid_schema
)
# collect(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
,
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'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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