Ich erhalte einen Fehler, wenn ich die Textplot() - Funktion im Wordcloud-Paket verwende, um Punkte in einem Diagramm (einem PCA) zu beschriften.Fehler mit Textplot in Wordcloud
Der Fehler ist: Error in match.arg(halign) : 'arg' must be NULL or a character vector
Hier sind die Variablen x und y:
> pca1$li
Axis1 Axis2
01 -26.3659354 18.0330276
02 -19.3576309 -18.9132485
03 -27.2273522 3.3373583
04 -23.0849100 0.9764428
05 8.1548417 29.4034493
06 14.9676626 -8.4668479
07 -9.2283936 4.5088119
08 17.9377761 -11.3030900
09 -0.8272139 2.3342824
10 30.3111878 18.8577228
11 2.0019239 -6.2150041
12 22.2964319 34.6544348
13 25.4172737 -39.6409997
14 4.4278974 -5.5672158
15 4.2769304 -11.4208116
16 19.2807143 -7.9307193
17 5.1918409 -5.2005851
18 -17.6999115 -26.7897873
19 -15.5909519 6.0809629
20 -3.6095312 1.2653160
21 -12.7500774 8.5864060
22 1.4774272 13.4100946
Der Text (was ich Etiketten hier nennen) soll ein Zeichen Vektor sein, die ich sicher von :
> labels
[1] "Vipond Park" "Little Joe" "Napa Sunset" "Deadline" "Deschutes" "Gifford Pinchot"
[7] "Mount Hood" "Okanogan" "Warm Springs" "Colville" "Wenatchee" "Olympic"
[13] "Smithers" "Mount Stevens" "Jesmond" "McBridePeak" "Cataract" "Prairie Bluff"
[19] "Tom Beal" "Humboldt" "Warner" "Goosenest"
> class(labels)
[1] "character"
Hier sind Plotten Spezifika (I weitere Informationen hinzufügen, als nötig, weil ich manchmal mehr Datenpunkte Plot):
> myPch <- c(18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18)
>
> myCol <- transp(c("blue","red","darkgreen","black","purple","blue","red","darkgreen","black","purple",
+ "blue","red","darkgreen","black","purple", "blue","red","darkgreen","black","purple", "blue","red",
+ "darkgreen","black","purple", "blue","red","darkgreen","black","purple", "blue","red","darkgreen",
+ "black","purple", "blue","red","darkgreen","black","purple","blue","red","darkgreen","black","purple",
+ "blue","red","darkgreen","black","purple","blue","red","darkgreen","black","purple", "blue","red",
+ "darkgreen","black","purple","blue","red","darkgreen","black","purple"),1)
>
>
>
ich die Daten plotten:
> plot(pca1$li, col=myCol, cex=3, pch=myPch)
> abline(h=0,v=0,col="grey",lty=2)
ich dann gehen die Etiketten auf dem Grundstück hinzuzufügen, aber ich habe den unten Fehler.
> textplot(pca1$li[,1], pca1$li[,2], words = labels, cex=1.4, new=FALSE)
Error in match.arg(halign) : 'arg' must be NULL or a character vector
>
Danke - Sie haben indirekt meine Frage beantwortet. Ich wollte Textplot im Wordcloud-Paket verwenden (nicht in gplots). Seit ich gplots und wordcloud geladen hatte, funktionierte die Formel für wordcloud nicht. Mit nur dem Paket wordcloud ist alles gut !!! – user3545679