Skip to content

Commit dc3cf57

Browse files
authored
Update Exercise_7.md
1 parent 0d3ed48 commit dc3cf57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

exercises/Exercise_7.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ pdf(file = "gene_length_vs_count.pdf") # This tells R that you want to make a pd
2626
plot(df$length, df$count) # Make the plot
2727
dev.off() # And save the plot
2828
```
29-
Run the script with `Rscript my_second_Rscript.R`. You should see the output of the messages when loading tidyverse, the output or reading the csv files as well as somehting like "null device 1" (this is from the pdf-plotting). In addition there should now be a new pdf file on Saga. Download it to your local computer and open it.
29+
Run the script with `Rscript my_second_Rscript.R`. You should see the output of the messages when loading tidyverse, the output or reading the csv files as well as somehting like "null device 1" (this is from the pdf-plotting). In addition there should now be a new pdf file in your home directory (if not, check carefully the filepaths in the R script and compare with your directory structure on Fox). Download the pdf file to your local computer and open it.
3030

3131
### Part 3
32-
If you for example want to repeat the commands in *my_second_Rscript.R* on a different data file, or save the pdf with a different file name you have to open and change the script every time. But it's also possible to pass "arguments" when running the R script that allows you to create a more flexible script that can do different operations every time.
32+
If you for example want to repeat the commands in *my_second_Rscript.R* on a different data file, or save the pdf with a different file name, you have to open and change the script every time. But it's also possible to pass "arguments" when running the R script that allows you to create a more flexible script that can do different operations every time.
3333
- Copy *my_second_Rscript.R* to a new file called *my_third_Rscript.R* using the Unix `cp` command.
3434
- Change the contents to this:
3535
```{r}
3636
library(tidyverse)
37-
args <- commandArgs(trailingOnly=TRUE) # This captures whatever you type in the command line
38-
df <- read_csv("~/BIOS-IN5410/data/data_file_1.csv")
37+
args <- commandArgs(trailingOnly=TRUE) # This captures whatever you type on the command line
38+
df <- read_csv("~/BIOS-IN5410/data/data_file_1.csv") # Make sure the file path is correct
3939
# Create an object that stores the file name
4040
name <- args[1]
4141
# Plot gene length vs. count

0 commit comments

Comments
 (0)