英文:
How to use the file chooser dialog to save a file in R on macOS?
问题
有人知道在Mac上用"choose.dir"导出我的生成的栅格数据为tif格式的解决方案吗?替换"file.choose"不起作用,不幸的是。
请参考下面的代码部分:
terra::writeRaster(kmeans_raster,
filename = base::paste0(utils::choose.dir,'/sentinel_kmeans.tif'))
谢谢帮助!
我尝试使用"file.choose"和"file.create"。
我尝试使用包'rJava' --> library("rJava")
操作无法完成。无法找到Java运行时。请访问http://www.java.com了解安装Java的信息。
错误: 加载包或命名空间“rJava”时出错:
.onLoad in loadNamespace() for 'rJava' failed, Details:
调用: fun(libname, pkgname)
错误: 找不到JVM库'NA/lib/server/libjvm.dylib'
安装Java并/或检查JAVA_HOME(如有疑问,请勿设置,它将被检测)
>
英文:
does anyone know a solution for "choose.dir" for Mac to export my builded raster as tif data. Exchanging "file.choose" didn't work unfortunately.
See the column code below:
terra::writeRaster(kmeans_raster,
filename = base::paste0(utils::choose.dir,'/sentinel_kmeans.tif'))
Thank you for help!
I tried to use "file.choose" and file.creat"
I tried to use package 'rJava' --> library("rJava")
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
Fehler: Laden von Paket oder Namensraum für ‘rJava’: fehlgeschlagen
.onLoad in loadNamespace() für 'rJava' fehlgeschlagen, Details:
Aufruf: fun(libname, pkgname)
Fehler: JVM could not be found
Zusätzlich: Warnmeldungen:
1: In system("/usr/libexec/java_home", intern = TRUE) :
Ausführung von Kommando '/usr/libexec/java_home' ergab Status 1
2: In fun(libname, pkgname) :
Cannot find JVM library 'NA/lib/server/libjvm.dylib'
Install Java and/or check JAVA_HOME (if in doubt, do NOT set it, it will be detected)
>
答案1
得分: 1
你可以执行以下操作:
filename <- file.path(utils::choose.dir(), "sentinel_kmeans.tif")
terra::writeRaster(kmeans_raster, filename, overwrite=TRUE)
我不知道你为什么认为 "rJava" 在这里相关。但它无法加载的原因似乎是你没有安装Java。
英文:
You can do
filename <- file.path(utils::choose.dir(), "sentinel_kmeans.tif")
terra::writeRaster(kmeans_raster, filename, overwrite=TRUE)
I do not know why you think "rJava" is relevant here. But the reason it won't load seems to be that you do not have Java installed.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论