Skip to content

Commit 87a5c58

Browse files
Proof reading: intro to r data types
1 parent 6733cd9 commit 87a5c58

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

individual_modules/introduction_to_r/data_types.ipynb

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@
382382
"\n",
383383
"Let's take a closer look at the `iris` data.\n",
384384
"\n",
385-
"First, let's ask what type of thing `iris` is using the function ```class()```\n"
385+
"First, let's ask what type of thing `iris` is using the function ```class()``` for.\n"
386386
]
387387
},
388388
{
@@ -421,7 +421,7 @@
421421
"tags": []
422422
},
423423
"source": [
424-
"The output tells us that it is a data frame. A data frame is an example of R object, and can be defined by certain properties. A data frame is comparable to a spreadsheet in MS Excel as it is a 2 dimensional object (i.e. has rows and columns). Data frames are very useful for storing data, especially if you are used to work with your data in tables. A typical data frame of experimental data contains individual observations in rows and variables in columns.\n",
424+
"The output tells us that it is a data frame. A data frame is an example of an R object, and can be defined by certain properties. A data frame is comparable to a spreadsheet in MS Excel as it is a 2 dimensional object (i.e. has rows and columns). Data frames are very useful for storing data, especially if you are used to work with your data in tables. A typical data frame of experimental data contains individual observations in rows and variables in columns.\n",
425425
"We can see the shape, or dimensions, of the data frame with the function ```dim()```:"
426426
]
427427
},
@@ -476,7 +476,7 @@
476476
"\n",
477477
"# Subsetting Data\n",
478478
"\n",
479-
"There are many occasions we want to \"look\" at some part of the data. Extract a subset is known as slicing.\n",
479+
"There are many occasions we want to \"look\" at some part of the data. Extracting a subset is known as slicing.\n",
480480
"If we want to get a single value from the data frame, we can index a specific position using square brackets.\n",
481481
"If you are familiar with matrices we index in the same way. For example, to get the element in the top left corner, i.e. in the first row and first column we run:"
482482
]
@@ -768,8 +768,8 @@
768768
"* Numeric - all real numbers e.g. 7.5\n",
769769
"* Integer - e.g. 2\n",
770770
"* Complex - numbers with real and imaginary parts e.g. 1+4i\n",
771-
"* Character - consists of letters or numbers or symbols or a combination of these e.g. \"a\", \"f5\", \"datatypes\", \"Learning R is fun\".\n",
772-
"* Logical - only takes TRUE or FALSE\n",
771+
"* Character - consists of letters or numbers or symbols or a combination of these e.g. \"a\", \"f5\", \"datatypes\", \"Learning R is fun\"\n",
772+
"* Logical - only takes TRUE or FALSE.\n",
773773
"\n",
774774
"\n",
775775
"These data types are also used to characterise other one dimensional R objects such as individual values or vectors \n",
@@ -783,7 +783,7 @@
783783
"* ```length()```- how long is it? \n",
784784
"* ```attributes()``` - does it have any metadata? \n",
785785
"* ```str``` - display the internal structure of an object.\n",
786-
"* ```is.numeric()```, ```is.character()```, ```is.complex()```, ```is.logical()``` - returns TRUE when an object is the datatype queried, FALSE if not\n",
786+
"* ```is.numeric()```, ```is.character()```, ```is.complex()```, ```is.logical()``` - returns TRUE when an object is the datatype queried, FALSE if not.\n",
787787
"\n",
788788
"Let's define some variables we can use R to profile the charateristics of"
789789
]
@@ -970,8 +970,7 @@
970970
"\n",
971971
"# Data Structures\n",
972972
"\n",
973-
"R has a number of inbuilt structures that can be used to store datasets. We have encountered one of these already \n",
974-
"the data.frame. Other include: \n",
973+
"R has a number of inbuilt structures that can be used to store datasets. We have encountered one of these already - the data.frame. Other include: \n",
975974
"\n",
976975
"* strings\n",
977976
"* vectors \n",
@@ -1221,7 +1220,7 @@
12211220
"## Matrices\n",
12221221
"\n",
12231222
"A matrix is another two dimensional object, but it differs to a data.frame as all columns/entries must be of the same type. \n",
1224-
"It is more efficient memory wise than a data.frame, but can not be used as a substitute to all data.frames.\n",
1223+
"It is more efficient memory-wise than a data.frame, but can-not be used as a substitute to all data.frames.\n",
12251224
"\n",
12261225
"We can construct a matrix as follows:"
12271226
]
@@ -1259,7 +1258,7 @@
12591258
"id": "88039000-c333-4361-8263-979a7f10253b",
12601259
"metadata": {},
12611260
"source": [
1262-
"When creating a __matrix__, it is important to remember that matrices __*are filled column-wise*__ If that is not what you want, you can use the ```byrow``` argument (a logical: can be ```TRUE``` or ```FALSE```) to specify how the matrix is filled.\n",
1261+
"When creating a __matrix__, it is important to remember that matrices __*are filled column-wise*__. If that is not what you want, you can use the ```byrow``` argument (a logical: can be ```TRUE``` or ```FALSE```) to specify how the matrix is filled.\n",
12631262
"\n",
12641263
"We can confirm the data type of a matrix with the function `class`."
12651264
]
@@ -1296,7 +1295,7 @@
12961295
"source": [
12971296
"## Arrays\n",
12981297
"\n",
1299-
"Arrays are n dimensional storage structures. A one dimensional array is a vector, a two dimensional array is a matrix. \n",
1298+
"Arrays are n-dimensional storage structures. A one-dimensional array is a vector, a two-dimensional array is a matrix. \n",
13001299
"\n",
13011300
"We will not be using this type of object, but it is included for completeness.\n",
13021301
"\n",
@@ -1306,7 +1305,7 @@
13061305
"including vectors, matrices, data.frames, functions, strings, numbers. They tend to be used to collate different \n",
13071306
"data types connected in some way. \n",
13081307
"\n",
1309-
"We can create a list of the vectors, data.frames we have already constructed as follows."
1308+
"We can create a list of the vectors and data.frames we have already constructed as follows:"
13101309
]
13111310
},
13121311
{

0 commit comments

Comments
 (0)