The bottom format is often called a "long format", and is often the best way to structure data for analysis because it makes everything explicit.
Both tables obviously contain the same data, but some of the type data only implicitly present in the top table. For example, we need to infer that row #2 describes a car from the total number of rows, the description ("I have file with data on 3 cars, 3 boats, 3 motorcycles"), and the parallel structure between rows #1, #4, and #7. This introduces an annoying dependency between the rows: to find the type of row $n$, you need to find the first non-empty type "above" it in the table and propagate it downwards. It also introduces the possibility for errors: if we weren't careful, we might conclude that the type information is missing for the remaining rows. Similarly, if the data were divided across three files, we'd have a similar implicit dependency on the file name
In contrast, everything is laid out explicitly in the long format. There is no need to deduce anything: if you need the type of the $n$th example, you just look at the $n$th entry of type. This layout also mirrors many of the things you're going to do with the data. For example, a regression expresses one column of the table (e.g., the price), as a combination of the remaining columns. It also allows you to extract subsets of the table, which you might do during cross validation.
The major disadvantage of the long format is that it contains more redundancy--you had to type "car" three times more often when producing the bottom table.
Most data analysis packages have functions for converting data to and from "long" format, which is often called "melting" the data. In R, you may want to look at tidyr
or reshape2
packages. In python, pandas
has similar functions, and stata has reshape long
. You may need to write a little bit of custom code though, depending on exactly how the implicit data is structured.