Re: Plotting categorical data

 

This is probably getting outside the realms of Linux for the list, but at the same time, R is a tool that can be used on Linux, it's open source AND the R has a very *nix* like feel to it, IMHO. 

In R, c() is used to create a vector.
A character vector would be c("a", "b", "c")
A numeric vector would be c(1,2,3) or simply 1:3 for short.

By default, read.table will make character columns into factors.  You can change this with the option stringsAsFactor = FALSE.

Factors can be helpful at times. Most people tend to avoid them, as they can do weird things later on.
Your Referee vector is a factor. This is why levels(Referee) is showing you the uniques. Be careful with levels(), it will not always show in alphabetical order.
You could also use the unique() function.

In thinking of your c(...) vector, notice the example below. "A" will "recycle" itself.

A <-1:2
B <- seq(10, 40, by =10)   # i.e. c(10, 20, 30, 40)
A * B

It was as though you did A <- c(1,2,1,2)

Jared



On Wed, Dec 5, 2018 at 12:00 PM Gordon Haverland <ghaverla@...> wrote:
There are N referees in the system, some work more than others.

If I do
 levels( Referee )
it displays the (unique) Referees found, and displays them in
alphabetical order.

--

Gord




Join elug@groups.io to automatically receive all group messages.