Questions tagged [frequency-table]

38 questions
1
vote
1 answer

How to obtain frequency table in R from one data set, using intervals and breaks form a different data set?

I have tried to get a frequency table for one dataset ("sim") using the intervals and classes from another dataset ("obs") (both of the same type). I've tried using the table () function in R, but it doesn't give me the frequency of the dataset…
Bondo
  • 43
  • 3
1
vote
3 answers

Grouping columns and getting frequency using purrr::map

I am trying to get crosstabs of multiple columns using tidyverse code. Sample data: df <- data.frame(col1=c("a", "b", "c", "c"), col2=c(NA, "d", "d","e")) %>% mutate_all(as.character) df col1 col2 1 a 2 b d 3 c d 4 c …
EML
  • 615
  • 4
  • 14
1
vote
3 answers

Pandas value_counts() with multiple matches in same row

I have categorical data (A, B, etc.) in which multiple matches can exist within the same field such as A,B. I would like to break my data into additional rows just for the purpose of counting the number of instances of each value. df =…
Francis Smart
  • 3,875
  • 6
  • 32
  • 58
1
vote
1 answer

Return table with count of elements that match a condition

I am new in Stack overflow. I have some experience in R but not a lot. I guess what I want to achieve is pretty simple but I do not know how to get it. I have a data frame that consists of four columns: Participant ID, Trial ID, Question ID and…
Miguel
  • 15
  • 3
1
vote
2 answers

Frequency count in R

I want it to display a frequency table of total domestic ( which includes Boston + salt lake city) and total frequency of international ( London + Shanghai). But it prints it out like this. table$Category<-c("Domestic","International") > table …
ysarak
  • 11
  • 3
1
vote
1 answer

How to merge attributes on a frequency table in R?

Assume that i have two variables. See Dummy data below: Out of 250 records: SEX Male : 100 Female : 150 HAIR Short : 110 Long : 140 The code i currently use is provided below, For each variable a different table is created: sexTable <-…
Loizos Vasileiou
  • 674
  • 10
  • 37
1
vote
1 answer

How do I extract specific frequencies from very large frequency tables in R?

I am making frequency tables (from a long list of genetic sequences) of the number of times genes appear in my sequencing samples. I've been using the ftable() function just fine, but I am narrowing my search and want to focus on a few specific…
Molly F
  • 11
  • 3
0
votes
1 answer

Is there a way to create a table in R that shows both frequency and proportion values for a dataframe using dplyr?

I want to create a table in R that looks something like this: I have tried many different approaches using dplyr and basic R but nothing looks like I want it to. Here is an example of my dataframe: Country Gender Income Country…
anso_s
  • 1
  • 1
0
votes
0 answers

How to use functions to generate an automated table of risk ratios and attack rates for a set of variables

I have a foodborne outbreak dataset (I made up the data in this example for privacy reasons) of foods at a picnic that tells which people ate the food and which people got sick. I would like to create functions and code to generate a table with…
Matt
  • 25
  • 4
0
votes
1 answer

Creating multiple frequency count tibbles at once in R

I have data on 30 people that includes ethnicity, gender, school type, whether they received free school meals, etc. I want to produce frequency counts for all of these features. Currently my code looks like this: df <- read.csv("~file") df %>%…
Jess
  • 11
  • 2
0
votes
1 answer

Calculating the median of data in a frequency table

I want to calculate the median age for each group in this data frame: dfx<-data.frame(group=c(1:100), `1`=rnorm(100,50,0.5), `2`=rnorm(100,45,15), `3`=rnorm(100,17,5)) colnames(dfx) <- c("group",…
Loz
  • 137
  • 8
0
votes
2 answers

Plot a histogram for a frequency table in R- ggplot2

I have a frequency table of number of occurrences of a variable per each value of reference (essentially bin size). For example (see data below): column 1, row 1 is reference value (0-5) and column 2, column 3 and column 4 represent the number of…
trailblazer_1
  • 111
  • 1
  • 7
0
votes
1 answer

How to add and subtract specific values from a frequency table in r?

This may have been asked before, but I couldn't find it. I have a data set and created a frequency table based on the data frame. I It looks like this: outcome N 1 3 70 2 1 8000 3 4 212 4 2 …
irene123
  • 11
  • 2
0
votes
1 answer

Output the n most frequent numbers in a frequency table as a list

I made a frequency table to count items from a given list. Example input: list[1, 2, 1, 1, 0, 8, 8] frequencyTable() returns a dict. of items from the list with their occurence counted. printTable() prints that return. With my example it would be…
Moepius
  • 17
  • 4
0
votes
0 answers

Pandas: How To Convert From 'Frequency Table' To Flat Dataframe Format?

How do I convert a Pandas dataframe from a 'frequency table' format to a flat dataframe format and back again using idiomatic Python? From: H E K 0 B B 12 1 B G 3 2 G B 17 3 G G …
matekus
  • 778
  • 3
  • 14