Re: [R] If() values in one dataframe then return values from another

2013-02-05 Thread arun
: Sent: Monday, February 4, 2013 12:48 PM Subject: [R] If() values in one dataframe then return values from another I have a large data frame ("data1") that looks like:         A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 A19 A20   [1,]  0  0  0  0  0  0  0  0  0  0  0

Re: [R] If() values in one dataframe then return values from another

2013-02-04 Thread Rui Barradas
Hello, Try the following. mA <- sapply(seq_len(nrow(data1)), function(i) if(any(data1[i,] == 3)) meter[i, 1] else NA) Hope this helps, Rui Barradas Em 04-02-2013 17:48, Steven Ranney escreveu: I have a large data frame ("data1") that looks like: A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A

Re: [R] If() values in one dataframe then return values from another

2013-02-04 Thread Jose Iparraguirre
Economist Age UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Ranney Sent: 04 February 2013 17:48 To: r-help@r-project.org Subject: [R] If() values in one dataframe then return values from another I have a large dat

Re: [R] If() values in one dataframe then return values from another

2013-02-04 Thread David Winsemius
On Feb 4, 2013, at 9:48 AM, Steven Ranney wrote: > I have a large data frame ("data1") that looks like: > >A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 A19 A20 > [1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 > [2,] 0 0 0 0 0 1 0

[R] If() values in one dataframe then return values from another

2013-02-04 Thread Steven Ranney
I have a large data frame ("data1") that looks like: A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 A19 A20 [1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 [2,] 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 [3,]