Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftable returned by freq_table must be data.frame or tibble #3

Closed
aravindhebbali opened this issue Aug 28, 2017 · 1 comment
Closed
Assignees

Comments

@aravindhebbali
Copy link
Member

ftable returned by freq_table() must be a data.frame or tibble instead of matrix.

> ecom <- readr::read_csv('https://raw.githubusercontent.com/rsquaredacademy/datasets/master/web.csv', 
+   col_types = list(col_integer(), 
+   col_factor(levels = c('bing', 'direct', 'google', 'social', 'yahoo')), 
+   col_factor(levels = c('tablet', 'laptop', 'mobile')), 
+   col_factor(levels = c('true', 'false')), col_integer(), col_double(), 
+   col_double(), col_character(), col_factor(levels = c('true', 'false')), 
+   col_double(), col_double())            
+ )
> freq_table(ecom$referrer)
$ftable
     Levels   Frequency Cum Frequency Percent Cum Percent
[1,] "bing"   "194"     "194"         "19.4"  "19.4"     
[2,] "direct" "191"     "385"         "19.1"  "38.5"     
[3,] "google" "208"     "593"         "20.8"  "59.3"     
[4,] "social" "200"     "793"         "20"    "79.3"     
[5,] "yahoo"  "207"     "1000"        "20.7"  "100"      

$varname
[1] "referrer"

attr(,"class")
[1] "freq_table"
@aravindhebbali
Copy link
Member Author

> k <- freq_table(ecom$referrer)
> k$ftable
# A tibble: 5 x 5
  Levels Frequency `Cum Frequency` Percent `Cum Percent`
   <chr>     <int>           <int>   <dbl>         <dbl>
1   bing       194             194    19.4          19.4
2 direct       191             385    19.1          38.5
3 google       208             593    20.8          59.3
4 social       200             793    20.0          79.3
5  yahoo       207            1000    20.7         100.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant