RE: [R] extract rows in dataframe with duplicated column values

2005-03-18 Thread Tiago R Magalhaes
second try: > cnt <- table(x[,1]) > v <- as.numeric(names(cnt[cnt > 1])) > v [1] 2 3 > x[x[,1] %in% v, ] a b 2 2 10 3 2 10 4 3 10 5 3 10 6 3 10 Andy > From: Liaw, Andy > > Does this work for you? > > > x[table(x[,1]) > 1,] > a b

[R] extract rows in dataframe with duplicated column values

2005-03-17 Thread Tiago R Magalhaes
Hi I want to extract all the rows in a data frame that have duplicates for a given column. I would expect this question to come up pretty often but I have researched the archives and surprisingly couldn't find anything. The best I can come up with is: x <- data.frame(a=c(1,2,2,3,3,3), b=10) xdu

[R] reshape without timevar argument?

2005-02-25 Thread Tiago R Magalhaes
Hi I have a data.frame with 2 columns. The first column is an ID column. The other columns are description of the ids. There is more than one description for each Id. Want I want to get as a value is a data.frame where each row corresponds to one ID and has as many columns as different descript

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

2005-02-13 Thread Tiago R Magalhaes
frame(a=sample(10), b=sample(10)) xAddOne <- lapply(x, function(x) x <- x+1) in this case lapply adds 1 to every element of the list/data.frame x and the result is the list xAddOne where every element is the corresponding element of x plus one I hope this doesn't confuse people even more...

[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] importing files, columns "invade next column"

2005-01-19 Thread Tiago R Magalhaes
e('file.txt', header=T) #gives an error Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 194 elements x <- read.table('file.txt', header=T, fill=T) #wrong columns take empty (NA) space x <- read.table('file.txt&

Re: [R] importing files, columns "invade next column"

2005-01-19 Thread Tiago R Magalhaes
7;file') in R2.01, Mac 10.3.7: source('file') I get a list, where the first element is the data.frame I want the column names have value added to them On Wed, 2005-01-19 at 04:25 +, Tiago R Magalhaes wrote: > Dear R-listers: I want to import a reasonably big file into a

[R] importing files, columns "invade next column"

2005-01-18 Thread Tiago R Magalhaes
Dear R-listers: I want to import a reasonably big file into a table. (15797 x 257 columns). The file is tab delimited with NA in every empty space. I have reproduced what I have used as my read.table instruction. I have read the R-dataImportExport FAQ and still couldn't solve my problem. (I mig

[R] muliple plots with pairs (matrix of scatter plots)

2004-12-19 Thread Tiago R Magalhaes
I am trying to make a graph with 4 scatter matrixes plots and couldn't do it. While trying to find a solution for this I also came across the idea of giving different values to the same argument for each of the lower and upper function but couldn't do it. (Examplified below with the col argumen

Re: [R] Combined variable names (two concrete suggestions)

2004-12-01 Thread Tiago R Magalhaes
Very interesting topic. "What I want to know is *WHY* people are doing this?" Here goes my view - I've used many for loops, and each time I realize how stupid that is... AFTER I learned how to avoid it. But it's difficult to avoid them without knowing how to do it. (Monsieur de LaPalice wouldn'

[R] scan; 1 items

2004-11-29 Thread Tiago R Magalhaes
HI the scan function when only one item is read says: scan() 1: 3.3 2: Read 1 items [1] 3.3 I hope my english is not playing a trick on me, but "1 items" sounds very strange this makes me feel very anal, and it's really not important and I apologize for it but here it goes anyway ___

[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,])

[R] Re: The hidden costs of GPL software?

2004-11-18 Thread Tiago R Magalhaes
My background: I am a biologist coming to R via Bioconductor. I have no computer background in computer sciences and only basic undergraduate training level in statistics. I have used R with great pleasure and great pains. The most difficult thing is to know what functions to use - sometimes I

[R] basic questions: any place for them

2004-08-03 Thread Tiago R Magalhaes
Hi I have two basic questions, and here they go, but I was wondering as well where can I ask these basic questions without bothering you people I've used Splus and now I'm using R and there's some functions that I can't simply find one: sort.col that allows data.frames to be sort by a given

Re: [R] running R UNIX in a mac computer

2004-06-10 Thread Tiago R Magalhaes
0.x, then you should download R-1.9.0 at: > http://cran.us.r-project.org/bin/macosx > > If you have anything older (MacOS 9 or lower), then you should visit: > http://cran.us.r-project.org/bin/macos > > Regards... > > On Thu, 10 Jun 2004, Tiago R Magalhaes wrote: > > >

[R] running R UNIX in a mac computer

2004-06-10 Thread Tiago R Magalhaes
Hi to you all My question is: there is a package written in UNIX for which there is no Mac version. I would like to know if it's possible to install the R UNIX version on the MacOSX and run that UNIX package on my Mac (through this UNIX R Vresion on a Mac) I have seen a porfile for r version 1.