Commit dc210095 authored by Virgile Baudrot's avatar Virgile Baudrot
Browse files

add gitignore and vignette

parent e75cc48e
inst/doc #ignore gitignore !
.gitignore
# History files
.Rhistory
vignettes/.Rhistory
# Example code in package build process
*-Ex.R
# R data files from past sessions
.Rdata
.RData
..pdf
..Rcheck
# RStudio files
.Rbuildignore
.Rproj.user/
fdf.Rproj
# some generated files
man/*.Rd
# NAMESPACE
--- ---
title: "start" title: "Getting started"
output: rmarkdown::html_vignette output: rmarkdown::html_vignette
vignette: > vignette: >
%\VignetteIndexEntry{start} %\VignetteIndexEntry{start}
...@@ -17,7 +17,7 @@ knitr::opts_chunk$set( ...@@ -17,7 +17,7 @@ knitr::opts_chunk$set(
``` ```
The package `fdf` allow to work with column-list. When for instance you have a list of time series that you want to include in a `data.frame`. The package `fdf` allows to work with column-list. When for instance you have a list of time series that you want to include in a `data.frame`.
Since it works only with `data.frame` object, there is no new object, you can use very easily with any package like `dplyr` (and the tidyverse) and spatio-temporal object with package `sf` for instance. Since it works only with `data.frame` object, there is no new object, you can use very easily with any package like `dplyr` (and the tidyverse) and spatio-temporal object with package `sf` for instance.
...@@ -25,28 +25,25 @@ Since it works only with `data.frame` object, there is no new object, you can us ...@@ -25,28 +25,25 @@ Since it works only with `data.frame` object, there is no new object, you can us
library(fdf) library(fdf)
``` ```
# Add a new column-list with `fd_add` ### Add a new column-list with `fd_add`
```{r addData} ```{r addData}
DF = data.frame( A = 1:10) DF = data.frame( A = 1:5)
DFD = fd_add(DF, "B", function(i) rnorm(runif(1, 4,20))) DFD = fd_add(DF, "B", function(i) round(rnorm(runif(1, 4,10))))
DFD DFD
``` ```
# Filter element in a column-list with `fd_filter` ### Filter element in a column-list with `fd_filter`
```{r filter} ```{r filter}
fd_filter(DFD, "B", 1)
fd_filter(DFD, "B", 2)
fd_filter(DFD, "B", 3) fd_filter(DFD, "B", 3)
``` ```
# Find index of element in column-list matching with a key using `fd_match` ### Find index of element in column-list matching with a key using `fd_match`
```{r} ```{r match}
DFD = fd_add(DFD, "C", function(i) sample(1:5, 5)) DFD = fd_add(DFD, "C", function(i) sample(1:5, 5))
idMatch = fd_match(DFD, "C", 4) idMatch = fd_match(DFD, "C", 4)
...@@ -56,22 +53,16 @@ idMatch ...@@ -56,22 +53,16 @@ idMatch
fd_filter(DFD, "C", idMatch) fd_filter(DFD, "C", idMatch)
``` ```
# Melting column-list to a classical data.frame with `fd_melt` ### Melting column-list to a classical data.frame with `fd_melt`
```{r meltSimple} ```{r meltSimple}
fd_melt(DFD, "B")
fd_melt(DFD, "B", keep = "A")
fd_melt(DFD, "B", keep = list("A", "C")) fd_melt(DFD, "B", keep = list("A", "C"))
``` ```
when two column list have the same length for each elements, we can melt in the same time when two column-lists have the same length for each elements, we can melt in the same time
```{r meltDouble} ```{r meltDouble}
DFD = fd_add(DFD, "B2", function(i) 1:length(DFD$B[[i]])) DFD = fd_add(DFD, "B2", function(i) 1:length(DFD$B[[i]]))
fd_melt(DFD, "B", "B2")
fd_melt(DFD, "B", "B2", keep = list("A", "C")) fd_melt(DFD, "B", "B2", keep = list("A", "C"))
``` ```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment