Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Що таке Фактор? | Фактори
Вступ до R: Частина 1
course content

Зміст курсу

Вступ до R: Частина 1

Вступ до R: Частина 1

1. Базовий Синтаксис та Команди
2. Вектори
3. Фактори

Що таке Фактор?

Факторні змінні (factors) широко росповсюджені у повсякденних даних та різноманітних дослідженнях. Синонімічний термін - категоріальна змінна. Такий тип змінної має обмежений набір можливих значень, що відрізняє його від числових. Приклади категорійних змінних - група крові, валюта, національність тощо.

З іншого боку, місячний дохід, зріст і ціна не є категорійними, оскільки можливі значення є необмеженими. Однак навіть ці типи можна перетворити на категорійні, що ми розглянемо в майбутніх розділах.

1234
# Vector of currencies curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') typeof(curr)
copy

In fact, a factor is a type of vector. To indicate to R that we are working with factor values, we use the factor() function and pass the relevant vector of values as an argument:

12345
curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') # Convert into factor curr_f <- factor(curr) curr_f
copy

Upon execution, not only is the vector of values output, but we also see a line titled Levels:, which indicates all the distinct (unique) values the factor can take.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 1
toggle bottom row

Що таке Фактор?

Факторні змінні (factors) широко росповсюджені у повсякденних даних та різноманітних дослідженнях. Синонімічний термін - категоріальна змінна. Такий тип змінної має обмежений набір можливих значень, що відрізняє його від числових. Приклади категорійних змінних - група крові, валюта, національність тощо.

З іншого боку, місячний дохід, зріст і ціна не є категорійними, оскільки можливі значення є необмеженими. Однак навіть ці типи можна перетворити на категорійні, що ми розглянемо в майбутніх розділах.

1234
# Vector of currencies curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') typeof(curr)
copy

In fact, a factor is a type of vector. To indicate to R that we are working with factor values, we use the factor() function and pass the relevant vector of values as an argument:

12345
curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') # Convert into factor curr_f <- factor(curr) curr_f
copy

Upon execution, not only is the vector of values output, but we also see a line titled Levels:, which indicates all the distinct (unique) values the factor can take.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 1
toggle bottom row

Що таке Фактор?

Факторні змінні (factors) широко росповсюджені у повсякденних даних та різноманітних дослідженнях. Синонімічний термін - категоріальна змінна. Такий тип змінної має обмежений набір можливих значень, що відрізняє його від числових. Приклади категорійних змінних - група крові, валюта, національність тощо.

З іншого боку, місячний дохід, зріст і ціна не є категорійними, оскільки можливі значення є необмеженими. Однак навіть ці типи можна перетворити на категорійні, що ми розглянемо в майбутніх розділах.

1234
# Vector of currencies curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') typeof(curr)
copy

In fact, a factor is a type of vector. To indicate to R that we are working with factor values, we use the factor() function and pass the relevant vector of values as an argument:

12345
curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') # Convert into factor curr_f <- factor(curr) curr_f
copy

Upon execution, not only is the vector of values output, but we also see a line titled Levels:, which indicates all the distinct (unique) values the factor can take.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Факторні змінні (factors) широко росповсюджені у повсякденних даних та різноманітних дослідженнях. Синонімічний термін - категоріальна змінна. Такий тип змінної має обмежений набір можливих значень, що відрізняє його від числових. Приклади категорійних змінних - група крові, валюта, національність тощо.

З іншого боку, місячний дохід, зріст і ціна не є категорійними, оскільки можливі значення є необмеженими. Однак навіть ці типи можна перетворити на категорійні, що ми розглянемо в майбутніх розділах.

1234
# Vector of currencies curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') typeof(curr)
copy

In fact, a factor is a type of vector. To indicate to R that we are working with factor values, we use the factor() function and pass the relevant vector of values as an argument:

12345
curr <- c('USD', 'EUR', 'AUD', 'NOK', 'CHF', 'EUR', 'AUD', 'EUR') # Convert into factor curr_f <- factor(curr) curr_f
copy

Upon execution, not only is the vector of values output, but we also see a line titled Levels:, which indicates all the distinct (unique) values the factor can take.

Завдання

Imagine we conducted a survey on blood groups and received 26 responses, which are now stored in the blood vector. Here's what you need to do:

  1. Display the values of the original vector blood.
  2. Convert blood into a factor and assign it to the variable blood_gr.
  3. Display the values of blood_gr.
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 1
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt