Graphics in pdf in R

Asked

Viewed 475 times

-1

I have the following exercise and I am in doubt on item b in bold.

Perform a data analysis, using lm(), between two variables, as we did in the room, but you should import data from any source, using read.table() or equivalent commands according to the data format.

(1) Data -- choose the variables you want to work and manipulate the data in an electronic spreadsheet; export the file in the format you want to be imported into R.

(2) Adjust -- after importing the data, make an adjustment with lm() using different models (functional forms) and place the data points and adjustments found on the chart (PDF format).

(3) send in compressed file containing only 2 files:

a. the data archive;

b. the code to be executed in R -- it is important to emphasize that the user must execute the code with source() and the code must do the whole task: import, analysis and generation of the Plots in PDF, and use of the Summary command to display the important statistical information of each model.

How to generate the graphic in pdf?

1 answer

2

Use the function pdf

Example:

pdf('grafico.pdf')
H <- c(2,3,3,3,4,5,5,5,5,6)
counts <- table(H)
barplot(counts)
dev.off()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.