Reporting R Results in LaTeX
I´m writing my thesis in LaTeX (using Overleaf) and I analyzed some data in R. So I have a R script where I perform a bunch of tests and regressions. Now I want to e.g. include the t-statistic and p-value in the Text.
x <- rnorm(10, 180, 10)
y <- rnorm(10, 150, 10)
Our Hypothesis that x is taller than y was accepted (t =t.test(x , y)$statisic
; p = t.test(x, y)$p.value)
.
S.t. In the final pdf it says:
Our Hypothesis that x is taller than y was accepted (t =-7.8841, p = 0.000).
What is the easiest way to do this? What is the workflow?
I`d be thankful for any advice using LaTeX. Even more so for advice for Overleaf.
r latex3
New contributor
add a comment |
I´m writing my thesis in LaTeX (using Overleaf) and I analyzed some data in R. So I have a R script where I perform a bunch of tests and regressions. Now I want to e.g. include the t-statistic and p-value in the Text.
x <- rnorm(10, 180, 10)
y <- rnorm(10, 150, 10)
Our Hypothesis that x is taller than y was accepted (t =t.test(x , y)$statisic
; p = t.test(x, y)$p.value)
.
S.t. In the final pdf it says:
Our Hypothesis that x is taller than y was accepted (t =-7.8841, p = 0.000).
What is the easiest way to do this? What is the workflow?
I`d be thankful for any advice using LaTeX. Even more so for advice for Overleaf.
r latex3
New contributor
I can think of 2 suggestions:datatool
package if you are willing to save some of the results inside a file and read into your LaTeX code later. Another way is write18 which you might be able to run a shell command with that. However, if you are using overleaf as a online editor, only the first suggestion might worth trying.
– Majid Abdolshah
3 hours ago
Thesagetex
package uses open source computer algebra system SAGE which includes R, see here. If you don't mind using Cocalc then you have access to SAGE, which should let you run R, and insert the results into your LaTeX document, similar to my answer here which used SAGE but not R in calculating descriptive statistics. Sagetex documentation here.
– DJP
3 hours ago
First page ofsagetex
document says "Similarly, the R statistical computing environment includes Sweave, which lets you do the same thing with R code and LATEX". So maybe worth looking into Sweave. Maybe something like this?
– DJP
3 hours ago
Welcome to TeX.SE. Useknitr
like this: <tex.stackexchange.com/a/481061>
– Ross
3 hours ago
add a comment |
I´m writing my thesis in LaTeX (using Overleaf) and I analyzed some data in R. So I have a R script where I perform a bunch of tests and regressions. Now I want to e.g. include the t-statistic and p-value in the Text.
x <- rnorm(10, 180, 10)
y <- rnorm(10, 150, 10)
Our Hypothesis that x is taller than y was accepted (t =t.test(x , y)$statisic
; p = t.test(x, y)$p.value)
.
S.t. In the final pdf it says:
Our Hypothesis that x is taller than y was accepted (t =-7.8841, p = 0.000).
What is the easiest way to do this? What is the workflow?
I`d be thankful for any advice using LaTeX. Even more so for advice for Overleaf.
r latex3
New contributor
I´m writing my thesis in LaTeX (using Overleaf) and I analyzed some data in R. So I have a R script where I perform a bunch of tests and regressions. Now I want to e.g. include the t-statistic and p-value in the Text.
x <- rnorm(10, 180, 10)
y <- rnorm(10, 150, 10)
Our Hypothesis that x is taller than y was accepted (t =t.test(x , y)$statisic
; p = t.test(x, y)$p.value)
.
S.t. In the final pdf it says:
Our Hypothesis that x is taller than y was accepted (t =-7.8841, p = 0.000).
What is the easiest way to do this? What is the workflow?
I`d be thankful for any advice using LaTeX. Even more so for advice for Overleaf.
r latex3
r latex3
New contributor
New contributor
New contributor
asked 4 hours ago
MoRitzMoRitz
33
33
New contributor
New contributor
I can think of 2 suggestions:datatool
package if you are willing to save some of the results inside a file and read into your LaTeX code later. Another way is write18 which you might be able to run a shell command with that. However, if you are using overleaf as a online editor, only the first suggestion might worth trying.
– Majid Abdolshah
3 hours ago
Thesagetex
package uses open source computer algebra system SAGE which includes R, see here. If you don't mind using Cocalc then you have access to SAGE, which should let you run R, and insert the results into your LaTeX document, similar to my answer here which used SAGE but not R in calculating descriptive statistics. Sagetex documentation here.
– DJP
3 hours ago
First page ofsagetex
document says "Similarly, the R statistical computing environment includes Sweave, which lets you do the same thing with R code and LATEX". So maybe worth looking into Sweave. Maybe something like this?
– DJP
3 hours ago
Welcome to TeX.SE. Useknitr
like this: <tex.stackexchange.com/a/481061>
– Ross
3 hours ago
add a comment |
I can think of 2 suggestions:datatool
package if you are willing to save some of the results inside a file and read into your LaTeX code later. Another way is write18 which you might be able to run a shell command with that. However, if you are using overleaf as a online editor, only the first suggestion might worth trying.
– Majid Abdolshah
3 hours ago
Thesagetex
package uses open source computer algebra system SAGE which includes R, see here. If you don't mind using Cocalc then you have access to SAGE, which should let you run R, and insert the results into your LaTeX document, similar to my answer here which used SAGE but not R in calculating descriptive statistics. Sagetex documentation here.
– DJP
3 hours ago
First page ofsagetex
document says "Similarly, the R statistical computing environment includes Sweave, which lets you do the same thing with R code and LATEX". So maybe worth looking into Sweave. Maybe something like this?
– DJP
3 hours ago
Welcome to TeX.SE. Useknitr
like this: <tex.stackexchange.com/a/481061>
– Ross
3 hours ago
I can think of 2 suggestions:
datatool
package if you are willing to save some of the results inside a file and read into your LaTeX code later. Another way is write18 which you might be able to run a shell command with that. However, if you are using overleaf as a online editor, only the first suggestion might worth trying.– Majid Abdolshah
3 hours ago
I can think of 2 suggestions:
datatool
package if you are willing to save some of the results inside a file and read into your LaTeX code later. Another way is write18 which you might be able to run a shell command with that. However, if you are using overleaf as a online editor, only the first suggestion might worth trying.– Majid Abdolshah
3 hours ago
The
sagetex
package uses open source computer algebra system SAGE which includes R, see here. If you don't mind using Cocalc then you have access to SAGE, which should let you run R, and insert the results into your LaTeX document, similar to my answer here which used SAGE but not R in calculating descriptive statistics. Sagetex documentation here.– DJP
3 hours ago
The
sagetex
package uses open source computer algebra system SAGE which includes R, see here. If you don't mind using Cocalc then you have access to SAGE, which should let you run R, and insert the results into your LaTeX document, similar to my answer here which used SAGE but not R in calculating descriptive statistics. Sagetex documentation here.– DJP
3 hours ago
First page of
sagetex
document says "Similarly, the R statistical computing environment includes Sweave, which lets you do the same thing with R code and LATEX". So maybe worth looking into Sweave. Maybe something like this?– DJP
3 hours ago
First page of
sagetex
document says "Similarly, the R statistical computing environment includes Sweave, which lets you do the same thing with R code and LATEX". So maybe worth looking into Sweave. Maybe something like this?– DJP
3 hours ago
Welcome to TeX.SE. Use
knitr
like this: <tex.stackexchange.com/a/481061>– Ross
3 hours ago
Welcome to TeX.SE. Use
knitr
like this: <tex.stackexchange.com/a/481061>– Ross
3 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
MoRitz is a new contributor. Be nice, and check out our Code of Conduct.
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%2ftex.stackexchange.com%2fquestions%2f481802%2freporting-r-results-in-latex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
MoRitz is a new contributor. Be nice, and check out our Code of Conduct.
MoRitz is a new contributor. Be nice, and check out our Code of Conduct.
MoRitz is a new contributor. Be nice, and check out our Code of Conduct.
MoRitz is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- 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%2ftex.stackexchange.com%2fquestions%2f481802%2freporting-r-results-in-latex%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
I can think of 2 suggestions:
datatool
package if you are willing to save some of the results inside a file and read into your LaTeX code later. Another way is write18 which you might be able to run a shell command with that. However, if you are using overleaf as a online editor, only the first suggestion might worth trying.– Majid Abdolshah
3 hours ago
The
sagetex
package uses open source computer algebra system SAGE which includes R, see here. If you don't mind using Cocalc then you have access to SAGE, which should let you run R, and insert the results into your LaTeX document, similar to my answer here which used SAGE but not R in calculating descriptive statistics. Sagetex documentation here.– DJP
3 hours ago
First page of
sagetex
document says "Similarly, the R statistical computing environment includes Sweave, which lets you do the same thing with R code and LATEX". So maybe worth looking into Sweave. Maybe something like this?– DJP
3 hours ago
Welcome to TeX.SE. Use
knitr
like this: <tex.stackexchange.com/a/481061>– Ross
3 hours ago