But that is a good reason to always use parentheses:
x[ !(x %in% c(0,255))]
since some of the 'precendences' vary between languages.
On Tue, Aug 30, 2011 at 4:47 AM, Jim Lemon wrote:
> On 08/30/2011 12:06 AM, Bert Gunter wrote:
>>
>> Jim et. al:
>>
>> This is the second time I've seen this "adv
On 08/30/2011 12:06 AM, Bert Gunter wrote:
Jim et. al:
This is the second time I've seen this "advice" recently. Use logical
indexing: which(), though not wrong, is superfluous:
x[ !x %in% c(0,255)] will do, rather than:
By golly, you're right, and it works even if x is a logical vector. I
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Bert Gunter
> Sent: Monday, August 29, 2011 7:07 AM
> To: Jim Lemon
> Cc: r-help@r-project.org
> Subject: Re: [R] Asking Favor For "Remove elemen
Thank you very much,friend.
--
View this message in context:
http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776435.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-proje
Thank you very much,friend.
--
View this message in context:
http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776430.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-proje
Thank you very much,friend.
--
View this message in context:
http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776427.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-proje
Thank you friend for suggestion.
--
View this message in context:
http://r.789695.n4.nabble.com/Asking-Favor-For-Remove-element-with-Particular-Value-In-Vector-tp3772779p3776432.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-
Jim et. al:
This is the second time I've seen this "advice" recently. Use logical
indexing: which(), though not wrong, is superfluous:
x[ !x %in% c(0,255)] will do, rather than:
> If you want to remove the specific values 0 and 255 from your vector, try:
>
> x<-x[-which(x %in% c(0,255))]
>
> J
chuan_zl wrote:
> Dear All.
>
> I am Chuan. I am beginner for R.I facing some problem in remove
element from
> vector.I have a vector with size 238 element as follow(a part)
>
> [1] 0 18 24 33 44..[238] 255
>
> Let the vector label as "x",I want remove element "0
Be careful about negating the 'which' in case there are no matches:
> x <- 1:10
> x[-which(x == 11)]
integer(0)
>
Notice it deletes the whole vector.
Safer to use logical vectors:
> x[!(x==3 | x == 7)]
[1] 1 2 4 5 6 8 9 10
> x[!(x == 11)] # notice this works
[1] 1 2 3 4 5 6 7 8
You can use 'which' and negative subscripts to remove elements from a vector.
y<-x[-(which(x==0|x==255))]
chuan_zl wrote:
>
> Dear All.
>
> I am Chuan. I am beginner for R.I facing some problem in remove element
> from vector.I have a vector with size 238 element as follow(a part)
>
> [1]
On Aug 27, 2011, at 5:31 AM, chuan_zl wrote:
Dear All.
I am Chuan. I am beginner for R.I facing some problem in remove
element from
vector.I have a vector with size 238 element as follow(a part)
[1] 0 18 24 33 44..[238] 255
Let the vector label as "x",I wan
Not sure whether I understand your question right but here is what I would do:
# Sample data
x <- seq( 1, 100, by=6)
x
[1] 1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97
# remove element with value 19
x <- x[ x != 19 ]
x
[1] 1 7 13 25 31 37 43 49 55 61 67 73 79 85 91 97
If you want to r
Dear All.
I am Chuan. I am beginner for R.I facing some problem in remove element from
vector.I have a vector with size 238 element as follow(a part)
[1] 0 18 24 33 44..[238] 255
Let the vector label as "x",I want remove element "0" and "255".I try use
such functi
Here is one I wrote for the raster package. It searches a raster layer for
NA's and takes the median of the number of non NA adjacent cells determined
by neighbor count. You could turn your matrix into a raster to make it work
or change the code.
Hope you find it useful, Robert
neighbor.filter <-
> CC: chuan...@hotmail.com; r-help@r-project.org
> From: dwinsem...@comcast.net
> To: marchy...@hotmail.com
> Subject: Re: [R] Asking Favor For the Script of Median Filter
> Date: Sun, 27 Mar 2011 18:30:48 -0400
>
>
>
gt;>>>
>>>> Date: Sun, 27 Mar 2011 07:56:11 -0700
>>>> From: chuan...@hotmail.com
>>>> To: r-help@r-project.org
>>>> Subject: [R] Asking Favor For the Script of Median Filter
>>>>
>>>> Hello,everybody. My name is Chuan Z
?runmed
-- Bert
On Sun, Mar 27, 2011 at 2:44 PM, David Winsemius wrote:
>
> On Mar 27, 2011, at 10:56 AM, chuan_zl wrote:
>
>> Hello,everybody. My name is Chuan Zun Liang. I come from Malaysia. I am
>> just
>> a beginner for R. Kindly to ask favor about median filter. The problem I
>> facing as
l.com
To: r-help@r-project.org
Subject: [R] Asking Favor For the Script of Median Filter
Hello,everybody. My name is Chuan Zun Liang. I come from Malaysia.
I am just
a beginner for R. Kindly to ask favor about median filter. The
problem I
facing as below:
x<-matrix(sample(1:30,25),5,5)
x
[,
On Mar 27, 2011, at 10:56 AM, chuan_zl wrote:
Hello,everybody. My name is Chuan Zun Liang. I come from Malaysia. I
am just
a beginner for R. Kindly to ask favor about median filter. The
problem I
facing as below:
x<-matrix(sample(1:30,25),5,5)
x
[,1] [,2] [,3] [,4] [,5]
[1,]7
this case it looks like a few packages available,
>
http://www.google.com/search?sclient=psy&hl=en&q=R+cran+median+filter
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>> Date: Sun, 27 Mar 2011 07:56:11 -0700
>>
Hello,everybody. My name is Chuan Zun Liang. I come from Malaysia. I am just
a beginner for R. Kindly to ask favor about median filter. The problem I
facing as below:
> x<-matrix(sample(1:30,25),5,5)
> x
[,1] [,2] [,3] [,4] [,5]
[1,]78 30 29 13
[2,]46 1259
[3,
Hi
what exactly do you want.
You say you can read your data
x <- read.jpeg(system.file("data", "cat.jpg", package="rimage"))
plot(x)
What do you mean by pixel image? By reading a picture you get an object
imagematrix
> str(x)
imagematrix [1:420, 1:418, 1:3] 0.255 0.251 0.247 0.247 0.255 .
Hi Chuan,
I'm forwarding your question to the list because I haven't used the
rimage package... It's best if you post questions to the list anyway
because you are more likely to get a fast and useful answer.
On 20 September 2010 23:03, chuan zun liang wrote:
> Dear Michael:
> I am so sorry,distur
nk you.
> Chuan
>
>
> ____________
> From: Michael Bedward
> To: chuan zun liang ; Rhelp
> Sent: Wednesday, 15 September 2010 16:08:20
> Subject: Re: [R] Asking Favor
>
> Hello Chuan,
>
> If you just want a matrix with the numbers 1 to 64 a
Hello Chuan,
If you just want a matrix with the numbers 1 to 64 arranged by row...
m <- matrix(1:64, ncol=8, byrow=TRUE)
But perhaps I don't understand your question properly ?
Michael
On 16 September 2010 12:46, chuan zun liang wrote:
> Dear Prof:
>
> My name is Chuan.I from Malaysia.I am a
Dear Prof:
My name is Chuan.I from Malaysia.I am a beginner for R.I need favor for Prof.
This is my data:
y<-c(52,55,61,66,70,61,64,73,63,59,55,90,109,85,69,72,62,59,68,113,144,104,66,73,63,58,71,122,154,106,70,69,67,61,68,104,126,88,68,70,79,65,60,70,77,68,58,75,85,71,64,59,55,61,65,83,87,79,69,
27 matches
Mail list logo