Package von github_cross_lag_plot

Wie erweitere ich R um eigene Funktionen oder Pakete? Welches Paket ist passend für meine Fragestellung?

Moderatoren: EDi, jogo

Antworten
jakob77
Beiträge: 4
Registriert: Do Nov 07, 2019 11:23 am

Package von github_cross_lag_plot

Beitrag von jakob77 »

Liebes R-Forum,

Ich kann folgendes Package von github nicht installieren: cgnguyen/cross_lag_plot
Mein Code:

Code: Alles auswählen

install.packages("devtools")
library(devtools)
install_github("cgnguyen/cross_lag_plot")
Antwort R:

Code: Alles auswählen

Failed to install 'unknown package' from GitHub:
HTTP error 404.
Not Found
Did you spell the repo owner (cgnguyen) and repo name (cross_lag_plot) correctly?
If spelling is correct, check that you have the required permissions to access the repo._
Woher bekomme ich die Permission? Hab auf github schon kommentiert, bekomm aber keine Antwort.

Ich habe versucht den verfügbaren Code auf github als eigenes Skript bzw. Funktion laufen zu lassen. Wie verwende ich die Funktion dann richtig?
Folgendes korrekt?

Code: Alles auswählen

x1<- DatenR2$x1
x2<- DatenR2$x2
x3<- DatenR2$x3
y1<- DatenR2$y1
y2<- DatenR2$y2
y3<- DatenR2$y3
clmp_graph(riclpmModel,x1,x2,x3,y1,y2,y3)
Antwort R:

Code: Alles auswählen

Fehler in clmp_graph(riclpmModel, x1, x2, x3, y1, y2, y3) :
unbenutzte Argumente (x3, y1, y2, y3) 
Wieso, habe ja alle 6 Elemente definiert! :?
Ich bitte um eure Expertise, ich komme keinen Schritt weiter leider.

Liebe Grüße, Jakob
Zuletzt geändert von jakob77 am Do Nov 21, 2019 3:10 pm, insgesamt 1-mal geändert.
bigben
Beiträge: 2771
Registriert: Mi Okt 12, 2016 9:09 am

Re: Package von github_cross_lag_plot

Beitrag von bigben »

Hallo Jakob,

ich sehe da kein Paket, nur ein Source-File. Also in der allergrößten Not kannst Du die 122 Zeilen Code per copy und paste von hier herunterziehen:

https://github.com/cgnguyen/cross_lag_p ... mp_graph.R

Da fehlt dann alles, was ein Paket sonst noch ausmacht, ein DEXCRIPTION-File, Hilfeseite, etc.

Die Funktionsdefinition beginnt wie folgt:

Code: Alles auswählen

clmp_graph<-function(model_name,var_names,var_labels){
...
Demnach erwartet die Funktion drei Argumente, Du lieferst bei Deinem Aufruf aber sieben Argumente. Deshalb meldet R an, dass es mit den überzähligen vier nichts anfangen kann. Zur Bedienung steht auf der Github-Page nur
So far, only works for 3-variable models and omits path between first and third variable for legibility. clmp_graph requires the name of the lavaan model and the name of the three variables of interest. An optional vector can be used to specify alternative names for the figure.

Default behavior is that significant paths are printed as a solid line + labels with coefficient estimates are printed. Non-significant paths are printed as a dotted line, and labels are omitted.
Help-Seiten scheint der Autor nicht geplant zu haben.

LG,
Bernhard
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
jakob77
Beiträge: 4
Registriert: Do Nov 07, 2019 11:23 am

Re: Package von github_cross_lag_plot

Beitrag von jakob77 »

Danke für deine Ausführungen bigben.

Code: Alles auswählen

clmp_graph requires the name of the lavaan model and the name of the three variables of interest. An optional vector can be used to specify alternative names for the figure.
Wie kann ich drei Variablen als ein Argument der Funktion eingeben?

Liebe Grüße, Jakob
bigben
Beiträge: 2771
Registriert: Mi Okt 12, 2016 9:09 am

Re: Package von github_cross_lag_plot

Beitrag von bigben »

Da steht nichts von Variablen übergeben. Nur von Variablennamen. Vielleicht als einen Vector?
---
Programmiere stets so, dass die Maxime Deines Programmierstils Grundlage allgemeiner Gesetzgebung sein könnte
Antworten