Question

In: Computer Science

What is the difference between a comma-delimited text file and a fixed-width text file? Why is...

What is the difference between a comma-delimited text file and a fixed-width text file? Why is it important that you understand the difference before you import data from a text file?

Solutions

Expert Solution

Okay all files are use to store multiple data items let's say I have a file that stores a list of students and their mobile numbers.

In a simple table in SQL or excel with a great interface we can easily distinguish them but in all these date are stored in form of simple text files in the background and there we need to use delimiter or some sort of property to distinguish the elements, and the CSV ( comma separated value) and fixed width text are two examples of that.

Now the reason we need to understand the file is because we need to tell the program how to extract and distinguish the items depending on the file type.

Example the file we took, with name and number

If saves as a CSV will look like

John,3674893827,Rita,6484028163,Andrew Garfield,7562518463

Now the thing is we know that each item is name then number then name and then number and so on but where the name ends and where the number started isn't something we can distinguish like if someone is named as Andrew2 will this be a name or number or I'm case we saw there and there father's name then how would you be able to distinguish that's why we have "," and on case to case basis other character to distinguish that one Elem has ended and other has started

Where as sometimes to keep things a little faster we keep the size fix, like 0-50th character is name 51-100th is number and then 101-150th is the next name, 151-200th is the number and so on and we fill the empty space with a stuffing like *** eg

John*****************

3674893827*********

Rita******************

.

.

And so on so now you know that line one will have the name and then 3 will have then and the even number will have there numbers.

So based on what type of files you are working on your data is read, with simple import function you have to tell the type of files so that the program in that library can extract the data from the file based on how it has been storing.

If there is any point which isn't clear put a comment, and I'll answer that

Hope it helps.


Related Solutions

a file is comma delimited, what does this mean? Why is a delimiter helpful when reading...
a file is comma delimited, what does this mean? Why is a delimiter helpful when reading from a flat file of data?
The data set 2017NBADraft.txt is a comma delimited file containing data on the players selected in...
The data set 2017NBADraft.txt is a comma delimited file containing data on the players selected in the 2017 NBA draft. Assume this data set is a representative sample of all players in the NBA. Correctly import the data set into R. c) In R, perform a hypothesis test to determine if the mean weights are different for the first round selections and second round selections. To do this, create a new variable so that the first 30 players all have...
Download the file data.csv (comma separated text file) and read the data into R using the...
Download the file data.csv (comma separated text file) and read the data into R using the function read.csv(). Your data set consists of 100 measurements in Celsius of body temperatures from women and men. Use the function t.test() to answer the following questions. Do not assume that the variances are equal. Denote the mean body temperature of females and males by μFμF and μMμMrespectively. (a) Find the p-value for the test H0:μF=μMH0:μF=μM versus HA:μF≠μM.HA:μF≠μM. Answer (b) Are the body temperatures...
What is the main difference between fixed and flexible budget? Why fixed budgets are preferred in...
What is the main difference between fixed and flexible budget? Why fixed budgets are preferred in government departments? Discuss the benefits of both types of budgets.
what is the difference between a normal file and a Webdocument?
what is the difference between a normal file and a Web document?
a) What is the difference between Beam-Width and First Null Beam-Width? b) A 70% efficient antenna...
a) What is the difference between Beam-Width and First Null Beam-Width? b) A 70% efficient antenna is having a radiation resistance (Rr) and loss resistance (RL). Calculate the ratio between (Rr) and (RL). c) Calculate the maximum effective aperture of an antenna operating at a wavelength of 0.5m and has a directivity of 250.
h) What is the difference between fixed costs and variable costs? What is the difference between...
h) What is the difference between fixed costs and variable costs? What is the difference between accounting costs and economic costs? What is the differ - ence between private costs and external costs? Name all the categories that comprise economic costs. i) How do we determine the profit-maximizing level of production using analy - sis of total costs and total revenues? What is the rule for profit maximization using marginal analysis? What happens to economic profits in a perfectly competitive...
In Access, what is the difference between the field size and field width? Are they important?...
In Access, what is the difference between the field size and field width? Are they important? Explain.
What do fixed and floating exchange rates have in common, and why is the difference between...
What do fixed and floating exchange rates have in common, and why is the difference between them so significant?
What is the difference between fixed costs and variable costs?’ Are there fixed costs in the...
What is the difference between fixed costs and variable costs?’ Are there fixed costs in the long run? Explain briefly. Are fixed costs also sunk costs? Explain. What are diminishing marginal returns as they relate to costs? Which costs are measured on a per-unit basis: fixed costs, average cost, the average variable cost, variable costs, and marginal cost? How is each of the following calculated: marginal cost, average total cost, average variable cost? What shapes would you generally expect each...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT