Reputation: 45
I am a newbie to R- I got this file from Professor. In the Groesse col. u have 1004 col.s altogether
lnr Klasse Gesch Alter Groesse Gewicht Mathe Physik Deutsch Bio Fehltage
1 6 w 12 124 42 3 NA 2 3 2
2 5 w 12 146 39 4 NA 2 2 3
3 10 w 17 174 64 4 3 5 2 4
4 8 w 15 138 53 5 6 4 3 0
5 8 w 15 147 56 5 4 3 2 3
6 9 m 16 162 65 2 2 4 2 2
7 6 w 14 141 49 2 NA 2 3 2
8 10 w 16 166 60 5 5 1 3 2
9 6 w 13 152 44 4 NA 2 2 1
10 5 w 12 151 39 5 NA 4 4 4
11 6 w 13 154 46 2 NA 2 1 4
12 5 w 12 163 41 1 NA 5 1 4
13 6 m 12 139 47 5 NA 5 4 1
14 7 w 14 145 51 4 NA 5 5 2
15 8 w 14 157 49 5 5 4 2 1
16 7 w 14 159 49 4 NA 2 3 1
17 9 w 15 149 55 1 2 3 2 3
18 6 m 13 144 49 1 NA 3 1 6
19 11 m 17 190 71 5 5 3 2 1
20 6 m 12 150 46 3 NA 2 3 6
21 9 w 17 165 65 3 6 5 1 5
22 5 w 13 151 47 2 NA 5 4 2
23 10 w 17 154 65 5 3 4 4 5
Here is the result:
Daten <- read.csv(file="C:/Users/WillieEkaPutra/Documents/D.Studium/Sem3/Stati 1/Uebung/Schueler.csv")
hist(Daten$Groesse)
# Error in hist.default(Daten$Groesse) : 'x' must be numeric
hist(as.numeric(Daten$Groesse))
# Error in hist.default(as.numeric(Daten$Groesse)) :
#
# invalid number of 'breaks'
hist(as.numeric(Daten$Groesse), breaks= 1)
# Error in hist.default(as.numeric(Daten$Groesse), breaks = 1) :
# character(0)
# In addition: Warning messages:
# 1: In min(x) : no non-missing arguments to min; returning Inf
# 2: In max(x) : no non-missing arguments to max; returning -Inf
hist(as.numeric(Daten$Groesse), breaks= 1)
# Error in hist.default(as.numeric(Daten$Groesse), breaks = 1004) :
# character(0)
# In addition: Warning messages:
# 1: In min(x) : no non-missing arguments to min; returning Inf
# 2: In max(x) : no non-missing arguments to max; returning -Inf
Anyone knows, what is wrong? I will be so happy for any help. regards, wili
Upvotes: 1
Views: 5899
Reputation: 423
will you keep read.csv(file = "url of your file", header = T and sep = ";") like this and instead of ;(semicolon) use separator of your record
Upvotes: 1
Reputation: 6516
@WillieEkaputra you have to delete the bracket after the path and put a comma there. Like this:
Daten <- read.table(file="C:/Users/WillieEkaPutra/Documents/.../Schueler.txt", header=TRUE)
This should make it work, if the path is right.
Upvotes: 2