[R] if-else function

2010-08-20 Thread Laetitia Schmid
Hi R people! I am looking for some suggestions writing an if-else function. The idea is to characterize different plots containing counts of variables (here parasites). If a plot has a count equal or higher than 4 for any parasite the function should return a 1 else a 0. Later I can loop

Re: [R] if-else function

2010-08-20 Thread Laetitia Schmid
Hi Richard, thank you very much. I got the results I needed. But I am still interested to find out how it would work with a if-else function in this context. Best, Laetitia Am 20.08.2010 um 23:40 schrieb RICHARD M. HEIBERGER: tmp - VariablePARPlot1Plot2

[R] extracting columns

2010-08-28 Thread Laetitia Schmid
Hi, Can anybody show me how to extract all columns in my dataset that are polymorphic? Or phrased in another way I would like to delete all columns that have no more than one letter in it (that are monomorphic). Thank you. Laetitia V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16

Re: [R] extracting columns

2010-08-28 Thread Laetitia Schmid
Wow. That was fast. And it works. Thank you! Laetitia Am 29.08.2010 um 00:35 schrieb Jorge Ivan Velez: index - apply(d, 2, function(x) length(table(x)) 1) d[, index] [[alternative HTML version deleted]] __ R-help@r-project.org mailing

[R] numerical or not?

2010-04-25 Thread Laetitia Schmid
Hi, I've had a little problem for several weeks now. It is annoying and therefore I will ask for help now: When I write a script with several iterations, I make it write out a text file to save the data during the run. For example I write: if (i %% 25)

[R] numerical or not?

2010-04-25 Thread Laetitia Schmid
Hi, I've had a little problem for several weeks now. It is annoying and therefore I will ask for help: When I write a script with several iterations, I make it write out a text file to save the data during the run. For example I write: if (i %% 25) write.table(output,temporary_output.txt)

[R] sample

2010-05-16 Thread Laetitia Schmid
Hi, I am sampling two random columns from females and two random columns from males to produce tetraploid offspring. For every female I am sampling a random male. In the end I want to write out a a matrix with all the offspring, but that does not work. I get always only the offspring from

[R] sample and rearrange

2010-05-19 Thread Laetitia Schmid
Dear Wu Gong and Peter Ehlers, thank you very much for your help debugging my script. Now I have a general following up question: Is there a straightforward way to rearrange the following dataset so that all first letters of each column will be combined in one column, all the second letters

[R] string functions

2010-01-09 Thread Laetitia Schmid
Hi! Does anybody know a string function that would calculate how many characters two strings share? I.e. (Hello World,Hello Peter) would be 7. Thanks. Laetitia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] apply a function down each column

2010-01-11 Thread Laetitia Schmid
Hello World, I have a function that makes pairwise comparisons between two strings. I would like to apply this function to my data (which consists of columns with different strings) in the way that it compares the first with the second entry, and then the third with the fourth, and then the

Re: [R] apply a function down each column

2010-01-12 Thread Laetitia Schmid
11.01.2010 um 15:18 schrieb Steve Lianoglou: Hi, On Mon, Jan 11, 2010 at 8:41 AM, Laetitia Schmid laeti...@gmt.su.se wrote: Hello World, I have a function that makes pairwise comparisons between two strings. I would like to apply this function to my data (which consists of columns with different

Re: [R] apply a function down each column

2010-01-13 Thread Laetitia Schmid
) before you do any analysis. -Peter Ehlers Laetitia Schmid wrote: Dear Peter, thank you for the suggestion. Unfortunately the star did not help. Did it work for you? For me it seems incomplete somehow. Laetitia From: Peter Ehlers [ehl...@ucalgary.ca

[R] compare tables

2010-03-08 Thread Laetitia Schmid
Hi! I need some help to finish my script. I have two tables that I combine randomly to produce a third table. This I do for hundreds of iterations. In the output file I get all the simulated tables after each other. It looks like this (in this case 3 iterations): output file: [[1]]