Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have the next link
[1] https://drive.google.com/open?id=0ByCmoyvCype7ODBMQjFTSlNtTzQ
This is a pdf file. The author of a paper gave the list of mutation in this format.
I need to annotate the mutation of this file.
I need a txt or TVS or VCF file to be reading by annovar.
Can you help me to convert this using R or other software in ubuntu?
In principle this is a job for tabulizer but I couldn't get it to work in this instance; I suspect the single table over so many pages confused it.
You can read it in to R as text with the pdftools package easily enough
library(pdftools)
txt <- pdf_text("selection.pdf")
Now txt is an R list, with each element of the list a character string for a single page in the original document. You might be able to do something fancy with regular expressions to convert this to more meaningful data.
However, it makes more sense to ask the original author for their data in an appropriate format. Publishing a 561 page PDF of tabular data is just nuts.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 days ago.
Improve this question
I have a 150pages microsoft word document with info on books listed. I include an example right here:
So this document contains several pieces of information per each book, there are hundreds of different books listed in this docx file and I want to extract and convert the information in a classic dataset with each column being "Title (en)", "Title (de)"..."Abstract" and so on. In this way I would organize all the info in a dataset which has 1 line per book and each cloumn with attributes like English name, abstract and so on. The point is that not all the books have the same piece of information so sometimes the Abstract (for example) is missing so I would need that cell empty.
How can I do that in R? I am not new in R but I never worked with texts so I am not sure what would be the best approach here.
Thanks
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
As I'm dealing with a huge dataset I had to split my data into different buckets. Thus, I want to save some interim results in a csv to recall it later. However, my datafile contains some columns with lists, which according to R can not be exported (see snapshot). Do you guys know a simple way for a R newbie to make this work?
Thank you so much!
I guess the best way to solve your problem is switching to a more apropriate file format. I recomend using write_rds() from the readr package, which creates .rds files. The files you create with readr::write_rds('your_file_path') can be read in with readr::read_rds('your_file_path').
The base R functions are saveRDS() and readRDS() and the functions mentioned earlier form the readr are just wrappers with some convience features.
Just right click, then choose new csv to the folder where you want to save your work. Then set the separator of the csv to a comma.
Input all data in column form. You can later make it a matrix in your R program.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Unfortunately I have to deal with a data file with .int file format. This has the effect of littering any search results with unrelated information about integers.
I can't figure out how to open this file in R. I have an example with the Julia language, shown below:
filename = "mnist_train.int"
open(filename) do f
...
end
But when I try to search for a similar function in R, I either find results about opening excel files, results for other languages, or results that deal with integers. Could someone please point me to some resources for dealing with this filetype?
Because I am not sure about what the content type, guess you trying to open a binary file format.
You can have a look at ?readBin
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a block of text that looks like this: "gatcctccatatacaacggtatctccacctcaggtttagatctca" and it goes on like that for 5000 characters.
I want to import it into R as a character vector. Should I put it in a .rtf file and try to import that file? And what code do I use in order to import it?
Your problem isn't really about reading the data into R, it's splitting up the string into individual characters.
Reading it in using either of the answers posted:
v <- readLines("your_file.txt")
v <- "gatcc...."
Splitting it up, using strsplit:
v <- strsplit(v, "")[[1]]
If you need to copy the text anyway, simply copy it directly into R:
v <- "gatcctccatatacaacggtatctccacctcaggtttagatctca"
I would save it as a text file and then load it in using the readLines() functions:
character_data <- "your_file.txt"
v<-readLines(character_data)
This is a little bit more complicated than copying and pasting but has the advantage of being reproducible for another person if they want to run the code as well as making it easy to change the string later on.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have an R dataset (an .Rdata file) that I need to convert to either SAS (.sas7bdat or .xpt) or SPSS (.sav or .por). How can I import this dataset into SAS or SPSS?
If you want to use this in SPSS, consider using the STATS_GETR extension command. It can read R workspace or data files and map appropriate elements directly to an SPSS dataset. This extension command is available from the SPSS Community (www.ibm.com/developerworks/spssdevcentral) website or, for Statistics 22, it can be installed via the Utilities menu.