Get access to all lessons in this course.
- Welcome to Reproducibility for the Rest of Us
- Reproducibility for the Rest of Us Course Logistics
- Using Space Wisely
- Naming All the Things
- Using Function Arguments
- Prologs & Annotation
- Using Seed Values
- Writing Functions for Repeated Tasks
- Literate Programming with Quarto
- Embedding Files to Improve Reproducibility
- Managing Project Files for Reproducibility
Reproducibility for the Rest of Us
Using Space Wisely
This lesson is locked
This lesson is called Using Space Wisely, part of the Reproducibility for the Rest of Us course. This lesson is called Using Space Wisely, part of the Reproducibility for the Rest of Us course.
If the video is not playing correctly, you can watch it in a new window
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Your Turn
Open the
unformatted-r-code.R
file and fix the formattingAdd hard returns to keep lines short
Add spaces after punctuation and around operators
Indent functions or processes that go together
Choose an option:
Fix the formatting by hand
Fix the formatting by hand then then run
styler
to find anything missedFix it using the
styler
package entirely
Learn More
Two great resources on writing readable code are:
You need to be signed-in to comment on this post. Login.
PAUL JEBARAJ
January 20, 2024
Hi, I have tried to fix the unformatted file entirely by using the styler approach and see nil changes..?? Opened the file,
ran:
then used the drop down in the add-in and selected "style active file".
I see nil changes were made ( that is it did not format anything).
In the console, I see: styler:::style_active_file() Using style transformers
styler::tidyverse_style()
Any help would be much appreciated. Thankn you kindly. Paul
David Keyes Founder
January 21, 2024
Hmm, it's hard to say without seeing your screen. Do you mind uploading a video here? Please send me an email when it's up and I'll review it and get back to you here.