Hi,
?unique should work fine for this.
I think the problem in your implementation is that you modify x in the
loop, in particular its length may become shorter than the stopping
condition.
HTH,
baptiste
On 27 Sep 2008, at 14:30, Bastian Offermann wrote:
Hello all,
one brief question
Dear jayuan2008,
See ?subset. If I understand your description below, something like this
could do the job:
a1-data.frame(x=c(a,b,a,b,a),y=c(4,3,6,1,2))
subset(a1,y2)
x y
1 a 4
2 b 3
3 a 6
BTW, I think that the final result you described in your post is incorrect.
HTH,
Jorge
On Sun, Aug
DF-cbind(c(a,b,a),c(4,3,6))
DF[(DF[,1] %in% names(which(table(DF[,1]) = 2))),]
On Sun, Aug 31, 2008 at 2:19 AM, Yuan Jian wrote:
Hi,
�
I have a matrix.
a-cbind(c(a,b,a),c(4,3,6))
[,1] [,2]
[1,] a� 4 [2,] b� 3 [3,] a� 6
I want to remove rows in matrix a whose first column has
See ?ave and try this:
a[as.numeric(ave(a[,1], a[,1], FUN = length)) 1, ]
On Sun, Aug 31, 2008 at 2:19 AM, Yuan Jian [EMAIL PROTECTED] wrote:
Hi,
I have a matrix.
a-cbind(c(a,b,a),c(4,3,6))
[,1] [,2]
[1,] a 4
[2,] b 3
[3,] a 6
I want to remove rows in matrix a whose first
Yuan Jian jayuan2008 at yahoo.com writes:
[...snip...]
I want to remove level b because level b has less than 2.
f
[1] a a
Levels: a
f[which(f %in% names(table(f))[table(f) = 2]), drop=TRUE]
[1] a a
Levels: a
HTH,
Adrian
__
Adrian Dusa wrote:
Adrian Dusa dusa.adrian at gmail.com writes:
[...snip...]
f[which(f %in% names(table(f))[table(f) = 2]), drop=TRUE]
[1] a a
Levels: a
Or, more simple:
f[f %in% names(table(f))[table(f) = 2], drop=TRUE]
[1] a a
Levels: a
Adrian
Also see the combine.levels function in
Hi,
how to remove levels that have less than a specific number such as 2. i.e..
f-as.factor(c(a,b,a))
f
[1] a b a
Levels: a b
I want to remove level b because level b has less than 2.
f
[1] a a
Levels: a
[[alternative HTML version deleted]]
Hi Yuan,
It is not ellegant, but may work for you..
f-as.factor(c(a,b,a))
f.freq-data.frame(table(f))
f.freq
lower.freq-2
f.freq.subset-subset(f.freq,f.freq$Freq=lower.freq)
f.freq.subset
f.selected-f[f %in% f.freq.subset$f]
f.selected-factor(f.selected)
f.selected
Best wishes,
miltinho
On Fri, 1 Aug 2008, Gundala Viswanath wrote:
How can I remove the even number from the following vector
x
[1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42
43
[20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121
122
[39] 123 135 136
x[!(x %% 2 == 0)]
On Thu, Jul 31, 2008 at 10:01 PM, Gundala Viswanath [EMAIL PROTECTED]wrote:
Dear all,
How can I remove the even number from the following vector
x
[1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42
43
[20] 44 50 74 75 82 84 89 90 91
Dear all,
How can I remove the even number from the following vector
x
[1] 4 5 6 8 17 20 21 22 23 25 26 31 35 36 38 40 41 42 43
[20] 44 50 74 75 82 84 89 90 91 95 96 97 100 101 102 118 119 121 122
[39] 123 135 136 157 158
yielding
5, 17, 21, 23, 25, .
Hello,
My question sounds simple, but as I am desperatly searchin for a solution I am
asking you all. :)
I try to filter out all non-numeric columns of a data frame using a for loop
to go through all columns. My if clause looks like this:
for(j in 1:length(data)) {
Try this:
x - data.frame(A=c(10,20), B = c(a, b), C = c(20,30))
x[sapply(x, is.numeric)]
On Sat, Jul 26, 2008 at 11:19 AM, Markus Mühlbacher [EMAIL PROTECTED] wrote:
Hello,
My question sounds simple, but as I am desperatly searchin for a solution I am
asking you all. :)
I try to filter out
Henrique Dallazuanna wrote:
Try this:
x - data.frame(A=c(10,20), B = c(a, b), C = c(20,30))
x[sapply(x, is.numeric)]
Yes, and read ?Extract to clear up the confusion between data$vol and
data[257] and data[[257]] (Section on Recursive (list-like) objects:).
Also, ?Extract.data.frame.
On Sat, Jul 26, 2008 at 9:35 AM, Peter Dalgaard
[EMAIL PROTECTED] wrote:
Henrique Dallazuanna wrote:
Try this:
x - data.frame(A=c(10,20), B = c(a, b), C = c(20,30))
x[sapply(x, is.numeric)]
Yes, and read ?Extract to clear up the confusion between data$vol and
data[257] and data[[257]]
Hi R,
A simple question, but don't know the answer...
x=a
a=5
I need to remove the object a by using only x. something like
rm(somefunction(x))...Is this possible?
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510
Bangalore * Colombo * London * New York
How about rm(list=x)?
Richard.
Shubha Vishwanath Karanth wrote:
Hi R,
A simple question, but don't know the answer...
x=a
a=5
I need to remove the object a by using only x. something like
rm(somefunction(x))...Is this possible?
Shubha Karanth | Amba Research
Ph +91 80
a - 1
x - a
rm(list=x)
a
Error: object a not found
See ?rm for details.
Gabor
On Tue, May 13, 2008 at 05:13:41PM +0530, Shubha Vishwanath Karanth wrote:
Hi R,
A simple question, but don't know the answer...
x=a
a=5
I need to remove the object a by using only x.
apparently you want to check the Introduction to R document I
found it very useful when I started working with R:
http://cran.r-project.org/doc/manuals/R-intro.pdf
try:
names(df) - NULL
b
ps: df is the name of the function to get the density for an F
distribution...
On Feb 18,
Try this:
names(df) - NA
or
names(df) - make.names(seq(ncol(df)))
On 18/02/2008, joseph [EMAIL PROTECTED] wrote:
I want to remove the column names from a data frame. I do
it the long way, can any body show me a better way ?
df= data.frame(chrN= c(chr1, chr2, chr3), start= c(1,
2, 3),
I want to remove the column names from a data frame. I do
it the long way, can any body show me a better way ?
df= data.frame(chrN= c(chr1, chr2, chr3), start= c(1,
2, 3), end= c(4, 5, 6), score= c(7, 8, 9))
df
#I write a txt file without row or column names
6 9
- Original Message
From: Benilton Carvalho [EMAIL PROTECTED]
To: joseph [EMAIL PROTECTED]
Cc: r-help@r-project.org
Sent: Monday, February 18, 2008 11:47:50 AM
Subject: Re: [R] remove column names from a data frame
: Benilton Carvalho [EMAIL PROTECTED]
To: joseph [EMAIL PROTECTED]
Cc: r-help@r-project.org
Sent: Monday, February 18, 2008 11:47:50 AM
Subject: Re: [R] remove column names from a data frame
apparently
you
want
to
check
the
Introduction
to
R
document
I
found
it
very
useful
when
]
To: joseph [EMAIL PROTECTED]
Cc: r-help@r-project.org
Sent: Monday, February 18, 2008 11:47:50 AM
Subject: Re: [R] remove column names from a data frame
apparently you want to check the Introduction to R document I
found it very useful when I started working with R:
http://cran.r-project.org
Hi
I have a data frame df with 3 columns. Some rows are NA across all 3 columns.
How can I remove rows with NA across all columns?
df=data.frame(col1=c(1:3,NA,NA,4),col2=c(7:9,NA,NA,NA),col3=c(2:4,NA,NA,4))
Thanks
Joseph
,
Bert Gunter
Genentech
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of joseph
Sent: Thursday, February 14, 2008 8:53 PM
To: r-help@r-project.org
Cc: r-help@r-project.org
Subject: [R] Remove rows with NA across all columns
Hi
I have a data frame df with 3
Hi Mohamed,
May be it's not the best way, but you can try
w=c(1,4,5,2,NA,4,5,1,NA)
w[-which(is.na(w))]
[1] 1 4 5 2 4 5 1
I hope this helps.
Jorge
On 2/8/08, mohamed nur anisah [EMAIL PROTECTED] wrote:
I have two sets of interval data.Below are my two dataset. In these
dataset, there
I have two sets of interval data.Below are my two dataset. In these dataset,
there is a missing values in each of the data. I want to find the
non-overlapping interval values. Here is my code:
mysetdiff=function(x,y){
m=length(x)
n=length(y)
bx = logical(m)
by = logical(n)
Hi,
Not sure I understand the question, but maybe you need ?unique or
?duplicated
Cheers,
Romain
mohamed nur anisah wrote:
hello!!
say that i have the values of x1 and x2. my x1 has longer length than x2.
how am i going to remove the similar values of x1 and x2. Any suggestion??
Romain Francois wrote:
Hi,
Not sure I understand the question, but maybe you need ?unique or
?duplicated
Or maybe ?union, ?setdiff, ?intersection. Or ?merge.
Cheers,
Romain
mohamed nur anisah wrote:
hello!!
say that i have the values of x1 and x2. my x1 has longer
Hi,
Sorry that this is such a basic question, but I am having trouble with
the following.
I would like to remove all rows where the data is all zeros in a
data.frame such as the following
x
dateabc
1 2007.09.25 99.89844 100.0586 100.0840
4 2007.09.26 99.89844
Rees, David wrote:
Hi,
Sorry that this is such a basic question, but I am having trouble with
the following.
I would like to remove all rows where the data is all zeros in a
data.frame such as the following
x
dateabc
1 2007.09.25 99.89844 100.0586
601 - 632 of 632 matches
Mail list logo