Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rdiagnosis
basicr
Commits
263976d5
Commit
263976d5
authored
Jan 31, 2019
by
Jean-Marie Lepioufle
Browse files
remove simple plot
parent
d1aa1d96
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/plot.R
deleted
100644 → 0
View file @
d1aa1d96
#' plot_tbl_basic
#' plot_tbl_basic
#' @param df tbl_friendlyts data.frame
#' @param target target
#' @param group "none","YEAR","MONTH","WDAY","HOUR","MINUTE","SECOND"
#' @param path path
#' @param name name
#' @param DESKTOP boolean
#' @param width_mm width_mm
#' @param height_mm height_mm
#' @keywords basicr
#' @export
#' @examples
#' \dontrun{
#' plot_tbl_basic()
#' }
plot_tbl_basic
<-
function
(
df
,
target
,
group
,
path
=
tempdir
(),
name
=
NULL
,
DESKTOP
=
TRUE
,
width_mm
=
200
,
height_mm
=
200
){
if
(
!
DESKTOP
)
{
filename
<-
normalizePath
(
file.path
(
path
,
paste0
(
"basic_"
,
group
,
"_"
,
target
,
".tiff"
)),
mustWork
=
FALSE
)
grDevices
::
tiff
(
filename
=
filename
,
width
=
width_mm
,
height
=
height_mm
,
units
=
"mm"
,
pointsize
=
12
,
compression
=
"lzw"
,
bg
=
"transparent"
,
res
=
300
)
}
else
grDevices
::
dev.new
()
names
(
df
)[
names
(
df
)
==
target
]
<-
"targ"
p
<-
switch
(
group
,
"YEAR"
=
ggplot2
::
ggplot
(
df
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
YEAR
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
target
),
"MONTH"
=
ggplot2
::
ggplot
(
df
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
MONTH
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
target
),
"WDAY"
=
ggplot2
::
ggplot
(
df
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
WDAY
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
target
),
"HOUR"
=
ggplot2
::
ggplot
(
df
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
HOUR
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
target
),
"MINUTE"
=
ggplot2
::
ggplot
(
df
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
MINUTE
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
target
),
"SECOND"
=
ggplot2
::
ggplot
(
df
)
+
ggplot2
::
geom_boxplot
(
ggplot2
::
aes
(
x
=
SECOND
,
y
=
targ
))
+
ggplot2
::
labs
(
x
=
group
,
y
=
target
),
stop
(
"group not recognized"
))
print
(
p
)
if
(
!
DESKTOP
)
{
grDevices
::
dev.off
()
print
(
filename
)
}
else
{}
return
(
TRUE
)
}
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