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
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
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
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...
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
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&
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
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
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
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'
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
___
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,])
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
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
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:
>
> >
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.
16 matches
Mail list logo