Week 5 revision — reproduce and transfer
Try each question before opening its hint or answer.
Topic quizzes: computers and data size · remote work · small study · reproduction · consolidation.
Q1. Name the location, not just the filename
Your report rendered remotely, but local Downloads is empty. What should you check? Does closing the SSH terminal necessarily delete saved remote output?
Rendering, transferring, and locating the received copy are separate actions.
Locate the output on the remote computer, then check whether it was transferred and to which destination. A remote desktop is not automatic synchronisation. Closing SSH ends a session, not saved files, subject to the service’s storage policy. Whether a running process continues depends on the service.
Q2. Where does R keep its objects?
You load a table with read_csv(), calculate growth in the console, and then restart R. Which of these still exist: the CSV file, the object in the Environment pane, the saved script? Which part of the computer holds each?
RAM is fast but temporary; the disk is slower but permanent.
The CSV file and the saved script survive: they are on disk. The object was in RAM and disappears when R restarts. This is why reports are rendered from saved files in a fresh session.
Q3. Will it fit?
Estimate the RAM needed for a table with 1,000,000 rows and 10 numeric columns. How much free RAM would you plan for? Would a single-cell table of 30,000 genes × 100,000 cells fit on a 16 GB laptop?
One number in R takes 8 bytes. 1 MB = 1,000,000 bytes; 1 GB = 1,000 MB.
1,000,000 × 10 × 8 = 80,000,000 bytes = 80 MB; plan for about 2–3 times that (160–240 MB) as working space. The single-cell table needs 30,000 × 100,000 × 8 bytes = 24 GB before working space, more than a 16 GB laptop has: use a subset or a bigger (remote) computer.
Q4. Available duckweed measurements
Twenty independent flasks were started, ten per allocation. Nutrient flask F17 spilled before weighing. How many available biomass observations are there, and why is replacing the missing value by zero inappropriate?
Start with ten per group, then account for the documented spill.
There are 10 control and 9 nutrient observations, 19 in total. Zero would invent a known biomass; unavailable and absent biomass are different meanings. Retain the original row, report the loss, and make the comparison conditional on the observed data and missingness limitation.
Q5. A percentage difference needs its units
In the supplied alternative, percentage yield is 100 × collected mass / supplied maximum mass, with matching mass units. Protocol means are 68.67% and 77.00%. Is their difference an 8.33% relative increase? Does it establish greater purity?
Subtracting two percentages gives a difference in percentage points.
The modified-minus-standard difference is 8.33 percentage points. A relative percentage change would divide by the starting mean and multiply by 100; it is a different quantity. Greater yield alone does not establish greater purity, safety, sustainability, or general superiority. Product purity was an explicit simplifying assumption in this numerical exercise, not a measured finding.
Q6. Share a recipe, not only its output
A reader receives your HTML but cannot update the analysis for new data. What else should be in the shared project? Why test extraction in a new location?
HTML displays a result; source and inputs are needed to update it.
Include the .Rmd source, actual input CSV, dictionary, project file, required output folder if used, and a short README naming packages and the file to render. Testing a new location detects dependencies on personal absolute paths or missing files. The .Rproj does not contain the dataset. A fresh session detects hidden interactive objects. Include only the study files.
Q7. What does successful reproduction establish?
Your report renders successfully from the shared source and input. Does that prove the design and interpretation are correct, or provide a backup against losing your only disk?
Test reproduction, scientific validity, and backup separately.
It establishes that the supplied work regenerates the result in the tested environment. A flawed analysis can be reproducible. Scientific validity still needs the design, assumptions, checks, and reasoning. Backup is a separate action: keep a retrievable copy using supported separate storage.
Q8. Checks have limits
The received table has the same filename, byte size, row count, and column names as the source. Does this prove that every measurement matches? What would you check in a small transfer audit before making a stronger claim?
A changed value can leave a table’s dimensions unchanged.
No. A changed value can occupy the same number of characters, and tables can have identical dimensions but different contents. Inspect the intended saved input, verify named records and missing values, and compare the contents using the supported method. Record the actual source and destination locations. Check saved contents rather than an unsaved editor buffer.
Q9. File size is not object size
A CSV of 100,000 rows × 10 numbers rounded to one decimal is 4.79 MB on disk. Is the loaded object in R larger or smaller? What happens to the object and the file when a unique text ID such as S000001 is added to every row?
In a CSV, one character is one byte; in R, one number is 8 bytes. Each different text value in R carries its own bookkeeping.
Larger: 100,000 × 10 × 8 bytes = 8.0 MB, because a value such as 19.3, takes only 5 bytes as text. With the ID column the object grows to 14.4 MB (6.4 MB for the IDs) but the file only to 5.59 MB. Check with object.size() and file.size() rather than assuming the file size equals RAM.
Q10. DNA and images as bytes
data/dna.txt holds 40 letters and is 41 bytes. Estimate the human genome (about 3.1 billion letters) as a text file. Then estimate one grayscale camera image of 2048 × 2048 pixels as an 8-bit file and as numbers in R.
One letter or one 8-bit pixel is 1 byte; one number in R is 8 bytes. The 41st byte of dna.txt is the line ending.
The genome is about 3.1 GB as text. The image has 4,194,304 pixels: about 4.2 MB as an 8-bit file and 33.6 MB as numbers in R.
Q11. A fresh dataset requires fresh counts
The algae table has 24 independent cultures, twelve per allocation. A19 in the supplement group spilled before weighing. Its available group means are 28.20 mg for reference and 33.91818 mg for supplement. Give available n and the observed supplement-minus-reference difference. Must supplement contain the largest single observation?
One supplement outcome is unavailable; subtract reference mean from supplement mean.
Available n is 12 reference and 11 supplement, 23 in total. The directed difference is 33.91818 - 28.20 ≈ 5.72 mg. A higher group mean does not require every value to be higher: reference culture A11 at 41.7 mg is the largest individual observation. Describe both the centre and observations.
Q12. A sensitivity check does not justify deletion
Omitting A11 lowers the algae reference mean to 26.97273 mg and increases the observed difference to about 6.95 mg. No source record identifies A11 as an error. Which result should be primary, and how should the other be labelled?
Ask whether the source record supports an exclusion.
Keep the all-available-measurements result primary: about 5.72 mg. The other is a diagnostic sensitivity calculation with an explicitly changed sample and no independent evidence for exclusion. Reweighing preferences or a more convenient p-value cannot justify removing a recorded observation. A19 remains a distinct missing measurement; omitting A11 does not repair that loss.
Q13. Rendering can miss the more serious fault
In a disposable report copy, an input is temporarily renamed. In another copy, the prose claims that every enrolled duckweed flask had a measured outcome. Which fault should stop rendering, and which may render successfully?
A missing input can stop execution; software can reproduce false prose.
The unchanged input path should fail when its required file is unavailable. Restore its exact name/path, rerun, and compare the result. The false prose can render successfully because software does not automatically validate the claim. It contradicts the documented missing F17 measurement. Check scientific meaning as well as execution; keep intentionally faulty copies out of the final package.
Q14. Is this a rounding difference or a different analysis?
One memo gives a mean of 33.91818 mg and the report displays 33.92 mg. Another report gives 34.32 mg. What should be investigated, and why should you check the input and calculation before changing display precision?
Round 33.91818 to two decimal places, then compare it with both displayed values.
33.92 is the first value rounded to two decimal places. 34.32 is not explained by that rounding. Check the saved input, available counts, group selection, outcome definition, and calculation, then confirm which rendered file was opened. Changing the number of displayed digits cannot repair a different input or an unrecorded exclusion. Retain full-precision values for subsequent calculations.
Q15. The receiver has the old README
You made report-share-v1.zip, extracted it into receiver-v1, and then added a missing unit to report-share/README.txt. The README in receiver-v1 still lacks the unit. What happened, and how do you give your colleague the corrected version? Is the ZIP on your laptop also your backup?
A ZIP is a snapshot of the folder at the moment it was made.
Neither the old ZIP nor its extracted copy changes when you edit the source folder. Make report-share-v2.zip from the folder that contains report-share, extract it into a new folder such as receiver-v2, check that the unit is there, and send v2. The ZIP is not a backup: it sits on the same disk as the original, so keep a copy on separate supported storage as well.
Return to day 25 consolidation and save your next-lab workflow with the reference pages.