I have a dataset that in a wide format represent lenders' characters for a banking credit system. I want to make a scatter plot using ggplot where colours represent the purpose of the credit. My table looks like this: where 1 means the purpose of the credit.
lending_duration | lending_amount | Car | Furniture | TV/RADIO | House |
---|---|---|---|---|---|
1 month | 2000 | 0 | 1 | 0 | 0 |
16 months | 15600 | 1 | 0 | 0 | 0 |
4 month | 13094 | 0 | 0 | 0 | 1 |
etc... |
I tried:
ggplot(Data, aes(x = DURATION, y = AMOUNT))+ geom_point(aes(color = c(Car, Furniture, 'TV/Ratio', House))+ scale_color_viridis_c()
Not working out. Another question is how can I escape the / in the variable name, for example here TV/(OR)Radio, I try to use '' to escape the / in the variables but seems not working out.
Can someone help me here? Much appreciated!