Question

I have a problem with plotting my results. Previously (about two weeks ago) I can use same code at below to plot my data but now I'am getting error

data<- read.table("my_step.odt", header = FALSE, sep = "", quote="\"'", dec=".", as.is =  FALSE, strip.white=FALSE, col.names=c(.......); 
mgn_my <- data[1:49999,18]
sim  <- data[1:49999, 21]
plot(sim , mgn_my , type="l",xlab="Time (ns)",ylab="mx")

error

Error in table(x, y) : attempt to make a table with >= 2^31 elements

any suggestion?

Was it helpful?

Solution

I have had a similar problem as you before. Based on my response from another post, here's what I would suggest before you run plot:

Option 1: Use droplevels

mgn_my <- droplevels(data[1:49999,18])

Option 2: Use apply. This approach seems "friendlier" if you are familiar with apply-family functions in R. For example:

mgn_my <- data[1:49999,18]
apply(mgn_my,1,plot)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top