Print?
After running the code, you may see [1]
preceding the results. This is R's way of indicating that the line starts with the first element in your output. As you progress through the course, you'll encounter outputs with multiple elements.
As you recall, in R, it's unnecessary to use a specific function to display output values.
Let's say we want to carry out a division operation.
If your goal is to 'round' a number to a desired number of significant characters, you can employ the familiar print()
function from other programming languages.
Here's how you use the function:
For instance, we can round the division result from our previous example to three significant characters.
As demonstrated, the output of the expression has been rounded to three significant characters.
Tarefa
- On the first line, execute a division of
50
by7
. - On the second line, divide
50
by7
again, but this time round the result to four significant characters using theprint()
function.
Tudo estava claro?
Conteúdo do Curso
R Introduction: Part I
R Introduction: Part I
Print?
After running the code, you may see [1]
preceding the results. This is R's way of indicating that the line starts with the first element in your output. As you progress through the course, you'll encounter outputs with multiple elements.
As you recall, in R, it's unnecessary to use a specific function to display output values.
Let's say we want to carry out a division operation.
If your goal is to 'round' a number to a desired number of significant characters, you can employ the familiar print()
function from other programming languages.
Here's how you use the function:
For instance, we can round the division result from our previous example to three significant characters.
As demonstrated, the output of the expression has been rounded to three significant characters.
Tarefa
- On the first line, execute a division of
50
by7
. - On the second line, divide
50
by7
again, but this time round the result to four significant characters using theprint()
function.
Tudo estava claro?