parent
b3635d65c6
commit
4725b93b1e
@ -0,0 +1,12 @@ |
||||
data(iris) |
||||
a = iris |
||||
a |
||||
|
||||
a$Species=NULL # 원래 데이터 제외 |
||||
|
||||
kc=kmeans(a, 3) # k=3 |
||||
summary(kc) |
||||
|
||||
table(iris$Species, kc$cluster) |
||||
|
||||
plot(a[c("Sepal.Length", "Sepal.Width")], col=kc$cluster) |
@ -0,0 +1,25 @@ |
||||
install.packages("WDI") |
||||
library(WDI) |
||||
|
||||
gdp = WDI(country = "KR", indicator = c("NY.GDP.PCAP.CD", "NY.GDP.MKTP.CD"), start = 1960, end = 2017) |
||||
|
||||
head(gdp) |
||||
names(gdp) = c("country", "iso2c", "iso3c", "year", "perCapGDP", "GDP") |
||||
head(gdp) |
||||
|
||||
kr = gdp$perCapGDP[gdp$country=="Korea, Rep."] |
||||
kr |
||||
|
||||
kr = ts(kr, start=min(gdp$year), end=max(gdp$year)) |
||||
kr |
||||
|
||||
install.packages("forecast") |
||||
library(forecast) |
||||
|
||||
krts = auto.arima(x=kr) |
||||
krts |
||||
|
||||
forecastResult = forecast(object=krts, h=5) |
||||
forecastResult |
||||
|
||||
plot(forecastResult) |
@ -0,0 +1,332 @@ |
||||
%!PS-Adobe-3.0 |
||||
%%DocumentNeededResources: font Helvetica |
||||
%%+ font Helvetica-Bold |
||||
%%+ font Helvetica-Oblique |
||||
%%+ font Helvetica-BoldOblique |
||||
%%+ font Symbol |
||||
%%DocumentMedia: a4 595 841 0 () () |
||||
%%Title: R Graphics Output |
||||
%%Creator: R Software |
||||
%%Pages: (atend) |
||||
%%Orientation: Landscape |
||||
%%BoundingBox: 18 18 577 824 |
||||
%%EndComments |
||||
%%BeginProlog |
||||
/bp { gs sRGB 595.00 0 translate 90 rotate gs } def |
||||
% begin .ps.prolog |
||||
/gs { gsave } bind def |
||||
/gr { grestore } bind def |
||||
/ep { showpage gr gr } bind def |
||||
/m { moveto } bind def |
||||
/l { rlineto } bind def |
||||
/np { newpath } bind def |
||||
/cp { closepath } bind def |
||||
/f { fill } bind def |
||||
/o { stroke } bind def |
||||
/c { newpath 0 360 arc } bind def |
||||
/r { 4 2 roll moveto 1 copy 3 -1 roll exch 0 exch rlineto 0 rlineto -1 mul 0 exch rlineto closepath } bind def |
||||
/p1 { stroke } bind def |
||||
/p2 { gsave bg fill grestore newpath } bind def |
||||
/p3 { gsave bg fill grestore stroke } bind def |
||||
/p6 { gsave bg eofill grestore newpath } bind def |
||||
/p7 { gsave bg eofill grestore stroke } bind def |
||||
/t { 5 -2 roll moveto gsave rotate |
||||
1 index stringwidth pop |
||||
mul neg 0 rmoveto show grestore } bind def |
||||
/ta { 4 -2 roll moveto gsave rotate show } bind def |
||||
/tb { 2 -1 roll 0 rmoveto show } bind def |
||||
/cl { grestore gsave newpath 3 index 3 index moveto 1 index |
||||
4 -1 roll lineto exch 1 index lineto lineto |
||||
closepath clip newpath } bind def |
||||
/rgb { setrgbcolor } bind def |
||||
/s { scalefont setfont } bind def |
||||
% end .ps.prolog |
||||
/sRGB { [ /CIEBasedABC |
||||
<< /DecodeLMN |
||||
[ { dup 0.03928 le |
||||
{12.92321 div} |
||||
{0.055 add 1.055 div 2.4 exp } |
||||
ifelse |
||||
} bind dup dup |
||||
] |
||||
/MatrixLMN [0.412457 0.212673 0.019334 |
||||
0.357576 0.715152 0.119192 |
||||
0.180437 0.072175 0.950301] |
||||
/WhitePoint [0.9505 1.0 1.0890] |
||||
>> |
||||
] setcolorspace } bind def |
||||
/srgb { setcolor } bind def |
||||
% begin encoding |
||||
/WinAnsiEncoding [ |
||||
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef |
||||
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef |
||||
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef |
||||
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef |
||||
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright |
||||
/parenleft /parenright /asterisk /plus /comma /minus /period /slash |
||||
/zero /one /two /three /four /five /six /seven |
||||
/eight /nine /colon /semicolon /less /equal /greater /question |
||||
/at /A /B /C /D /E /F /G |
||||
/H /I /J /K /L /M /N /O |
||||
/P /Q /R /S /T /U /V /W |
||||
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore |
||||
/grave /a /b /c /d /e /f /g |
||||
/h /i /j /k /l /m /n /o |
||||
/p /q /r /s /t /u /v /w |
||||
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef |
||||
/Euro /.notdef /quotesinglbase /florin /quotedblbase /ellipsis /dagger /daggerdbl |
||||
/circumflex /perthousand /Scaron /guilsinglleft /OE /.notdef /Zcaron /.notdef |
||||
/.notdef /quoteleft /quoteright /quotedblleft /quotedblright /bullet /endash /emdash |
||||
/tilde /trademark /scaron /guilsinglright /oe /.notdef /zcaron /Ydieresis |
||||
/space /exclamdown /cent /sterling /currency /yen /brokenbar /section |
||||
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron |
||||
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered |
||||
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown |
||||
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla |
||||
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis |
||||
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply |
||||
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls |
||||
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla |
||||
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis |
||||
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide |
||||
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis |
||||
] |
||||
def |
||||
% end encoding |
||||
%%IncludeResource: font Helvetica |
||||
/Helvetica findfont |
||||
dup length dict begin |
||||
{1 index /FID ne {def} {pop pop} ifelse} forall |
||||
/Encoding WinAnsiEncoding def |
||||
currentdict |
||||
end |
||||
/Font1 exch definefont pop |
||||
%%IncludeResource: font Helvetica-Bold |
||||
/Helvetica-Bold findfont |
||||
dup length dict begin |
||||
{1 index /FID ne {def} {pop pop} ifelse} forall |
||||
/Encoding WinAnsiEncoding def |
||||
currentdict |
||||
end |
||||
/Font2 exch definefont pop |
||||
%%IncludeResource: font Helvetica-Oblique |
||||
/Helvetica-Oblique findfont |
||||
dup length dict begin |
||||
{1 index /FID ne {def} {pop pop} ifelse} forall |
||||
/Encoding WinAnsiEncoding def |
||||
currentdict |
||||
end |
||||
/Font3 exch definefont pop |
||||
%%IncludeResource: font Helvetica-BoldOblique |
||||
/Helvetica-BoldOblique findfont |
||||
dup length dict begin |
||||
{1 index /FID ne {def} {pop pop} ifelse} forall |
||||
/Encoding WinAnsiEncoding def |
||||
currentdict |
||||
end |
||||
/Font4 exch definefont pop |
||||
%%IncludeResource: font Symbol |
||||
/Symbol findfont |
||||
dup length dict begin |
||||
{1 index /FID ne {def} {pop pop} ifelse} forall |
||||
currentdict |
||||
end |
||||
/Font5 exch definefont pop |
||||
%%EndProlog |
||||
%%Page: 1 1 |
||||
bp |
||||
18.00 18.00 823.89 577.28 cl |
||||
48.24 48.24 793.65 518.24 cl |
||||
/Font1 findfont 12 s |
||||
0 0 0 srgb |
||||
331.08 461.26 (|) .5 0 t |
||||
0.75 setlinewidth |
||||
[] 0 setdash |
||||
1 setlinecap |
||||
1 setlinejoin |
||||
10.00 setmiterlimit |
||||
np |
||||
133.36 283.24 m |
||||
158.17 181.32 l |
||||
79.09 0 l |
||||
158.17 -181.32 l |
||||
o |
||||
np |
||||
349.05 101.91 m |
||||
143.79 181.33 l |
||||
71.90 0 l |
||||
143.79 -181.33 l |
||||
o |
||||
161.91 378.40 (P) 0 ta |
||||
-0.600 (etal.Length< 2.45) tb gr |
||||
373.42 195.87 (P) 0 ta |
||||
-0.600 (etal.Width< 1.75) tb gr |
||||
397.33 363.42 (P) 0 ta |
||||
-0.600 (etal.Length>=2.45) tb gr |
||||
587.27 180.89 (P) 0 ta |
||||
-0.600 (etal.Width>=1.75) tb gr |
||||
/bg { 1 1 1 srgb } def |
||||
np |
||||
398.28 464.56 m |
||||
-0.37 2.56 l |
||||
-1.10 2.52 l |
||||
-1.82 2.47 l |
||||
-2.52 2.39 l |
||||
-3.19 2.28 l |
||||
-3.84 2.15 l |
||||
-4.42 1.99 l |
||||
-4.98 1.80 l |
||||
-5.46 1.61 l |
||||
-5.90 1.40 l |
||||
-6.27 1.16 l |
||||
-6.57 0.91 l |
||||
-6.79 0.67 l |
||||
-6.95 0.40 l |
||||
-7.02 0.13 l |
||||
-7.03 -0.13 l |
||||
-6.95 -0.40 l |
||||
-6.79 -0.67 l |
||||
-6.57 -0.91 l |
||||
-6.27 -1.16 l |
||||
-5.90 -1.40 l |
||||
-5.46 -1.61 l |
||||
-4.98 -1.80 l |
||||
-4.42 -1.99 l |
||||
-3.83 -2.15 l |
||||
-3.20 -2.28 l |
||||
-2.52 -2.39 l |
||||
-1.82 -2.47 l |
||||
-1.10 -2.52 l |
||||
-0.37 -2.56 l |
||||
0.37 -2.55 l |
||||
1.10 -2.53 l |
||||
1.82 -2.47 l |
||||
2.52 -2.39 l |
||||
3.20 -2.28 l |
||||
3.83 -2.14 l |
||||
4.42 -1.99 l |
||||
4.98 -1.81 l |
||||
5.46 -1.61 l |
||||
5.90 -1.39 l |
||||
6.27 -1.16 l |
||||
6.57 -0.92 l |
||||
6.79 -0.66 l |
||||
6.95 -0.40 l |
||||
7.03 -0.13 l |
||||
7.02 0.13 l |
||||
6.95 0.40 l |
||||
6.79 0.66 l |
||||
6.57 0.92 l |
||||
6.27 1.16 l |
||||
5.90 1.39 l |
||||
5.46 1.61 l |
||||
4.98 1.81 l |
||||
4.42 1.99 l |
||||
3.84 2.14 l |
||||
3.19 2.28 l |
||||
2.52 2.39 l |
||||
1.82 2.47 l |
||||
1.10 2.53 l |
||||
0.37 2.55 l |
||||
cp p3 |
||||
np |
||||
595.99 283.24 m |
||||
-0.37 2.55 l |
||||
-1.10 2.53 l |
||||
-1.82 2.47 l |
||||
-2.52 2.39 l |
||||
-3.19 2.28 l |
||||
-3.83 2.14 l |
||||
-4.43 1.99 l |
||||
-4.97 1.81 l |
||||
-5.47 1.61 l |
||||
-5.90 1.39 l |
||||
-6.27 1.16 l |
||||
-6.57 0.92 l |
||||
-6.79 0.66 l |
||||
-6.95 0.40 l |
||||
-7.02 0.14 l |
||||
-7.03 -0.14 l |
||||
-6.94 -0.40 l |
||||
-6.80 -0.66 l |
||||
-6.57 -0.92 l |
||||
-6.26 -1.16 l |
||||
-5.90 -1.39 l |
||||
-5.47 -1.61 l |
||||
-4.97 -1.81 l |
||||
-4.43 -1.99 l |
||||
-3.83 -2.14 l |
||||
-3.20 -2.28 l |
||||
-2.52 -2.39 l |
||||
-1.82 -2.47 l |
||||
-1.10 -2.53 l |
||||
-0.37 -2.55 l |
||||
0.37 -2.56 l |
||||
1.10 -2.52 l |
||||
1.82 -2.47 l |
||||
2.52 -2.39 l |
||||
3.20 -2.28 l |
||||
3.83 -2.15 l |
||||
4.43 -1.98 l |
||||
4.97 -1.81 l |
||||
5.47 -1.61 l |
||||
5.90 -1.40 l |
||||
6.26 -1.16 l |
||||
6.57 -0.91 l |
||||
6.80 -0.67 l |
||||
6.94 -0.40 l |
||||
7.03 -0.13 l |
||||
7.02 0.13 l |
||||
6.95 0.40 l |
||||
6.79 0.67 l |
||||
6.57 0.91 l |
||||
6.27 1.16 l |
||||
5.90 1.40 l |
||||
5.47 1.61 l |
||||
4.97 1.81 l |
||||
4.43 1.98 l |
||||
3.83 2.15 l |
||||
3.19 2.28 l |
||||
2.52 2.39 l |
||||
1.82 2.47 l |
||||
1.10 2.52 l |
||||
0.37 2.56 l |
||||
cp p3 |
||||
np |
||||
180.88 300.52 m |
||||
0 -34.56 l |
||||
-95.04 0 l |
||||
0 34.56 l |
||||
cp p3 |
||||
np |
||||
396.57 119.19 m |
||||
0 -34.56 l |
||||
-95.04 0 l |
||||
0 34.56 l |
||||
cp p3 |
||||
np |
||||
756.05 119.19 m |
||||
0 -34.56 l |
||||
-95.04 0 l |
||||
0 34.56 l |
||||
cp p3 |
||||
331.08 474.66 (setosa ) .5 0 t |
||||
331.08 460.26 (50/50/50) .5 0 t |
||||
133.36 293.33 (setosa ) .5 0 t |
||||
133.36 278.93 (50/0/0) .5 0 t |
||||
503.12 293.33 (v) 0 ta |
||||
-0.300 (ersicolor) tb gr |
||||
528.79 278.93 (0/50/50) .5 0 t |
||||
323.38 112.00 (v) 0 ta |
||||
-0.300 (ersicolor) tb gr |
||||
349.05 97.60 (0/49/5) .5 0 t |
||||
708.53 112.00 (virginica ) .5 0 t |
||||
708.53 97.60 (0/1/45) .5 0 t |
||||
18.00 18.00 823.89 577.28 cl |
||||
/Font2 findfont 14 s |
||||
0 0 0 srgb |
||||
420.94 542.73 (Endpoint = Species) .5 0 t |
||||
ep |
||||
%%Trailer |
||||
%%Pages: 1 |
||||
%%EOF |
Loading…
Reference in new issue