Hello R users,

For the last few days I am struggling with the following task:


my data.frame:
         A1            A2            A3             B1             B2
          B3
 58.81 53.292 54.501 13.013 17.39 19.407  56.02 56.251 54.033 20.099 13.15
10.411  55.376 53.099 57.625 13.396 21.031 13.22  58.584 53.194 54.218
13.038 16.854 19.289  55.7 55.921 53.847 19.942 13.153 9.828  55.093 52.934
57.393 12.675 20.804 13.222  58.374 53.114 53.949 13.085 16.274 19.177
55.394 55.592 53.687 19.804 13.121 9.245  54.807 52.785 57.134 12.053 20.612
13.2  58.183 53.049 53.701 13.129 15.615 19.065  55.094 55.255 53.542 19.672
13.071 8.701  54.521 52.652 56.864 11.493 20.442 13.159  58.007 52.994
53.481 13.168 14.9 18.949  54.796 54.901 53.409 19.537 13.027 8.159  54.257
52.534 56.572 10.954 20.273 13.101  57.827 52.951 53.282 13.199 14.157
18.826
I  load a map with command:

p<-ggmap(map)

But when I want to add points from my data.frame with for loop (A1 is x1,
B1 is y1, A2 is x2, B2 is y2 and so on):

for (num in 1:ncol(my data.frame)) { p<-p+addlinetoplot(my data.frame, varx
= sprintf("B%s",num), vary = sprintf("A%s",num)) }

Using not too many columns (up to 30) everything works fine. But when I
want to plot over 100 columns - computer stalls and memory runs out
suggesting to do memory.size() etc..

here addlinetoplot is a function:

addlinetoplot <- function(dataset, varx, vary) {
list(geom_point(data=dataset, aes_string(x=varx, y=vary), color="yellow",
size=3))
}

In my opinion the problem lays under " p<-p+addlinetoplot"....

So, is there any other way to add multiple points for x's and y's in
ggplot2?

Thank you in advance.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to