# buffer

Buffers a signal vector into matrix

## Syntax

list <- buffer(x, n, p, opt, nodelay = FALSE) X <- buffer(x, n, p, nodelay = TRUE)

## Description

This function is used to buffer a signal vector into a matrix of data frames. If the input for nodelay is TRUE, the the signal is buffered with no delay. If nodelay is FALSE, and specifies a vector of samples to precede x[1] in an overlapping buffer.

## Inputs

Input var | Description | Units | Default value |
---|---|---|---|

x | The signal vector to be buffered | N/A | N/A |

n | The desired length of data segments (rows). | N/A | N/A |

p | The desired amount of overlap between consecutive frames (columns) in the output matrix | N/A | N/A |

opt | The vector of samples specified to precede x[1] in an overlapping buffer | N/A | N/A |

nodelay | A logical statement to determine if the vector should be buffered with or without delay. Default is FALSE (with delay) | Logical | FALSE |

## Outputs

Output var | Description | Units |
---|---|---|

X | A matrix of the buffered signal vector “vec” with “n” data segments and an overlap between consecutive frames specified by “p”. The matrix starts with “opt” values if nodelay is FALSE. | N/A |

z | (if nodelay = FALSE) The remainder of the vector which was not included in the matrix if the last column did not have a full number of rows. | N/A |

opt | (nodelay = FALSE) The last values, length of “p”, of the matrix “X”. | N/A |

## Example

x <- c(1:10) n <- 3 p <- 2 opt <- c(2,1) list1 <- buffer(x, n, p, opt) X <- buffer(x, n, p nodelay = TRUE)

## About

bugs@animaltags.org Last modified: 10 May 2017