我需要在 R 中读取一些“paraquet”文件。使用的解决方案很少
现在的问题是我不允许安装 R 以外的任何工具。R 中是否有任何可用的软件包可以在不使用任何其他工具的情况下读取“paraquet”?
你可以用arrow它(与Python中的相同)pyarrow),但现在也为 R 打包了(不需要 Python)。由于 CRAN 上尚不可用,因此您必须先手动安装 Arrow C++:
git clone https://github.com/apache/arrow.git\ncd arrow/cpp && mkdir release && cd release\n\n# It is important to statically link to boost libraries\ncmake .. -DARROW_PARQUET=ON -DCMAKE_BUILD_TYPE=Release -DARROW_BOOST_USE_SHARED:BOOL=Off\nmake install\nRun Code Online (Sandbox Code Playgroud)\n\n然后就可以安装R了arrow包:
devtools::install_github("apache/arrow/r")\nRun Code Online (Sandbox Code Playgroud)\n\n并用它来加载 Parquet 文件
\n\nlibrary(arrow)\n#> \n#> Attaching package: \'arrow\'\n#> The following object is masked from \'package:utils\':\n#> \n#> timestamp\n#> The following objects are masked from \'package:base\':\n#> \n#> array, table\nread_parquet("somefile.parquet", as_tibble = TRUE)\n#> # A tibble: 10 x 2\n#> x y\n#> <int> <dbl>\n#> \xe2\x80\xa6\nRun Code Online (Sandbox Code Playgroud)\n\n现在可以在 CRAN 上使用,安装使用install.packages("arrow")