Learn R Programming

FITSio (version 2.1-6)

readFrameFromFITS: Read a single data set from a FITS file into a data frame

Description

Read a binary table from a FITS file directly into an R data frame.

Usage

readFrameFromFITS(file, hdu = 1)

Arguments

file

existing FITS file name.

hdu

position of Header and Data Unit (HDU) in FITS file: 1 for the first HDU, 2 for the second HDU, etc.

Value

An R data frame with the contents of the requested binary table.

Details

readFrameFromFITS reads a single binary table Header and Data Unit (HDU) pair from a file and returns the values as a data table.

Binary table bit, complex, and array descriptor data types are not implemented in this release due to a lack of examples for testing. 8, 16, 24, and 32-bit bit arrays return as integers. Other lengths are not supported.

References

Hanisch et al., Astron.\ Astrophys. 376, 359-380 (2001)

https://fits.gsfc.nasa.gov/

See Also

readFITS

Examples

Run this code
# NOT RUN {
require(FITSio)

## Either download example file from
## <https://fits.gsfc.nasa.gov/fits_samples.html>
## and use
# }
# NOT RUN {
filename <- "IUElwp25637mxlo.fits"
# }
# NOT RUN {
## or, for local example use
filename <- system.file("fitsExamples", "IUElwp25637mxlo.fits",
                        package = "FITSio")

## Get data and display
F <- readFrameFromFITS(filename) 
names(F)
plot(F$NET, ylab = "Value", main = names(F)[5], type = "l")

### Simple flat file example
filename <- system.file("fitsExamples", "2008_03_11_203150.fits",
                        package = "FITSio")  
F <- readFrameFromFITS(filename) 
names(F)
attach(F)
plot(DMJD, TiltX, xlab = "Time [DMJD]", ylab = "X Tilt [degr]", type = "l")
detach(F)

# }

Run the code above in your browser using DataLab