# Trim aligned curves

### Description

Trims curves to specified range of X and Y coordinates

### Usage

1 2 | ```
phylocurve.trim(phylocurve.generalized, min_Y = -Inf,
max_Y = Inf, min_X = -Inf, max_X = Inf)
``` |

### Arguments

`phylocurve.generalized` |
The value returned by the phylocurve.generalized function |

`min_Y` |
The minimum Y value for trimming curves |

`max_Y` |
The maximum Y value for trimming curves |

`min_X` |
The minimum X value for trimming curves |

`max_X` |
The maximum X value for trimming curves |

### Value

`aligned_data ` |
x and y coordinates arranged in a single row vector for each species |

`aligned_coordinates ` |
x and y coordinates for each species (one data point per row) |

`aligned_X` |
Aligned X coordinates in N x M matrix |

`aligned_Y` |
Aligned Y coordinates in N x M matrix |

`nr` |
Number of aligned landmarks |

`anc_X` |
Vector of root X values (assuming Brownian motion) |

`anc_Y` |
Vector of root Y values (assuming Brownian motion) |

`tree` |
Phylogenetic tree supplied into the function |

### Author(s)

Eric W. Goolsby

### References

Goolsby, E.W. 2015. "Phylogenetic comparative methods for evaluating the evolutionary history of function-valued traits." Systematic Biology. In press.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
# NOT RUN (takes several minutes)
# x_length <- 50
# nspecies <- 25
#sim_data <- sim.curves(nspecies = nspecies,x_length = x_length)
#
# Perform ancestral curve reconstruction without any assumptions about function shape
# P <- phylocurve.generalized(tree = sim_data$tree,
# X = sim_data$data$x[1:x_length],Y = t(matrix(sim_data$data$y,
# nrow = x_length,dimnames = list(1:x_length,sim_data$tree$tip.label))))
#
# Data might need trimming for values where there is no variation
# plot(P$anc_X,P$anc_Y)
#
# P.trimmed <- phylocurve.trim(phylocurve.generalized = P,min_X = 4,max_X = 8)
``` |