A
A
AlexLIn2015-03-21 17:02:07
R
AlexLIn, 2015-03-21 17:02:07

R incorrectly counts why?

Good afternoon. There is a file fish.csv (at the end of the question)
I read from it
d <- read.csv("fish.csv")
I try to see the table
table(d$sex)
and R tells me

f f     m 
 19   1  23

And should
f     m
20  23

And if you create a boxplot
boxplot(d$wingspan ~ d$sex)
shows this
b3e6ee9927f74b59be36cf97916bb7d4.png
Which is also not correct at all.
What's wrong here?
"wingspan","sex"
"23.8","m"
"26.6","f"
"24.4","m"
"30.3","f"
"22.3","m"
"24.5","m"
"24.1","m"
"23.5","m"
"31.0","m"
"22.6","m"
"23.5","m"
"25.1","f"
"28.7","f"
"30.5","m"
"29.7","f"
"18.4","m"
"26.3","m"
"27.4","f"
"25.1","m"
"22.4","f"
"22.4","m"
"32.3","f"
"25.6","m"
"20.8","m"
"25.7","m"
"23.9","m"
"13.1","f"
"26.8","f"
"21.1","f"
"22.0","m"
"19.6","f"
"27.2","f"
"18.3","f"
"23.4","f"
"23.7","f"
"30.7","m"
"26.1","f"
"23.4","f"
"25.7","m"
"21.9","f"
"27.6","m"
"22.9","m"
"29.2","f"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
protven, 2015-03-21
@protven

d <- read.csv("fish.csv", header=TRUE )
PS It is highly recommended to learn the help command.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question