Re: [R] function using values separated by a comma

2010-10-18 Thread burgundy
Hi, Thanks again for your help with this. I would like to use a variation of this function in a similar dataset (numeric) with elements separated by a comma e.g. dat - read.table(tc - textConnection( '0,1 1,3 40,10 0,0 20,5 4,2 10,40 10,0 0,11 1,2 120,10 0,0'), sep=) to simply calculate the

Re: [R] function using values separated by a comma

2010-10-11 Thread burgundy
: function using values separated by a comma To: burgundy saub...@yahoo.com Date: Friday, 8 October, 2010, 16:48 Here's another method without using any external regular expression libraries: dat - read.table(tc - textConnection( '0,1 1,3 40,10 0,0 20,5 4,2 10,40 10,0 0,11 1,2 120,10 0,0'), sep

[R] Comparison of two files with multiple arguments

2010-10-11 Thread burgundy
Hello, I have an example file which can be generated using: dat - read.table(tc - textConnection( 'T T,G G T C NA G G A,T A A NA'), sep=) I also have a reference file with the same number of rows, for example: G C A I would like to transform the file to numerical values using the following

[R] function using values separated by a comma

2010-10-08 Thread burgundy
Hello, I have a dataframe (tab separated file) which looks like the example below - two values separated by a comma, and tab separation between each of these. [,1] [,2] [,3] [ ,4] [1,] 0,1 1,3 40,10 0,0 [2,] 20,5 4,2 10,40 10,0 [3,] 0,11 1,2 120,10 0,0 I would like to

[R] Replace query

2010-05-02 Thread burgundy
Hi, I'm trying to replace all values equal to 1 in one file (a) with the value in the corresponding column in a separate file (b). Example below. Any help (and brief notes if poss) much appreciated. Thanks!! file a: 0,0,1,1,0 1,0,0,0,1 0,0,0,0,0 1,0,1,1,0 file b: 3,4,6,8,11 output request:

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-30 Thread burgundy
] - 1; o} r } # Test: t(apply(A, 1, f)) [,1] [,2] [,3] [,4] [,5] [1,]00001 [2,]00001 [3,]00100 [4,]00000 HTH, Dennis On Fri, Apr 9, 2010 at 1:04 AM, burgundy [hidden email] wrote: Hi, I

Re: [R] How to replace all non-maximum values in a row with 0

2010-04-30 Thread burgundy
Thanks for advice, sorted now! From: Owe Jessen-2 [via R] ml-node+1819075-790408820-225...@n4.nabble.com Sent: Fri, 9 April, 2010 18:39:53 Subject: Re: How to replace all non-maximum values in a row with 0 Am 09.04.2010 10:04, schrieb burgundy: Hi, I

[R] How to generate a distance matrix?

2010-04-30 Thread burgundy
Hi, I'm trying to generate a distance matrix between sample pairs (example below). I'm not very familiar with the loop command which I expect I will need for this. The example below demosntrates what I'd like to get out of the data - essentially, to calculate the proportion of positions where

[R] Histogram not plotting correct breaks

2010-04-26 Thread burgundy
Hi, I'm using the hist function to plot the frequency of 21 variables, but it keeps starting the x-axis from 0 and adding variables 1 and 2 together (all other vairables have the correct frequencies). I suspect it adds 1 and 2 together so that 0 can fit in with demarcations at intervals of 5.

[R] How to assign scores to rows based on column values

2010-04-25 Thread burgundy
Hi, I'm trying to assign a score to each row which allow me to identify which rows differ. In the example file below, I've used , to indicate column separators. In this example, I'd like to identify that row 1 and row 5 are the same, and row 2 and row 4 are teh same. Any help much appreciated.

[R] replace cells with column number

2010-04-13 Thread burgundy
Hello, I'm trying to replace cells with value 1 with the number of the column. Example below. Thank you! from: 0,1,0,1 0,0,0,1 1,0,0,1 to: 0,2,0,4 0,0,0,4 1,0,0,4 -- View this message in context: http://n4.nabble.com/replace-cells-with-column-number-tp1838289p1838289.html Sent from the R

[R] How to replace all non-maximum values in a row with 0

2010-04-09 Thread burgundy
Hi, I would like to replace all the max values per row with 1 and all other values with 0. If there are two max values, then 0 for both. Example: from: 2 3 0 0 200 30 0 0 2 50 0 0 3 0 0 0 0 8 8 0 to: 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 Thanks! -- View this