Re: [R] Thrashing?
IMHO it's dependend on your data size and the functions you use. I'm getting same behaviour (suse9) when i use mysqlWriteTable and reshape with large datasets and a upgrade from 512MB to 1GB works much more better - but now i dream from 2GB-4GB. christian Rob Steele wrote: Does R do its own swapping out to disk? I disabled Linux swapping and the system still gets stuck in Purgatory where there's little CPU activity but the disk goes like crazy. That's with R having almost the whole machine to itself and running a memory hungry compute only function. I've seen this behavior with other version numbers but I'm running R 2.0.0 under Fedora Core 3. The system is a laptop with 1 Gig. RAM. Thanks! __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] density estimation: compute sum(value * probability) for
On 13-Nov-04 bogdan romocea wrote: Dear R users, However, how do I compute sum(values*probabilities)? The probabilities produced by the density function sum to only 26%: sum(den$y) [1] 0.2611142 Would it perhaps be ok to simply do sum(den$x*den$y) * (1/sum(den$y)) [1] 1073.22 ? What you're missing is the dx! A density estimation estimates the probability density function g(x) such that int[g(x)*dx] = 1, and R's 'density' function returns estimated values of g at a discrete set of points. An integral can be approximated by a discrete summation of the form sum(g(x.i)*delta.x You can recover the set of x-values at which the density is estimated, and hence the implicit value of delta.x, from the returned density. Example: X-rnorm(1000) f-density(X) x-f$x delta.x-x[2]-x[1] g-f$y sum(g*delta.x) [1] 1.000976 Hoping this helps, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 [NB: New number!] Date: 14-Nov-04 Time: 08:50:53 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Odd behaviour of R 2.00
Hiroto Miyoshi [EMAIL PROTECTED] writes: Dear R users I have a data frame containing character and numeric variables, whose name is seishin. When I tried to assign NA to in the data frame, R, 2.00 showed an error message, such as seishin[seishin==]-NA Error: NAs are not allowed in subscripted assignments This did not happen under R 1.9.0. More oddly, The following commands work just fine under R 2.0.0 a-1:10 b-letters[1:10] b[3]- c-data.frame(cbind(a,b)) c[c==]-NA Why is this so? It is the NA pattern on the left hand side that matters. Does it help to use seishin[!is.na(seishin) seishin==]-NA ? (For atomic vectors you could also use %in% instead of ==, but this doesn't work with data frames.) And how can I assign NA to data.framewise in seishin data.frame? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dyn.load problem
O. Neto wrote: Hi, Uwe. Thank you for help. Yesterday another R-user Mr. Ramasamy told me to do a simple program such as (changing too the directories, now C:/minhadll/): /*file conv.c*/ #include R.h void printhello (){ Rprintf(%s, hello world\n); } When I use C:\R\rw2000\binRCMD SHLIB -o c:/minhadll/meuteste.dll c:/minhadll/conv.c to compile this one. Below is the output. C:\R\rw2000\bin RCMD SHLIB -o c:/minhadll/meuteste.dll c:/minhadll/conv.c making c:/minhadll/conv.d from c:/minhadll/conv.c gcc -IC:/R/RW2000/include -Wall -O2 -c c:/minhadll/conv.c -o c:/minhadll/conv.o ar cr c:/minhadll/meuteste.a c:/minhadll/conv.o ranlib c:/minhadll/meuteste.a gcc --shared -s -o c:/minhadll/meuteste.dll c:/minhadll/meuteste.def c:/minhadll/meuteste.a -LC:/R/RW2000/src/gnuwin32 -lg2c -lR The result is meuteste.dll located in C:/minhadll/meuteste.dll. Now, talking about paths: I believe that I have make a correct way... but I'll list here to you: SET PATH=C:\Rtools\;C:\Perl\bin\;C:\MinGW\bin;C:\R\rw2000\include\ I'd rather vote for set PATH=.;C:\Rtools;C:\Perl\bin;C:\MinGW\bin;%PATH% Anyway, this doesn't seem to be the culprit. Do you have the recommended tools in their most recent versions? The last point might be your OS. I think nobody of the developers is working on non-NT based Windows versions (such as 95, 98, ME) these days. Uwe Ligges Is it correct? Thank you again for help me. I'm trying to do a dll for 3 weeks or more, without a good result. PS: The same error dyn.load appears O. Neto __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Odd behaviour of R 2.00
Dear Professor Dalgaard It is the NA pattern on the left hand side that matters. Does it help to use seishin[!is.na(seishin) seishin==]-NA ? Yes! the above line worked perfectly. But why? To me, !is.na(seishin) seishin== seems redundant. If you could explain this, it would be greatly appreciated. Thank you. Hiroto Miyoshi [EMAIL PROTECTED] - Original Message - From: Peter Dalgaard [EMAIL PROTECTED] To: Hiroto Miyoshi [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 14, 2004 7:26 PM Subject: Re: [R] Odd behaviour of R 2.00 Hiroto Miyoshi [EMAIL PROTECTED] writes: Dear R users I have a data frame containing character and numeric variables, whose name is seishin. When I tried to assign NA to in the data frame, R, 2.00 showed an error message, such as seishin[seishin==]-NA Error: NAs are not allowed in subscripted assignments This did not happen under R 1.9.0. More oddly, The following commands work just fine under R 2.0.0 a-1:10 b-letters[1:10] b[3]- c-data.frame(cbind(a,b)) c[c==]-NA Why is this so? (For atomic vectors you could also use %in% instead of ==, but this doesn't work with data frames.) And how can I assign NA to data.framewise in seishin data.frame? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Odd behaviour of R 2.00
On Sun, 14 Nov 2004, Hiroto Miyoshi wrote: Dear Professor Dalgaard It is the NA pattern on the left hand side that matters. Does it help to use seishin[!is.na(seishin) seishin==]-NA ? Yes! the above line worked perfectly. But why? To me, !is.na(seishin) seishin== seems redundant. If you could explain this, it would be greatly appreciated. Without it, your logical matrix index contains NA. What do you intend that to do? Do you replace the corresponding element or not? You don't know, so perhaps you set it to NA, whatever the rhs? And do you use up a value on the rhs or not (not relevant if as here you are recycling a single value, except that you need to know how many times to recycle it)? Prior to 2.0.0, R behaved inconsistently (both within itself and with S) with NA indices in assignments, so now we force the user to say what he intended. This has picked up quite a number of errors. I do think this would be cleaner and faster using a loop over columns, especially as you probably have factors in the data frame. Read the code of [-.data.frame if you don't see that. Thank you. Hiroto Miyoshi [EMAIL PROTECTED] - Original Message - From: Peter Dalgaard [EMAIL PROTECTED] To: Hiroto Miyoshi [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 14, 2004 7:26 PM Subject: Re: [R] Odd behaviour of R 2.00 Hiroto Miyoshi [EMAIL PROTECTED] writes: Dear R users I have a data frame containing character and numeric variables, whose name is seishin. When I tried to assign NA to in the data frame, R, 2.00 showed an error message, such as seishin[seishin==]-NA Error: NAs are not allowed in subscripted assignments This did not happen under R 1.9.0. More oddly, The following commands work just fine under R 2.0.0 a-1:10 b-letters[1:10] b[3]- c-data.frame(cbind(a,b)) c[c==]-NA Why is this so? (For atomic vectors you could also use %in% instead of ==, but this doesn't work with data frames.) And how can I assign NA to data.framewise in seishin data.frame? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Odd behaviour of R 2.00
Hiroto Miyoshi [EMAIL PROTECTED] writes: Dear Professor Dalgaard It is the NA pattern on the left hand side that matters. Does it help to use seishin[!is.na(seishin) seishin==]-NA ? Yes! the above line worked perfectly. But why? To me, !is.na(seishin) seishin== seems redundant. If you could explain this, it would be greatly appreciated. Thank you. It's due to this change (do check the NEWS file when things change unexpectedly...): o Subassignments involving NAs and with a replacement value of length 1 are now disallowed. (They were handled inconsistently in R 2.0.0, see PR#7210.) For data frames they are disallowed altogether, even for logical matrix indices (the only case which used to work). Now, I'm getting slightly confused here, since there appears to be exceptions: str(c) `data.frame': 10 obs. of 2 variables: $ a: Factor w/ 10 levels 1,10,2,3,..: 1 3 4 5 6 NA 8 9 10 2 $ b: Factor w/ 9 levels ,a,b,e,..: 2 3 1 NA 4 5 6 7 8 9 c[c==]-NA str(c) `data.frame': 10 obs. of 2 variables: $ a: Factor w/ 10 levels 1,10,2,3,..: 1 3 4 5 6 NA 8 9 10 2 $ b: Factor w/ 9 levels ,a,b,e,..: 2 3 NA NA 4 5 6 7 8 9 version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor0.0 year 2004 month10 day 04 language R Also: aq - airquality aq[aq==5] - 98765432 aq[aq==97] - 98765432 Error: NAs are not allowed in subscripted assignments (difference being that 97 occurs in columns with NA's and 5 does not) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Odd behaviour of R 2.00
Dear Professor Ripley and Professor Dalgaard Thank you for your quick reply. Now, I understand. Thank you. Hiroto Miyoshi [EMAIL PROTECTED] - Original Message - From: Prof Brian Ripley [EMAIL PROTECTED] To: Hiroto Miyoshi [EMAIL PROTECTED] Cc: Peter Dalgaard [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, November 14, 2004 9:27 PM Subject: Re: [R] Odd behaviour of R 2.00 On Sun, 14 Nov 2004, Hiroto Miyoshi wrote: Dear Professor Dalgaard It is the NA pattern on the left hand side that matters. Does it help to use seishin[!is.na(seishin) seishin==]-NA ? Yes! the above line worked perfectly. But why? To me, !is.na(seishin) seishin== seems redundant. If you could explain this, it would be greatly appreciated. Without it, your logical matrix index contains NA. What do you intend that to do? Do you replace the corresponding element or not? You don't know, so perhaps you set it to NA, whatever the rhs? And do you use up a value on the rhs or not (not relevant if as here you are recycling a single value, except that you need to know how many times to recycle it)? Prior to 2.0.0, R behaved inconsistently (both within itself and with S) with NA indices in assignments, so now we force the user to say what he intended. This has picked up quite a number of errors. I do think this would be cleaner and faster using a loop over columns, especially as you probably have factors in the data frame. Read the code of [-.data.frame if you don't see that. Thank you. Hiroto Miyoshi [EMAIL PROTECTED] Hiroto Miyoshi [EMAIL PROTECTED] - Original Message - From: Peter Dalgaard [EMAIL PROTECTED] To: Hiroto Miyoshi [EMAIL PROTECTED] Cc: Peter Dalgaard [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, November 14, 2004 9:27 PM Subject: Re: [R] Odd behaviour of R 2.00 Hiroto Miyoshi [EMAIL PROTECTED] writes: Dear Professor Dalgaard It is the NA pattern on the left hand side that matters. Does it help to use seishin[!is.na(seishin) seishin==]-NA ? Yes! the above line worked perfectly. But why? To me, !is.na(seishin) seishin== seems redundant. If you could explain this, it would be greatly appreciated. Thank you. It's due to this change (do check the NEWS file when things change unexpectedly...): o Subassignments involving NAs and with a replacement value of length 1 are now disallowed. (They were handled inconsistently in R 2.0.0, see PR#7210.) For data frames they are disallowed altogether, even for logical matrix indices (the only case which used to work). Now, I'm getting slightly confused here, since there appears to be exceptions: str(c) `data.frame': 10 obs. of 2 variables: $ a: Factor w/ 10 levels 1,10,2,3,..: 1 3 4 5 6 NA 8 9 10 2 $ b: Factor w/ 9 levels ,a,b,e,..: 2 3 1 NA 4 5 6 7 8 9 c[c==]-NA str(c) `data.frame': 10 obs. of 2 variables: $ a: Factor w/ 10 levels 1,10,2,3,..: 1 3 4 5 6 NA 8 9 10 2 $ b: Factor w/ 9 levels ,a,b,e,..: 2 3 NA NA 4 5 6 7 8 9 version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor0.0 year 2004 month10 day 04 language R Also: aq - airquality aq[aq==5] - 98765432 aq[aq==97] - 98765432 Error: NAs are not allowed in subscripted assignments (difference being that 97 occurs in columns with NA's and 5 does not) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 - Original Message - From: Peter Dalgaard [EMAIL PROTECTED] To: Hiroto Miyoshi [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, November 14, 2004 7:26 PM Subject: Re: [R] Odd behaviour of R 2.00 Hiroto Miyoshi [EMAIL PROTECTED] writes: Dear R users I have a data frame containing character and numeric variables, whose name is seishin. When I tried to assign NA to in the data frame, R, 2.00 showed an error message, such as seishin[seishin==]-NA Error: NAs are not allowed in subscripted assignments This did not happen under R 1.9.0. More oddly, The following commands work just fine under R 2.0.0 a-1:10 b-letters[1:10] b[3]- c-data.frame(cbind(a,b)) c[c==]-NA Why is this so? (For atomic vectors you could also use %in% instead of ==, but this doesn't work with data frames.) And how can I assign NA to data.framewise in seishin data.frame? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL
[R] Problem updating the package foreign
Hi Group: From an R session, I wanted to update packages, and issued the command: update.packages() R started to update the package foreign and proceeded. After downloading, while it attempted to install the packages, it came up with the following error message. I could not understand the error message. Does it indicate that the problem lies with the gcc? How do I install the current version of foreign? My operating system is MepisLinux, based on Debian, and the computer is a compaq presario laptop with dual booting with Win XP(the linux partition has 10 GB space, with 128 MB RAM). I have appended the R message in this mail. I could not locate the config.log file. Would greatly appreciate your advice in solving the problem. /Arin Basu ---Beginning of R command and error message--- update.packages() trying URL `http://cran.r-project.org/src/contrib/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 212630 bytes opened URL == downloaded 207Kb Update (y/N)? y trying URL `http://cran.r-project.org/src/contrib/foreign_0.8-0.tar.gz' Content type `application/x-tar' length 259351 bytes opened URL == downloaded 253Kb * Installing *source* package 'foreign' ... checking for gcc... gcc checking for C compiler default output file name... configure: error: C compiler cannot create executables See `config.log' for more details. ERROR: configuration failed for package 'foreign' ---end of R command and error message--- [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Inbound Virus Alert
A virus has been detected in a message addressed to [EMAIL PROTECTED] from [EMAIL PROTECTED] The subject of the message is Re: Here. The virus could not be cleaned and the message is held in Dirty Messages Message from: [EMAIL PROTECTED] Message subject: Re: Here Sent to: [EMAIL PROTECTED] Dated: Sun, 14 Nov 2004 13:16:48 + Detection Summary: Scenarios/Incoming/Incoming Virus Scanning: Information 0x42060008, W32/Netsky-D Scenarios/Incoming/Block Executables: 'ItemLength.GE.0'. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problem updating the package foreign
On Sun, 14 Nov 2004, Arin Basu wrote: Hi Group: From an R session, I wanted to update packages, and issued the command: update.packages() R started to update the package foreign and proceeded. After downloading, while it attempted to install the packages, it came up with the following error message. I could not understand the error message. Does it indicate that the problem lies with the gcc? How do I install the current version of foreign? My operating system is MepisLinux, based on Debian, and the computer is a compaq presario laptop with dual booting with Win XP(the linux partition has 10 GB space, with 128 MB RAM). I have appended the R message in this mail. I could not locate the config.log file. You haven't told us the version of R, though, or how you installed it (do read the posting guide, as we ask). To find the config.log you need to download and unpack the foreign tarball, then use R CMD INSTALL on the unpacked directory, which is where config.log will be put. I suggest you wait until tomorrow and install R-2.0.1 (released then) from the sources. Would greatly appreciate your advice in solving the problem. /Arin Basu ---Beginning of R command and error message--- update.packages() trying URL `http://cran.r-project.org/src/contrib/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 212630 bytes opened URL == downloaded 207Kb Update (y/N)? y trying URL `http://cran.r-project.org/src/contrib/foreign_0.8-0.tar.gz' Content type `application/x-tar' length 259351 bytes opened URL == downloaded 253Kb * Installing *source* package 'foreign' ... checking for gcc... gcc checking for C compiler default output file name... configure: error: C compiler cannot create executables See `config.log' for more details. ERROR: configuration failed for package 'foreign' ---end of R command and error message--- -- 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, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Exporting to file: passing source name to file name in loop
Hi, I'm having a mental block as to how I can automatically assign filenames to the output of the following code. I am wishing to create a separate .png file for every image created, each of them having a sequential filename ie sourcefile_index.png so that I can create a movie from them. Please could someone tell me where I am going wrong? the following code works fine and outputs to screen: fun_pca_vector_movie_plot-function(x,y,z,t){ zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ pca-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ image(east,north,t(map.matrix),col=my.colors,axes=T, xlab=,ylab=) text(y[,3],y[,2],labels=as.character(y[,1])) title(paste(Component,i,Step:)) arrows(y[,3],y[,2],(y[,3]+50*(pca$rotation[i,1:(ncol(x)/2)])), (y[,2]+50*(pca$rotation[i,((ncol(x)/2)+1):(ncol(x))])), angle=30,length=0.05,code=2) } box() } }} but when I try to save to file as follows it doesn't work: fun_pca_vector_movie_plot-function(x,y,z,t){ zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ pca-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ plot.new() png(file=(paste(x.,i,_,zz,.png,sep=)),width=240,height=240) image(east,north,t(map.matrix),col=my.colors,axes=T, xlab=,ylab=) text(y[,3],y[,2],labels=as.character(y[,1])) title(paste(Component,i,Step:)) arrows(y[,3],y[,2],(y[,3]+50*(pca$rotation[i,1:(ncol(x)/2)])), (y[,2]+50*(pca$rotation[i,((ncol(x)/2)+1):(ncol(x))])), angle=30,length=0.05,code=2) dev.off() } box() } }} many thanks in advance! Laura Quinn Institute of Atmospheric Science School of Earth and Environment University of Leeds Leeds LS2 9JT tel: +44 113 343 1596 fax: +44 113 343 6716 mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Exporting to file: passing source name to file name in loop
What does `it doesn't work' actually mean? Please read the posting guide and follow its advice. Also, please show us readable and properly indented code, using spaces consistently. (There is a chapter in `Writing R Extensions' showing you how to do this.) I just cannot parse your code, and suspect you cannot either. On Sun, 14 Nov 2004, Laura Quinn wrote: Hi, I'm having a mental block as to how I can automatically assign filenames to the output of the following code. I am wishing to create a separate .png file for every image created, each of them having a sequential filename ie sourcefile_index.png so that I can create a movie from them. Please could someone tell me where I am going wrong? the following code works fine and outputs to screen: fun_pca_vector_movie_plot-function(x,y,z,t){ zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ pca-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ image(east,north,t(map.matrix),col=my.colors,axes=T, xlab=,ylab=) text(y[,3],y[,2],labels=as.character(y[,1])) title(paste(Component,i,Step:)) arrows(y[,3],y[,2],(y[,3]+50*(pca$rotation[i,1:(ncol(x)/2)])), (y[,2]+50*(pca$rotation[i,((ncol(x)/2)+1):(ncol(x))])), angle=30,length=0.05,code=2) } box() } }} but when I try to save to file as follows it doesn't work: fun_pca_vector_movie_plot-function(x,y,z,t){ zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ pca-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ plot.new() png(file=(paste(x.,i,_,zz,.png,sep=)),width=240,height=240) image(east,north,t(map.matrix),col=my.colors,axes=T, xlab=,ylab=) text(y[,3],y[,2],labels=as.character(y[,1])) title(paste(Component,i,Step:)) arrows(y[,3],y[,2],(y[,3]+50*(pca$rotation[i,1:(ncol(x)/2)])), (y[,2]+50*(pca$rotation[i,((ncol(x)/2)+1):(ncol(x))])), angle=30,length=0.05,code=2) dev.off() } box() } }} many thanks in advance! Laura Quinn Institute of Atmospheric Science School of Earth and Environment University of Leeds Leeds LS2 9JT tel: +44 113 343 1596 fax: +44 113 343 6716 mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] solving system of nonlinear equations
Hello there Can anybody please tell me if there is any package in R to solve the following 4 nonlinear equations with 4 unknowns: alpha*exp(20/sigma)+ beta*exp(21/tau) = 2 alpha*exp(22/sigma)+ beta*exp(9/tau) = 4 alpha*exp(10/sigma)+ beta*exp(30/tau) = 6 alpha*exp(40/sigma)+ beta*exp(39/tau) = 5 where alpha = exp(lambda/sigma) beta= exp(delta/tau) I need to estimate lambda, sigma, delta, tau Thanks. E Raheem __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Exporting to file: passing source name to file name in loop
Apologies - Sunday afternoon coding, not my forte. I am trying to pass the name of my input variable x (my.data) into the name of my output file, and am wanting to combine this with a count value. I hope that this code is a little more readable (though I seem to be having problems pasting the formatting into my email composition): fun_pca_vector_movie_plot - function (x,y,z,t) { zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ plot.new() png(file=(paste(as.character(x),.,i,.png,sep=)),width=240,height=240) pca-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ image(east,north,t(map.matrix),col=my.colors,axes=T, xlab=,ylab=) text(y[,3],y[,2],labels=as.character(y[,1])) title(paste(Component,i,Step:)) arrows(y[,3],y[,2],(y[,3]+50*(pca$rotation[i,1:(ncol(x)/2)])), (y[,2]+50*(pca$rotation[i,((ncol(x)/2)+1):(ncol(x))])), angle=30,length=0.05,code=2) } box() } dev.off() } } I get a syntax error relating to the as.character(x) part of the file name - if I remove this, the code works fine for the rest of the file extension. I have tried deparse(x) but this returns a file extension of the following nature: structure(list(f1 = c(5.56358661715647, 6.10364037003176, 6.24040147126807, .10.png Thanks, Laura Laura Quinn Institute of Atmospheric Science School of Earth and Environment University of Leeds Leeds LS2 9JT tel: +44 113 343 1596 fax: +44 113 343 6716 mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Exporting to file: passing source name to file name in loop
Laura Quinn writes: Apologies - Sunday afternoon coding, not my forte. I am trying to pass the name of my input variable x (my.data) into the name of my output file, and am wanting to combine this with a count value. I hope that this code is a little more readable (though I seem to be having problems pasting the formatting into my email composition): fun_pca_vector_movie_plot - function (x,y,z,t) { zz=seq(1,(nrow(x)-t),by=t);jj=seq(t+1,(nrow(x)),by=t) for(i in seq(along=zz)){ plot.new() png(file=(paste(as.character(x),.,i,.png,sep=)),width=240,height=240) pca-prcomp(x[zz[i]:jj[i],], retx=T, center=T,scale=T) { par(mfrow=c(1,z)) for(i in 1:z){ image(east,north,t(map.matrix),col=my.colors,axes=T, xlab=,ylab=) text(y[,3],y[,2],labels=as.character(y[,1])) title(paste(Component,i,Step:)) arrows(y[,3],y[,2],(y[,3]+50*(pca$rotation[i,1:(ncol(x)/2)])), (y[,2]+50*(pca$rotation[i,((ncol(x)/2)+1):(ncol(x))])), angle=30,length=0.05,code=2) } box() } dev.off() } } I get a syntax error relating to the as.character(x) part of the file name - if I remove this, the code works fine for the rest of the file extension. I have tried deparse(x) but this returns a file extension of the following nature: structure(list(f1 = c(5.56358661715647, 6.10364037003176, 6.24040147126807, .10.png You should try something like: png(file=paste(substitute(x),.,i,.png,sep=),width=240,height=240) Also, drop the 'plot.new()', it's useless. png() already sets up a new ploting device. -- Fernando Henrique Ferraz P. da Rosa http://www.ime.usp.br/~feferraz __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] excel/r interface
Dear all, I am quite new to R and for preofessional reasons I was interested in the R/excel interface by Baier and Neuwirth. After setup I see the Rexcel and the Rhelp on the Menu bar of Microsoft Excel XP. However, after putting the formula =RApply(pchisqr, 30, 1) Excel returns the message could not start Rserver. Any suggestions how to fix this. How do run this application in R. Any will be appreciated Andreas Betz Andreas Betz [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Combining expressions and objects within labels
Hello all, I am an R novice and I have a simple question and hope somebody can help me out. I need to place several labels in a plot, this labels are some kind of text and also some objects (which come from some more complicated R calculations). In one of this labels I'd like to place a superscript, however I cannot find a way to place both the expression and the object in the same label. Thanks in advance and best regards. Please look at the example below: # my objects eonr - 75 yldeonr - 150 r_2 - 0.95 # the plot and simple labels plot(0:100, 0:100) text(60,40, paste(EONR=,eonr)) text(60,36, paste(Yield at EONR=,yldeonr)) # I'd like to place the superscript on the r text(60,32, paste(Pseudo r^2=,r_2)) # This does not seem to work ... I can get the subscript # but now I cannot paste the r_2 object. Any ideas ? text(60,28, expression(paste(Pseudo r ^2, = r_2))) -- Jose A. Hernandez Department of Soil, Water, and Climate University of Minnesota 1991 Upper Buford Circle St. Paul, MN 55108 Ph. (612) 625-0445, Fax. (612) 625-2208 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] excel/r interface
On Sun, 14 Nov 2004, Andreas Betz wrote: I am quite new to R and for preofessional reasons I was interested in the R/excel interface by Baier and Neuwirth. After setup I see the Rexcel and the Rhelp on the Menu bar of Microsoft Excel XP. However, after putting the formula =RApply(pchisqr, 30, 1) Excel returns the message could not start Rserver. Any suggestions how to fix this. How do run this application in R. Please ask such questions on their mailing list, not the R one. See http://cran.r-project.org/contrib/extra/dcom/RSrv135.html for where. -- 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, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Combining expressions and objects within labels
Hi Jose A. Hernandez wrote: Hello all, I am an R novice and I have a simple question and hope somebody can help me out. I need to place several labels in a plot, this labels are some kind of text and also some objects (which come from some more complicated R calculations). In one of this labels I'd like to place a superscript, however I cannot find a way to place both the expression and the object in the same label. Thanks in advance and best regards. Please look at the example below: # my objects eonr - 75 yldeonr - 150 r_2 - 0.95 # the plot and simple labels plot(0:100, 0:100) text(60,40, paste(EONR=,eonr)) text(60,36, paste(Yield at EONR=,yldeonr)) # I'd like to place the superscript on the r text(60,32, paste(Pseudo r^2=,r_2)) # This does not seem to work ... I can get the subscript # but now I cannot paste the r_2 object. Any ideas ? text(60,28, expression(paste(Pseudo r ^2, = r_2))) text(60, 28, substitute(paste(Pseudo , r^2 == r_2), list(r_2=r_2))) Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question about the tick label.
Hello, I am a beginner of R. I want to plot the vectors Y vs. X where X has continuous interger values. How can I use the name of each element as the tick label? Thanks a lot! Haiyong __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Where has the Debian respository gone?
Hi all! Did I miss something or is it just a temporary problem? Where has the Debian respository http://cran.r-project.org woody/main Packages resp. http://cran.r-project.org/bin/linux/debian/ gone? I tried it for about the last 7 hours. $ apt-get update [...] Err http://cran.r-project.org woody/main Packages 404 Not Found [...] Failed to fetch http://cran.r-project.org/bin/linux/debian/dists/woody/main/binary-i386/Packages 404 Not Found Greetings, Christoph __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] question about the tick label.
Not sure if this is what you want, but give it a shot anyway: plot(x, y, xaxt=n) axis(1, at=x, label=names(x)) Andy From: Haiyong Xu Hello, I am a beginner of R. I want to plot the vectors Y vs. X where X has continuous interger values. How can I use the name of each element as the tick label? Thanks a lot! Haiyong __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Legend help needed
R : Version 1.9.1 Hi, Am having trouble adding a legend to scatterplot. R code is shown below. I have tried various incantations to add a legend (using the legend() function) to the resulting plot but without any success. Looks like it should be simple but I must be missing something. Any pointers would be welcome. Have looked at help(legend) etc. --8-- --- sfiles - c(72_12_12_V.csv , 150_25_15_V.csv, 150_25_20_V.csv, 150_25_25_V.csv, 150_25_40_V.csv, 150_25_60_V.csv, 150_25_90_V.csv, 240_40_40_V.csv) ## process each file in list for (i in 1:length(sfiles)) { data - read.csv(paste(../data/,sfiles[i],sep=)) ## assign columns to some nice names K - data[,8] AN - data[,3] * (data[,2] - data[,4]) ## plot K against AN if ( i == 1) { plot(AN, K, ylim=c(1000,9000), xlim=c(0,1500), xlab=Area above Notch (mm), main=Size Effect Specimens) par(new=TRUE) } else{ plot(AN,K, pch=(i),ylim=c(1000,9000), xlim=c(0,1500), axes=FALSE,xlab=) par(new=TRUE) } } --8-- --- -- Sean Richards C-fACS P.O. Box 84, Lincoln University, Canterbury, New Zealand Phone:(64)(3) 325-2811 ext 8636 Email: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] solving system of nonlinear equations
Have you considered nls? If you read the help file and work through the examples, there is a good chance you can make it work, I think. I think I would start trying plinear in nls, parameterizing the problem in terms of alpha, beta, ln.sigma, and ln.tau, unless you think a solution might require sigma 0 or tau 0. Using logarithms will get rid of the constraint and may make the problem numerically easier. Using alpha and beta rather than lambda and delta transforms the problem into an ordinary least squares problem for alpha and beta given any two numbers for sigma and tau (or ln.sigma and ln.tau). If I had trouble with this, I might try two other things: (a) The solver in Excel. (b) I might generate a grid in ln.sigma and ln.tau using expand.grid. For each combination of levels, I'd set up the linear regression problem and use lm to estimate alpha and beta and compute and store the sum of squares of residuals. Then I'd use contour to visualize the sum of squares surface. I've done all these things with crudely similar problems in the past and been happy with the results. If I only had this one problem, I'd be surprised if it would require more than a few hours. If I wanted a general algorithm for other purposes, I might do it two or three different ways both to help select a good algorithm and to build confidence in the results. hope this helps. spencer graves p.s. Some of these techniques are discussed in Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer). If you don't have this, I'd encourage you to consider spending some time with it. Enayetur RAHEEM wrote: Hello there Can anybody please tell me if there is any package in R to solve the following 4 nonlinear equations with 4 unknowns: alpha*exp(20/sigma)+ beta*exp(21/tau) = 2 alpha*exp(22/sigma)+ beta*exp(9/tau) = 4 alpha*exp(10/sigma)+ beta*exp(30/tau) = 6 alpha*exp(40/sigma)+ beta*exp(39/tau) = 5 where alpha = exp(lambda/sigma) beta= exp(delta/tau) I need to estimate lambda, sigma, delta, tau Thanks. E Raheem __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Spencer Graves, PhD, Senior Development Engineer O: (408)938-4420; mobile: (408)655-4567 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Power curves
How do I draw/calculate power curves in R? Cheers, Duncan. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Where has the Debian respository gone?
On Sun, Nov 14, 2004 at 10:53:42PM +0100, Christoph Bier wrote: Hi all! Did I miss something or is it just a temporary problem? Where has the Debian respository http://cran.r-project.org woody/main Packages resp. http://cran.r-project.org/bin/linux/debian/ gone? I tried it for about the last 7 hours. [...] It has been turned off by the CRAN masters as the content had slipped further and further behind the Debian content. Current R and CRAN packages are on the Debian archives; you can install these on testing too. To the best of my knowledge, there are no backports of current R and Debian CRAN packages to Debian stable. Hope this helps, Dirk -- If your hair is standing up, then you are in extreme danger. -- http://www.usafa.af.mil/dfp/cockpit-phys/fp1ex3.htm __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Where has the Debian respository gone?
On Sun, Nov 14, 2004 at 07:35:27PM -0600, Dirk Eddelbuettel wrote: On Sun, Nov 14, 2004 at 10:53:42PM +0100, Christoph Bier wrote: Hi all! Did I miss something or is it just a temporary problem? Where has the Debian respository http://cran.r-project.org woody/main Packages resp. http://cran.r-project.org/bin/linux/debian/ gone? I tried it for about the last 7 hours. [...] It has been turned off by the CRAN masters as the content had slipped further and further behind the Debian content. Current R and CRAN packages are on the Debian archives; you can install these on testing too. To the best of my knowledge, there are no backports of current R and Debian CRAN packages to Debian stable. Upon re-reading this, I should clarify that in this context CRAN packages refers to the several dozen CRAN packages that are in Debian; the list is growing but still far from exhaustive. Dirk -- If your hair is standing up, then you are in extreme danger. -- http://www.usafa.af.mil/dfp/cockpit-phys/fp1ex3.htm __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html