Learn R Programming

solaR2 (version 0.11)

D_as.data.tableD-methods: Methods for Function as.data.tableD

Description

Convert a Sol, G0, Gef, ProdGCPV or ProdPVPS object into a data.table object with daily values.

Usage

# S4 method for Sol
as.data.tableD(object, complete=FALSE, day=FALSE)

Arguments

object

A Sol object (or extended.)

complete

A logical.

day

A logical.

Methods

signature(object = "Sol")

Conversion to a data.table object with the content of the solD slot. If day=TRUE (default is FALSE), the result includes three columns named month, day (day of the year) and year.

signature(object = "G0")

If complete=FALSE (default) the result includes only the columns of G0d, D0d and B0d from the G0D slot. If complete=TRUE it returns the contents of the slots solD and G0D.

signature(object = "Gef")

If complete=FALSE (default) the result includes only the columns of Gefd, Defd and Befd from the GefD slot. If complete=TRUE it returns the contents of the slots solD, G0D and GefD

signature(object = "ProdGCPV")

If complete=FALSE (default) the result includes only the columns of Eac, Edc and Yf from the prodD slot. If complete=TRUE it returns the contents of the slots solD, G0D, GefD and prodD.

signature(object = "ProdPVPS")

If complete=FALSE (default) the result includes only the columns of Eac, Qd and Yf from the prodD slot. If complete=TRUE it returns the contents of the slots solD, G0D, GefD and prodD.

Author

Oscar Perpiñán Lamigueiro, Francisco Delgado López.

Examples

Run this code
library("data.table")
setDTthreads(2)

lat = 37.2
BTd = fBTd(mode = 'prom')
sol = calcSol(lat, BTd)
solD = as.data.tableD(sol)
solD

solD2 = as.data.tableD(sol, day = TRUE)
solD2

G0dm <- c(2766, 3491, 4494, 5912, 6989, 7742, 7919, 7027, 5369, 3562,
          2814, 2179)
Ta <- c(10, 14.1, 15.6, 17.2, 19.3, 21.2, 28.4, 29.9, 24.3, 18.2,
        17.2, 15.2)
prom <- list(G0dm = G0dm, Ta = Ta)
prodfixed = prodGCPV(lat, dataRad = prom)
prodD = as.data.tableD(prodfixed, complete = TRUE, day = TRUE)
prodD

Run the code above in your browser using DataLab