我正在尝试使用rgee
包让以下代码在Google Earth Engine中工作:
# Load rgee
library(rgee)
# Initialise
ee_users()
ee_Initialize()
# The incorrect use of repeat within an rgee context
ee$List$repeat(1,3)
但我得到了错误:
Error: unexpected 'repeat' in "ee$List$repeat"
是因为在基r中与repeat
有一些混淆吗?
对于R保留字,请使用反引号/引号:
# Load rgee
library(rgee)
# Initialise
ee_users()
ee_Initialize()
# The incorrect use of repeat within an rgee context
ee$List$'repeat'(1,3)$map(
ee_utils_pyfunc( #ee_utils_pyfunc is necessary to apply a map function to an ee$List
function(x) {
ee$Number(x)$add(1)
}
)
)