Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inlcolor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INLPO
inlcolor
Commits
a38b0a66
Commit
a38b0a66
authored
2 years ago
by
Fisher, Jason C.
Browse files
Options
Downloads
Patches
Plain Diff
add file argument to print_table as recommended by cran
parent
5ad737d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#240360
passed
2 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/utils.R
+12
-6
12 additions, 6 deletions
R/utils.R
inst/tinytest/test_colors.R
+2
-2
2 additions, 2 deletions
inst/tinytest/test_colors.R
with
14 additions
and
8 deletions
R/utils.R
+
12
−
6
View file @
a38b0a66
...
...
@@ -249,6 +249,7 @@ print_table <- function(d,
na
=
"\\textemdash"
,
rm_dup
=
NULL
,
landscape
=
FALSE
,
file
=
""
,
...
)
{
stopifnot
(
inherits
(
d
,
c
(
"matrix"
,
"data.frame"
)))
...
...
@@ -375,6 +376,7 @@ print_table <- function(d,
}
print_xtable
<-
xtable
::
print.xtable
formals
(
print_xtable
)
$
file
<-
file
formals
(
print_xtable
)
$
type
<-
"latex"
formals
(
print_xtable
)
$
caption.placement
<-
"top"
formals
(
print_xtable
)
$
size
<-
"\\small"
...
...
@@ -391,9 +393,9 @@ print_table <- function(d,
formals
(
print_xtable
)
$
comment
<-
FALSE
for
(
i
in
seq_along
(
n
))
{
if
(
i
>
1
)
cat
(
"\n\\clearpage\n"
)
if
(
i
==
2
)
cat
(
"\\captionsetup[table]{list=no}\n"
)
if
(
landscape
)
cat
(
"\\begin{landscape}\n"
)
if
(
i
>
1
)
cat
(
"\n\\clearpage\n"
,
file
=
file
,
append
=
TRUE
)
if
(
i
==
2
)
cat
(
"\\captionsetup[table]{list=no}\n"
,
file
=
file
,
append
=
TRUE
)
if
(
landscape
)
cat
(
"\\begin{landscape}\n"
,
file
=
file
,
append
=
TRUE
)
if
(
i
==
1
)
{
idxs
<-
1
:
n
[
i
]
...
...
@@ -402,7 +404,7 @@ print_table <- function(d,
idxs
<-
(
n
[
i
-
1
]
+
1
)
:
n
[
i
]
caption
<-
sprintf
(
"%s---Continued"
,
cap1
)
label
<-
NULL
cat
(
"\\addtocounter{table}{-1}\n"
)
cat
(
"\\addtocounter{table}{-1}\n"
,
file
=
file
,
append
=
TRUE
)
}
tbl
<-
d
[
idxs
,
]
...
...
@@ -444,8 +446,12 @@ print_table <- function(d,
print_xtable
(
x
=
tbl
,
hline.after
=
hline_after
,
add.to.row
=
add_to_row
,
...
)
if
(
landscape
)
cat
(
"\\end{landscape}\n"
)
if
(
i
>
1
&&
i
==
length
(
n
))
cat
(
"\\captionsetup[table]{list=yes}\n"
)
if
(
landscape
)
{
cat
(
"\\end{landscape}\n"
,
file
=
file
,
append
=
TRUE
)
}
if
(
i
>
1
&&
i
==
length
(
n
))
{
cat
(
"\\captionsetup[table]{list=yes}\n"
,
file
=
file
,
append
=
TRUE
)
}
}
invisible
()
...
...
This diff is collapsed.
Click to expand it.
inst/tinytest/test_colors.R
+
2
−
2
View file @
a38b0a66
...
...
@@ -6,10 +6,10 @@ using("checkmate")
# test retrieval of color palettes
n
<-
10L
x
<-
get_colors
(
n
=
n
)
checkmate
::
expect_character
(
x
,
len
=
n
,
any.missing
=
FALSE
,
unique
=
TRUE
)
expect_character
(
x
,
len
=
n
,
any.missing
=
FALSE
,
unique
=
TRUE
)
# test setting the hinge location in color palette
n
<-
19L
fun
<-
set_hinge
(
x
=
c
(
-3
,
7
),
hinge
=
0
)
x
<-
fun
(
n
)
checkmate
::
expect_character
(
x
,
len
=
n
,
any.missing
=
FALSE
,
unique
=
TRUE
)
expect_character
(
x
,
len
=
n
,
any.missing
=
FALSE
,
unique
=
TRUE
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment