BaşlayınÜcretsiz başlayın

How many people answered the chocolate suvey?

Before we fit a hierarchical model, we should know how many people answered the survey. The person who answered each question in the chocolate data is identified by a number in the Subject variable. We can find out how many people are described in the data by finding the number of levels of the subject variable. The chocolate data is already loaded. levels() returns a vector with the levels of a factor and length() will tell us the length of the vector.

Bu egzersiz, kursun bir parçasıdır

Choice Modeling for Marketing in R

Kursa Göz Atın

Egzersiz talimatları

  • Compute the length() of the levels() of chocolate$Subject.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Determine the number of subjects in chocolate$Subjects
Kodu Düzenle ve Çalıştır