Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Labeling List Elements | Section
Essential R Programming for Absolute Beginners - 1768563985826

bookLabeling List Elements

List elements can be given labels to make them easier to identify and work with.

Assigning Labels on List Creation

To assign labels during the list creation, use the syntax name = value (without quotes around the name) in the list() function.

Example

12
test <- list(text = "Text", number = 42, logical = TRUE) test
copy

Assigning Labels to an Existing List

If the list is already created, you can add labels afterward by assigning a vector of labels to names(list).

Example

123
test <- list("Text", 42, TRUE) names(test) <- c('text', 'number', 'logical') test
copy
Tarefa

Swipe to start coding

You have a list info with course information.

Your task is to:

  1. Use the names() function to assign the following names to its elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'.
  2. Output the resulting list.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 42
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

bookLabeling List Elements

Deslize para mostrar o menu

List elements can be given labels to make them easier to identify and work with.

Assigning Labels on List Creation

To assign labels during the list creation, use the syntax name = value (without quotes around the name) in the list() function.

Example

12
test <- list(text = "Text", number = 42, logical = TRUE) test
copy

Assigning Labels to an Existing List

If the list is already created, you can add labels afterward by assigning a vector of labels to names(list).

Example

123
test <- list("Text", 42, TRUE) names(test) <- c('text', 'number', 'logical') test
copy
Tarefa

Swipe to start coding

You have a list info with course information.

Your task is to:

  1. Use the names() function to assign the following names to its elements: 'Course name', 'Section', 'Chapter', 'Chapter overall'.
  2. Output the resulting list.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 42
single

single

some-alt