Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aaltodimensions
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Repository Analytics
Value Stream Analytics
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tuija Sonkkila
aaltodimensions
Commits
1c46c105
Commit
1c46c105
authored
Feb 26, 2018
by
Tuija Sonkkila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
7347b33f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
missing.R
missing.R
+79
-0
No files found.
missing.R
0 → 100644
View file @
1c46c105
#--------------------
# Plot NA values
#--------------------
library
(
tidyverse
)
library
(
lattice
)
data
<-
readRDS
(
"shiny_data.RDS"
)
data
<-
data
[
!
duplicated
(
data
[,
c
(
'doi'
)]),]
#---------------
# Publishers
#---------------
publishers
<-
unique
(
data
$
publisher
)
# http://www.rensenieuwenhuis.nl/r-sessions-30-visualizing-missing-values/
var.NA
<-
matrix
(
ncol
=
length
(
publishers
),
nrow
=
23
)
for
(
i
in
1
:
dim
(
data
)[
2
])
{
var.NA
[
i
,]
<-
tapply
(
data
[[
i
]],
data
$
publisher
,
function
(
x
)
sum
(
is.na
(
x
))
/
length
(
x
))
}
dimnames
(
var.NA
)
<-
list
(
names
(
data
),
sort
(
publishers
))
publ_stats
<-
data
%>%
group_by
(
publisher
)
%>%
summarise
(
n
=
n
())
%>%
filter
(
n
>=
20
)
%>%
arrange
(
desc
(
n
))
publ_names
<-
publ_stats
$
publisher
var_names
<-
c
(
"urls"
,
"times_cited_wos"
)
# https://stackoverflow.com/a/7352287
p
<-
var.NA
[
rownames
(
var.NA
)
%in%
var_names
,
colnames
(
var.NA
)
%in%
publ_names
,
drop
=
FALSE
]
trellis.par.set
(
canonical.theme
(
color
=
FALSE
))
levelplot
(
p
,
scales
=
list
(
x
=
list
(
rot
=
90
)),
main
=
"Percentage of missing variables"
,
xlab
=
"Variable"
,
ylab
=
"Publisher"
)
# Export fron RStudio as PNG 1500x800
#-----------------
# Schools
#-----------------
data
<-
readRDS
(
"shiny_data.RDS"
)
schools
<-
unique
(
data
$
parent
)
var_s.NA
<-
matrix
(
ncol
=
length
(
schools
),
nrow
=
23
)
for
(
i
in
1
:
dim
(
data
)[
2
])
{
var_s.NA
[
i
,]
<-
tapply
(
data
[[
i
]],
data
$
parent
,
function
(
x
)
sum
(
is.na
(
x
))
/
length
(
x
))
}
dimnames
(
var_s.NA
)
<-
list
(
names
(
data
),
sort
(
schools
))
var_names
<-
c
(
"urls"
,
"times_cited_wos"
)
p2
<-
var_s.NA
[
rownames
(
var_s.NA
)
%in%
var_names
,,
drop
=
FALSE
]
trellis.par.set
(
canonical.theme
(
color
=
FALSE
))
levelplot
(
p2
,
scales
=
list
(
x
=
list
(
rot
=
90
)),
main
=
"Percentage of missing variables"
,
xlab
=
"Variable"
,
ylab
=
"School"
)
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