I'm trying to export a frequency histogram table of a classified image for a region.
function country (image) {var c = image.reduceRegion({
geometry: image.geometry(),
reducer: ee.Reducer.frequencyHistogram(),
scale: 30,
maxPixels: 1e12,
}); return ee.Feature(c.select(['classification']))}
// export function
function export_table (table, description, date) {
var em = Export.table.toDrive({
collection: ee.FeatureCollection(table),
description: region+'_'+description+'_'+date,
folder: region,
});return em}
But I get the error: Error: Invalid argument: 'collection' must be a FeatureCollection
.
I've set the FeatureCollection in the export function, so I don't know what's happening here.
Link to code: https://code.earthengine.google.com/582da4a11433f1645b359b8ae2086c86