<- seq(-5, 5, length = 100)
x # Hint: Use the plot function
Problem set 1
After finishing the homework, you are to turn in all the code to GitHub using git.
Start an RStudio project. Pick a good name following a naming convention. Start a Quarto document called
beginning.qmd
.Create a directory called
img
and save a screen shot of your RStudio session for the project. Include your screenshot in the Quarto document.Next, in your Quarto document, define variables \(a=1, b=-1, c=-2\) and print out the solutions to \(f(x) = ax^2+bx+c=0\). Do not report complex solutions, only real numbers.
Include a graph of \(f(x)\) versus \(x\) for \(x \in (-5,5)\).
- Create a directory called
docs
. Use the commandquarto render
to create a PDF and save it to thedocs
directory. Show us the command you typed:
# Your code here
- Use Unix to create a directory called
data
in the project home directory. Include the Unix command you used to create the directory.
# Your code here
- Use a terminal-based text editor to create a file
coefs.txt
in thedata
directory and save three coefficients,1 -1 -2
for example. Show us the Unix commands you used to achieve this:
# Your code here
- Make a directory called
code
. Use Unix to copy the filebeginning.qmd
to a file calledquadratic.qmd
in the code directory. Show us the Unix commands you used.
# Your code here
Edit the
quadratic.qmd
file to read ina
,b
, andc
from the filecoefs.txt
. Make sure to use a relative path when reading the file. As before, print out the solutions to \(f(x) = ax^2+bx+c=0\). Do not report complex solutions, only real numbers.Change the path of the file you are reading to the full path you get when you type
file.path(getwd(), "data/coefs.txt")
. Confirm that the file still renders. Then move the entirepset-01-rmarkdown
project to a directory calledRtmpyDknq4
. Does the file render? Change the path back to a relative path and see if it renders.