Question 5
0/1 point (graded)
The following is the full path to a homework assignment file called "assignment.txt": /Users/student/Documents/projects/homeworks/assignment.txt.
Which line of code will allow you to move the assignment.txt file from the “homeworks” directory into the parent directory “projects”?
mv assignment.txt
mv assignment.txt .
mv assignment.txt ..
mv assignment.txt /projects incorrect
Answer
Incorrect:
Try again. This code does not provide enough information about where to move the file. You need to specify a relative or full path to the location where you want to move the file to.
Question 9
0/1 point (graded)
The source function reads a script from a url or file and evaluates it. Check ?source in the R console for more information.
Suppose you have an R script at ~/myproject/R/plotfig.R and getwd() shows ~/myproject/result, and you are running your R script with source('~/myproject/R/plotfig.R').
Which R function should you write in plotfig.R in order to correctly produce a plot in ~/myproject/result/fig/barplot.png?
ggsave('fig/barplot.png'), because this is the relative path to the current working directory.
ggsave('../result/fig/barplot.png'), because this is the relative path to the source file ("plotfig.R"). incorrect
ggsave('result/fig/barplot.png'), because this is the relative path to the project directory.
ggsave('barplot.png'), because this is the file name.
Question 12
1 point possible (graded)
Which of the following meanings for options following less are not correct?
(Hint: use man less to check.)
-g: Highlights current match of any searched string
-i: case-insensitive searches
-S: automatically save the search object
-X: leave file contents on screen when less exits.
Question 13
1 point possible (graded)
Which of the following statements is incorrect about preparation for a data science project?
Select ALL that apply.
Always use absolute paths when working on a data science project.
Saving .RData every time you exit R will keep your collaborator informed of what you did.
Use ggsave to save generated files for use in a presentation or a report.
Saving your code in a Word file and inserting output images is a good idea for making a reproducible report.
Question 5
The following is the full path to a homework assignment file called "assignment.txt": /Users/student/Documents/projects/homeworks/assignment.txt.
Which line of code will allow you to move the assignment.txt file from the “homeworks” directory into the parent directory “projects”?
mv assignment.txt
mv assignment.txt .
mv assignment.txt ..
mv assignment.txt /projects
Answer : mv assignment.txt ..
syntax to move file is : mv filename directoryPath
To denote parent directory we use ".." (double dots) in unix. Hence in the above question it is mv assignment.txt ..
******************************
Question 9
The source function reads a script from a url or file and evaluates it. Check ?source in the R console for more information.
Suppose you have an R script at ~/myproject/R/plotfig.R and getwd() shows ~/myproject/result, and you are running your R script with source('~/myproject/R/plotfig.R').
Which R function should you write in plotfig.R in order to correctly produce a plot in ~/myproject/result/fig/barplot.png?
Answer : ggsave('fig/barplot.png'), because this is the relative path to the current working directory.
While executing the script , it takes current working directory which is "~/myproject/result" . Hence to save the plot in ~/myproject/result/fig/barplot.png, have to use fig/barplot.png.
******************************
Question 12
Which of the following meanings for options following less are not correct?
(Hint: use man less to check.)
Answer : -S: automatically save the search object
-g: Highlights current match of any searched string ->correct
-i: case-insensitive searches ->correct
-S: automatically save the search object ->incorrect (-S means Chop (truncate) long lines rather than wrapping.)
-X: leave file contents on screen when less exits. ->correct
******************************
Question 13
Which of the following statements is incorrect about preparation for a data science project?
Select ALL that apply.
Answer :
Always use absolute paths when working on a data science project. ->(You should never use absolute paths in your scripts, because they hinder sharing: no one else will have exactly the same directory configuration as you.)
Get Answers For Free
Most questions answered within 1 hours.