I have a database with several columns with different species names, and one with a range of years. I have to produce a graph between species and years of sightings: everything works fine and the graph comes up, but as a legend it doesn't write the name in words but in numbers. For example, instead of putting "Citizen Science"=red, it writes 1=red. To do this I use a function that has already been tested on other PCs and everything works correctly, while on mine it doesn't.
I noticed that on other PCs it reads the variables as characters while on mine it gives them as factors. I tried modifying them with stringsAsFactors=F
and indeed they all come out as character, but doing so completely throws the graph off. I can't understand what the problem is and why only my computer reads the dataframe this way.
If it is helpful, this is the plot part of the function:
tipidati<-unique(data[,3])
tipidati<-tipidati[order(tipidati)]
if(plot){
plot(rbind(c(start-2,0),c(end,length(species))),type="n",ylab="Species richness",xlab="Years of record")
mtext(paste(paste(c(tipidati,"Plural"),"=",col=c(colours[1:length(tipidati)],colours[length(colours)]),sep=""),collapse=","),cex=0.9)