R: need finite ‘ylim’ values in function

In plot1, change y = range(x$VALUE) to y = range(x$VALUE, na.rm=TRUE) to remove NA missing values. You have another problem, namely that in both functions you refer to ind[[i]], which I assume means at some point this code was part of a loop. My guess is all the references to ind[[i]] should be x.

Categories R

Subscript out of bounds – general definition and solution?

This is because you try to access an array out of its boundary. I will show you how you can debug such errors. I set options(error=recover) I run reach_full_in <- reachability(krack_full, ‘in’) I get :reach_full_in <- reachability(krack_full, ‘in’) Error in reach_mat[i, alter] = 1 : subscript out of bounds Enter a frame number, or 0 to exit 1: … Read more

Categories R

Why I get this error writing data to a file

I know @dickoa answered the question in the comments, but in order to provide at least one answer here, I wanted to go through a few simple gotchas with R on Windows. When you are using Windows, you still have to use forward slashes for paths. In R, backslashes are reserved for escaping values. So … Read more

Categories R

“replace” function examples

If you look at the function (by typing it’s name at the console) you will see that it is just a simple functionalized version of the [<- function which is described at ?”[“. [ is a rather basic function to R so you would be well-advised to look at that page for further details. Especially important is learning that the … Read more

Categories R

plot.new has not been called yet

Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a “click” on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a … Read more

Categories R

Reading PSV (pipe-separated) file or string

We could use read.table to read *.psv file. There might be many different representations of psv file, but when it comes to data mining, I think it might be more about “pipe separated” file. The data in the file is separated by “|”

Categories R

Understanding the order() function

This seems to explain it. The definition of order is that a[order(a)] is in increasing order. This works with your example, where the correct order is the fourth, second, first, then third element. You may have been looking for rank, which returns the rank of the elementsR> a <- c(4.1, 3.2, 6.1, 3.1)R> order(a)[1] 4 2 1 3R> rank(a)[1] 3 2 … Read more

Categories R