Hi to everybody!
I´m just a beginner in R, and I´m trying to replace values in a distance
matrix with a concret condition: replace all values (elements) lower than 4.5
with value=18.
I´ve tried this, but it doesn´t work...
Dxy would be my 117 x 117 euclidean distance matrix
M4.5[M4.5 4.5] - 18
On 7/27/06, Mari Carmen Garcia Esteban [EMAIL PROTECTED] wrote:
Hi to everybody!
I´m just a beginner in R, and I´m trying to replace values in a distance
matrix with a concret condition: replace all values (elements) lower than
4.5 with value=18.
I´ve tried this, but
Hi all,
I have a three columned list that I have imported into R. The first column
is a plot (ex. Plot1), the second is a species name (ex ACERRUB) and the
third a numeric value. I want to replace some of the second column names
with other names (for example replace ACERRUB with ACERDRU). The
On Fri, 2006-07-07 at 11:20 -0400, Wade Wall wrote:
Hi all,
I have a three columned list that I have imported into R. The first column
is a plot (ex. Plot1), the second is a species name (ex ACERRUB) and the
third a numeric value. I want to replace some of the second column names
with
The format is like this.
Plot species Value
P1 ACERRUB 3
P2 MAGNVIR2
P3 ARONARB 2
etc.
imported using x-read.table(file=filename.txt)
I want to replace a list of values in the 2nd column with another list. For
example, I want to replace ARONARB with PHOTPYR.
Thanks for re-posting onlist. My offlist reply:
The 'list' argument, as per ?replace, needs to be a vector of one or
more indices into another vector, generally the source vector argument
'x', not the actual values that you want to replace. 'list' can either
be explicit integers as the indices,
Wade,
Given that you appear to have multiple search and replace items to deal
with, here is a possible loop based Global Search and Replace
solution:
gsr - function(Source, Search, Replace)
{
if (length(Search) != length(Replace))
stop(Search and Replace Must Have Equal Number of Items\n)
On 07/02/06 12:39, zhijie zhang wrote:
Dear friends,
i have a dataset like this:
x y z
1 2 3
2 3 1
3 2 1
1 1 3
2 1 2
3 2 3
2 1 1
I want to replace x with the following values:1-a,2-b,3-c,4-d;
replace y with the following values:1-b,2-a,3-c,4-d;
replace z
# reproducing your example
xx-x y z
+ 1 2 3
+ 2 3 1
+ 3 2 1
+ 1 1 3
+ 2 1 2
+ 3 2 3
+ 2 1 1
# you did not tell us the class of your data, assuming data.frame
df-read.table(textConnection(xx),header=T,colClasses=factor)
# a clean way to do what you want is using factors with ?levels
# (note that
Dear friends,
i have a dataset like this:
x y z
1 2 3
2 3 1
3 2 1
1 1 3
2 1 2
3 2 3
2 1 1
I want to replace x with the following values:1-a,2-b,3-c,4-d;
replace y with the following values:1-b,2-a,3-c,4-d;
replace z with the following values:1-d,2-c,3-b,4-a;
Werner Wernersen wrote:
Hi everybody!
I am sorry to bother you with a question so simple but
I think there might be a
better solution:
I have a matrix of size 360x501 where I want to check
the value of each 5th
column of each row and replace it (and the 6th, 7th,
8th column) by zero if the
Uwe Ligges wrote:
Werner Wernersen wrote:
Hi everybody!
I am sorry to bother you with a question so simple
but
I think there might be a better solution:
I have a matrix of size 360x501 where I want to
check
the value of each 5th column of each row and
replace it (and the 6th,
7th,
8th
Hi everybody!
I am sorry to bother you with a question so simple but
I think there might be a
better solution:
I have a matrix of size 360x501 where I want to check
the value of each 5th
column of each row and replace it (and the 6th, 7th,
8th column) by zero if the
value is less than 1000. I
Hi,
have anybody a hint/help how it's possible replace i.e.
the NA values from BL02DATE with non-Missing
values from BLOCKED and vice versa.
Both variables are with an id in a 188.249 rows data.frame and
my fr function didn't count the NA's.
Many thanks
Christian
fr(BL02DATE)
What are the lengths of
match02$BL02DATE[is.na(match02$BL02DATE)] and match02$BLOCKED?
In particular, have you considered the following:
match02$BL02DATE[is.na(match02$BL02DATE)] - match02$BLOCKED[is.na(match02$BL02DATE)]
hope this helps. spencer graves
Christian Schulz wrote:
15 matches
Mail list logo