"0527180040"
1-STORY 1946 & NEWER ALL STYLES
85
1017
"0527182190"
1-STORY PUD (Planned Unit Development) - 1946 & NEWER
NaN
682
"0527216070"
2-STORY 1946 & NEWER
47
5350
⋮
Create Variable for Date of Sale
The table has separate variables for the month and year of sale. It is more convenient if those
variables are combined in one datetime variable. Assignment by using dot notation is a good way to
add a new variable at the right edge of a table. Add the date of sale as a new variable.
housing.LastSoldDate = datetime(housing.YrSold,housing.MoSold,0,"Format","MMM yyyy");
Now delete the two original variables. It is easier to list the variables by name and use removevars.
housing = removevars(housing,["YrSold" "MoSold"])
housing=2930×24 table
PID
MSSubClass
LotFrontage
LotAr
____________
_____________________________________________________
___________
_____
"0526301100"
1-STORY 1946 & NEWER ALL STYLES
141
3177
"0526350040"
1-STORY 1946 & NEWER ALL STYLES
80
1162
"0526351010"
1-STORY 1946 & NEWER ALL STYLES
81
1426
"0526353030"
1-STORY 1946 & NEWER ALL STYLES
93
1116
"0527105010"
2-STORY 1946 & NEWER
74
1383
"0527105030"
2-STORY 1946 & NEWER
78
997
"0527127150"
1-STORY PUD (Planned Unit Development) - 1946 & NEWER
41
492
"0527145080"
1-STORY PUD (Planned Unit Development) - 1946 & NEWER
43
500
"0527146030"
1-STORY PUD (Planned Unit Development) - 1946 & NEWER
39
538
"0527162130"
2-STORY 1946 & NEWER
60
750
"0527163010"
2-STORY 1946 & NEWER
75
1000
"0527165230"
1-STORY 1946 & NEWER ALL STYLES
NaN
798
"0527166040"
2-STORY 1946 & NEWER
63
840
"0527180040"
1-STORY 1946 & NEWER ALL STYLES
85
1017
"0527182190"
1-STORY PUD (Planned Unit Development) - 1946 & NEWER
NaN
682
"0527216070"
2-STORY 1946 & NEWER
47
5350
⋮
Explore Data with Plots
Explore the data by making some simple plots. Many basic plotting commands do not accept tables as
input arguments. But you can use dot notation to pass one or more table variables into a plotting
function. You are taking arrays out of the table and passing them as input arguments to a plotting
function.
For example, make a scatter plot of the sale prices of houses in the table as a function of the years in
which they were built.
scatter(housing.YearBuilt,housing.SalePrice,20,"filled");
9 Tables
9-72
Précédent

- 416/1450

Suivant