Hello! I have used read.csv to read in a data frame, and there are a few variables in it, however, when I tried is.list(data$V1)>FALSEIn fact, I have tried, they are not vectors either. I'm wondering: 1. What objects are these "lists" of data? 2. How could I find out about the type/inheritence of an object in general? 3. The reason I want it to be a list or vector, is that I want to fill in some blank values, i can't seem to do things like: data$V1[1] = 3 Is it because these variables are pointers? Is there a better way to do this? Sorry to cram so many questions in one email! Karen _________________________________________________________________ l. Click here to learn how. [[alternative HTML version deleted]]
class(data) class(data$V1) str(data) str(data$V1) dput(data) dput(data$V1) On Wed, Mar 12, 2008 at 7:17 PM, Chang Liu <changisme at hotmail.com> wrote:> > Hello! > I have used read.csv to read in a data frame, and there are a few variables in it, however, when I tried > is.list(data$V1) > >FALSE > In fact, I have tried, they are not vectors either. > > I'm wondering: > 1. What objects are these "lists" of data? > 2. How could I find out about the type/inheritence of an object in general? > 3. The reason I want it to be a list or vector, is that I want to fill in some blank values, i can't seem to do things like: > data$V1[1] = 3 > Is it because these variables are pointers? Is there a better way to do this? > > Sorry to cram so many questions in one email! > > Karen > _________________________________________________________________ > > l. Click here to learn how. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
is(data$V1) Have a look at the refcard that you can download from cran.r-project.org or please take a look at one of the many other manuals that are provided there for free (many manuals are also available elsewhere on the internet, so you can google them). Almost all of them answer these basic questions. (Sorry for not giving credit to the one who has written the refcard, but it slipped my mind who.) Also you can type help.search("put your search term here") or RSiteSearch("put your search term here") to check whether your question has been addressed by others before. Cheers. ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im Auftrag von Chang Liu Gesendet: Wednesday, March 12, 2008 7:18 PM An: R Help Betreff: [R] type of object of a variable in a data frame Hello! I have used read.csv to read in a data frame, and there are a few variables in it, however, when I tried is.list(data$V1)>FALSEIn fact, I have tried, they are not vectors either. I'm wondering: 1. What objects are these "lists" of data? 2. How could I find out about the type/inheritence of an object in general? 3. The reason I want it to be a list or vector, is that I want to fill in some blank values, i can't seem to do things like: data$V1[1] = 3 Is it because these variables are pointers? Is there a better way to do this? Sorry to cram so many questions in one email! Karen _________________________________________________________________ l. Click here to learn how. [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Chang Liu <changisme at hotmail.com> wrote in news:BAY144-W56113AA5B8B59D44C17F37BE080 at phx.gbl:> 3. The reason I want it to be a list or vector, is that I want to > fill in some blank values, i can't seem to do things like: > data$V1[1] = 3 Is it because these variables are pointers? Is there > a better way to do this? >You have not given reproducible code, so it is difficult to know why that does not succeed. I have a data.frame with a similar name left over from another problem. When I enter DATA$V1[1] = -.5 , it has the desired effect. Although it is not the source of the error, you should learn to use "<-" rather than "=". You should also learn to post questions with reproducible code. -- David Winsemius