library(xrayr)
library(tibble)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
To create RADEC vector using values in deg use
ra_dec
function.
n <- 5
x <- ra_dec(ra = runif(n, 0, 360),
dec = runif(n, -90, 90))
y <- ra_dec(ra = runif(n, 0, 360),
dec = runif(n, -90, 90))
x
#> <astro_radec[5]>
#> [1] 01h56m16.8s -06°02'57" 20h01m26.4s -00°24'00" 14h25m05.7s -37°50'31"
#> [4] 03h46m22.8s +41°55'08" 00h10m39.3s +49°03'14"
Also we can create RADEC vectors using radec
function.
Coords in the ‘hms dms’ format
coords <- c("21h16m19.6s -16d30m31.2s", "12 14 19.6 34 1 1.2s", "J112233.44+551122.33")
radec(coords)
#> <astro_radec[3]>
#> [1] 21h16m19.6s -16°30'31" 12h14m19.6s +34°01'01" 11h22m33.4s +55°11'22"
At the current time NAs support is limited.
t <- tibble(x = x) %>%
bind_cols(tibble(y = y))
t
#> # A tibble: 5 × 2
#> x y
#> <RA DEC> <RA DEC>
#> 1 01h56m16.8s -06°02'57" 20h59m25.5s -54°46'46"
#> 2 20h01m26.4s -00°24'00" 04h11m54.9s -17°21'47"
#> 3 14h25m05.7s -37°50'31" 00h49m18.4s -78°32'27"
#> 4 03h46m22.8s +41°55'08" 07h41m21.3s -20°02'02"
#> 5 00h10m39.3s +49°03'14" 09h39m21.2s +85°35'55"