as.data.frame.curve {frenchCurve} | R Documentation |
Conversion to data frame
Description
Method function to convert an object inheriting from class "curve"
to a data.frame
Usage
## S3 method for class 'curve'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
Arguments
x |
An object inheriting from class |
row.names , optional , ... |
as for |
Value
A data frame object
Examples
library(ggplot2)
set.seed(1234)
z <- complex(real = runif(5), imaginary = runif(5))
z <- z[order(Arg(z - mean(z)))]
cz <- closed_curve(z)
oz <- open_curve(z)
ggplot() + geom_path(data = as.data.frame(cz), aes(x,y), colour = "#DF536B") +
geom_path(data = as.data.frame(oz), aes(x,y), colour = "#2297E6") +
geom_point(data = as.data.frame(z), aes(x = Re(z), y = Im(z))) +
geom_segment(data = as.data.frame(z), aes(x = Re(mean(z)),
y = Im(mean(z)),
xend = Re(z),
yend = Im(z)),
arrow = arrow(angle=15, length=unit(0.125, "inches")),
colour = alpha("grey", 1/2)) +
theme_bw()
[Package frenchCurve version 0.2.0 Index]