Hi, I had the same result from a slightly different code: data%>% group_by(x)%>% count(y)%>% mutate(freq = n / sum(n)) I appreciate your videos so much. I also learn a lot from Q&A in these comments. Thanks a million.
Hello Larissa, In the tutorial, the frequency of ys is calculated relative to xs, in your code, the frequency of xs is calculated with respect to the ys. Regards, Cansu
Hey Ruqayah, Histograms are usually not created based on frequencies of categorical variables. You may create a barplot though. Have a look here: statisticsglobe.com/barplot-in-r Regards, Joachim
Hey Jesse, the table created in the video shows the proportions within each group of the variable x. In case you want to know the frequency of 1 A relative to the entire data frame, you can use the following code: data2
Hey Angelica, generally speaking, you can extract columns using the $ operator (e.g. data$x). Could you illustrate how the values in your column look and how the output should be formatted? Regards, Joachim
@@StatisticsGlobe I'm using the midwest date set and in the one column I have percollege which is percentage of people that went to college and I want to extract that into my tibble, but i need it to show me the proportion of college educated people.
Hi, I had the same result from a slightly different code:
data%>%
group_by(x)%>%
count(y)%>%
mutate(freq = n / sum(n))
I appreciate your videos so much. I also learn a lot from Q&A in these comments. Thanks a million.
Thank you so much for the very kind words Khang, glad you find my tutorials useful! Also, thanks a lot for sharing your alternative code!
The uses of this code must be really interesting, I will apply this to work!
Glad to hear that, I hope it will help you daily workflow :)
Thank you
Thanks for the feedback Bridgett. Hope the video was helpful.
very useful
Thanks Beatus! Glad you think so!
Thanks a lot!
You're welcome Hitomi! :)
R! How is that different from:
data1 %>%
count(X,Y) %>%
group_by(Y) %>%
mutate(prop = prop.table(n) * 100) ? Love your videos :)
Hello Larissa,
In the tutorial, the frequency of ys is calculated relative to xs, in your code, the frequency of xs is calculated with respect to the ys.
Regards,
Cansu
@@cansustatisticsglobe Thank you very much!
@@larissacury7714, You are welcome!
Can you use this info to create a histogram, and if so, how do you do that?
Hey Ruqayah, Histograms are usually not created based on frequencies of categorical variables. You may create a barplot though. Have a look here: statisticsglobe.com/barplot-in-r Regards, Joachim
@@StatisticsGlobe I just renamed the variable and then could reference it. Also, thanks for the reference.
You are welcome :)
So, what if you wanted to know, for example, what proportion of 1 is A?
Hey Jesse, the table created in the video shows the proportions within each group of the variable x. In case you want to know the frequency of 1 A relative to the entire data frame, you can use the following code:
data2
If you have a tibble, inside the tibble is a column of percentages that I want to extract as proportions.
How do I do that?
Hey Angelica, generally speaking, you can extract columns using the $ operator (e.g. data$x). Could you illustrate how the values in your column look and how the output should be formatted? Regards, Joachim
@@StatisticsGlobe I'm using the midwest date set and in the one column I have percollege which is percentage of people that went to college and I want to extract that into my tibble, but i need it to show me the proportion of college educated people.
So the values in your data look like that "25%" and you want to convert it to that "0.25"?
@@StatisticsGlobe yes, but I need to do that and extract it from the existing tibble into a new tibble.
Please have a look at the following example code:
library("tidyverse")
tibble1