Re: [R] Working with Data Frames

2015-11-03 Thread Joshua Ulrich
On Tue, Nov 3, 2015 at 6:26 PM, Robert Sherry wrote: > I have created what I believe to be a data frame. It is called env1$SPY. It's not a data.frame. You can use str() to look at the *str*ucture of an object: R> str(env1$SPY) An ‘xts’ object on 1995-01-03/2015-11-02 containing: Data: num [1:

Re: [R] Working with Data Frames

2015-11-03 Thread Bert Gunter
Have you gone through any R tutorials? There are innumerable good ones on the web -- and one that ships with R (An Intro to R). Don't you think you should make an effort to learn some basics on your own before posting here? ... or do I misinterpret your question? (And if so, my apologies -- feel f

Re: [R] Working with Data Frames

2015-11-03 Thread Peter Alspach
Of Robert Sherry Sent: Wednesday, 4 November 2015 1:27 p.m. To: r-help@r-project.org Subject: [R] Working with Data Frames I have created what I believe to be a data frame. It is called env1$SPY. The r statement head( env1$SPY ) produces the following output: SPY.Open SPY.High SPY.Low

[R] Working with Data Frames

2015-11-03 Thread Robert Sherry
I have created what I believe to be a data frame. It is called env1$SPY. The r statement head( env1$SPY ) produces the following output: SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted 1995-01-03 45.7031 45.8437 45.6875 45.7812 324300 31.55312 1995-01-04 45.9843

Re: [R] Working with data frames

2014-12-11 Thread William Dunlap
Sun Shine wrote > with(MHP.def, {plot(as.integer(MHP.def$Names),cH.E, axes=FALSE, xlab='Area') axis(side=2) axis(side=1, at=seq_along(levels(MHP.def$Names)), lab=levels(MHP.def$Names))}) Error: unexpected symbol in "with(MHP.def, {plot(as.integer(MHP.def$Names), MHP.def$cH.E, axes=FALSE, xlab='Are

Re: [R] Working with data frames

2014-12-11 Thread Jeff Newmiller
Ggplot2 also depends on factors, so learn about them asap. It does have some support for automatically converting strings to factors in some cases, but it doesn't always work the way you want it to. --- Jeff Newmiller

Re: [R] Working with data frames

2014-12-11 Thread Sun Shine
Hello William, Ivan and Jim I appreciate your replies. I did suppress the factors using stringsAsFactors=FALSE and in that way was able to progress some more on getting a sense of the data set, so thanks for that suggestion. I had previously overlooked it. Also thanks William, I never understo

Re: [R] Working with data frames

2014-12-11 Thread William Dunlap
Here is a reproducible example > d <- read.csv(text="Name,Age\nBob,2\nXavier,25\nAdam,1") > str(d) 'data.frame': 3 obs. of 2 variables: $ Name: Factor w/ 3 levels "Adam","Bob","Xavier": 2 3 1 $ Age : int 2 25 1 Do you get something similar? If not, show us what you have (you could

Re: [R] Working with data frames

2014-12-11 Thread jim holtman
If you are using 'read.csv' (or 'read.table') to input, then use the 'as.is = TRUE' parameter to prevent the conversion to factors of the data. You can also do "as.character(df$col_with_factors)" to get the character values back. Jim Holtman Data Munger Guru What is the problem that you are try

Re: [R] Working with data frames

2014-12-11 Thread Ivan Calandra
Hi Sun, If I understood correctly (a reproducible example would be of great help), it seems you're struggling with factors. Read on this topic to better understand how it works. For your plots, you would need to set the labels with the argument 'xlab' for plot(). To access the names of the f

[R] Working with data frames

2014-12-11 Thread Sun Shine
Hello I am struggling with data frames and would appreciate some help please. I have a data set of 13 observations and 80 variables. The first column is the names of different political area boundaries (e.g. MHad, LBNW, etc), the first row is a vector of variable names concerning various cens