I’d like to ask a beginner’s question, please, because I cannot find an answer to it anywhere. So please bear with me!
I have three complex data structures (“JAMES”, “CHARLES”, and “RICHARD”) and calculated certain values from it. Now I’d like to illustrate some of these values. Trying to use them directly gives me error messages I don’t understand. That’s why and due to the structure of the data sets I’d rather copy the values I’m interested in to a new simple data set. But I don’t know how to do this, unfortunately. I’m not even sure how to provide you with a correct machine readable example because it’s so complex. So instead of that I’d like to know the following, please:
What’s the fastest and easiest way to feed these values into R in order to illustrate them as a table or graphs in a diagram?
This is an example of the values I mentioned:
Year – “JAMES” – “CHARLES” – “RICHARD”
2001 14 10 5
2002 15 14 7
2003 16 16 9
2004 17 18 11
2005 18 20 13
How can I create a machine readable version of the example above?
Thank you very much in advance for your consideration!
The most convenient method would be to construct a dataframe using read.table()
Instead of a text argument, you could have read from a file on your computer. This is rather basic stuff and suggests that you should be working through the examples in “Introduction to R” or maybe the “R for Dummies” text which has a convenient price. The second instance would be giving two of our regular SO contributors a vote of confidence. It’s very good (despite the series title which I find off-putting.)
If these were in separate files and very long , you could read the header text with different separator, and the data with whitespace separation with both using read.table