Extract some data from an output of a bias corrected dataset

I am not deep into r, but I recently used the bias correction of the climate4R package. After successful bias correction, I wanted to extract some data to an excel file for use in another program. I tried so many ways to do that but I can't extract the data. for example, if i run head(kano.cal), i got a display of the data in the r console, but i can't extract it to the excel file. I used
precip <- Kano.cal$Variable$Data
precip <- Kano.cal[["Variable"]][["Data"]]
kano_cal <- read.table("kano.cal")
the codes above, but after checking Head(precip) or dim(precip), it gave a null output. Kano.cal is an output of a function i run, it has no extension. find below the output of Kano.cal in my console. please kindly support me in extracting the $data of the file. Thank you

$Variable
$Variable$varName
[1] "precip"

$Variable$level
NULL

attr(,"units")
[1] "mm"
attr(,"subset")
[1] "loc"
attr(,"time_subset")
[1] "intersectGrid.time"
attr(,"correction")
[1] "delta"

$Data
[1] 24.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5.0 0.6 6.6 0.0 10.4 0.0 8.2
[18] 16.4 0.0 0.0 11.1 0.0 3.4 0.0 0.0 1.2 16.7 1.2 0.0 0.0 0.0 0.0 10.9 0.0
[35] 0.0 0.0 7.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 37.6 0.0 10.7 0.0 0.0 0.0 38.4
[ reached getOption("max.print") -- omitted 3600 entries ]
attr(,"dimensions")
[1] "time"

$xyCoords
x y
1 8.274 11.916

$Dates
$Dates$start
[1] "1991-05-01 GMT" "1991-05-02 GMT" "1991-05-03 GMT" "1991-05-04 GMT" "1991-05-05 GMT"
[6] "1991-05-06 GMT" "1991-05-07 GMT" "1991-05-08 GMT" "1991-05-09 GMT" "1991-05-10 GMT"
[11] "1991-05-11 GMT" "1991-05-12 GMT" "1991-05-13 GMT" "1991-05-14 GMT" "1991-05-15 GMT"
[16] "1991-05-16 GMT" "1991-05-17 GMT" "1991-05-18 GMT" "1991-05-19 GMT" "1991-05-20 GMT"

kano.cal is clearly not tabular as a whole.
Are there tabular elements within it that you want to use ?

it's not a tabular element, i just want to extract the $data column of Kano.cal

Kano.cal$Data should give you the vector
you can make a data.frame out of it to write it out to disk as a csv, or use an excel related package to write a fresh excel file, or modify an exising file.

myframe <- data.frame(name_for_my_column= Kano.cal$Data))
write.csv(x=myframe, file="myframe.csv")

wow, it works! thank you very much.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.