-
Notifications
You must be signed in to change notification settings - Fork 1
/
r-novice-gapminder--04-data-structures-part1.diff
70 lines (54 loc) · 1.79 KB
/
r-novice-gapminder--04-data-structures-part1.diff
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff --git a/home/zhian/Documents/Carpentries/Git/zkamvar--postmaul/data/rmd-repos/swcarpentry--r-novice-gapminderR3/_episodes/04-data-structures-part1.md b/home/zhian/Documents/Carpentries/Git/zkamvar--postmaul/data/rmd-repos/swcarpentry--r-novice-gapminderR4/_episodes/04-data-structures-part1.md
index 0062404..6a92e0f 100644
--- a/home/zhian/Documents/Carpentries/Git/zkamvar--postmaul/data/rmd-repos/swcarpentry--r-novice-gapminderR3/_episodes/04-data-structures-part1.md
+++ b/home/zhian/Documents/Carpentries/Git/zkamvar--postmaul/data/rmd-repos/swcarpentry--r-novice-gapminderR4/_episodes/04-data-structures-part1.md
@@ -105,8 +105,7 @@ cats$coat
~~~
-[1] calico black tabby
-Levels: black calico tabby
+[1] "calico" "black" "tabby"
~~~
{: .output}
@@ -151,17 +150,10 @@ cats$weight + cats$coat
~~~
-Warning in Ops.factor(cats$weight, cats$coat): '+' not meaningful for factors
+Error in cats$weight + cats$coat: non-numeric argument to binary operator
~~~
{: .error}
-
-
-~~~
-[1] NA NA NA
-~~~
-{: .output}
-
Understanding what happened here is key to successfully analyzing data in R.
## Data Types
@@ -292,7 +284,7 @@ typeof(cats$weight)
~~~
-[1] "integer"
+[1] "character"
~~~
{: .output}
@@ -308,17 +300,10 @@ cats$weight + 2
~~~
-Warning in Ops.factor(cats$weight, 2): '+' not meaningful for factors
+Error in cats$weight + 2: non-numeric argument to binary operator
~~~
{: .error}
-
-
-~~~
-[1] NA NA NA NA
-~~~
-{: .output}
-
What happened? When R reads a csv file into one of these tables, it insists that
everything in a column be the same basic type; if it can't understand
*everything* in the column as a double, then *nobody* in the column gets to be a
@@ -1362,7 +1347,7 @@ class(matrix_example)
~~~
-[1] "matrix"
+[1] "matrix" "array"
~~~
{: .output}