[R] best method to format output of frequency table

Henrique Dallazuanna wwwhsd at gmail.com
Wed Sep 16 14:20:52 CEST 2009


Try this:

 as.matrix(table(x))

On Tue, Sep 15, 2009 at 6:50 PM, esawdust <landon at 360vl.com> wrote:
>
> I have some security alert log data that I'm parsing and doing some stats on.
> One of the fields is the "Classtype" which is the enumerated value of the
> type of alert found.
>
> classtypes = factor( alerts$Classtype )
> fclass_types = table( classtypes )
>
> fclass_types gives me a frequency table of the intrusion types:
>
> fclass_types
> classtypes
>                                  attempted-admin          attempted-recon
>                      18                       93                       35
>          attempted-user            misc-activity              misc-attack
>                      21                       30                       12
>  protocol-command-decode        unsuccessful-user web-application-activity
>                       2                        2                      287
>
>
> I would like to be able to somehow output this table in the form:
>
> attempted-admin  93
> attempted-recon   35
> attempted-user    21
> misc-activity       30
>
> and so on.   Is there a function I'm missing or some option that will let me
> be able to dump the fclass_types out in a two-column format?
>
> Thanks for any tips,
>
> Landon
> --
> View this message in context: http://www.nabble.com/best-method-to-format-output-of-frequency-table-tp25462448p25462448.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O




More information about the R-help mailing list