Re: [R] plot legend: combining filled boxes and lines

2007-09-10 Thread Monica Pisica

 
This is not quite what you want but you can try this:
 
legend(3, 0.45, legend = c(x1, x2, mean(x1), mean(x2)), col =
c(orange, green),pch = c(15,15,-1,-1), lty=c(-1,-1,2,2))
 
 
Although pch=22 should draw a filled square with a border - but it draws only 
the border instead 
 

Monica
 
__
Message: 24Date: Mon, 10 Sep 2007 09:05:27 +0300From: Lauri Nikkinen [EMAIL 
PROTECTED]Subject: [R] plot legend: combining filled boxes and linesTo: [EMAIL 
PROTECTED]:[EMAIL PROTECTED]Content-Type: text/plain; charset=ISO-8859-1 
Hello, I have difficulties combining boxes and lines in plot legend. Isearched 
previous R-posts and found this (with no 
solution):http://tolstoy.newcastle.edu.au/R/help/06/07/30248.html. Is there 
away to avoid boxes behind the line legends? x1 - rnorm(100)x2 - rnorm(100, 
2)hist(x1, main = , col = orange,ylab = density, xlab = x, freq= F, 
density = 55, xlim = c(-2, 5), ylim = c(0, 0.5))par(new = T)hist(x2, main = , 
col = green, ylab = , xlab = ,axes = F, xlim= c(-2, 5), ylim = c(0, 0.5), 
density = 45, freq = F) abline(v = mean(x1), col = orange, lty = 2, lwd = 
2.5)abline(v = mean(x2), col = green, lty = 2, lwd = 2.5)legend(3, 0.45, 
legend = c(x1, x2, mean(x1), mean(x2)), col =c(orange, green), 
fill=c(orange,green, 0, 0), lty = c(0, 0,2, 2), merge = T) ThanksLauri 
_
Gear up for Halo® 3 with free downloads and an exclusive offer. It’s our way of 
saying thanks for using Windows Live™.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] confusion matrix - better code?

2007-09-09 Thread Monica Pisica

Wolfgang,
 
This looks great and certainly puts to shame my code .
 
Thanks,
 
Monica
 
 Date: Fri, 7 Sep 2007 21:04:32 +0100 From: [EMAIL PROTECTED] To: [EMAIL 
 PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] confusion matrix - 
 better code?  Dear Monica,  try this:  cm = table(tr, pr) cm pr tr 1 
 2 3 1 2 1 0 2 2 1 0 3 0 0 3 4 0 1 0   rowSums(cm) colSums(cm)  Best 
 wishes Wolfgang Huber  Monica Pisica ha scritto:  Hi,I�ve 
 written some code to obtain a confusion matrix when the true classification 
 and the predicted classification are known. Suppose true classification is 
 called �tr� and predicted classification is �pr�. I have 4 classes in 
 tr, but only 3 classes out of 4 are predicted in �pr�. Following is my 
 code, but looks quite �clunky� to me. I wonder if you have any 
 suggestions to improve it.Thanks,Monica
 -tr - c(1,2,2,3,3,3,2,4,1,1)  
 pr-c(1,2,1,3,3,3,1,2,1,2)  dat - data.frame(tr, pr)  class - 
 c(1:length(tr))  m - max(c(length(unique(tr)), length(unique(pr  
 for(i in 1:length(class)) {  class[i] - sub(' 
 ','',paste(dat[i,1],dat[i,2])) }  dat - data.frame(dat, class)  mat - 
 matrix(0, nrow=m, ncol=m)  for (i in 1:m){  for (j in 1:m){  mat[i,j] 
 - sub(' ','',paste(i,j))  }}  cat - matrix(0, nrow=(m+1), ncol=(m+1)) 
  for (i in 1:m){  for(j in 1:m){  cat[i,j]- 
 nrow(dat[dat$class==mat[i,j],])  }}  for (i in 1:m){  
 cat[(m+1),i]-sum(cat[1:m,i])  cat[i,(m+1)]- sum(cat[i,1:m])  
 cat[(m+1),(m+1)] - sum(cat[1:m,(m+1)])  }  cat  [,1] [,2] [,3] [,4] 
 [,5]  [1,] 2 1 0 0 3  [2,] 2 1 0 0 3  [3,] 0 0 3 0 3  [4,] 0 1 0 0 1 
  [5,] 4 3 3 0 10The 5th row / col represents the sum on each row / 
 col respectively.
_
Gear up for Halo® 3 with free downloads and an exclusive offer. It’s our way 
of saying thanks for using Windows Live™.
http://gethalo3gear.com?ocid=SeptemberWLHalo3_WLHMTxt_2
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] confusion matrix - better code?

2007-09-08 Thread Monica Pisica

Michael,
 
Thank you very much. My code is certainly put to shame by yours. I promise to 
read about factor to see how you use it and why ;-))
 
I really appreciate your help.
 
Monica
 Subject: RE: [R] confusion matrix - better code? Date: Fri, 7 Sep 2007 
 15:36:00 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]  How about 
 this?   
 tab-table(factor(tr,levels=unique(tr)),factor(pr,levels=unique(tr)))  
 tab-rbind(tab,colSums(tab))  tab-cbind(tab,rowSums(tab))  tab 1 2 3 4 
  1 2 1 0 0 3 2 2 1 0 0 3 3 0 0 3 0 3 4 0 1 0 0 1 4 3 3 0 10   Of 
 course you can add some dimnames for the 5th row and 5th column if you 
 want.  dimnames(tab)[[1]][5]-Total dimnames(tab)[[2]][5]-Total  
 tab 1 2 3 4 Total 1 2 1 0 0 3 2 2 1 0 0 3 3 0 0 3 0 3 4 0 1 0 0 1 Total 
 4 3 3 0 10  Michael Conklin  Chief Methodologist - Advanced Analytics  
   MarketTools, Inc.  6465 Wayzata Blvd. Suite 170  Minneapolis, MN 
 55426   Tel: 952.417.4719 | Mobile:612.201.8978  [EMAIL PROTECTED]
 MarketTools(r) http://www.markettools.comThis e-mail and any 
 attachments may contain privileged, confidential or proprietary information. 
 If you are not the intended recipient, be aware that any review, copying, or 
 distribution of this e-mail or any attachment is strictly prohibited. If you 
 have received this e-mail in error, please return it to the sender 
 immediately, and permanently delete the original and any copies from your 
 system. Thank you for your cooperation.-Original Message- 
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Monica 
 Pisica Sent: Friday, September 07, 2007 2:53 PM To: 
 r-help@stat.math.ethz.ch Subject: [R] confusion matrix - better code? 
 Importance: High   Hi,  I've written some code to obtain a confusion 
 matrix when the true classification and the predicted classification are 
 known. Suppose true classification is called tr and predicted 
 classification is pr. I have 4 classes in tr, but only 3 classes out of 4 
 are predicted in pr. Following is my code, but looks quite clunky to me. 
 I wonder if you have any suggestions to improve it.  Thanks,  Monica  
 -  tr - c(1,2,2,3,3,3,2,4,1,1) 
 pr-c(1,2,1,3,3,3,1,2,1,2) dat - data.frame(tr, pr) class - 
 c(1:length(tr)) m - max(c(length(unique(tr)), length(unique(pr for(i 
 in 1:length(class)) { class[i] - sub(' ','',paste(dat[i,1],dat[i,2])) } 
 dat - data.frame(dat, class) mat - matrix(0, nrow=m, ncol=m) for (i in 
 1:m){ for (j in 1:m){ mat[i,j] - sub(' ','',paste(i,j)) }} cat - 
 matrix(0, nrow=(m+1), ncol=(m+1)) for (i in 1:m){ for(j in 1:m){ 
 cat[i,j]- nrow(dat[dat$class==mat[i,j],]) }} for (i in 1:m){ 
 cat[(m+1),i]-sum(cat[1:m,i]) cat[i,(m+1)]- sum(cat[i,1:m]) 
 cat[(m+1),(m+1)] - sum(cat[1:m,(m+1)]) } cat [,1] [,2] [,3] [,4] [,5] 
 [1,] 2 1 0 0 3 [2,] 2 1 0 0 3 [3,] 0 0 3 0 3 [4,] 0 1 0 0 1 [5,] 4 3 3 0 
 10  The 5th row / col represents the sum on each row / col respectively. 
 _ Gear up 
 for Halo(r) 3 with free downloads and an exclusive offer. It's our way of 
 saying thanks for using Windows Live(tm).  [[alternative HTML version 
 deleted]] 
_

é.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] computing distance in miles or km between 2 street

2007-09-07 Thread Monica Pisica

 
Phil,
 
If you have only a list of addresses and nothing else - i have to recognize i 
am lost. But if you have more info you can use a GIS software and it will 
calculate your distance automatically for all your addresses. To have your 
distance in miles or Km you need to have a projection in your data which will 
establish your units.
 
The very basic principle is that for each address you have a set of 
coordinates, x, y and you actually use these to calculate distances. If your 
file is for exaple a point shape file (standard for ESRI ArcGIS products) you 
can very simply perform this task using either shortest driving route or as 
the crow flies - again depending on what other info you have in the file. A 
shape file is actually a group of files with with data attributes, projection 
info and so on - so even if you don't see xy coordinates, they actually are 
imbeded in the file.
 
I suspect Mapquest or any other mapping web product has a database with all 
those addresses with xy coordinates. The user needs to know only the address 
and behind doors there is an sql process which selects particular addresses 
together with all the other attributes attached to it and calculate distances 
because it knows coordinates, a network of roads and so on.
 
I am not sure this helps but at least maybe gives you some ideas where to look 
next.
Monica
 

Message: 53Date: Thu, 06 Sep 2007 14:42:32 -0400From: Philip James Smith 
[EMAIL PROTECTED]Subject: [R] computing distance in miles or km between 2 
streetaddressesTo: [EMAIL PROTECTED]: [EMAIL PROTECTED]Content-Type: 
text/plain; charset=ISO-8859-1; format=flowed Hi R-ers: I need to compute the 
distance between 2 street addresses in either km or miles. I do not care if the 
distance is a shortest driving route or if it is as the crow flies. Does 
anybody know how to do this? Can it be done in R? I have thousands of 
addresses, so I think that Mapquest is out of the question! Please rely to: 
[EMAIL PROTECTED] Thank you!Phil Smith  
_

 Hotmail®. NOW with 5GB storage.

ration_HM_mini_5G_0907
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] confusion matrix - better code?

2007-09-07 Thread Monica Pisica

Hi,
 
I’ve written some code to obtain a confusion matrix when the true 
classification and the predicted classification are known. Suppose true 
classification is called “tr” and predicted classification is “pr”. I have 4 
classes in tr, but only 3 classes out of 4 are predicted in “pr”. Following is 
my code, but looks quite “clunky” to me. I wonder if you have any suggestions 
to improve it.
 
Thanks,
 
Monica
 
-
 
tr - c(1,2,2,3,3,3,2,4,1,1)
pr-c(1,2,1,3,3,3,1,2,1,2)
dat - data.frame(tr, pr)
class - c(1:length(tr))
m - max(c(length(unique(tr)), length(unique(pr
for(i in 1:length(class)) {
 class[i] - sub(' ','',paste(dat[i,1],dat[i,2])) }
dat - data.frame(dat, class)
mat - matrix(0, nrow=m, ncol=m)
for (i in 1:m){
  for (j in 1:m){
 mat[i,j] - sub(' ','',paste(i,j))
 }}
cat - matrix(0, nrow=(m+1), ncol=(m+1))
  for (i in 1:m){
  for(j in 1:m){
 cat[i,j]- nrow(dat[dat$class==mat[i,j],])
}}
for (i in 1:m){
cat[(m+1),i]-sum(cat[1:m,i])
 cat[i,(m+1)]- sum(cat[i,1:m])
cat[(m+1),(m+1)] - sum(cat[1:m,(m+1)])
}
cat
 [,1] [,2] [,3] [,4] [,5]
[1,]21003
[2,]21003
[3,]00303
[4,]01001
[5,]4330   10
 
The 5th row / col represents the sum on each row / col respectively.
_
Gear up for Halo® 3 with free downloads and an exclusive offer. It’s our way of 
saying thanks for using Windows Live™.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] write geotiff with projection - RGDAL package

2007-09-06 Thread Monica Pisica

Hi,
 
Doing more search i've discovered package RGDAL that can write a geotiff file 
with projection. I saved a geotiff file in UTM projection and if i read the 
file back in R and check the projection seems that everything is OK. But if i 
load the file in ArcGIS (ESRI product) i get the warning that the file is 
missing spatial reference so it cannot be projected, but it is displayed 
correctly. I guess somewhere i am doing a mistake when i define the projection 
in R. My code follows:
 
data.grid - read.csv(x, header=TRUE)
gridded(data.grid) = ~East.m.+North.m.
proj4string(data.grid) = CRS(+proj=tmerc +lat_0=0.000 
+lon_0=-81.000 +k=0.9996 +x_0=50.00 +y_0=0.000 
+ellps=GRS80 +units=m)
tr - e:\\JELA_veg\\test_gtiff\\test.tif
writeGDAL(data.grid[class.pca], tr)
 
mg3 - readGDAL(tr)
proj4string(mg3)
[1]  +proj=utm +zone=17 +ellps=GRS80 +units=m +no_defs
 
I will really appreciate if anybody can point me in the right dirrection.
 
Thanks,
 
Monica

 
_


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] larger decimal numbers get rounded ....

2007-09-06 Thread Monica Pisica

Hi,
 
I am sure there is a reason but .. why larger decimal numbers get rounded 
to the nearest integer?
 
Example:
 
a - 3308000.5
a
[1] 3308001
 
I would like my numbers to be decimals  since they do represent coordinates 
and i don't want them rounded  how can i keep them as they are?
 
Thanks,
 
Monica
_


e=wlmailtagline
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] For loop with if else statement

2007-09-05 Thread Monica Pisica

Hans,
 
I think your problem is that you don't use the variable which takes different 
values in your if statement  your i changes values and has really nothing 
to do with your x variable (except the length part ). Also all the other 
variables need to be declared somehow - otherwise how can you store values in 
them???
 
So your first code may be something like that:
 
t=c(1,2)
for(i in 1:length(t)){
if (i==1) t[i]=i+1 else t[i]=i
}
 
 t[1] 2 2
and your second code:
 
a = c(1,2)
b=c(1,2)for(i in 1:2){if (i==1){a[i]=ib[i]=i-1} else{ 
a[i]=i+1b[i]=i}c-list(a=a,b=b)}
 c$a[1] 1 3 c$b[1] 0 2
 
Also when you have only 2 possible values for i i don't think the second if 
is necessary. I hope this helps a little, although my explanation is not 
necessarily the best.
 
Monica
 
-- Message: 16Date: Tue, 4 Sep 2007 15:59:54 
+0200From: Hans Ole ?rka [EMAIL PROTECTED]Subject: [R] For loop with if else 
statementTo: 'r-help@stat.math.ethz.ch' 
r-help@stat.math.ethz.chMessage-ID:[EMAIL PROTECTED]Content-Type: 
text/plain; charset=iso-8859-1 Hi,I try to make a simple for loop with a if 
else statement (First example - Below) and extend it to a more complex loop 
(Second example). However, my results #First example:x=c(1,2)t=for(i in 
1:length(x)){if (x==1){a=x+1}elseif (x==2){a=x}} Returned from R:Warning 
messages:1: the condition has length  1 and only the first element will be 
used in: if (x == 1) {2: the condition has length  1 and only the first 
element will be used in: if (x == 1) { t[1] 2 3 However, the result i had 
liked to get was t=c(2,2) i.e. using the first function (a=x+1) for x[1] and 
(a=x) for x[2]. I can remove the Warnings by making: if (x[i]==1) etc. but this!
  do not make the results any better.  #Second example:x=c(1,2)t-for(i in 
1:length(x)){if (x==1){a=xb=x-1}elseif (x==2){a=x+1b=x}b-list(a=a,b=b)} 
Returned from R:Warning messages:1: the condition has length  1 and only the 
first element will be used in: if (x == 1) {2: the condition has length  1 and 
only the first element will be used in: if (x == 1) { t$a[1] 1 2 $b[1] 0 1 The 
result i like to get are $a =c(1,3) and $b=c(0,2) Probably there are couple of 
things that I do wrong and I appreciate all help!  
_
Discover the new Windows Vista

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] geotiff or tiff files with world files

2007-09-05 Thread Monica Pisica

Hi,
 
I have a matrix of data which i can vizualize as an image - for example. I 
would like to save this image as a geotiff file or at a tiff file with a world 
file which holds the projection of my data (ultimately the data represent a map 
of some sort). I know i can save the data as an ESRI grid, but i am not 
interested in that.
 
I wonder if anybody knows about any code which will help me do that.
 
Thanks in advance,
 
Monica
_

s. It's easy!

aspxmkt=en-us
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] How to signal the end of the table?

2007-08-30 Thread Monica Pisica

Well, i am surprise you have problems to read a table that is small enough to 
be opened entirely in Excel. 
 
I work with csv tables with hundreds of thousands of rows, and sometimes even 
millions  with no problems except that sometimes i have to wait up to 1 or 
2 minutes for R to read the table. I use the command read.csv.
 
If your tables are always small enough to be read in Excel, the limit of number 
of rows in Excel is about 64000 or something of that sort (maybe 65000 ) so 
you can use this number as a limit for your number of rows  although you 
may have to clean-up your data.frame afterwards.
 
I work on a Windows machine with 4 Gb DRAM - just for comparison.
 
I hope this helps,
 
Monica
 
 
 
 
 

Message: 88Date: Wed, 29 Aug 2007 10:41:05 -0700From: Yuchen Luo [EMAIL 
PROTECTED]Subject: [R] How to signal the end of the table?To: 
r-help@stat.math.ethz.chMessage-ID:[EMAIL PROTECTED]Content-Type: 
text/plainI am using a for loop to read a table row by row and I have to 
specify howmany records are there in the table. I need to read row by row 
because thetable is huge and the memory not large enough for the whole 
table.:number.of.records=100fp=file(abc.csv,r)pos=seek(fp, 
rw=read)for (i in 1:number.of.record){current.row=scan(file=fp, sep=',', 
what=list(count=1, cusip6=, idate=1,spread=1.1, vol252=1.1, vol1000=1.1, 
st_debt=1.1, lt_debt=1.1 , total_liab=1.1, cr=1.1, shrout=1.1, prc=1.1, 
mkt_cap=1.1, rtng=1.1, sec=1.1, cr3m=1.1,cr5y=1.1, ust3m=1.1, ust5y=1.1), 
flush=TRUE, nlines=1,quiet=T)...}I need to know the number of records 
in the table and put it in the variablenamed nu!
 mber.of.records. When I have a new table that I do not know howmany records 
it has, I use excel to open the file to figure it out and putit in variable  
number.of.records. I often have many tables to try andevery one of them has 
thousands of recordsit takes a lot of time andtrouble to adjust the code 
every time I read a different table.I am wondering if I can change the 
for loop to a while loop:while (the end of the table has not been 
reached){current.row=scan(file=fp, sep=',', what=list(count=1, cusip6=, 
idate=1,spread=1.1, vol252=1.1, vol1000=1.1, st_debt=1.1, lt_debt=1.1 , 
total_liab=1.1, cr=1.1, shrout=1.1, prc=1.1, mkt_cap=1.1, rtng=1.1, sec=1.1, 
cr3m=1.1,cr5y=1.1, ust3m=1.1, ust5y=1.1), flush=TRUE, 
nlines=1,quiet=T)...}The problem is how to articulate while (the end of 
the table has not beenreached), or equivalently, how to signal the end of the 
table?Best WishesYuchen Luo [[alternative HTML version deleted]]
_
Discover the new Windows Vista

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] Cleaning up the memory

2007-08-10 Thread Monica Pisica

Hi,
 
I have 4 huge tables on which i want to do a PCA analysis and a kmean 
clustering. If i run each table individually i have no problems, but if i want 
to run it in a for loop i exceed the memory alocation after the second table, 
even if i save the results as a csv table and i clean up all the big objects 
with rm command. To me it seems that even if i don't have the objects anymore, 
the memory these objects used to occupy is not cleared. Is there any way to 
clear up the memory as well? I don't want to close R and start it up again. 
Also i am running R under Windows.
 
thanks,
 
Monica
_
[[trailing spam removed]]

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] Cleaning up the memory

2007-08-10 Thread Monica Pisica

Thanks! I will look into ...
 
I have 4 GB RAM, and i was monitoring the memory with Windows task manager so i 
was looking how R gets more and more memory allocation from less than 100Mb 
to  1500Mb .
 
My initial tables are between 30 to 80 Mb and the resulting tables that 
incorporate the initial tables plus PCA and kmeans results are inbetween 50 to 
200MB or thereabouts!
 
And yes, i don't really care about memory allocation in detail - what i want is 
to free that memory after every cycle ;-)
 
Although, after i didn't do anything in R and it was idle for more than 30 min. 
the memory allocation according to Task manager dropped to 15 Mb . which is 
good - but i cannot wait inbetween cycles half an hour though .
 
Again thanks,
 
Monica Date: Fri, 10 Aug 2007 18:28:07 +0100 From: [EMAIL PROTECTED] To: 
[EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] Cleaning up 
the memory  On Fri, 10 Aug 2007, Monica Pisica wrote:Hi,   I 
have 4 huge tables on which i want to do a PCA analysis and a kmean   
clustering. If i run each table individually i have no problems, but if   i 
want to run it in a for loop i exceed the memory alocation after the   second 
table, even if i save the results as a csv table and i clean up   all the big 
objects with rm command. To me it seems that even if i don't   have the 
objects anymore, the memory these objects used to occupy is not   cleared. Is 
there any way to clear up the memory as well? I don't want   to close R and 
start it up again. Also i am running R under Windows.  See ?gc, which does 
the clearing.  However, unless you study the memory allocation in detail 
(which you  cannot do from R code), you don't actually know that this is the 
problem.  More likely is that you have fragmentation of your 32-bit address 
space:  see ?Memory-limits.  Without any idea what memory you have and 
what 'huge' means, we can only  make wild guesses. It might be worth raising 
the memory limit (the  --max-mem-size flag).thanks,   Monica  
_  [[trailing 
spam removed]]   [[alternative HTML version deleted]]   
__  R-help@stat.math.ethz.ch 
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.   --  Brian D. 
Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, 
http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 
(self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 
1865 272595
_
Messenger Café — open for fun 24/7. Hot games, cool activities served daily. 
Visit now.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] problems saving jpg files

2007-08-07 Thread Monica Pisica

Hi,
 
I have a batch routine that does PCA on a series of files and saves the results 
as a csv file, and the respective graphs as pdf and jpg. While pdf's are fine, 
jpg files have a light grey background does not matter what color i set the bg 
param. I am running this on a PC with 4 GB RAM - if this makes any difference. 
My command is as follows:
 
dev.print(jpeg, file=filejpg, width=1024, height=768, quality = 100, bg = 
white)
 
I would appreciate if you have any explanations, and yes, i did read the help 
files this time ;-)))
 
Thanks,
 
Monica
_
[[trailing spam removed]]

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] - round() strange behaviour

2007-08-02 Thread Monica Pisica

Hi,
 
I am getting some strange results using round - it seems that it depends if the 
number before the decimal point is odd or even 
 
For example:
 
 round(1.5)[1] 2 round(2.5)[1] 2
While i would expect that round(2.5) be 3 and not 2.
 
Do you have any explanation for that?
 
I really appreciate your input,
 
Monica
 
 
_
[[trailing spam removed]]

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] - round() strange behaviour

2007-08-02 Thread Monica Pisica

Hi again,
 
Mea culpa for not reading help pages before hand - but one would not go there 
when the function syntax is obvious and known  besides other programming 
languages (for example IDL) with same function do not round to the next even 
number  so i do get 3 for round(2.5), and i didn't realize that it is 
normal for R to give a 2 instead of 3. Date: Thu, 2 Aug 2007 22:38:49 +0200 
From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch 
Subject: Re: [R] - round() strange behaviour  On Thu, 2 Aug 2007, Monica 
Pisica wrote:Hi,   I am getting some strange results using round - 
it seems that it depends if the number before the decimal point is odd or even 
   For example:round(1.5)[1] 2 round(2.5)[1] 2  While i 
would expect that round(2.5) be 3 and not 2.   Do you have any explanation 
for that?  Yes: you obviously did not read the man page! Please do. Z   I 
really appreciate your input,   Monica
_  [[trailing 
spam removed]]   [[alternative HTML version deleted]]   
__  R-help@stat.math.ethz.ch 
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.   
_
Messenger Café — open for fun 24/7. Hot games, cool activities served daily. 
Visit now.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


[R] - ICA for less common data

2007-04-30 Thread Monica Pisica

Hi everyone,

I am not sure this is the appropriate list I should put this question to, 
but I hope you will re-direct me to the most appropriate one if necessary.


I am doing an independent component analysis on a dataset that represents 
different metrics for patchreefs such as depth, area, volume, relative 
relief, shape index and rugosity. Doing different multivariate analyses and 
correlations among variables we discovered that the average reef depth data 
is heavily bi-modal, and rugosity behaves differently in each of the depth 
populations. Other reef metrics behave differently with depth as well. Since 
not all metrics are really independent we did a PCA analysis followed by 
cluster analysis and we tried to compare the results with the results from 
the depth analysis. It was not too conclusive I am afraid, and trying to 
understand the results I came across independent component analysis (ICA).


So ….. I’ve run it on a combination of principal components and it seems 
that certainly we have 2 independent components that keep popping up (if I 
can use this expression) when we run the analysis with 2, 3, or 4 
components. So I guess these 2 components are the strongest ones …. If I can 
say so. My next question is …. How can I relate these 2 components to the 
initial data??? I’ve plotted each component and if I add a loess line to 
each, visually it seems that one independent component is an unknown 
function of rugosity while the other component is an unknown function of 
reef geometry and depth. But, of course, I would like something more than a 
visual similarity. Also the 2 independent components seem to split the data 
in 3 classes, rather than 2, as the analysis of the depth data suggested. 
Looking back at the depth histogram it is obvious that there are some data 
that actually are not quite modeled by the 2 mixing functions I came up 
with. These data correspond to the deepest patch reefs, a category clearly 
singled out by ICA classification. The bottom line is that I am trying to 
understand what each independent component tells me about the patch reefs 
and how I can relate that to the patch reef morphometrics, biology, other 
factors that impact some reefs but not others, etc.


If you have any clarifying thoughts or if you know about any other 
literature about the subject that can help (except articles that deal with 
ICA and image analysis or wave form data) I will really appreciate.


Thank you very much for your consideration,

Monica

_
Mortgage refinance is Hot. *Terms. Get a 5.375%* fix rate. Check savings

__
R-help@stat.math.ethz.ch 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.


[R] ICA for less common data

2007-04-17 Thread Monica Pisica

Hi everyone,

I am not sure this is the appropriate list I should put this question to, 
but I hope you will re-direct me to the most appropriate one if necessary.


I am doing an independent component analysis on a dataset that represents 
different metrics for patchreefs such as depth, area, volume, relative 
relief, shape index and rugosity. Doing different multivariate analyses and 
correlations among variables we discovered that the average reef depth data 
is heavily bi-modal, and rugosity behaves differently in each of the depth 
populations. Other reef metrics behaves differently with depth as well. 
Since not all metrics are really independent we did a PCA analysis followed 
by cluster analysis and we tried to compare the results with the results 
from the depth analysis. It was not too conclusive I am afraid, and trying 
to understand the results I came across independent component analysis 
(ICA).


So ….. I’ve run it on a combination of principal components and it seems 
that certainly we have 2 independent components that keep popping up (if I 
can use this expression) when we run the analysis with 2, 3, or 4 
components. So I guess these 2 components are the strongest ones …. If I can 
say so. My next question is …. How can I relate these 2 components to the 
initial data??? I’ve plotted each component and if I add a loess line to 
each, visually it seems that one independent component is an unknown 
function of rugosity while the other component is an unknown function of 
reef geometry and depth. But, of course, I would like something more than a 
visual similarity. Also the 2 independent components seem to split the data 
in 3 classes, rather than 2, as the analysis of the depth data suggested. 
Looking back at the depth histogram it is obvious that there are some data 
that actually are not quite modeled by the 2 mixing functions I came up 
with. These data correspond to the deepest patch reefs, a category clearly 
singled out by ICA classification. The bottom line is that I am trying to 
understand what each independent component tells me about the patch reefs 
and how I can relate that to the patch reef morphometrics, biology, other 
factors that impact some reefs but not others, etc.


If you have any clarifying thoughts or if you know about any other 
literature about the subject that can help (except articles that deal with 
ICA and image analysis or wave form data) I will really appreciate.


Thank you very much for your consideration,

Monica

_
The average US Credit Score is 675. The cost to see yours: $0 by Experian.

__
R-help@stat.math.ethz.ch 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.


[R] Kmeans cluster analysis

2007-04-11 Thread Monica Pisica
Hi Nataniel,

As far as i know there is a package called clustTool which has a very nice 
interface with the capability to do different cluster analyses. It also 
prodused a plot of each cluster and the mean for each cluster of each 
variable - and i guess this is what you are after! But depending of which 
parameters you are using for the cluster analysis, the package is extremely 
slow if you have more than 5000 datapoints. Maybe you can take the function 
apart to see where and what generates the plot and use that for your 
analysis.

I hope this helps,

Monica Palaseanu-Lovejoy


Message: 35
Date: Tue, 10 Apr 2007 19:51:24 + (GMT)
From: nathaniel Grey [EMAIL PROTECTED]
Subject: [R] Kmeans cluster analysis
To: r-help@stat.math.ethz.ch
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain

Hello,

I have a data-set containing  22 variables, after appropriate 
transformations etc I  ran  a
kmeans cluster analysis for 4 clusters , I ran it 20 times to find a result 
with the lowest
within sum of squares.

My question is how best do I go about finding out what the characteristics 
are of each cluster?
Is one cluster dominated by a particular set of variables or by a particular 
variable?

The only way I know is to to look at the means for each variable for each 
cluster, but as there
are 22 variables this is time consuming.

Is there a way to graphically represent the clusters in relation to the 
variables...if so I
might need some guidance on the coding as I am new to the R environment.

Any advice and direction would be gratefully received.

best wishes,

Nataniel Grey

_

Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/

__
R-help@stat.math.ethz.ch 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.


[R] strange error in robust package

2007-02-05 Thread Monica Pisica
Hi everybody,

I am using quite frequently the robust package and until now i never had 
any problems. Actually last time i used it was last Friday very 
successfully.

Anyway, today anytime i want to use the function fit.models i get the 
following error even if i use the example form the help file:

data(woodmod.dat)
woodmod.fm - fit.models(list(Robust = covRob, Classical = cov), data = 
woodmod.dat)

Error in donostah(data, control) : object .Random.seed not found
Error in model.list[[i]] : subscript out of bounds

Does anybody know what is wrong?

Thanks,

Monica Palaseanu-Lovejoy
USGS / ETI Pro
St. Petersburg, FL

_

Spaces

__
R-help@stat.math.ethz.ch 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.


[R] problems with plot.data.frame

2006-08-31 Thread Monica Pisica
Hi list,

I have a question about 'plot'. I am trying to plot values registered every 
month - or every other month. If i build a data.frame called mydata like 
this (as an example)

jan   3   1   7
mar  2   4   2
may 1   3   2
jul3   7   4
sep  5   2   3
nov  3   1   5

and use the command line:

plot(mydata[c(1,3)])

I get a graph that has on the x axis my months in alphabetical order - which 
i don't want, and instead of points i have thick horizontal lines. I've 
tried everything i could and understood from the R help files to give me 
points and on x axis the month in my order instead of alpha order. No 
success. What is the trick?

I fixed the month order by using numerals in front of them like 01, 03, ... 
etc, but this is not an elegant solution.

Any help will be much appreciated.

Monica

__
R-help@stat.math.ethz.ch 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.


Re: [R] problems with plot.data.frame

2006-08-31 Thread Monica Pisica
Hi again,

OK i came up with this after i got few good sugegstions.

First my data.frame actually looks like that (Thanks for clarifications to 
Prof. Brian Ripley)

   V1 V2 V3 V4
1  jan  3  1   7
2  mar 2  4  2
3  may 1  3  2
4  jul   3  7  4
5  sep  5  2  3
6  nov  3  1  5

What i want: 1. On x axis i want the ticks with labels column V1 in that 
order and not alpha order.
2. i want points to represent the data, not horizoltal bars as a box-plot 
with only one value as it will plot if i use plot.data.frame

Note. In my table i already have the order i want, but if i wouldn't have it 
prof. Ripley's sugegstion is very welcome.

What i've done in the end:

plot (mydata$V3, xlab=month)
axis (side=1, at=c(1:6), labels=c(1:6), ticks=TRUE, col.axis=white)
month.label - as.character(mydata[[1]])
axis(side=1, at=c(1:6), labels = month.label, ticks=TRUE)

This is not an elegant solution but i get the graph i wanted. If anybody has 
a better solution certainly i would like to see it.

thanks you again for all your help,

Monica

__
R-help@stat.math.ethz.ch 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.