software r

  1. S

    plot type 'line' will be truncated to first character

    For anyone that can help me this would be greatly appreciated. I have to determine the probability of a Markov chain hittng state 1 before hitting state 5, with z varying from 0 to 1 and produce a plot. The code I have so far is: trials = 1000; hitone=0; for (k in 1:20){ z= 0 + k/20 for(j in...
  2. P

    Create new variable in R dataframe by counting values equal to or greater than 1

    Hi, I have a dataframe in which I need to create a new column by counting all values equal to or greater than 1 occurring row-wise. I tried to use the following command: length(which(birds[2, 3:29] > 0)) This command only returns a value for ONE row (in this case, the 2nd row)...