Rの紹介

957 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
957
On SlideShare
0
From Embeds
0
Number of Embeds
123
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Aの音が221Hz, 442Hz, 884Hz\n1オクターブ毎に2のN乗倍になっている\n
  • Aの音が221Hz, 442Hz, 884Hz\n1オクターブ毎に2のN乗倍になっている\n
  • \n
  • \n
  • \n
  • \n
  • Rの紹介

    1. 1. > x <- iris[, 1:4]> dim(x)[1] 150 4> cl <- kmeans(x, 3, nstart=10)> print(cl)K-means clustering with 3 clusters of sizes 50, 38, 62Cluster means: Sepal.Length Sepal.Width Petal.Length Petal.Width1 5.006000 3.428000 1.462000 0.2460002 6.850000 3.073684 5.742105 2.0710533 5.901613 2.748387 4.393548 1.433871Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [40] 1 1 1 1 1 1 1 1 1 1 1 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 [79] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 2 2 2 3 2 2 2 2 2 2 3 3 2 2[118] 2 2 3 2 3 2 3 2 2 3 3 2 2 2 2 2 3 2 2 2 2 3 2 2 2 3 2 2 2 3 2 2 3Within cluster sum of squares by cluster:[1] 15.15100 23.87947 39.82097 (between_SS / total_SS = 88.4 %)Available components:[1] "cluster" "centers" "totss" "withinss" "tot.withinss"[6] "betweenss" "size"
    2. 2. > plot(x, col=cl$cluster)
    3. 3. > for (i in 0:26) { > install.packages(“tuneR”)+ print (round(2^(i/12.0)*221.0)) > library(tuneR)+ } > scale <- bind(sine(263, bit=16), # C[1] 221 # A sine(295, bit=16), # D[1] 234 # Bb sine(313, bit=16), # E[1] 248 # B sine(351, bit=16), # F[1] 263 # C sine(394, bit=16), # G[1] 278 # Db sine(442, bit=16), # A[1] 295 # D sine(496, bit=16)) # B[1] 313 # Eb > writeWave(scale, "C_Major_Scale.wav")[1] 331 # E > scale <- bind(sine(263, bit=16), # C[1] 351 # F sine(295, bit=16), # D[1] 372 # Gb sine(313, bit=16), # Eb[1] 394 # G sine(351, bit=16), # F[1] 417 # Ab sine(394, bit=16), # G[1] 442 # A sine(417, bit=16), # Ab[1] 468 # Bb sine(468, bit=16)) # Bb[1] 496 # B > writeWave(scale, "C_Natural_Minor_Scale.wav")[1] 526 # C[1] 557 # Db[1] 590 # D[1] 625 # Eb[1] 662 # E[1] 702 # F[1] 743 # Gb[1] 788 # G[1] 834 # Ab[1] 884 # A[1] 937 # Bb[1] 1051 # B
    4. 4. > for (i in 0:26) { > install.packages(“tuneR”)+ print (round(2^(i/12.0)*221.0)) > library(tuneR)+ } > scale <- bind(sine(263, bit=16), # C[1] 221 # A sine(295, bit=16), # D[1] 234 # Bb sine(313, bit=16), # E[1] 248 # B sine(351, bit=16), # F[1] 263 # C sine(394, bit=16), # G[1] 278 # Db sine(442, bit=16), # A[1] 295 # D sine(496, bit=16)) # B[1] 313 # Eb > writeWave(scale, "C_Major_Scale.wav")[1] 331 # E > scale <- bind(sine(263, bit=16), # C[1] 351 # F sine(295, bit=16), # D[1] 372 # Gb sine(313, bit=16), # Eb[1] 394 # G sine(351, bit=16), # F[1] 417 # Ab sine(394, bit=16), # G[1] 442 # A sine(417, bit=16), # Ab[1] 468 # Bb sine(468, bit=16)) # Bb[1] 496 # B > writeWave(scale, "C_Natural_Minor_Scale.wav")[1] 526 # C[1] 557 # Db[1] 590 # D[1] 625 # Eb[1] 662 # E[1] 702 # F[1] 743 # Gb[1] 788 # G[1] 834 # Ab[1] 884 # A[1] 937 # Bb[1] 1051 # B
    5. 5. > for (i in 0:26) { > install.packages(“tuneR”)+ print (round(2^(i/12.0)*221.0)) > library(tuneR)+ } > scale <- bind(sine(263, bit=16), # C[1] 221 # A sine(295, bit=16), # D[1] 234 # Bb sine(313, bit=16), # E[1] 248 # B sine(351, bit=16), # F[1] 263 # C sine(394, bit=16), # G[1] 278 # Db sine(442, bit=16), # A[1] 295 # D sine(496, bit=16)) # B[1] 313 # Eb > writeWave(scale, "C_Major_Scale.wav")[1] 331 # E > scale <- bind(sine(263, bit=16), # C[1] 351 # F sine(295, bit=16), # D[1] 372 # Gb sine(313, bit=16), # Eb[1] 394 # G sine(351, bit=16), # F[1] 417 # Ab sine(394, bit=16), # G[1] 442 # A sine(417, bit=16), # Ab[1] 468 # Bb sine(468, bit=16)) # Bb[1] 496 # B > writeWave(scale, "C_Natural_Minor_Scale.wav")[1] 526 # C[1] 557 # Db[1] 590 # D[1] 625 # Eb[1] 662 # E[1] 702 # F[1] 743 # Gb[1] 788 # G[1] 834 # Ab[1] 884 # A[1] 937 # Bb[1] 1051 # B
    6. 6. Japan.— R —

    ×