[R] replace values in a distance matrix

2006-07-27 Thread Mari Carmen Garcia Esteban
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

Re: [R] replace values in a distance matrix

2006-07-27 Thread jim holtman
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

[R] replace values in data frame

2006-07-07 Thread Wade Wall
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

Re: [R] replace values in data frame

2006-07-07 Thread Marc Schwartz (via MN)
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

Re: [R] replace values in data frame

2006-07-07 Thread Wade Wall
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.

Re: [R] replace values in data frame

2006-07-07 Thread Marc Schwartz (via MN)
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,

Re: [R] replace values in data frame

2006-07-07 Thread Marc Schwartz (via MN)
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)

Re: [R] replace values?

2006-07-02 Thread Jonathan Baron
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

Re: [R] replace values?

2006-07-02 Thread Matthias Braeunig
# 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

[R] replace values?

2006-07-01 Thread zhijie zhang
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;

Re: [R] replace values in a matrix subject to boolean condition

2005-03-24 Thread Uwe Ligges
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

Re: [R] replace values in a matrix subject to boolean condition

2005-03-24 Thread Werner Wernersen
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

[R] replace values in a matrix subject to boolean condition

2005-03-23 Thread Werner Wernersen
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

[R] replace values but different replacement length

2004-07-02 Thread Christian Schulz
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)

Re: [R] replace values but different replacement length

2004-07-02 Thread Spencer Graves
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: