Skip to content

Commit

Permalink
separate oue first code steps so set wd can be set to eval=FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
bhass-neon committed Jan 25, 2024
1 parent aa27a69 commit 2f5ff42
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,28 @@ Please be sure that you have *at least* version 2.10 of `rhdf5` installed. Use:
# Load `terra` and `rhdf5` packages to read NIS data into R
library(terra)
library(rhdf5)
```

<div id="ds-dataTip" markdown="1">

<i class="fa fa-star"></i> **Data Tip:** To update all packages installed in
R, use `update.packages()`.

</div>

```{r set-wd, eval=FALSE, results="hide" }
# set working directory to ensure R can find the file we wish to import and where
# we want to save our files. Be sure to move the download into your working directory!
wd <- "~/data/" #This will depend on your local environment
setwd(wd)
```

# Define the file name to be opened
```{r define-h5, results="hide" }
# Define the h5 file name to be opened
f <- paste0(wd,"NEON_hyperspectral_tutorial_example_subset.h5")
```

<div id="ds-dataTip" markdown="1">

<i class="fa fa-star"></i> **Data Tip:** To update all packages installed in
R, use `update.packages()`.

</div>
You can use `h5ls` and/or `View(h5ls(...))` to look at the contents of the hdf5 file, as follows:

```{r view-file-strux, eval=FALSE, comment=NA}
# look at the HDF5 file structure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ <h2 id="read-hdf5-data-into-r">Read HDF5 data into R</h2>
library(terra)

library(rhdf5)



# set working directory to ensure R can find the file we wish to import and where
</code></pre>
<div id="ds-dataTip" markdown="1">
<p><i class="fa fa-star"></i> <strong>Data Tip:</strong> To update all packages installed in
R, use <code>update.packages()</code>.</p>
</div>
<pre><code># set working directory to ensure R can find the file we wish to import and where

# we want to save our files. Be sure to move the download into your working directory!

Expand All @@ -188,15 +190,11 @@ <h2 id="read-hdf5-data-into-r">Read HDF5 data into R</h2>
setwd(wd)



# Define the file name to be opened
# Define the h5 file name to be opened

f &lt;- paste0(wd,&quot;NEON_hyperspectral_tutorial_example_subset.h5&quot;)
</code></pre>
<div id="ds-dataTip" markdown="1">
<p><i class="fa fa-star"></i> <strong>Data Tip:</strong> To update all packages installed in
R, use <code>update.packages()</code>.</p>
</div>
<p>You can use <code>h5ls</code> and/or <code>View(h5ls(...))</code> to look at the contents of the hdf5 file, as follows:</p>
<pre><code># look at the HDF5 file structure

View(h5ls(f,all=T))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ Please be sure that you have *at least* version 2.10 of `rhdf5` installed. Use:

library(rhdf5)


<div id="ds-dataTip" markdown="1">

<i class="fa fa-star"></i> **Data Tip:** To update all packages installed in
R, use `update.packages()`.

</div>


# set working directory to ensure R can find the file we wish to import and where

Expand All @@ -155,18 +161,12 @@ Please be sure that you have *at least* version 2.10 of `rhdf5` installed. Use:

setwd(wd)



# Define the file name to be opened
# Define the h5 file name to be opened

f <- paste0(wd,"NEON_hyperspectral_tutorial_example_subset.h5")

<div id="ds-dataTip" markdown="1">

<i class="fa fa-star"></i> **Data Tip:** To update all packages installed in
R, use `update.packages()`.

</div>
You can use `h5ls` and/or `View(h5ls(...))` to look at the contents of the hdf5 file, as follows:


# look at the HDF5 file structure
Expand Down

0 comments on commit 2f5ff42

Please sign in to comment.