uncompress gz file in R, and do a bitewise operation

  bitwise-operators, compression, gzip, python, r

Currently I have a .gz file of a csv file. And I would like to uncompressed it.

The difficulty is that after decompressing the .gz file, it needs a bitewise operation to get it to the right format.

I have the code in python that works, but I am struggling to convert it to R

def uncompress_file(file_location_gz, file_location_save):

    with open(file_location_gz, "rb") as f:
      data = f.read()
    data2 = gzip.GzipFile(fileobj=BytesIO(data),
    data2 = bytearray(data2)
    for i in range(len(data2)):
      data2[i] ^= 0x95
    with open(file_location_save, 'wb') as f_out:

Any help or suggestion would be really helpful.

Source: Python Questions