Skip to content

Commit

Permalink
example vignette update
Browse files Browse the repository at this point in the history
  • Loading branch information
sebkopf committed Nov 12, 2016
1 parent 447f02a commit b59736f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plot_maps <- function(data, draw_ROIs = T, normalize = T, color_scale = c("black
scale_y_continuous(expression("y ["*mu*"m]"), expand = c(0,0)) +
scale_x_continuous(expression("x ["*mu*"m]"), expand = c(0,0)) +
scale_fill_continuous(low=color_scale[1], high=color_scale[2]) +
expand_limits(x = c(0, data$frame_size[1]), y = c(0, data$frame_size[1])) +
expand_limits(x = c(0, data$frame_size.um[1]), y = c(0, data$frame_size.um[1])) +
theme_bw() +
theme(panel.background = element_rect(fill = "black"),
panel.margin = unit(0, "mm"),
Expand Down
19 changes: 6 additions & 13 deletions inst/doc/example.html

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions vignettes/example.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ You can install this package directly from [GitHub](https://github.com/sebkopf/l

```{r, eval=FALSE}
install.packages("devtools")
devtools::install_github('sebkopf/lans2r')
devtools::install_github('KopfLab/lans2r')
```

## Load data

To load data into R, export it from LANS which creates a folder for each analysis with sub folders **dat** containing the aggregated information about the different ROIs (in text file format) and **mat** containing the raw ion maps (in Matlab file format). Both of these can be imported easily with this package. For easier demonstration **lans2r** bundles a set of 3 analyses (folders `analysis1`, `analysis2` and `analysis3`) with the package sources.

```{r, message=FALSE}
```{r, message=FALSE, warning=FALSE}
library(lans2r)
folder <- system.file("extdata", "nanosims_data", package = "lans2r") # data base directory
```
Expand All @@ -49,8 +49,8 @@ To calculate ratios and abundances, simply specificy which ions you would like t
```{r}
data <- data %>%
calculate_sums(c(`13C`, `12C`), c(`15N12C`, `14N12C`)) %>%
calculate_ratios(c(`13C`, `12C`), c(`15N12C`, `14N12C`), c(`13C+12C`, `15N12C+14N12C`)) %>% # calculate ratios
calculate_abundances(c(`13C`, `12C`), c(`15N12C`, `14N12C`)) # calculate abundances
calculate_ratios(c(`13C`, `12C`), c(`15N12C`, `14N12C`), c(`13C+12C`, `15N12C+14N12C`)) %>%
calculate_abundances(c(`13C`, `12C`), c(`15N12C`, `14N12C`))
```

For additional operations, one can use the more generic `calculate` function and provide custom functions for value and error calculations and name construction. Here, we have APE (atom percent enrichment) as an example.
Expand All @@ -76,9 +76,8 @@ data <- data %>%

Let's take a look at the first couple of rows of the data frame.

```{r}
library(knitr)
data %>% head(n=10) %>% kable()
```{r, warning=FALSE}
data %>% head(n=10) %>% knitr::kable()
```

Since this is now in long format so it's easy to have both `value` and the `sigma` error, it's hard to see line by line what is going on, let's look just at `analysis1` and recast the values into a wide format using the `spread_data` function.
Expand Down

0 comments on commit b59736f

Please sign in to comment.