我从API获得一个 base64 gzip压缩字符串,并希望在R中解压缩它。
输入:一个压缩的base64 gzip字符串
输出:解压缩的字符串
试用:
string <- "H4sIAAAAAAAA/3OtSMwtyEmNLy4pysxLjy/Jj09JTc7PLShKLS6OTyvKz41PSixONTOJT6/KLOACAIKC50YuAAAA"
datadecompressed <- memDecompress(from = charToRaw(string),type = c('gzip'))
错误:Error in memDecompress(from = charToRaw(string), type = c("gzip")) :
internal error -3 in memDecompress(2)
它在Python中工作得很好:
import gzip, base64
comp = "H4sIAAAAAAAA/3OtSMwtyEmNLy4pysxLjy/Jj09JTc7PLShKLS6OTyvKz41PSixONTOJT6/KLOACAIKC50YuAAAA"
decomp = gzip.decompress(base64.b64decode(comp))
print(comp)
print(decomp)
...但是不幸的是我在R中需要它。 预先谢谢你