Learn R Programming

solaR2 (version 0.11)

D_writeSolar-methods: Exporter of solaR results

Description

Exports the results of the solaR functions as text files using write.table

Usage

# S4 method for Sol
writeSolar(object, file, complete = FALSE,
    day = FALSE, timeScales = c('i', 'd', 'm', 'y'), sep = ',', ...)

Arguments

object

A Sol object (or extended.)

file

A character with the name of the file.

complete

A logical. Should all the variables be exported?

day

A logical. Should be daily values included in the intradaily file?

timeScales

A character. Use 'i' to export intradaily values, 'd' for daily values, 'm' for monthly values and 'y' for yearly values. A different file will be created for each choice.

sep

The field separator character.

...

Additional arguments for write.table

Methods

signature(object = "Sol")

This function exports the slots with results using write.table. If complete = FALSE and day = FALSE (default) the result includes only the content of the solI slot. It day = TRUE the contents of the solD slot are included.

signature(object = "G0")

If complete = FALSE and day = FALSE (default) the result includes only the columns of G0, D0 and B0 of the G0I slot. If complete = TRUE it returns the contents of the slots G0I and solI. If day = TRUE the daily values (slots G0D and solD) are also included.

signature(object = "Gef")

If complete = FALSE and day = FALSE (default) the result includes only the columns of Gef, Def and Bef of the GefI slot. If complete = TRUE it returns the contents of the slots GefI, G0I and solI. If day = TRUE the daily values (slots GefD, G0D and solD) are also included.

signature(object = "ProdGCPV")

If complete = FALSE and day = FALSE (default) the result includes only the columns of Pac and Pdc of the prodI slot. If complete = TRUE it returns the contents of the slots prodI, GefI, G0I and solI. If day = TRUE the daily values (slots prodD, GefD, G0D and solD) are also included.

signature(object = "ProdPVPS")

If complete = FALSE and day = FALSE (default) the result includes only the columns of Pac and Q of the prodI slot. If complete = TRUE it returns the contents of the slots prodI, GefI, G0I and solI. If day = TRUE the daily values (slots prodD, GefD, G0D and solD) are also included.

Author

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

See Also

write.table, fread, as.data.tableI, as.data.tableD, as.data.tableM, as.data.tableY

Examples

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

lat <- 37.2;
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 = lat, dataRad = prom, modeRad = 'aguiar', keep.night = FALSE)

old <- setwd(tempdir())

writeSolar(prodFixed, 'prodFixed.csv')

dir()

zI <- fread("prodFixed.csv",
            header = TRUE, sep = ",")
zI

zD <- fread("prodFixed.D.csv",
            header = TRUE, sep = ",")
zD

zM <- fread("prodFixed.M.csv",
            header = TRUE, sep = ",")
zM

zY <- fread("prodFixed.Y.csv",
            header = TRUE, sep = ",")
zY

setwd(old)

Run the code above in your browser using DataLab