Displaying 3 results from an estimated 3 matches for "secondstrongest".
2010 Jul 24
4
Trouble retrieving the second largest value from each row of a data.frame
I have a data frame with a couple million lines and want to retrieve the largest and second largest values in each row, along with the label of the column these values are in. For example
row 1
strongest=-11072
secondstrongest=-11707
strongestantenna=value120
secondstrongantenna=value60
Below is the code I am using and a truncated data.frame. Retrieving the largest value was easy, but I have been getting errors every way I have tried to retrieve the second largest value. I have not even tried to retrieve the labels fo...
2011 Aug 10
2
using if then statements in a dataframe
...ame with several thousand lines and to each line I need to apply a series of "if else" statements. For each row I need either a value or a blank/NA. Below is the series of if else statements I have been trying without success to integrate into a function such as "apply".
if (t1.secondstrongest<-13000) {NA} else
if (noise>-13000) {NA} else
if ((abs(value.str1-value.str2))==120) {NA} else
if ((abs(value.str1-value.str2))==180) {NA} else
if ((abs(value.str1-value.str2))==240) {NA} else
if (value.str1 ==300&&value.str2 ==0) {value.str1_adj+ bearingdiff} else
if (value.str1 ==0&...
2010 Jul 26
1
After writing data in MMF using SEXP structure, can i reference in R?
...ois.edu> wrote:
> I have a data frame with a couple million lines and want to retrieve
> the largest and second largest values in each row, along with the
> label of the column these values are in. For example
>
> row 1
> strongest=-11072
> secondstrongest=-11707
> strongestantenna=value120
> secondstrongantenna=value60
>
> Below is the code I am using and a truncated data.frame. Retrieving
> the largest value was easy, but I have been getting errors every way
> I have tried to retrieve the second large...