gpt4 book ai didi

r - 导入 "zst"文件?

转载 作者:行者123 更新时间:2023-12-05 02:26:56 24 4
gpt4 key购买 nike

我正在使用 R 编程语言。我正在尝试从此网站 ( https://files.pushshift.io/reddit/comments/ ) 下载最小的文件,即 https://files.pushshift.io/reddit/comments/RC_2005-12.zst .我的目标是将此文件导入 R,然后查询此文件以查找包含某些术语的评论。例如,我想找到所有包含单词“tacos”的评论。

我已将此文件下载到我的计算机上,现在我想尝试将此文件导入 R。我以前从未听说过或使用过这种文件扩展名格式。我试图在 Internet 上阅读如何将此文件导入 R。

我在网上做了一些阅读,发现了以下包:https://github.com/thekvs/zstdr .但是,我似乎无法安装此软件包:

> install.packages('zstdr')
Installing package into ‘C:/Users/me/OneDrive/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘zstdr’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

有谁知道我如何将这个 zst 文件导入 R,然后查询它以获取特定的搜索词(例如“篮球”)?是否有一些标准方法可以将 ZST 文件导入 R?

这是我在尝试从 github 安装相同库时收到的错误消息:

 > devtools::install_github("thekvs/zstdr")

Downloading GitHub repo thekvs/zstdr@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All
2: CRAN packages only
3: None
4: Rcpp (1.0.8.3 -> 1.0.9) [CRAN]

Enter one or more numbers, or an empty line to skip updates:
v checking for file 'C:\Users\me\AppData\Local\Temp\RtmpqumrUb\remotes710158629f3\thekvs-zstdr-f992e66/DESCRIPTION' (533ms)
- preparing 'zstdr': (3.9s)
v checking DESCRIPTION meta-information ...
- cleaning src
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories (629ms)
Omitted 'LazyData' from DESCRIPTION
- building 'zstdr_0.1.1.tar.gz'
Warning: file 'zstdr/cleanup' did not have execute permissions: corrected
Warning: file 'zstdr/configure' did not have execute permissions: corrected

Installing package into ‘C:/Users/me/OneDrive/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
ERROR: Unix-only package
* removing 'C:/Users/me/OneDrive/Documents/R/win-library/4.1/zstdr'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/me/AppData/Local/Temp/RtmpqumrUb/file710783f1c08/zstdr_0.1.1.tar.gz’ had non-zero exit status

这是我的 session 信息:

> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C LC_TIME=English_Canada.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] htm2txt_2.2.2 dplyr_1.0.9 RedditExtractoR_2.1.5

loaded via a namespace (and not attached):
[1] tinytex_0.40 tidyselect_1.1.2 xfun_0.30 remotes_2.4.2 purrr_0.3.4 vctrs_0.4.1 generics_0.1.3 testthat_3.1.4 usethis_2.1.6
[10] htmltools_0.5.2 yaml_2.3.5 utf8_1.2.2 rlang_1.0.2 pkgbuild_1.3.1 pillar_1.7.0 glue_1.6.2 withr_2.5.0 DBI_1.1.3
[19] sessioninfo_1.2.2 lifecycle_1.0.1 visNetwork_2.1.0 devtools_2.4.3 htmlwidgets_1.5.4 memoise_2.0.1 evaluate_0.15 knitr_1.39 callr_3.7.0
[28] fastmap_1.1.0 ps_1.6.0 curl_4.3.2 fansi_1.0.3 cachem_1.0.6 desc_1.4.1 pkgload_1.2.4 jsonlite_1.8.0 fs_1.5.2
[37] brio_1.1.3 digest_0.6.29 processx_3.5.3 RJSONIO_1.3-1.6 rprojroot_2.0.3 cli_3.3.0 tools_4.1.3 magrittr_2.0.2 tibble_3.1.6
[46] crayon_1.5.1 pkgconfig_2.0.3 ellipsis_0.3.2 prettyunits_1.1.1 assertthat_0.2.1 rmarkdown_2.14 rstudioapi_0.13 R6_2.5.1 igraph_1.2.11
[55] compiler_4.1.3

最佳答案

主要问题是你必须安装CMake在您的设备上,根据维基百科:“CMake 是跨平台的免费开源软件,用于使用独立于编译器的方法构建自动化、测试、打包和安装软件”。

在您的设备上安装 CMake

您可以点击上面的链接进行安装。确保根据您的系统获取正确的文件。

window

我没有 Windows 设备,所以我不确定它是否更难,但我可能找到了一个不错的 youtube tutorial .

苹果机

我在 MAC 上工作,所以我按照这个 YouTube tutorial 安装了它,一开始很难,但您必须确保使用 sudo 激活程序将其安装在应用程序中。

在 Studio 上安装 zstdr

在您的设备上安装 CMake 后,您可以使用以下代码安装包:

devtools::install_github("thekvs/zstdr")
library(zstdr)

这应该有效,最后您可以使用此代码导入数据:

data_file <- file.path(R.home(), "COPYING")
data <- readBin(data_file, raw(), file.info(data_file)$size)
compressed <- zstdCompress(data)

关于r - 导入 "zst"文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73508617/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com