Read SQL Microft Exported File 2016

Asked

Viewed 55 times

1

I received a file exported from Microsoft SQL 2016 that has extension . txt and the same with . csv and has this face:

Amostra dos dados

​ I searched, but I haven’t found anything yet, someone has some experience importing that file to R?

A simple read.csv for example does not work

1 answer

1

In theory, any. txt file can be imported into the R. Try to rotate the command

dados <- read.table(file="NomeDoArquivo.txt", header=TRUE, sep="\t")

in which

  • file="NomeDoArquivo.txt" is the file name to be imported

  • header=TRUE informs that NomeDoArquivo.txt has a header. If NomeDoArquivo.txt does not have header, change the argument to header=FALSE

  • sep="\t" is the column separator of the file. How read.csv is not working, I guess the column separator is a tab tag. Other common options for sep sane ,, ; and " " (space).

Finally, turn

dim(dados)
str(dados)

and see if the number of rows and columns reported is as expected and if the data type in each column is correct. If all goes well, the data set has been imported correctly. If it doesn’t work (or if the above code doesn’t work), come back here and we’ll try to figure out what to do together.

  • Thanks Marcus Nunes, I had already tried with the read.csv, the problem is that from a point, as here: [{id:14974258949854043,Component:datepicker,index:0,label:Veuillez ele le:

  • I’m sorry, but I didn’t understand if my suggestion solved the problem.

  • The suggestion Marcus gave was a path, and I would even suggest that if not, try the function read.fwf. Only after your comment read a field as a variable only I started to question what would be the variables of your problem. The read.txt or similar will understand each column of the figure as a variable. If your problem is that the variables are only in the part of [{id:14974258949854043,component:datePicker,index:0,label:Ve‌​uillez then it would be another way to solve your problem.

  • Thanks Rafael Cunha, the problem is exactly figure out which one to read this, in fact it starts with numbers, then comes the bracket and the keys and it seems that there is a label separated by ':' of the value, but I’m not sure yet: 001115,9156BFA5-4A4B-4028-9F13-769DECDC01D8,Questionnaire,2017-06-21 08:36:49,000,2017-06-21 12:00:00,000,1,"[{""id"":""14974258949854043"",

  • Hi Marcos Nunes, did not solve, she reads the file but does not separate the fields, see my last comment

  • So the situation is much more complicated. What should be the result of reading the field [{id:14974258949854043,component:datePicker,index:0,label:Ve‌​‌​uillez? What does this mean? How many different columns? Would four be (id , component, index and label)?

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.