'Using r in Google Colab to read file and values appear as NAs
I have a large txt tab delimited file (around 24000 rows and 71 columns) and I am trying to read the file using the following code
kirc <- read.delim(file=kirc_path,header = TRUE, sep = "\t",check.names = FALSE)
I used the same code in RStudio with no issues, but with Google Colab many values appear as NAs with no obvious reasons!
Solution 1:[1]
I noticed that it read entire rows as NAs and the index of these columns was outside the dimension of my dataframe
dim(kirc)
For some reason, reading the file created so many rows with empty values which created the NAs issue. So subsetting the dataframe to the actual dimension solved the issue.
kirc = kirc[1:dim(kirc)[1],]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sherbman |
