Is the general rule to use factor when the variable being used to determine the shape/size/colour is discrete, and not continuous? Or is there another use of factor in this context? It seems like the first command can be made like the second with the right legend, even without factor. thanks. edit: I get this when I use the colour=gear:
Performance: as.factor > factor when input is integer A factor variable is the next of kin of an integer variable. ... This means that converting an integer to a factor is easier than converting a numeric / character to a factor. as.factor just takes care of this.
Why use as.factor () instead of just factor () - Stack Overflow
A factor is a vector of integers, each of which is associated with a character 'label'. When you create a factor by reading a column of character values in a text file (e.g. .csv), R assigns the integer values in alphabetical order rather than in the order they appear in the file.
Read your identity from right to left. And ask yourself why it is true. And your answer will be to multiply the two factors and finding out that the result is $x^3+1$.
What is the method to factor $x^3 + 1$? - Mathematics Stack Exchange
abstract algebra - Prove that $x-1$ is a factor of $x^n-1 ...
From my understanding, the currently accepted answer only changes the order of the factor levels, not the actual labels (i.e., how the levels of the factor are called).
The levels of a factor are stored as character data type anyway (attributes(f)), so I don't think there is anything wrong with as.numeric(paste(f)). Perhaps it would be better to think why (in the specific context) you are getting a factor in the first place, and try to stop that. E.g., is the dec argument in read.table set correctly?