Displaying 1 result from an estimated 1 matches for "aa_non_neg".
2009 Nov 03
2
Change negative values in column
...alues in a data frame column to a small positive value, based on the the minimum value of the column.
However, I get the following error:
Error in if (x[i] < 0) { : argument is of length zero
As well, I would "minimum" to be the smallest of the non-negative values...
Aa_non_neg=(fieldTrial0809$Aa) # Copy column from data frame to manipulate
nonNegative = function(x)
{
minimum=min(x) # Should only use positive minimum!
for (i in x)
{
if(x[i]<0) # Found a negative value
{
x[i]=minimum/10 # Change to a new non-negative value
}
}...