[R] field significance test
ani jaya
g@@@uu| @end|ng |rom gm@||@com
Tue Sep 7 02:38:44 CEST 2021
Hello Jim, thank you for your response. What I am trying to achieve is
like this:
#calculate the positive significant station for every row based on p-value
df5<-df3
df5[df4>0.05|df5<0]<-NA
#remove the insignificant one or negative statistic value
df5[df5>0]<-1
#change the positive value to be +1 so I can row sum later
pos<-as.data.frame(rowSums(df5, na.rm=T)) #row
sum to see the total significant station (column) for each row
poss<-as.data.frame(table(pos))
#get the frequency of each significant number (row that have only
1,2,3,.. significant station)
posss<-as.numeric(rep(poss$pos[-1],poss$Freq[-1]))-1 #create
the series based on frequency
#calculate the negative significant station for every row based on p-value
df6<-df3
df6[df4>0.05|df5>0]<-NA
df6[df6<0]<-1
neg<-as.data.frame(rowSums(df6, na.rm=T))
negg<-as.data.frame(table(neg))
neggg<-(as.numeric(rep(negg$neg[-1],negg$Freq[-1]))-1)*-1
ne<-sum(pos==0&neg==0)
#to see the 0 significant station, row that have no significant
station
after that I want to combine posss, neggg, and ne to be 1 column data
frame but not success yet. After that, I want to plot the histogram to
see the distribution of significant stations.
Any lead is appreciate. Thank you
Ani Jaya
More information about the R-help
mailing list