Summary() Help?

Hi all! I'm having an issue with the summary function in rstudio. My data set is titled (Sample_Data_Set) from Chapter 3 of the Salkind/Shaw book. I am attempting to replicate the example using the summary function from chapter 3, but instead of this:
Gender
Female: 14
Male: 11

Treatment
Control: 17
Experimental: 8

I'm getting this:
Gender
Length: 25
Class: character
Mode: character

Treatment
Length: 25
Class: character
Mode: character

To my knowledge I have replicated everything exactly and have even tried importing the data in different ways and have tried different data sets with the same issue. Is there something I'm missing? I'd like to be able to find out the frequency without having to manually count. Thanks in advance!

We need to see your code and some sample data, Please have a look at

Suspect the book used R3.x and you are using R4.x, and that you are importing from a CSV file?

If so, R no longer imports as factors by default. There are several solutions.

Sample_Data_Set$Gender <- as.factor(Sample_Data_Set$Gender)

May be the solution.

1 Like

This was perfectly helpful for what I needed! Thank you! -Bri

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.