Re: [R] data.frame loses name when constructed with one column

2007-09-04 Thread jim holtman
Try drop=FALSE: > x out pred1 predd2 1 1 2.03.0 2 2 3.55.5 3 3 5.5 11.0 > x[,1] [1] 1 2 3 > data.frame(x[,1]) x...1. 1 1 2 2 3 3 > data.frame(x[,1, drop=FALSE]) out 1 1 2 2 3 3 > On 9/4/07, Stan Hopkins <[EMAIL PROTECTED]> wrote: > Not sure why th

[R] data.frame loses name when constructed with one column

2007-09-04 Thread Stan Hopkins
Not sure why the data.frame function does not capture the name of the column field when its being built with only one column. Can anyone help? > data out pred1 predd2 1 1 2.03.0 2 2 3.55.5 3 3 5.5 11.0 > data1=data.frame(data[,1]) > data1 data...1. 1 1 2

Re: [R] data.frame

2007-06-18 Thread jim holtman
Is this close to what you want? 'var' was not defined for row.names. > M <- matrix(scan(textConnection(x)), ncol=3, byrow=TRUE) Read 63 items > dm <- ncol(M) > v <- vector() > t <- 1 > while (dm > 0) { + v <- c(v,paste("Rép",t,sep="")) + t <- t + 1 + dm <- dm - 1 + } > df <- as.data.frame(M) >

Re: [R] data.frame

2007-06-18 Thread Christophe Pallier
If M is the original matrix, k <- as.data.frame(M) names(k) <- paste("Rép",1:ncol(k),sep="") rownames(k) <- paste("Col",1:nrow(k),sep="") # replace by what you want k On 6/18/07, elyakhlifi mustapha <[EMAIL PROTECTED]> wrote: > > hello, > I'm trying to write a function which take a matrix and g

Re: [R] data.frame

2007-06-18 Thread Christophe Pallier
On 6/18/07, Robin Hankin <[EMAIL PROTECTED]> wrote: > > > I think the questioner was looking for row() and col(), which (IMO) are > difficult to find if you don't know of their existence. Searching for "R matrix number of rows columns" in google returns, in fourth position, the manual page for '

[R] data.frame

2007-06-18 Thread elyakhlifi mustapha
hello, I'm trying to write a function which take a matrix and give a dataframe with column names and row names but the problem I meet it's that the column number is changing and the vector containing the column names is also changing how can I do to write a good progam for the moment I tryied li

Re: [R] data.frame

2007-06-18 Thread Robin Hankin
On 18 Jun 2007, at 14:16, Adaikalavan Ramasamy wrote: > See help(dim) and please read the manuals before asking basic > questions > like this. Thank you. > I think the questioner was looking for row() and col(), which (IMO) are difficult to find if you don't know of their existence. [as ind

Re: [R] data.frame

2007-06-18 Thread Christophe Pallier
On 6/18/07, elyakhlifi mustapha <[EMAIL PROTECTED]> wrote: > > hello, > are there functions giving the columns number and the rows number of a > matrix? Yes, there are. Are you trying to use R without reading *any* documentation??? The mailing list is not a substitute for the manuals. See the Po

Re: [R] data.frame

2007-06-18 Thread Adaikalavan Ramasamy
See help(dim) and please read the manuals before asking basic questions like this. Thank you. elyakhlifi mustapha wrote: > hello, > are there functions giving the columns number and the rows number of a matrix? > thanks. > > > > __

[R] data.frame

2007-06-18 Thread elyakhlifi mustapha
hello, are there functions giving the columns number and the rows number of a matrix? thanks. _ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.c

Re: [R] data.frame and subsetting problem

2007-06-17 Thread Michelle Wynn
Yes, the problem I have is finding away to get rid of the extra levels I do not need in the subset. What Don posted works for my needs. I will also read up on factors/levels. Thanks for all suggestions and sorry my example had and error (x2 was supposed to y). Michelle On 6/16/07, Don MacQueen

Re: [R] data.frame and subsetting problem

2007-06-16 Thread Don MacQueen
I too have no idea what the object named "x2" is, or where it came from. Particularly since after your use of subset(), the new dataframe, y, *does* include a row where V2 = 'color'. But I have a guess at what your problem may be. In your original dataframe ("x") the first and second columns ar

Re: [R] data.frame and subsetting problem

2007-06-16 Thread jim holtman
Not sure what 'x2' is that you are plotting; it is not defined. read.delimand subset return dataframes, so you don't need data.frame. Here is something that does work: > x <- "shirt,size,40 + shirt,color,10 + shirt,length,10 + shirt,brand, 1 + shoes,style,5 + shoes,brand,4 + shoes,color,1" > x <-

[R] data.frame and subsetting problem

2007-06-16 Thread Michelle Wynn
I have read the R online help and wiki and I cannot seem to get something to work the way I need it to. I want to create a new data frame from an subset of an existing data frame which has no reference to the original superset. If you following this example, what I am trying to do may make more s

Re: [R] data.frame handling

2007-03-19 Thread Tony Plate
'table()' can compute your desired result in this particular case (though I don't know if it's what you want in general): > y <- factor(c("a","b","c")[c(1,1,1,2,2,3,3,3)]) > x <- factor(c("x","y","z")[c(1,2,3,1,2,1,2,3)]) > table(x, y) y x a b c x 1 1 1 y 1 1 1 z 1 0 1 > If x

[R] data.frame handling

2007-03-19 Thread Michela Cameletti
Dear R-users, I have a little problem that I can't solve by myself. I have a data frame with 2 factors and 8 observations (see the following code): y <- c(1,1,1,2,2,3,3,3) y <- factor(y) levels(y) <- c("a","b","c") x <- c(1,2,3,1,2,1,2,3) x <- factor(x) levels(x) <- c("x","y","z") X <- dat

Re: [R] Data.frame columns in R console

2007-02-09 Thread Martin Maechler
> "Lauri" == Lauri Nikkinen <[EMAIL PROTECTED]> > on Fri, 9 Feb 2007 14:21:26 +0200 writes: Lauri> This still does not solve the issue that when I print in R console I get Lauri> columns that don't fit in the window underneath each other. Thanks anyway! But Brian did give y

Re: [R] Data.frame columns in R console

2007-02-09 Thread Lauri Nikkinen
Hi, This still does not solve the issue that when I print in R console I get columns that don't fit in the window underneath each other. Thanks anyway! -Lauri 2007/2/9, Martin Maechler <[EMAIL PROTECTED]>: > > > "Petr" == Petr Pikal <[EMAIL PROTECTED]> > > on Fri, 09 Feb 2007 09:42:

Re: [R] Data.frame columns in R console

2007-02-09 Thread Martin Maechler
> "Petr" == Petr Pikal <[EMAIL PROTECTED]> > on Fri, 09 Feb 2007 09:42:13 +0100 writes: Petr> Hi Petr> On 9 Feb 2007 at 10:17, Lauri Nikkinen wrote: >> Thank you for your answer. When I set options(width=250) I still get >> the same result when I print the data.frame o

Re: [R] Data.frame columns in R console

2007-02-09 Thread Lauri Nikkinen
kinen wrote: > > Date sent: Fri, 9 Feb 2007 10:17:48 +0200 > From: "Lauri Nikkinen" <[EMAIL PROTECTED]> > To: "Prof Brian Ripley" <[EMAIL PROTECTED]> > Copies to: r-help@stat.math.ethz.ch > Sub

Re: [R] Data.frame columns in R console

2007-02-09 Thread Petr Pikal
r-help@stat.math.ethz.ch Subject: Re: [R] Data.frame columns in R console > Thank you for your answer. When I set options(width=250) I still get > the same result when I print the data.frame on my Rgui console (R > 2.4.1, Windows XP). Colums become underneath each other. I also get a

Re: [R] Data.frame columns in R console

2007-02-09 Thread Prof Brian Ripley
On Fri, 9 Feb 2007, Lauri Nikkinen wrote: > Thank you for your answer. When I set options(width=250) I still get the > same result when I print the data.frame on my Rgui console (R 2.4.1, Windows > XP). Colums become underneath each other. I also get an error (?) message [ > reached getOption("max

Re: [R] Data.frame columns in R console

2007-02-09 Thread Lauri Nikkinen
Thank you for your answer. When I set options(width=250) I still get the same result when I print the data.frame on my Rgui console (R 2.4.1, Windows XP). Colums become underneath each other. I also get an error (?) message [ reached getOption("max.print") -- omitted 3462 rows ]]. For example if I

Re: [R] Data.frame columns in R console

2007-02-08 Thread Prof Brian Ripley
?options, look for 'width'. I don't know what OS this in: the Windows Rgui has an option to set the width to the width of the console, but you can override it. On Thu, 8 Feb 2007, Lauri Nikkinen wrote: > Hi R-users, > > > > A newbie question: assume that I have for example 30 columns in my > dat

[R] Data.frame columns in R console

2007-02-08 Thread Lauri Nikkinen
Hi R-users, A newbie question: assume that I have for example 30 columns in my data.frame named DF. When I print DF in R console I get columns that don't fit on the same row underneath each other. So how do I change the R console preferences so that the console does not wrap my data.frame column

Re: [R] data.frame to shape

2006-08-09 Thread Gabor Grothendieck
Try this: DF[unlist(tapply(rownames(DF), DF$id, function(x) c(x, x[1]))),] On 8/9/06, Leonardo Lami <[EMAIL PROTECTED]> wrote: > Hi all, > I have a simple question: > I have a data.frame like this: > > id x y > 1 50 1647685 4815259 > 2 50 1647546 4815196 > 3 50 1647454 4815294 >

[R] R: data.frame to shape

2006-08-09 Thread Guazzetti Stefano
---Messaggio originale- >Da: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] conto di Leonardo Lami >Inviato: 09 August, 2006 15:33 >A: r-help@stat.math.ethz.ch >Oggetto: [R] data.frame to shape > > >Hi all, >I have a simple question: >I h

[R] data.frame to shape

2006-08-09 Thread Leonardo Lami
Hi all, I have a simple question: I have a data.frame like this: id x y 1 50 1647685 4815259 2 50 1647546 4815196 3 50 1647454 4815294 4 50 1647405 4815347 5 50 1647292 4815552 6 50 1647737 4815410 7 74 1647555 4815201 8 74 1647464 4815023 9 74 1646970 4815129 10 74 1646895 481

[R] data.frame error using sem package

2006-06-28 Thread Patrick Bedard
Hi there, I just saw your question on the help list and tough you could help me with some start-up info I just downloaded the R project software to try running SEM analysis and I also downloaded the SEM package. But it just sits there on the desktop and R does not know where it is...I can¹t

Re: [R] data.frame

2006-05-24 Thread P Ehlers
Sara, You didn't read your data into R correctly. If your data are really in the form you posted (one long column of mixed data types and lots of blank lines), then I would: 1. remove the blank lines with my text editor and save (say, mydata.txt) 2. scan() the variable names into a vector nm

Re: [R] data.frame

2006-05-24 Thread Petr Pikal
3) I wonder how did you created your arguments? HTH Petr On 24 May 2006 at 13:05, Sara Mouro wrote: From: "Sara Mouro" <[EMAIL PROTECTED]> To: Date sent: Wed, 24 May 2006 13:05:45 +0100 Subject:[R] data.frame >

[R] data.frame

2006-05-24 Thread Sara Mouro
Dear all, Does any one knows why should I get the following error message, when trying to do a simple data.frame?? DataF<-data.frame(Subject,BiomR,Spp,Capas,Litter,Herbs,LitterD,MaxCanH,DDifS p,DSSp,Slope, CanDens,NearestSp) Erro em data.frame(Subject, BiomR, Spp, Capas, Litter, Herbs,

Re: [R] data.frame to list

2006-04-05 Thread Larry Howe
On Tuesday April 4 2006 21:56, Gabor Grothendieck wrote: > Try this: > dd <- read.table(myfile, as.is = TRUE) > lst <- as.list(dd[,2]) > names(lst) <- dd[,1] > lst$title This (almost) works. I did this instead: p = read.delim("params.txt", as.is=T) lst = as.list(p[ ,1]) names(lst) = rownames(p)

Re: [R] data.frame to list

2006-04-05 Thread Brahm, David
Larry Howe <[EMAIL PROTECTED]> wants to: > 1. read in a 2-column data file, e.g. > status new > db green > title "Most Significant Excursions" > 2. end up with an R list such that I can write e.g. > lst$title > and have R return "Most Significant Excursions". I call this "reading a hash table"

Re: [R] data.frame to list

2006-04-04 Thread jim holtman
You might want to consider the use of 'attr' to assign attributes to an object. That way you can keep your object as a data.frame: > attr(x,"title") <- "Most Significant" > attr(x,"title") [1] "Most Significant" On 4/4/06, Larry Howe <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm new to R, and I'm

Re: [R] data.frame to list

2006-04-04 Thread Gabor Grothendieck
Try this: dd <- read.table(myfile, as.is = TRUE) lst <- as.list(dd[,2]) names(lst) <- dd[,1] lst$title For a data frame (but not for a matrix) the names are the same as the colnames and dimnames is a two-element list consisting of the rownames and colnames. Try this: DF <- data.frame(A = 1:5, B

[R] data.frame to list

2006-04-04 Thread Larry Howe
Hi, I'm new to R, and I'm not a statistician (stunned silence). I am trying to do the following: 1. read in a 2-column data file, e.g. status new db green title "Most Significant Excursions" 2. end up with an R list such that I can write e.g. lst$title and have R return "Most Signifi

Re: [R] data.frame() size

2005-12-09 Thread Matthew Dowle
--- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: 08 December 2005 18:57 To: Matthew Dowle Cc: 'r-help@stat.math.ethz.ch' Subject: Re: [R] data.frame() size Matthew Dowle <[EMAIL PROTECTED]> writes: > Hi, > > In the example below wh

Re: [R] data.frame() size

2005-12-08 Thread Peter Dalgaard
Matthew Dowle <[EMAIL PROTECTED]> writes: > Hi, > > In the example below why is d 10 times bigger than m, according to > object.size ? It also takes around 10 times as long to create, which fits > with object.size() being truthful. gcinfo(TRUE) also indicates a great deal > more garbage collecto

[R] data.frame() size

2005-12-08 Thread Matthew Dowle
Hi, In the example below why is d 10 times bigger than m, according to object.size ? It also takes around 10 times as long to create, which fits with object.size() being truthful. gcinfo(TRUE) also indicates a great deal more garbage collector activity caused by data.frame() than matrix(). $ R

Re: [R] data.frame-question]

2005-10-27 Thread Petr Pikal
"'r-help@stat.math.ethz.ch'" Date sent: Thu, 27 Oct 2005 08:47:45 +0200 Subject:Re: [R] data.frame-question] > First a general comment on posting style, could you please be more > specific about where the error occurs as without this it is ver

Re: [R] data.frame-question]

2005-10-26 Thread Brandt, T. (Tobias)
minor2.0 year 2005 month10 day 06 svn rev 35749 language R -Original Message- From: Michael Graber [mailto:[EMAIL PROTECTED] Sent: 27 October 2005 12:43 AM To: [EMAIL PROTECTED] Subject: Re: Re:

Re: [R] data.frame-question

2005-10-26 Thread Brandt, T. (Tobias)
9:45 PM To: R-Mailingliste Subject: [R] data.frame-question Dear R-List, I am very new to R and programming itself, so my question may be easy to answer for you. I tried a lot and read through the manuals, but I still have the following problem: I have 2 data-frames: Number<-as.numeric (Number) N

Re: [R] data.frame-question

2005-10-25 Thread bogdan romocea
Mailingliste > Subject: [R] data.frame-question > > > Dear R-List, > I am very new to R and programming itself, so my question may > be easy to > answer for you. > I tried a lot and read through the manuals, but I still have the > following problem: > I have 2 data-fr

[R] data.frame-question

2005-10-25 Thread Michael Graber
Dear R-List, I am very new to R and programming itself, so my question may be easy to answer for you. I tried a lot and read through the manuals, but I still have the following problem: I have 2 data-frames: Number<-as.numeric (Number) Name<-as.character (Name) TAB1<-data.frame (Name,Number) - it

Re: [R] data.frame error using sem package

2005-10-06 Thread John Fox
mcmaster.ca/jfox/sem-package.pdf>. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -----Original Message

[R] data.frame error using sem package

2005-10-06 Thread Suzanne Witt
I am trying to use sem to measure effective connectivity among four brain regions. I have pasted the code that I am trying to run since that seems easier than trying to come up with another example. The input data is time series data taken from SPM; they are each 1x121 columns of numbers.

Re: [R] data.frame error using sem package

2005-10-06 Thread Uwe Ligges
Suzanne Witt wrote: > I keep getting this error when I try to use the sem package. I and > another person who has successfully used the sem package for similar > analysis (fMRI effective connectivity) cannot figure out what is > wrong with my code. I would appreciate any suggestions. It i

[R] data.frame error using sem package

2005-10-06 Thread Suzanne Witt
I keep getting this error when I try to use the sem package. I and another person who has successfully used the sem package for similar analysis (fMRI effective connectivity) cannot figure out what is wrong with my code. I would appreciate any suggestions. The error message: Error in data

Re: [R] data.frame to character - thanks

2005-06-10 Thread Gabor Grothendieck
Here is one minor improvement -- it does not overwrite the input: replace(d,,as.matrix(d)) On 6/10/05, Muhammad Subianto <[EMAIL PROTECTED]> wrote: > Dear all, > Thank you very much for your help. > I would like to thank Andy Liaw and Gabor Grothendieck for their fast help. > > Regards, > Muha

Re: [R] data.frame to character - thanks

2005-06-10 Thread Muhammad Subianto
Dear all, Thank you very much for your help. I would like to thank Andy Liaw and Gabor Grothendieck for their fast help. Regards, Muhammad Subianto On this day 6/10/2005 2:30 PM, Liaw, Andy wrote: > Is this what you want? > > >>d[] <- lapply(d, as.character) >>str(d) > > `data.frame': 10

Re: [R] data.frame to character

2005-06-10 Thread Gabor Grothendieck
On 6/10/05, Muhammad Subianto <[EMAIL PROTECTED]> wrote: > Hi, > Excuse me for this simple question. > How to convert as.data.frame to as.character? > > ?data.frame > > > L3 <- LETTERS[1:3] > > L10 <- LETTERS[1:10] > > d <- data.frame(cbind(x=c("XYZ"), y=L10), fac=sample(L3, 10, repl=TRUE))

Re: [R] data.frame to character

2005-06-10 Thread Liaw, Andy
Is this what you want? > d[] <- lapply(d, as.character) > str(d) `data.frame': 10 obs. of 3 variables: $ x : chr "XYZ" "XYZ" "XYZ" "XYZ" ... $ y : chr "A" "B" "C" "D" ... $ fac: chr "B" "A" "C" "B" ... Andy > From: Muhammad Subianto > > Hi, > Excuse me for this simple question. > How

[R] data.frame to character

2005-06-10 Thread Muhammad Subianto
Hi, Excuse me for this simple question. How to convert as.data.frame to as.character? ?data.frame > L3 <- LETTERS[1:3] > L10 <- LETTERS[1:10] > d <- data.frame(cbind(x=c("XYZ"), y=L10), fac=sample(L3, 10, repl=TRUE)) > d x y fac 1 XYZ A A 2 XYZ B A 3 XYZ C A 4 XYZ D A 5

[R] data.frame objects as seen by tapply

2005-04-21 Thread Ivan Alves
Dear all, I have encountered a bizarre ocurrence: tapply() does not treat the columns of data.frame[,cols] in the same way as those of data.frame[1:length(data.frame),cols]. Whilst for the latter it identifies the "length" of the column to be length(data.frame) in the former it does not seem

Re: [R] data.frame, data types, and apply

2005-03-02 Thread Uwe Ligges
Vincent Detours wrote: Dear all, Here is an issue I often stumble on. 1- colunm types in data.frames. --- d <- data.frame(x=as.character(c("a", "b", "c")), y=as.numeric(c(1, 2, 3))) d x y 1 a 1 2 b 2 3 c 3 is.numeric(d[1,2]) [1] TRUE is.numeric(d[1,1]) [1] FALSE apply(

[R] data.frame, data types, and apply

2005-03-02 Thread Vincent Detours
Dear all, Here is an issue I often stumble on. 1- colunm types in data.frames. --- > d <- data.frame(x=as.character(c("a", "b", "c")), y=as.numeric(c(1, 2, 3))) > d x y 1 a 1 2 b 2 3 c 3 > is.numeric(d[1,2]) [1] TRUE > is.numeric(d[1,1]) [1] FALSE > apply(d, c(1,2),

RE: [R] data.frame error message

2005-02-23 Thread Petr Pikal
Hi Nic Be careful with variables with same names in your environment as variables in data.frame. If you have a variable with the same name e.g. ppmtrans in data frame and in environment, your commands use variable from environment. So probably trt is from data frame and ppmtrans from environme

RE: [R] data.frame error message

2005-02-23 Thread Liaw, Andy
> From: Nic Ellis > > At 09:47 PM 2/22/2005 -0500, Liaw, Andy wrote: > >Following the suggestions in the Posting Guide would help us > to help you > >much better. > > > >What command(s) did you use to get the data into > >R? read.table("C:/.../persist.dat",col.names=c("a","b",etc.")) > > > >

RE: [R] data.frame error message

2005-02-23 Thread Nic Ellis
At 09:47 PM 2/22/2005 -0500, Liaw, Andy wrote: >Following the suggestions in the Posting Guide would help us to help you >much better. > >What command(s) did you use to get the data into >R? read.table("C:/.../persist.dat",col.names=c("a","b",etc.")) >What does the `.dat' file look like? Itn

RE: [R] data.frame error message

2005-02-22 Thread Liaw, Andy
Following the suggestions in the Posting Guide would help us to help you much better. What command(s) did you use to get the data into R? What does the `.dat' file look like? What are `x' and `y'? Data frames in R, by definition, has to have (unique) rownames. If they are not present in the da

[R] data.frame error message

2005-02-22 Thread Nic Ellis
Dear R users, I am using v2.0.1 on Windows 2000. I have read a ".dat" file with several vectors, including 2 factors (2 levels x 3 levels), and a vector of responses, into R. There are no unique row names. When I try plot(x,y) or lm(y~x) the following error is returned: Error in model.frame(f

RE: [R] data.frame into list by columns; merge and row.names

2005-02-13 Thread Tiago R Magalhaes
thanks to Andy Liaw and james holtman that replied to my posting this is very basic stuff, but for people strugling with these concepts - as I am... - here goes a more detailed explanation # what I wanted was to create a list where every element would be a column of a given data.frame the o

Re: [R] data.frame into list by columns; merge and row.names

2005-02-12 Thread Gabor Grothendieck
Tiago R Magalhaes socrates.Berkeley.EDU> writes: : : Hi : : a) : I want to make a list out of a data.frame, where each element of the : list is a column of the data.frame. : I looked in the archives and saw a lot of postings but surprsingly : none elucidated me. I also tried the split, aggreg

RE: [R] data.frame into list by columns; merge and row.names

2005-02-12 Thread Liaw, Andy
> From: Tiago R Magalhaes > > Hi > > a) > I want to make a list out of a data.frame, where each element of the > list is a column of the data.frame. > I looked in the archives and saw a lot of postings but surprsingly > none elucidated me. I also tried the split, aggregate help files and > cou

[R] data.frame into list by columns; merge and row.names

2005-02-12 Thread Tiago R Magalhaes
Hi a) I want to make a list out of a data.frame, where each element of the list is a column of the data.frame. I looked in the archives and saw a lot of postings but surprsingly none elucidated me. I also tried the split, aggregate help files and counldn't see any easy way to do this. I wouldn't

Re: [R] data.frame into vector

2004-11-24 Thread Jan Goebel
Hi, as other already pointed out as.matrix is what you need. Just one comment: as.matrix(x[1,]) should be much faster for larger data frames compared to as.matrix(x)[1,] Best jan On Tue, 23 Nov 2004, Tiago R Magalhaes wrote: > Hi > > I want to extract a row from a data.frame but I want

Re: [R] data.frame into vector

2004-11-23 Thread Marc Schwartz
On Tue, 2004-11-23 at 16:27 +, Tiago R Magalhaes wrote: > Hi > > I want to extract a row from a data.frame but I want that object to > be a vector . After trying some different ways I end up always with a > data.frame or with the wrong vector. Any pointers? > > x <- data.frame(a = factor(

RE: [R] data.frame into vector

2004-11-23 Thread Liaw, Andy
Is this what you want? > as.matrix(x[1,])[1,] a b "a" "4" HTH, Andy > From: Tiago R Magalhaes > > Hi > > I want to extract a row from a data.frame but I want that object to > be a vector . After trying some different ways I end up always with a > data.frame or with the wrong vector. An

Re: [R] data.frame into vector

2004-11-23 Thread Prof Brian Ripley
A data frame is a list, and a list is a vector. Once you understand that, yoy may understand what you are seeing. as.matrix(x)[1,] seems to be one of the easiest ways to get what you want On Tue, 23 Nov 2004, Tiago R Magalhaes wrote: Hi I want to extract a row from a data.frame but I want that

[R] data.frame into vector

2004-11-23 Thread Tiago R Magalhaes
Hi I want to extract a row from a data.frame but I want that object to be a vector . After trying some different ways I end up always with a data.frame or with the wrong vector. Any pointers? x <- data.frame(a = factor(c('a',2,'b')), b = c(4,5,6)) I want to get "a" "4" I tried: as.vector(x[1,])

Re: [R] data.frame size limit

2004-06-08 Thread Prof Brian Ripley
On Tue, 8 Jun 2004, Philip Sobolik wrote: > Is there a limit to the number of columns that a data.frame can have? Yes. A data frame is a list, and a list is limited to 2^31-1 items. > For > example, can I read.csv() a file that has 1000 columns and 10,000 rows, > will it break or is it limi

[R] data.frame size limit

2004-06-08 Thread Philip Sobolik
Is there a limit to the number of columns that a data.frame can have? For example, can I read.csv() a file that has 1000 columns and 10,000 rows, will it break or is it limited by available memory. ... Philip Soboli

[R] data.frame preserves names for all columns

2004-03-23 Thread Liaw, Andy
Dear R-help, I was surprised to find that data.frame() keeps the names of all columns: > x1 <- structure(1:5, names=1:5) > x2 <- structure(5:1, names=5:1) > x3 <- structure(10:6, names=10:6) > x <- data.frame(x1, x2, x3) > str(x) `data.frame': 5 obs. of 3 variables: $ x1: Named int 1 2 3 4 5

Re: RES: [R] data.frame to matrix

2004-02-09 Thread Duncan Murdoch
On Mon, 9 Feb 2004 19:10:00 -0300, you wrote: >Hi Duncan, > >You were right. It was a vector and not a data.frame that I was dealing >with. But still I am having dificulties. Please, take a look at some output >(I am using R Commander GUI by the way): > >R-cmdr> print(b) > [1] 0.70 0.85 0.80 0.70

Re: [R] data.frame to matrix

2004-02-09 Thread John Fox
Dear Gustavo, To fill in other list members, this is occurring with code written to augment the Rcmdr package. The problem is that .numeric is a vector of names of numeric variables in the "active data set" (data frame) maintained by Rcmdr, it is not itself a data frame. Consequently, your varste

RES: [R] data.frame to matrix

2004-02-09 Thread Gustavo Pinheiro
OTECTED] Enviada em: Monday, February 09, 2004 5:25 PM Para: Gustavo Pinheiro Cc: [EMAIL PROTECTED] Assunto: Re: [R] data.frame to matrix On Mon, 9 Feb 2004 17:47:36 -0300, "Gustavo Pinheiro" <[EMAIL PROTECTED]> wrote : >Hello all, > >I've had trouble converting

Re: [R] data.frame to matrix

2004-02-09 Thread Duncan Murdoch
On Mon, 9 Feb 2004 17:47:36 -0300, "Gustavo Pinheiro" <[EMAIL PROTECTED]> wrote : >Hello all, > >I've had trouble converting a data.frame to a matrix (numeric) using either >data.matrix() and as.matrix(). >After executing one of those I end up with another data.frame with only the >first column of

[R] data.frame to matrix

2004-02-09 Thread Gustavo Pinheiro
Hello all, I've had trouble converting a data.frame to a matrix (numeric) using either data.matrix() and as.matrix(). After executing one of those I end up with another data.frame with only the first column of the original data.frame. I use a window (tcltk) to let the user choose the columns he wa

Re: [R] data.frame subset?

2003-11-18 Thread Uwe Ligges
On Tue, 18 Nov 2003, Jeff D. Hamann wrote: > Can someone tell me why this is since I can't seem to find an explination in > the docs or FAQ for this. > > Since there are no "BM" in the mtrs data.frame, but only in the "parent" > data.frame (trees), I'm assuming the subset data.frame is still as

[R] data.frame subset?

2003-11-18 Thread Jeff D. Hamann
Can someone tell me why this is since I can't seem to find an explination in the docs or FAQ for this. Since there are no "BM" in the mtrs data.frame, but only in the "parent" data.frame (trees), I'm assuming the subset data.frame is still associated with the original. Is that correct and how woul

Re: [R] data.frame subsetting

2003-09-29 Thread Hecht Michael, F+E/ST
Hi, I think I have the same problem. The following works > aa<-data.frame(1:10) > ab<-data.frame(1:12) > ba<-data.frame(1:14) > bb<-data.frame(1:16) > xa<-data.frame() > xa$aa<-aa > xa$ab<-ab > xb<-data.frame() > xb$ba<-ba > xb$bb<-bb > xx<-data.frame() > xx$xa<-xa > xx$xb<-xb > summary(xx) xa

Re: [R] data.frame -> matrix

2003-09-27 Thread Roger D. Peng
I think data.matrix() is what you want. -roger Sokratis Alikhanidi wrote: Dear colleagues, I am beginner, so the primitive questions: in pls.pcr package in the function mvr I need to indicate a matrix of observations and a vector of responses. But read.table function returns the data.frame o

Re: [R] data.frame -> matrix

2003-09-27 Thread Patrick Burns
One place to start is "A Guide for the Unwilling S User". Patrick Burns Burns Statistics [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Sokratis Alikhanidi wrote: Dear colleagues, I am beginner, so the primitive questi

[R] data.frame -> matrix

2003-09-26 Thread Sokratis Alikhanidi
Dear colleagues, I am beginner, so the primitive questions: in pls.pcr package in the function mvr I need to indicate a matrix of observations and a vector of responses. But read.table function returns the data.frame object. What is the way for conversion of the data.frame object into matrix

Re: [R] data.frame with duplicated id's

2003-09-24 Thread Philipp Pagel
Hi! > is there a exstisting function (..i found nothing until now.) > what makes it possible transfrom a dataset: > > ID AGE V.MAI V.JUNE > 11 20 100 120 > 12 30 200 90 > > into > > IDAGEV > 1120 100 > 1120 120 > 1230200 > 1230

RE: [R] data.frame with duplicated id's

2003-09-23 Thread Andrew Hayen
Try ?reshape A -Original Message- From: Christian Schulz [mailto:[EMAIL PROTECTED] Sent: Wednesday, 24 September 2003 3:42 PM To: [EMAIL PROTECTED] Subject: [R] data.frame with duplicated id's Hi, is there a exstisting function (..i found nothing until now.) what makes it pos

[R] data.frame with duplicated id's

2003-09-23 Thread Christian Schulz
Hi, is there a exstisting function (..i found nothing until now.) what makes it possible transfrom a dataset: ID AGE V.MAI V.JUNE 11 20 100 120 12 30 200 90 into IDAGEV 1120 100 1120 120 1230200 123090 ,or have i to programm th

Re: [R] data.frame subsetting

2003-07-24 Thread Douglas Bates
Still works for me in both 1.7.1 and 1.8.0 (in development) > data(women) > women[["height"]] [1] 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 > women$height [1] 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 Can you provide an example of how it is failing for you? Dirk Repsilber <[EMAIL PROTEC

Re: [R] data.frame subsetting

2003-07-24 Thread Duncan Murdoch
On Thu, 24 Jul 2003 16:27:28 +0200, Dirk Repsilber <[EMAIL PROTECTED]> wrote : >Hi, > >is there advice how to subset a data.frame, where until R version 1.7.0 >it was possible to write > > > data[["subset"]] > >which meant the same as > > > data$subset > >(data is a data.frame). From 1.7.1 on thi

Re: [R] data.frame subsetting

2003-07-24 Thread Uwe Ligges
Dirk Repsilber wrote: Hi, is there advice how to subset a data.frame, where until R version 1.7.0 it was possible to write > data[["subset"]] which meant the same as > data$subset (data is a data.frame). From 1.7.1 on this does not seem to work longer. Could there be a bug in downwards co

[R] data.frame subsetting

2003-07-24 Thread Dirk Repsilber
Hi, is there advice how to subset a data.frame, where until R version 1.7.0 it was possible to write > data[["subset"]] which meant the same as > data$subset (data is a data.frame). From 1.7.1 on this does not seem to work longer. Could there be a bug in downwards compatibility? sincerely y

Re: [R] data.frame building

2003-06-03 Thread Prof Brian Ripley
On Mon, 2 Jun 2003, Jean Eid wrote: > I have two seperate questions that both deal with the way R handels data > sets: > > First, I am trying to read a data set of 80M into R. I am using > read.table(). The file is a tab file and I have tested the function for a > small amount of lines. It seems

[R] data.frame building

2003-06-03 Thread Jean Eid
Hi all, I have two seperate questions that both deal with the way R handels data sets: First, I am trying to read a data set of 80M into R. I am using read.table(). The file is a tab file and I have tested the function for a small amount of lines. It seems to work fine (i.e. correct amount of colu