Load a file from your Data Store in RStudio¶
Draft: not yet validated
The code on this page was run inside MESA RStudio Geospatial on 2026-11-13 (R 4.6.2), by the AI assistant that drafted it, and produced the output shown, one step at a time. No person has yet followed the steps, so a screen may differ. Tell us what you find.
You will: have the practice readings loaded as an R data frame, with a row count you have checked.
Time: 5 to 10 minutes. You need: to be signed in to the MESA Portal, and your CyVerse username.
Steps¶
-
In the portal, click Applications, and on the MESA RStudio Geospatial card click Instant Launch. Wait for RStudio to open.
You should see: RStudio, with the Console on the left.
-
In the Console, go to a practice folder in your Data Store and fetch the files, with your own username in the first line:
setwd("~/data-store/home/<your username>") dir.create("mesa-practice", showWarnings = FALSE) setwd("mesa-practice") base <- "https://idss-mesa.github.io/trainings/assets/practice/" for (f in c("gauges.csv", "readings.csv")) download.file(paste0(base, f), f)You should see: two lines that begin
downloaded. -
Read both files:
readings <- read.csv("readings.csv", na.strings = "") gauges <- read.csv("gauges.csv")You should see:
readingsandgaugesappear in the Environment tab at the top right.na.strings = ""tells R that an empty cell is a missing value, not an empty piece of text. -
Check the size:
dim(readings)You should see: rows, then columns.
[1] 152 4 -
Look at the first rows:
head(readings)You should see:
<NA>whereverflagwas blank in the file.gauge_id date value flag 1 G01 2026-07-01 0.0 <NA> 2 G01 2026-07-02 0.0 <NA> 3 G01 2026-07-03 24.9 <NA> 4 G01 2026-07-04 0.0 <NA> 5 G01 2026-07-05 17.6 <NA> 6 G01 2026-07-06 0.0 <NA> -
Check what type each column was read as:
str(readings)You should see:
valueas numbers (num), anddateas text (chr). R did not turn the dates into dates;as.Date(readings$date)does that when you need it.
Check it worked¶
dim(readings) is 152 4, the size the practice data page gives,
and the Environment tab lists readings with 152 obs. of 4 variables.
If it didn't¶
cannot open file 'readings.csv': No such file or directory. R is not in the
folder that holds the file. Run getwd() to see where it is, then repeat the setwd()
lines in step 2 with your username spelled exactly.
Next¶
- Tally a quality flag in R
- The same task in Python: Load a file from your Data Store into a notebook.
- Reference: MESA RStudio Geospatial.
Not yet validated by a person in MESA RStudio Geospatial. Drafted with AI assistance on 2026-11-13; the code was run there that day (R 4.6.2).
Machine-readable versions of this page: Markdown twin · raw source on GitHub · llms.txt · llms-full.txt (whole site). See For AI agents.