commit 9ef3188cb55cc466cab2f5f296705bd9eabaa9e8
parent 22a4ee17e5776b4ccdb608d3a9ac0a8636577425
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date: Tue, 11 Oct 2016 09:35:12 -0400
Function to turn a flighttrajectory to a data.frame
Diffstat:
3 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/NAMESPACE b/NAMESPACE
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand
+S3method(as.data.frame,flighttrajectory)
S3method(as.flightpath,data.frame)
S3method(as.flightpath,flightpath)
S3method(as.flightpath,matrix)
diff --git a/R/createTrajectory.R b/R/createTrajectory.R
@@ -88,3 +88,10 @@ createTrajectory <- function(longitude, latitude, altitude = 0, timestamp = NULL
#' Check if an object is a flighttrajectory
#' @export
is.flighttrajectory <- function(x) inherits(x, "flighttrajectory")
+
+#' Convert a trajectory to a data.frame
+#' @method as.data.frame flighttrajectory
+#' @export
+as.data.frame.flighttrajectory <- function(x) {
+ return(as.data.frame(as.list(x)))
+}
diff --git a/man/as.data.frame.flighttrajectory.Rd b/man/as.data.frame.flighttrajectory.Rd
@@ -0,0 +1,12 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/createTrajectory.R
+\name{as.data.frame.flighttrajectory}
+\alias{as.data.frame.flighttrajectory}
+\title{Convert a trajectory to a data.frame}
+\usage{
+\method{as.data.frame}{flighttrajectory}(x)
+}
+\description{
+Convert a trajectory to a data.frame
+}
+