Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
E
esi_analytics
Project
Project
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
Andrii
esi_analytics
Commits
027f9326
Commit
027f9326
authored
Mar 17, 2017
by
Я
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add "id" into Company: Data views
parent
fc2fca2d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
3 deletions
+47
-3
app.R
app.R
+3
-3
wp_esi_entity
data/wp_esi_entity
+0
-0
wp_esi_news
data/wp_esi_news
+0
-0
research_news.R
research_news.R
+44
-0
No files found.
app.R
View file @
027f9326
...
@@ -291,7 +291,7 @@ df_company_data_all <- reactive({
...
@@ -291,7 +291,7 @@ df_company_data_all <- reactive({
mutate
(
mutate
(
country
=
ifelse
(
country
==
""
,
"N/A"
,
country
),
country
=
ifelse
(
country
==
""
,
"N/A"
,
country
),
description
=
paste0
(
substr
(
description
,
1
,
10
),
"..."
))
%>%
description
=
paste0
(
substr
(
description
,
1
,
10
),
"..."
))
%>%
subset
(
select
=
c
(
name
,
url
,
description
,
country
,
city
,
founded_in
,
employees
,
total_raised
))
subset
(
select
=
c
(
id
,
name
,
url
,
description
,
country
,
city
,
founded_in
,
employees
,
total_raised
))
})
})
# 2. Table
# 2. Table
...
@@ -339,7 +339,7 @@ df_company_data_tags <- reactive({
...
@@ -339,7 +339,7 @@ df_company_data_tags <- reactive({
mutate
(
mutate
(
country
=
ifelse
(
country
==
""
,
"N/A"
,
country
),
country
=
ifelse
(
country
==
""
,
"N/A"
,
country
),
description
=
paste0
(
substr
(
description
,
1
,
20
),
"..."
))
%>%
description
=
paste0
(
substr
(
description
,
1
,
20
),
"..."
))
%>%
subset
(
select
=
c
(
name
,
url
,
description
,
country
,
city
,
founded_in
,
employees
,
total_raised
))
subset
(
select
=
c
(
id
,
name
,
url
,
description
,
country
,
city
,
founded_in
,
employees
,
total_raised
))
}
}
# 4.2. Select entities <AND>
# 4.2. Select entities <AND>
...
@@ -360,7 +360,7 @@ df_company_data_tags <- reactive({
...
@@ -360,7 +360,7 @@ df_company_data_tags <- reactive({
mutate
(
mutate
(
country
=
ifelse
(
country
==
""
,
"N/A"
,
country
),
country
=
ifelse
(
country
==
""
,
"N/A"
,
country
),
description
=
paste0
(
substr
(
description
,
1
,
20
),
"..."
))
%>%
description
=
paste0
(
substr
(
description
,
1
,
20
),
"..."
))
%>%
subset
(
select
=
c
(
name
,
url
,
description
,
country
,
city
,
founded_in
,
employees
,
total_raised
))
subset
(
select
=
c
(
id
,
name
,
url
,
description
,
country
,
city
,
founded_in
,
employees
,
total_raised
))
}
}
# 5. Get result
# 5. Get result
...
...
data/wp_esi_entity
View file @
027f9326
No preview for this file type
data/wp_esi_news
0 → 100644
View file @
027f9326
File added
research_news.R
View file @
027f9326
#
# "News" tables analysis
#
# "wp_esi_news"
# "wp_esi_news"
# "wp_esi_news_entity"
# "wp_esi_news_entity"
...
@@ -6,3 +9,44 @@
...
@@ -6,3 +9,44 @@
# "wp_esi_news_industry"
# "wp_esi_news_industry"
# "wp_esi_tag_news"
# "wp_esi_tag_news"
# "wp_esi_technology_news"
# "wp_esi_technology_news"
library
(
shinydashboard
)
library
(
RMySQL
)
#library(sqldf)
library
(
feather
)
library
(
ggplot2
)
library
(
dplyr
)
library
(
reshape2
)
library
(
lubridate
)
library
(
plotly
)
# 1. Connect to db
mydb
<-
dbConnect
(
MySQL
(),
user
=
'analyst'
,
password
=
'exa_analyst1&'
,
dbname
=
'esi_management'
,
host
=
'lecanaldb.c12hbxfn3xzn.eu-west-1.rds.amazonaws.com'
,
port
=
3306
)
# 2. List of tables
dbListTables
(
mydb
)
# 3. Load tables
db_load
<-
function
(
table
){
rs
=
dbSendQuery
(
mydb
,
paste0
(
"select * from "
,
table
))
df
=
fetch
(
rs
,
n
=
-1
)
write_feather
(
df
,
paste0
(
"data/"
,
table
))
}
# 3.2. Load all tables
# <main>
df_entity
<-
db_load
(
"wp_esi_entity"
)
# basic for cross
df_tag
<-
db_load
(
"wp_esi_tag"
)
df_technology
<-
db_load
(
"wp_esi_technology"
)
df_industry
<-
db_load
(
"wp_esi_industry"
)
df_function
<-
db_load
(
"wp_esi_function"
)
# news tables
df_news
<-
db_load
(
"wp_esi_news"
)
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