1

My code in RStudio is the next one:

---
title: "QUESTION 8 (a)"
author: "Ana"
date: "17/2/2023"
output: 
  beamer_presentation:
    theme: "Malmoe"
    colortheme: "crane"
    toc: true
    slide_level: 2
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tinytex)
library(revealjs)
library(ISLR)
```


# Enunciado

bottomUse the lm() function to perform a simple linear regression with "mpg" as the response and "horsepower" as the predictor. Use the summary() function to print the results. Comment the result. For example:



# i)

```{r}
data(Auto)
fit <- lm(mpg ~ horsepower, data = Auto)
```

```{r}
summary(fit)
```

I want that the part of the code called "summary(fit)" appears in another slide, but i doesn´t, this appears in the same as "fit<-lm........"

How can I fix this? Thanks.

1
  • You have to indent your code with 4 spaces. You can do so by selecting all code and then press the {} button when you edit your question. Feb 17 at 12:37

1 Answer 1

1

You can use ## to start a new frame:

---
title: "QUESTION 8 (a)"
author: "Ana"
date: "17/2/2023"
output: 
  beamer_presentation:
    theme: "Malmoe"
    colortheme: "crane"
    toc: true
    slide_level: 2
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tinytex)
library(revealjs)
library(ISLR)
```


# Enunciado

bottomUse the lm() function to perform a simple linear regression with "mpg" as the response and "horsepower" as the predictor. Use the summary() function to print the results. Comment the result. For example:



# i)

```{r}
data(Auto)
fit <- lm(mpg ~ horsepower, data = Auto)
```

##

```{r}
summary(fit)
```

enter image description here

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .