R noob here again. I want to prompt the user and according to user's choice I want to execute a block code. So example;
answer <- readline(prompt = " Enter a, b or c: ")
if (answer == "a") {
library("igraph")
variable <- graph_from_data_frame(d=links, vertices=nodes, directed=T)
variable
plot(variable, edge.arrow= .5, vertex.frame.color = "#ffffff")
} else if (answer == "b") {
#do something else like above
} else {
#do something different than everything above
}
This didn't work for me, switch cases didn't also work. Is there a solution for this kind of a problem? This also gave me: Error: unexpected '}' in " }"
I am pretty sure I didn't do any mistakes with my brackets.
Aucun commentaire:
Enregistrer un commentaire