R - kableExtra - How to densify as much as possible the html output of a table to then convert it into word
I have a table generated in R of the following form. What I want to do is copy this table from the html output (after knit to html
) into word for a scientific paper that I have to write. It's rather complicated, but it is the only way I found to have that table in an editable format which is required from the journal to which I will submit the article with the table (first question: I would be glad to know if there is another way to do it). As the table is quite big, the main question is how to have the text as packed as possible und have the space between line as small as possible so that when copying from the html document into word, I don't spend 20 minutes to adjust the layout in word.
Here is an example:
library(dplyr)
library(knitr)
library(kableExtra)
mydf <- data.frame(
# group = rep(letters[1:4], each = 2),
row = c(1:16),
group = c("group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8", "group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8")
)
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling()
html r ms-word kable kableextra
add a comment |
I have a table generated in R of the following form. What I want to do is copy this table from the html output (after knit to html
) into word for a scientific paper that I have to write. It's rather complicated, but it is the only way I found to have that table in an editable format which is required from the journal to which I will submit the article with the table (first question: I would be glad to know if there is another way to do it). As the table is quite big, the main question is how to have the text as packed as possible und have the space between line as small as possible so that when copying from the html document into word, I don't spend 20 minutes to adjust the layout in word.
Here is an example:
library(dplyr)
library(knitr)
library(kableExtra)
mydf <- data.frame(
# group = rep(letters[1:4], each = 2),
row = c(1:16),
group = c("group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8", "group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8")
)
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling()
html r ms-word kable kableextra
add a comment |
I have a table generated in R of the following form. What I want to do is copy this table from the html output (after knit to html
) into word for a scientific paper that I have to write. It's rather complicated, but it is the only way I found to have that table in an editable format which is required from the journal to which I will submit the article with the table (first question: I would be glad to know if there is another way to do it). As the table is quite big, the main question is how to have the text as packed as possible und have the space between line as small as possible so that when copying from the html document into word, I don't spend 20 minutes to adjust the layout in word.
Here is an example:
library(dplyr)
library(knitr)
library(kableExtra)
mydf <- data.frame(
# group = rep(letters[1:4], each = 2),
row = c(1:16),
group = c("group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8", "group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8")
)
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling()
html r ms-word kable kableextra
I have a table generated in R of the following form. What I want to do is copy this table from the html output (after knit to html
) into word for a scientific paper that I have to write. It's rather complicated, but it is the only way I found to have that table in an editable format which is required from the journal to which I will submit the article with the table (first question: I would be glad to know if there is another way to do it). As the table is quite big, the main question is how to have the text as packed as possible und have the space between line as small as possible so that when copying from the html document into word, I don't spend 20 minutes to adjust the layout in word.
Here is an example:
library(dplyr)
library(knitr)
library(kableExtra)
mydf <- data.frame(
# group = rep(letters[1:4], each = 2),
row = c(1:16),
group = c("group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8", "group 1.1<br>group1.2", "group 2", "group 3", "group 4", "group 5", "group 6", "group 7", "group 8")
)
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling()
html r ms-word kable kableextra
html r ms-word kable kableextra
asked Nov 21 '18 at 7:40
ecjbecjb
354317
354317
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I didn't fully understand, so I hope I'm in the right direction.
What if you'll edit the kable_styling
arguments?
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling(full_width = FALSE,
font_size = 12,
position = "left")
In addition, if you're looking for APA tables, depend on your analysis, you can try the apaTables
and apa
packages.
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when Iknit to pdf
the document. But it's a beginning. I will also check theapa
package. Does it do html output as well?
– ecjb
Nov 21 '18 at 21:34
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
I just checkedapaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?
– ecjb
Nov 21 '18 at 22:38
Unfortunately not more thankable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"
– DJV
Nov 22 '18 at 13:48
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407297%2fr-kableextra-how-to-densify-as-much-as-possible-the-html-output-of-a-table-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I didn't fully understand, so I hope I'm in the right direction.
What if you'll edit the kable_styling
arguments?
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling(full_width = FALSE,
font_size = 12,
position = "left")
In addition, if you're looking for APA tables, depend on your analysis, you can try the apaTables
and apa
packages.
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when Iknit to pdf
the document. But it's a beginning. I will also check theapa
package. Does it do html output as well?
– ecjb
Nov 21 '18 at 21:34
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
I just checkedapaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?
– ecjb
Nov 21 '18 at 22:38
Unfortunately not more thankable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"
– DJV
Nov 22 '18 at 13:48
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
add a comment |
I didn't fully understand, so I hope I'm in the right direction.
What if you'll edit the kable_styling
arguments?
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling(full_width = FALSE,
font_size = 12,
position = "left")
In addition, if you're looking for APA tables, depend on your analysis, you can try the apaTables
and apa
packages.
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when Iknit to pdf
the document. But it's a beginning. I will also check theapa
package. Does it do html output as well?
– ecjb
Nov 21 '18 at 21:34
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
I just checkedapaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?
– ecjb
Nov 21 '18 at 22:38
Unfortunately not more thankable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"
– DJV
Nov 22 '18 at 13:48
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
add a comment |
I didn't fully understand, so I hope I'm in the right direction.
What if you'll edit the kable_styling
arguments?
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling(full_width = FALSE,
font_size = 12,
position = "left")
In addition, if you're looking for APA tables, depend on your analysis, you can try the apaTables
and apa
packages.
I didn't fully understand, so I hope I'm in the right direction.
What if you'll edit the kable_styling
arguments?
mydf %>%
kable("html", escape = FALSE) %>%
kable_styling(full_width = FALSE,
font_size = 12,
position = "left")
In addition, if you're looking for APA tables, depend on your analysis, you can try the apaTables
and apa
packages.
answered Nov 21 '18 at 10:38
DJVDJV
1,6271419
1,6271419
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when Iknit to pdf
the document. But it's a beginning. I will also check theapa
package. Does it do html output as well?
– ecjb
Nov 21 '18 at 21:34
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
I just checkedapaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?
– ecjb
Nov 21 '18 at 22:38
Unfortunately not more thankable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"
– DJV
Nov 22 '18 at 13:48
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
add a comment |
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when Iknit to pdf
the document. But it's a beginning. I will also check theapa
package. Does it do html output as well?
– ecjb
Nov 21 '18 at 21:34
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
I just checkedapaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?
– ecjb
Nov 21 '18 at 22:38
Unfortunately not more thankable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"
– DJV
Nov 22 '18 at 13:48
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when I
knit to pdf
the document. But it's a beginning. I will also check the apa
package. Does it do html output as well?– ecjb
Nov 21 '18 at 21:34
Thank you very much @DJV for your answer that I upvoted. However the output is not as packed as the output that I get when I
knit to pdf
the document. But it's a beginning. I will also check the apa
package. Does it do html output as well?– ecjb
Nov 21 '18 at 21:34
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
Glad I could somewhat help you. Regarding the APA packages, they export to word documents.
– DJV
Nov 21 '18 at 21:42
I just checked
apaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?– ecjb
Nov 21 '18 at 22:38
I just checked
apaTables
out: it looks really great! The thing is that it looks like the package performs both statistical analysis (ANOVA, correlation, linear regression and so on) AND ouput in word. As I already did the statistical analysis and stored them in a dataframe, do you have an idea if it's possible to use apaTables` and output it in word without performing any stat?– ecjb
Nov 21 '18 at 22:38
Unfortunately not more than
kable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"– DJV
Nov 22 '18 at 13:48
Unfortunately not more than
kable
as to offer. From some google search, you can try to look here (dmyee.files.wordpress.com/2016/03/table_workshop.pdf). However, most of the packages will force you "recalculate"– DJV
Nov 22 '18 at 13:48
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
Thank you for your comment and your help @DJV
– ecjb
Nov 22 '18 at 20:15
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407297%2fr-kableextra-how-to-densify-as-much-as-possible-the-html-output-of-a-table-t%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown