In: Computer Science
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
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 is mv assignment.txt ..
.. represents the parent directory
ex :
Please let me know if anything is required
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.
-g : highlight the string which was found by last search command - is correct
-i: case-insensitive searches - is correct
-S: automatically save the search object : is correct Save current content (got from another program like grep) in a file.
-X: leave file contents on screen when less exits. : is incorrect
Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.