You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/09-L3-intro-to-R.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,7 +161,7 @@ b
161
161
## [1] 5
162
162
```
163
163
164
-
In addition to standard alphanumeric characters, strings can also store various special characters. Special characters are identified using a backlash followed by a single character, the most relevant are the special character for tab : "\t" and new line : "\n". To demonstrate the these special characters lets concatenate (cat) together two strings with these characters separating (sep) them:
164
+
In addition to standard alphanumeric characters, strings can also store various special characters. Special characters are identified using a backlash followed by a single character, the most relevant are the special character for tab : `\t` and new line : `\n`. To demonstrate the these special characters lets concatenate (cat) together two strings with these characters separating (sep) them:
Note that special characters work differently in different functions. For instance the "paste" function does the same thing as "cat" but does not recognize special characters.
190
+
Note that special characters work differently in different functions. For instance the `paste` function does the same thing as `cat` but does not recognize special characters.
Single or double backslash is also used as an "escape" character to turn off special characters or allow quotation marks to be included in strings:
217
+
Single or double backslash is also used as an `escape` character to turn off special characters or allow quotation marks to be included in strings:
218
218
219
219
220
220
```r
@@ -231,7 +231,7 @@ Special characters are generally only used in pattern matching, and reading/writ
231
231
dat= read.delim("file.tsv", sep="\t")
232
232
```
233
233
234
-
Another special type of character data are colours. Colours can be specified in three main ways: by name from those [available](http://bxhorn.com/r-color-tables/), by red, green, blue values using the "rgb" function, and by hue (colour), saturation (colour vs white) and value (colour/white vs black) using the "hsv" function. By default rgb and hsv expect three values in 0-1 with an optional fourth value for transparency. Alternatively, sets of predetermined colours with useful properties can be loaded from many different packages with [RColorBrewer](http://colorbrewer2.org/) being one of the most popular.
234
+
Another special type of character data are colours. Colours can be specified in three main ways: by name from those [available](http://bxhorn.com/r-color-tables/), by red, green, blue values using the `rgb` function, and by hue (colour), saturation (colour vs white) and value (colour/white vs black) using the `hsv` function. By default rgb and hsv expect three values in 0-1 with an optional fourth value for transparency. Alternatively, sets of predetermined colours with useful properties can be loaded from many different packages with [RColorBrewer](http://colorbrewer2.org/) being one of the most popular.
The "logical" class stores boolean truth values, i.e. TRUE and FALSE. It is used for storing the results of logical operations and conditional statements will be coerced to this class. Most other data-types can be coerced to boolean without triggering (or "throwing") error messages, which may cause unexpected behaviour.
256
+
The `logical` class stores boolean truth values, i.e. TRUE and FALSE. It is used for storing the results of logical operations and conditional statements will be coerced to this class. Most other data-types can be coerced to boolean without triggering (or "throwing") error messages, which may cause unexpected behaviour.
257
257
258
258
259
259
```r
@@ -368,14 +368,14 @@ as.numeric(as.character(x))
368
368
## [1] 20 25 23 38 20 40 25 30
369
369
```
370
370
371
-
To make R read text as character data instead of factors set the environment option "stringsAsFactors=FALSE". This must be done at the start of each R session.
371
+
To make R read text as character data instead of factors set the environment option `stringsAsFactors=FALSE`. This must be done at the start of each R session.
372
372
373
373
374
374
```r
375
375
options(stringsAsFactors=FALSE)
376
376
```
377
377
__Exercise__
378
-
How would you use factors to create a vector of colours for an arbitrarily long vector of fruits like "str_vector" above?
378
+
How would you use factors to create a vector of colours for an arbitrarily long vector of fruits like `str_vector` above?
379
379
__Answer__
380
380
381
381
@@ -437,9 +437,9 @@ class(x)
437
437
```
438
438
## [1] "character"
439
439
```
440
-
Here we tried to put character, numeric and logical data into a single vector so all the values were coerced to "character" data.
440
+
Here we tried to put character, numeric and logical data into a single vector so all the values were coerced to `character` data.
441
441
442
-
A "matrix" is the two dimensional version of a vector, it also requires all data to be of the same type.
442
+
A `matrix` is the two dimensional version of a vector, it also requires all data to be of the same type.
443
443
If we combine a character vector and a numeric vector into a matrix, all the data will be coerced to characters:
444
444
445
445
@@ -517,15 +517,15 @@ class(z[,1])
517
517
## [1] "factor"
518
518
```
519
519
520
-
Another difference between matrices and dataframes is the ability to select columns using the "$" operator:
520
+
Another difference between matrices and dataframes is the ability to select columns using the `$` operator:
521
521
522
522
523
523
```r
524
524
m$x# throws an error
525
525
z$x# ok
526
526
```
527
527
528
-
The final basic data structure is the "list". Lists allow data of different types and different lengths to be stored in a single object. Each element of a list can be any other R object : data of any type, any data structure, even other lists or functions.
528
+
The final basic data structure is the `list`. Lists allow data of different types and different lengths to be stored in a single object. Each element of a list can be any other R object : data of any type, any data structure, even other lists or functions.
529
529
530
530
531
531
```r
@@ -564,12 +564,12 @@ ll
564
564
## $even_a_function
565
565
## function (..., deparse.level = 1)
566
566
## .Internal(cbind(deparse.level, ...))
567
-
## <bytecode: 0x7f3bf97ae978>
567
+
## <bytecode: 0x55e4ded2f378>
568
568
## <environment: namespace:base>
569
569
```
570
570
571
571
Lists are most commonly used when returning a large number of results from a function that do not fit into any of the previous data structures.
572
572
573
573
## More information
574
574
575
-
You can get more information about any R commands relevant to these datatypes using by typing "?function" in an interactive session.
575
+
You can get more information about any R commands relevant to these datatypes using by typing `?function` in an interactive session.
Copy file name to clipboardExpand all lines: docs/10-L3-Intro-to-Bioconductor.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Task 1: In what ways is the untidy data not tidy? How could we make the untidy d
43
43
44
44
Tidy data is generally easier to work with than untidy data, especially if you are working with packages such as ggplot. Fortunately, packages are available to make untidy data tidy. Today we will explore a few of the functions available in the tidyr package which can be used to make untidy data tidy. If you are interested in finding out more about tidying data, we recommend reading "R for Data Science", by Garrett Grolemund and Hadley Wickham. An electronic copy is available here: http://r4ds.had.co.nz/
45
45
46
-
The untidy data above is untidy because two variables ("Wins" and "Losses") are stored in one column ("Category"). This is a common way in which data can be untidy. To tidy this data, we need to make "Wins" and "Losses" into columns, and store the values in "Counts" in these columns. Fortunately, there is a function from the tidyverse packages to perform this operation. The function is called `spread`, and it takes two arguments, `key` and `value`. You should pass the name of the column which contains multiple variables to `key`, and pass the name of the column which contains values from multiple variables to `value`. For example:
46
+
The untidy data above is untidy because two variables (`Wins` and `Losses`) are stored in one column (`Category`). This is a common way in which data can be untidy. To tidy this data, we need to make `Wins` and `Losses` into columns, and store the values in `Counts` in these columns. Fortunately, there is a function from the tidyverse packages to perform this operation. The function is called `spread`, and it takes two arguments, `key` and `value`. You should pass the name of the column which contains multiple variables to `key`, and pass the name of the column which contains values from multiple variables to `value`. For example:
47
47
48
48
49
49
```r
@@ -86,7 +86,7 @@ Task 2: The dataframe `foods` defined below is untidy. Work out why and use `spr
The other common way in which data can be untidy is if the columns are values instead of variables. For example, the dataframe below shows the percentages some students got in tests they did in May and June. The data is untidy because the columns "May" and "June" are values, not variables.
89
+
The other common way in which data can be untidy is if the columns are values instead of variables. For example, the dataframe below shows the percentages some students got in tests they did in May and June. The data is untidy because the columns `May` and `June` are values, not variables.
Copy file name to clipboardExpand all lines: docs/20-exprs-norm.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -436,7 +436,18 @@ plotRLE(
436
436
437
437
\caption{Cell-wise RLE of the tung data}(\#fig:norm-ours-rle-scran)
438
438
\end{figure}
439
+
scran sometimes calculates negative or zero size factors. These will completely distort the normalized expression matrix.
440
+
We can check the size factors scran has computed like so:
439
441
442
+
```r
443
+
summary(sizeFactors(umi.qc))
444
+
```
445
+
446
+
```
447
+
## Min. 1st Qu. Median Mean 3rd Qu. Max.
448
+
## 0.4646 0.7768 0.9562 1.0000 1.1444 3.4348
449
+
```
450
+
For this dataset all the size factors are reasonable so we are done. If you find scran has calculated negative size factors try increasing the cluster and pool sizes until they are all positive.
0 commit comments