-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataFrame.r
More file actions
56 lines (33 loc) · 796 Bytes
/
DataFrame.r
File metadata and controls
56 lines (33 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
x<-10:1
y<--5:4
q<-c('Hockey', 'Football', 'Baseball', 'Curling', 'Rugby',
'Lacrosse', 'Basketball', 'Tennis', 'Cricket', 'Soccer')
theDF<-data.frame(x, y, q)
theDF
theDF<-data.frame(First=x, Second= y, Sport=q)
class(theDF$Sport)
theDF<-data.frame(First=x, Second= y,Sport=q, stringsAsFactors=FALSE)
class(theDF$Sport)
nrow(theDF)
ncol(theDF)
dim(theDF)
NROW(theDF)
nrow(x)
length(x)
NROW(x)
names(theDF)
nrow(theDF)[3]
rownames(theDF)
rownames(theDF)<-c('One', 'Two', 'Three', 'Four', 'Five', 'Six',
'Seven', 'Eight', 'Nine', 'Ten')
rownames(theDF)
theDF
head(theDF)
head(theDF, n=7)
tail(theDF)
class(theDF)
theDF$Sport
theDF[3,2]
theDF[, 3, drop=FALSE]
theDF[,c('First', 'Sport')]
theDF[,c('Sport', 'First')]