Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Reading chapter : R Functions Used In This Chapter Chapter 5 c() Combines data elements together.

Reading chapter : R Functions Used In This Chapter

Chapter 5

c() Combines data elements together.

<- Indicates an assignment arrow.

data.frame() Makes a dataframe from separate vectors.

head() Lists the first row in a dataframe.

str() Reports the structure of a data object.

summary() Reports data modes/types and a data overview.

tail() Lists the last row of a dataframe.

$ Use to address a column by name.

Gather some basic "demographic" information from about five friends or family members and then enter those data into a dataframe using the appropriate R commands.

2. Finally, summarize the contents of the dataframe, again using the appropriate R commands. Keep the demographics "light" to avoid getting too personal.

3. For each person report (1) the number of pets that they have (dogs, cats, etc.); (2) their birth order in their family (i.e., 1 for first born, etc.); and (3) the number of siblings they have.

4. Collect the necessary data from your friends and family members; write, test, and submit the necessary code in R to accomplish the following:

  1. Create three vectors of integers (whole numbers) as described above, using the c( ) (concatenate/combine) command to store data reported by group members, with these variable names: Pets, Order, and Siblings.
  2. Also create a vector of user IDs for the friends and family members.
  3. Bind those four vectors together into a dataframe called myFriends. (Just as we did in Chapter 5 with myFamily-LEARN: Rows & Columns)
  4. Use the appropriate R command to report the structure of your dataframe as well as a summary of the data (with minimums, means, maximums, etc. as shown on page 39). The result should show, "X obs. Of 4 variables," where X is the number of friends and family members who reported their data.
  5. Use the $ notation explained on page 39 to list all of the values for each of the variables in the myFriends dataframe (e.g. myGroup$Pets).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Programming questions

Question

Understand the content theories of motivation.

Answered: 1 week ago

Question

-x/2 x/4 If A = -x/2 and A-1 =6 then x equals

Answered: 1 week ago