[R] Kernlab: problem with small datasets
Hi, I found a small problem with kernlab. The problem, I think, is that the 3-fold cross-validation performed to estimate probabilities is not class-balanced, so the classifier could find empty classes. The following example (maybe a little forced) show the error: data(glass) set.seed(1) model-ksvm(Type~.,data=glass[c(1:2,75:76,165:166,180:181,190:191),],type=C-svc,kernel=vanilla,prob.model=TRUE) Setting default kernel parameters Error in indexes[[j]] : subscript out of bounds In addition: Warning message: Variable(s) `' constant. Cannot scale data. in: .local(x, ...) HTH, Pablo __ 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
[R] tcltk package
Hi all, I have a package depending on the tcltk-package. However, I see that this package has been disappeared... Is there a reason why package 'tcltk' is not available anymore? Or is it replaced by another one? thx, Kurt. __ 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
Re: [R] Tables: Invitation to make a collective package
If the functionality you are thinking of already exists across multiple packages an alternative to creating a new package would be to create a task view as in: http://cran.r-project.org/src/contrib/Views/ as explained in the ctv package and the article in R News 5/1. On 7/7/05, Jose Claudio Faria [EMAIL PROTECTED] wrote: Hi All, I would like to make an invitation to make a collective package with all functions related to TABLES. I know that there are many packages with these functions, the original idea is collect all this functions and to make a single package, because is arduous for the user know all this functions broadcast in many packages. So, I think that the original packages can continue with its original functions, but, is very good to know that exist one package with many (I dream all) the functions related to tables. I've been working with these functions (while I am learning R programming): ### # Tables - Package # ### # # 1. Tables # # # Common function # tb.make.table.I - function(x, start, end, h, right) { f- table(cut(x, br=seq(start, end, h), right=right)) # Absolut freq fr - f/length(x) # Relative freq frP - 100*(f/length(x)) # Relative freq, % fac - cumsum(f) # Cumulative freq facP - 100*(cumsum(f/length(x))) # Cumulative freq, % fi - round(f, 2) fr - round(as.numeric(fr), 2) frP - round(as.numeric(frP), 2) fac - round(as.numeric(fac), 2) facP - round(as.numeric(facP),2) res - data.frame(fi, fr, frP, fac, facP)# Make final table names(res) - c('Class limits', 'fi', 'fr', 'fr(%)', 'fac', 'fac(%)') return(res) } # # Common function # tb.make.table.II - function (x, k, breaks=c('Sturges', 'Scott', 'FD'), right=FALSE) { x - na.omit(x) # User defines only x and/or 'breaks' # (x, {k,}[breaks, right]) if (missing(k)) { brk - match.arg(breaks) switch(brk, Sturges = k - nclass.Sturges(x), Scott = k - nclass.scott(x), FD = k - nclass.FD(x)) tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/k } # User defines 'x' and 'k' # (x, k,[breaks, right]) else { tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/abs(k) } tbl - tb.make.table.I(x, start, end, h, right) return(tbl) } # # With Gabor Grotendieck suggestions (thanks Gabor, very much!) # tb.table - function(x, ...) UseMethod(tb.table) # # Table form vectors # tb.table.default - function(x, k, start, end, h, breaks=c('Sturges', 'Scott', 'FD'), right=FALSE) { # User defines nothing or not 'x' isn't numeric - stop stopifnot(is.numeric(x)) x - na.omit(x) # User defines only 'x' # (x, {k, start, end, h}, [breaks, right]) if (missing(k) missing(start) missing(end) missing(h) ) { brk - match.arg(breaks) switch(brk, Sturges = k - nclass.Sturges(x), Scott = k - nclass.scott(x), FD = k - nclass.FD(x)) tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/k } # User defines 'x' and 'k' # (x, k, {start, end, h}, [breaks, right]) else if (missing(start) missing(end) missing(h)) { stopifnot(length(k) = 1) tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/abs(k) } # User defines 'x', 'start' and 'end' # (x, {k,} start, end, {h,} [breaks, right]) else if (missing(k) missing(h)) { stopifnot(length(start) = 1, length(end) =1) tmp - range(x) R - end-start k - sqrt(abs(R)) if (k 5) k - 5 # min value of k h - R/k } # User defines 'x', 'start', 'end' and 'h' # (x, {k,} start, end, h, [breaks, right]) else if (missing(k)) { stopifnot(length(start) = 1, length(end) = 1, length(h) = 1) } else stop('Error, please, see the function sintax!') tbl - tb.make.table.I(x, start, end, h, right) return(tbl) } # # Table form data.frame # tb.table.data.frame - function(df, k, by, breaks=c('Sturges', 'Scott',
Re: [R] tcltk package
It's included in the base R distribution, I believe. Andy From: Kurt Sys Hi all, I have a package depending on the tcltk-package. However, I see that this package has been disappeared... Is there a reason why package 'tcltk' is not available anymore? Or is it replaced by another one? thx, Kurt. __ 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 __ 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
Re: 答复: 答复: [R] fail in add ing library in new version.
On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example Another possibility is to put Rcmd.bat from the batch file collection http://cran.r-project.org/contrib/extra/batchfiles/ in your path. It will use the registry to find R so you won't have to modify your path (nor would you have to remodify it every time you install a new version of R which is what you would otherwise have to do): cd \MyPackages Rcmd install example There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\ 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable (In your previous mail, you said put these at the beginning of the path, I don't understand what is your meaning. Which path?) If in the console you enter the command: path then it will display a semicolon separated list of folders. You want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior to the one where the tools are stored. 5. I tried an library example. I set a new folder named example in the c:\MyRpackages\. And In the example folder, it contain an DESCRIPTION file and R folder. in R folder contain a example file. I just write very simple script in it: a-2; b-3;sum - sum(a,b); print(paste(a,+,b,=,sum)) 6. I opened the DOS environment. Into the D:\ Type the following code: cd \Program Files\R\rw2010 But I don't understand the second line you writed in your previous mail: bin\R cmd install /MyRPackages/example I was assuming that MyRPackages and R are on the same disk. If they are not then you need to specify the disk too. That is if MyRPackages is on C and R is installed on D then install your package via: d: cd \Program Files\R\rw2010 bin\R CMD install c:/MyRPackages/example Note that bin\R means to run R.exe in the bin subfolder of the current folder using command script install and the indicated source package. I am not sure that I set up R in D:\ But I do so much action in C:\ Did I do the correct action? Did I do the action into the correct path? If you are not sure where R is installed then enter the following at the Windows console prompt to find out (this will work provided you let it install the key into the registry when you installed R initially). The reg command is a command built into Windows (I used XP but I assume its the same on other versions) that will query the Windows registry: reg query hklm\software\r-core\r /v InstallPath I still need your and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月6日 10:21 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: [R] fail in adding library in new version. On 6/5/05, Ivy_Li [EMAIL
Re: [R] tcltk package
How do you know that it has disappeared? -roger Kurt Sys wrote: Hi all, I have a package depending on the tcltk-package. However, I see that this package has been disappeared... Is there a reason why package 'tcltk' is not available anymore? Or is it replaced by another one? thx, Kurt. __ 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 -- Roger D. Peng http://www.biostat.jhsph.edu/~rpeng/ __ 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
Re: 答复: 答复: [R] fail in adding librar y in new version.
Gabor Grothendieck wrote: On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example Another possibility is to put Rcmd.bat from the batch file collection http://cran.r-project.org/contrib/extra/batchfiles/ in your path. It will use the registry to find R so you won't have to modify your path (nor would you have to remodify it every time you install a new version of R which is what you would otherwise have to do): cd \MyPackages Rcmd install example Just for the records: 1. cd \MyPackages won't work, as I have already explained above. 2. I do *not* recommend this way, in particular I find it misleading to provide these batch files on CRAN. 3. I have decided not to comment any more on this topic in future. Uwe Ligges There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\ 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable (In your previous mail, you said put these at the beginning of the path, I don't understand what is your meaning. Which path?) If in the console you enter the command: path then it will display a semicolon separated list of folders. You want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior to the one where the tools are stored. 5. I tried an library example. I set a new folder named example in the c:\MyRpackages\. And In the example folder, it contain an DESCRIPTION file and R folder. in R folder contain a example file. I just write very simple script in it: a-2; b-3;sum - sum(a,b); print(paste(a,+,b,=,sum)) 6. I opened the DOS environment. Into the D:\ Type the following code: cd \Program Files\R\rw2010 But I don't understand the second line you writed in your previous mail: bin\R cmd install /MyRPackages/example I was assuming that MyRPackages and R are on the same disk. If they are not then you need to specify the disk too. That is if MyRPackages is on C and R is installed on D then install your package via: d: cd \Program Files\R\rw2010 bin\R CMD install c:/MyRPackages/example Note that bin\R means to run R.exe in the bin subfolder of the current folder using command script install and the indicated source package. I am not sure that I set up R in D:\ But I do so much action in C:\ Did I do the correct action? Did I do the action into the correct path? If you are not sure where R is installed then enter the following at the Windows console prompt to find out (this will work provided you let it install the key into the registry when you installed R initially). The reg command is a command built into Windows (I used XP but I assume its the same on other versions) that will query the Windows registry: reg query hklm\software\r-core\r /v InstallPath I still need your and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Re: [R] Kernlab: problem with small datasets
[EMAIL PROTECTED] wrote: Hi, I found a small problem with kernlab. The problem, I think, is that the 3-fold cross-validation performed to estimate probabilities is not class-balanced, so the classifier could find empty classes. The following example (maybe a little forced) show the error: data(glass) set.seed(1) model-ksvm(Type~.,data=glass[c(1:2,75:76,165:166,180:181,190:191),],type=C-svc,kernel=vanilla,prob.model=TRUE) Setting default kernel parameters Error in indexes[[j]] : subscript out of bounds In addition: Warning message: Variable(s) `' constant. Cannot scale data. in: .local(x, ...) So time to report it to the package mainteiner (CCing), if you think it is an insufficiency or bug. Uwe Ligges HTH, Pablo __ 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 __ 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
Re: [R] Making Package, Chm error, Html Help Workshop
TEMPL Matthias wrote: Hello, When building my package (R CMD check) following error message occurs: ... varinf.plot text html latex example xtext html latex example make[2]: *** No rule to make target `disclosure.chm`. Stop. cp: cannot stat 'D:/Programme/R/rw2010dev/disclosure/chm/disclosure.chm`: No such file or directory make[1]: *** [chm-disclosure] Error 1 make: *** [pkg-disclosure] Error 2 *** Installation of disclosure failed *** Removing `D:/Programme/R/rw2010dev/bin/disclosure.Rcheck/disclosure' ERROR Installation failed. It seems, that there is a problem with HTML Workshop. No chm´s were built. When I uninstall the HTML Help Workshop and remove the entry in the path environmental variable and doing packaging after this, the same error occurs. I´m sure, that I have written the right entry (the path of the HTML help Workschop, where the hhc.exe file is) in the path of the environmental variable as the instructions said. (Windows XP, Intel, R 2.1.0, HTML Workshop 1.32) Has anybody seen such a problem before? Can anybody give me a hint, please? hhc.exe is found, because it is not reported that hhc is not there. I guess you have used an irregular name (from hhc's point of view) as the name or alias of a help topic, or you have an irregular name of an Rd file. Have you tried with a recent and released version of R such as R-2.1.1? Your's is unreleased, obviously. If it still won't work, please sent me the source package and I will take a look. Uwe Ligges Thank you very much, Matthias __ 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 __ 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
Re: 答复: 答复: [R] fail in add ing library in new version.
On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example Another possibility is to put Rcmd.bat from the batch file collection http://cran.r-project.org/contrib/extra/batchfiles/ in your path. It will use the registry to find R so you won't have to modify your path (nor would you have to remodify it every time you install a new version of R which is what you would otherwise have to do): cd \MyPackages Rcmd install example Just for the records: 1. cd \MyPackages won't work, as I have already explained above. If MyPackages is not a top level directory in the current drive then it will not work. Otherwise it does work. 2. I do *not* recommend this way, in particular I find it misleading to provide these batch files on CRAN. The alternative, at least as discussed in your post, is more work since one will then have to change one's path every time one reinstalls R. This is just needless extra work and is error prone. If you forget to do it then you will be accessing the bin directory of the wrong version of R. There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\ 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable (In your previous mail, you said put these at the beginning of the path, I don't understand what is your meaning. Which path?) If in the console you enter the command: path then it will display a semicolon separated list of folders. You want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior to the one where the tools are stored. 5. I tried an library example. I set a new folder named example in the c:\MyRpackages\. And In the example folder, it contain an DESCRIPTION file and R folder. in R folder contain a example file. I just write very simple script in it: a-2; b-3;sum - sum(a,b); print(paste(a,+,b,=,sum)) 6. I opened the DOS environment. Into the D:\ Type the following code: cd \Program Files\R\rw2010 But I don't understand the second line you writed in your previous mail: bin\R cmd install /MyRPackages/example I was assuming that MyRPackages and R are on the same disk. If they are not then you need to specify the disk too. That is if MyRPackages is on C and R is installed on D then install your package via: d: cd \Program Files\R\rw2010 bin\R CMD install c:/MyRPackages/example Note that bin\R means to run R.exe in the bin subfolder of the current folder using command script install and the indicated source package. I am not sure that I set up R in D:\ But I do so much action in C:\ Did I do the correct action? Did I do the action into the correct path? If you are not sure
Re: [R] tcltk package [SOLVED]
I had R 2.0.1... It's not included in that distribution of R. It's ok in distribution 2.1.1. thx (to all that've been replying that it's included in the base distribution), Kurt. Liaw, Andy wrote: It's included in the base R distribution, I believe. Andy From: Kurt Sys Hi all, I have a package depending on the tcltk-package. However, I see that this package has been disappeared... Is there a reason why package 'tcltk' is not available anymore? Or is it replaced by another one? thx, Kurt. __ 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
[R] R crashes when spherical autocorrelation specified in nlme
Dear list: R crashes when I specify spatial autocorrelation in nlme: sp3 - corSpher(c(30,0.75),~x+y|Site, nugget = T) cs3 - Initialize(sp3, data = sav) sav.nlme1-nlme(vc.asin ~ SSasymp(canopy, Asym, R0, lrc),data = sav, fixed = Asym + R0 + lrc ~ 1, random = R0 + lrc ~ 1|Site, start = list(fixed = sav.ini), verbose = T, correlation = cs3) There is a longish (~3 s) pause prior to the crash. There is no crash if correlation = cs3 is omitted. The nugget effect is large (~0.75), so perhaps it is not worth including, but I would still like to know if the crash can be avoided. My system is: R 2.0.1 Windows XP SP2 Dual Intel Xeon 2.8GHz 2Gb RAM Thanks, Dan Bebber Department of Plant Sciences University of Oxford UK __ 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
Re: [R] Java and R help
Im doing an aplication in Java and i have a program made in R what i want to launch with Java. I have the following instructions: Runtime r = Runtime.getRuntime(); try { System.out.println (Llamada a R...); p = r.exec(sRutaR); } catch (IOException e) { System.out.println (Error lanzando R: + e.getMessage()); e.printStackTrace(); } catch (Exception ex) { System.out.println (Error lanzando R + ex.toString()); ex.printStackTrace(); } } and after that i wait for a file that R must to make called terminado.dat. But when i launch the process the file doesn't create until i destroy the process. can anyone explain what's happend with the process? Thx in advance and sorry for my poor english The reason is that you did consume java output buffer, the process hanged until you clear them. Try to use following StreamGobbler.java to catch all the outputs: //start of StreamGobbler.java import java.util.*; import java.io.*; class StreamGobbler extends Thread { InputStream is; String type; StreamGobbler(InputStream is, String type) { this.is = is; this.type = type; } public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line=null; while ( (line = br.readLine()) != null) System.out.println(type + + line); } catch (IOException ioe) { ioe.printStackTrace(); } } } //end of StreamGobbler then use this method to do system call: public boolean execWait(String comm){ try{ Process proc = Runtime.getRuntime().exec(comm); StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), ERROR); // any output? StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), OUTPUT); // kick them off errorGobbler.start(); outputGobbler.start(); int returnVal = proc.waitFor(); if (returnVal != 0) { return(false); } } catch (Exception e){ e.printStackTrace(); return false; } return true; } Hope this helps, Junwen __ 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
[R] What method I should to use for these data?
Dear R user: I am studying the allele data of two populations. the following is the data: a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 pop10.0217 0. 0.0109 0.0435 0.0435 0. 0.0109 0.0543 0.1739 0.0761 0.1413 0.1522 0.1087 0.0870 0.0435 0.0217 0.0109 pop20.0213 0.0213 0. 0. 0. 0.0426 0.1702 0.2128 0.1596 0.1809 0.0957 0.0745 0.0106 0.0106 0. 0. 0. a1,a2,a3 .. a17 is the frequency of 17 alleles , the sum is 1. I want to test the significance of the distribution of 17 alleles between two populations. How can I do? I want to use chisquare, is is right for these data ? can anyone help me ? Thanks!! luan Yellow Sea Fisheries Research Institute , Chinese Academy of Fishery Sciences , Qingdao , 266071 __ ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä __ 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
[R] What method I should to use for these data?
Dear R user: I am studying the allele data of two populations. the following is the data: a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 pop10.0217 0. 0.0109 0.0435 0.0435 0. 0.0109 0.0543 0.1739 0.0761 0.1413 0.1522 0.1087 0.0870 0.0435 0.0217 0.0109 pop20.0213 0.0213 0. 0. 0. 0.0426 0.1702 0.2128 0.1596 0.1809 0.0957 0.0745 0.0106 0.0106 0. 0. 0. a1,a2,a3 .. a17 is the frequency of 17 alleles , the sum is 1. I want to test the significance of the distribution of 17 alleles between two populations. How can I do? I want to use chisquare, is is right for these data ? can anyone help me ? Thanks!! luan Yellow Sea Fisheries Research Institute , Chinese Academy of Fishery Sciences , Qingdao , 266071 __ ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä __ 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
Re: [R] plotting on a reverse log scale
There is an enhanced pretty function called nice in the Epi package that also works with log data. Not sure if this could lead to any simplifications in this problem? On 7/6/05, Marc Schwartz [EMAIL PROTECTED] wrote: I thought that I would take a stab at this. I should note however that my solution is heavily biased by the first log scale plot that Michael referenced below. To wit, my x axis has major ticks at powers of 10 and minor ticks at 1/10 of each major tick interval. Thus, here is my approach: # Set the max range to an integer power of 10 as may be required max.pow - 5 # Set the data as others have done below set.seed(1) x - runif(500, 1, 10^max.pow) d - density(x, from = 1, to = 10^max.pow) # Now do the density plot, leaving the x axis blank # Note that by doing a rev() on 'xlim' it reverses the min/max on the # x axis, so you don't have to worry about adjusting things. plot(d$y ~ d$x, xlim = rev(c(1, 10^max.pow)), log = x, xaxt = n, type = l, xlab = 2000 - Year (log scale)) # Set the axis major tick marks axis.at - 10 ^ c(0:max.pow) # Draw the major tick marks and label them using plotmath axis(1, at = axis.at, tcl = -1, labels = parse(text = paste(10^, 0:max.pow, sep = ))) # Now do the minor ticks, at 1/10 of each power of 10 interval axis(1, at = 1:10 * rep(axis.at[-1] / 10, each = 10), tcl = -0.5, labels = FALSE) # Do the rug plot rug(x) Not sure if this is helpful here, but thought I would post it for review/critique. The 'max.pow' constant can be explicitly adjusted or can be calculated automatically based upon input year ranges. Best regards, Marc Schwartz On Wed, 2005-07-06 at 17:31 -0400, Gabor Grothendieck wrote: Not sure if I am missing something essential here but it would seem as simple as: # data set.seed(1) x - runif(500, 1500, 1990) # plot d - density(x, from = 1500, to = 1990) plot(d$y ~ d$x, log = x) rug(x) axis(1, seq(1500, 1990, 10), FALSE, tcl = -0.3) On 7/6/05, Michael Friendly [EMAIL PROTECTED] wrote: Thanks Duncan, That is almost exactly what I want, except I want time to go in the normal order, not backwards, so: # plot on reverse log scale years1500 - runif(500, 1500, 1990) # some fake data x - -log(2000-years1500) from - -log(2000-1990) to - -log(2000-1500) plot(density(x, from=from, to=to), axes=F) rug(x) labels - pretty(years1500) labels - labels[labels2000] axis(1, labels, at=-log(2000-labels)) minorticks - pretty(years1500, n=20) minorticks - minorticks[minorticks2000] axis(1, labels=FALSE, at=-log(2000-minorticks), tcl=-0.25) axis(2) box() -Michael Duncan Murdoch wrote: On 7/6/2005 3:36 PM, Michael Friendly wrote: I'd like to do some plots of historical event data on a reverse log scale, started, say at the year 2000 and going backwards in time, with tick marks spaced according to log(2000-year). For example, see: http://euclid.psych.yorku.ca/SCS/Gallery/images/log-timeline.gif As an example, I'd like to create a density plot of such data with the horizontal axis reverse-logged, a transformation of this image: http://euclid.psych.yorku.ca/SCS/Gallery/milestone/Test/mileyears1.gif Some initial code to do a standard density plot looks like this: mileyears - read.csv(mileyears3.csv, skip=1, col.names=c(key,year,where,add,junk)) mileyears - mileyears[,2:4] years - mileyears$year years1500 - years[years1500] dens - density(years1500, from=1500, to=1990) plot(dens) rug(years1500) I could calculate log(2000-year), but I'm not sure how to do the plotting, do some minor tick marks and label the major ones, say at 100 year intervals. I think you'll have to do everything explicitly. That is, something like this: years1500 - runif(500, 1500, 1990) # some fake data x - log(2000-years1500) from - log(2000-1990) to - log(2000-1500) plot(density(x, from=from, to=to), axes=F) rug(x) labels - pretty(years1500) labels - labels[labels2000] axis(1, labels, at=log(2000-labels)) minorticks - pretty(years1500, n=20) minorticks - minorticks[minorticks2000] axis(1, labels=FALSE, at=log(2000-minorticks), tcl=-0.25) axis(2) box() __ 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
Re: [R] Lack of independence in anova()
On Thu, Jul 07, 2005 at 11:18:09AM +0100, Ted Harding wrote: My first reaction to Duncan's example was Touché -- with apologies to Göran for suspecting on over-trivial example! No need to apologize; that was of course my first reaction to Thomas' statement. I had not thought long enough about possible cases. Duncan is right; and maybe it is the same example as Göran was thinking of. On second thought it was not difficult to find: (X, Y) bivariate standard normal, P(Z = 1) = P(Z = -1) = 1/2. [...] However, interesting though it maybe, this is a side-issue to the original question concerning independence of the F-ratios in an ANOVA. Here, numerators and denominator are all positive, so examples like the above are not relevant. The original argument (that increasing Z diminishes both X/Z and Y/Z simultaneously) applies; but it is also possible to demonstrate analytically that P(X/Z = v and Y/Z = w) is greater than P(X/Z = v)*P(Y/Z = w). Maybe it is simplest to calculate Cov(X/Z, Y/Z), which turns out to be equal to E(X)E(Y)V(1/Z) (given total independence). So, a necessary condition for independence is that at least one of these three terms is zero. Which is impossible in the F-ratios case. Göran __ 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
[R] What method I should to use for these data?
-Original Message- From: luan_sheng [mailto:[EMAIL PROTECTED] Sent: Thursday, July 07, 2005 9:46 PM To: (r-help@stat.math.ethz.ch) Cc: ([EMAIL PROTECTED]) Subject: What method I should to use for these data? Dear R user: I am studying the allele data of two populations. the following is the data: a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 pop10.0217 0. 0.0109 0.0435 0.0435 0. 0.0109 0.0543 0.1739 0.0761 0.1413 0.1522 0.1087 0.0870 0.0435 0.0217 0.0109 pop20.0213 0.0213 0. 0. 0. 0.0426 0.1702 0.2128 0.1596 0.1809 0.0957 0.0745 0.0106 0.0106 0. 0. 0. a1,a2,a3 .. a17 is the frequency of 17 alleles , the sum is 1. I want to test the significance of the distribution of 17 alleles between two populations. How can I do? I want to use chisquare, is is right for these data ? can anyone help me ? Thanks!! luan Yellow Sea Fisheries Research Institute , Chinese Academy of Fishery Sciences , Qingdao , 266071 __ ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä __ 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
Re: [R] About ade4 and overlaying points
Jacques VESLOT a écrit : Dear R-users, Is there an easy way to avoid points one upon another when ploting rows and columns of 'dudi' objects ? Maybe there is a function in ade4 or in an other package, or maybe someone has his or her own function to do this (for example to automatically modify a little the coordinates of these points to get a readable plot ?). Thanks in advance. Best regards, Jacques VESLOT __ 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 Hello Jacques, Have a look at ?jitter Best, Renaud -- Dr Renaud Lancelot, vétérinaire Projet FSP régional épidémiologie vétérinaire C/0 Ambassade de France - SCAC BP 834 Antananarivo 101 - Madagascar e-mail: [EMAIL PROTECTED] tel.: +261 32 40 165 53 (cell) +261 20 22 665 36 ext. 225 (work) +261 20 22 494 37 (home) __ 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
[R] function par(mfrow....)
Hi, I have made 3 barplots differents in the some window plot with the function par(mfrow), but is it possible to give different dimension to this 3 parts. for example, I want the first part smaller than the others. I have attached my plot! thanks Sabine - __ 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
Re: [R] timezone problems
?POSIXt says: 'POSIXlt' objects will often have an attribute 'tzone', a character vector of length 3 giving the timezone name from the 'TZ' environment variable and the names of the base timezone and the alternate (daylight-saving) timezone. Sometimes this may just be of length one, giving the timezone name. Therefore, any function that relies on either (1) the presence of a tzone attribute, or (2) when it is present, it necessarily has a length 3 is relying on something that is documented not to be reliable. Sys.timezone(), as defined on Martin's system (see his email below) does both of these, so that would appear to be the problem. It is not hard to verify that the tzone attribute is not always present, and when present, may be of length one or three. Sys.putenv(TZ='US/Pacific') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] US/Pacific PSTPDT Sys.putenv(TZ='GMT') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] GMT Sys.putenv(TZ='US/Eastern') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] US/Eastern ESTEDT z - as.POSIXlt(c('2005-1-1','2005-6-1')) names(attributes(z)) [1] names class -Don At 11:57 AM +0200 7/7/05, Uwe Ligges wrote: Martin Keller-Ressel wrote: Thank you Don for your hints. I have checked my environment vairable TZ again. But everything is set correctly. I think the problem is with Sys.timezone(). Maybe it is a conflict between how my system formats the time/date and what Sys.timezone() expects. This is what I get on my system: Sys.getenv(TZ) TZ GMT Sys.time() [1] 2005-07-07 07:32:39 GMT ## everything fine so far Sys.timezone() [1] NA ## This is what Sys.timezone looks like: Sys.timezone function () { z - as.POSIXlt(Sys.time()) attr(z, tzone)[2 + z$isdst] } environment: namespace:base z - as.POSIXlt(Sys.time()) attributes(z) $names [1] sec min hour mday mon year wday yday isdst $class [1] POSIXt POSIXlt $tzone [1] GMT attr(z,tzone) [1] GMT z$isdst [1] 0 attr(z,tzone)[2] [1] NA I dont understand why Sys.timezone doesn't use attr(z,tzone) but tries to read its (2+z$isdst)-th element. Of course it would be easy to write a workaround, but I wonder why nobody else is having this problem. I can confirm for R-2.1.1 under Windows NT 4.0 and it looks like a bug (somewhere down the way from as.POSIXlt). Don't have the time to look at it more closely, perhaps Brian knows it at once? If this is not already in the bug repository (please check at first), can you submit a report, please? Thanks! Uwe Ligges best regards, Martin Keller-Ressel On Wed, 06 Jul 2005 14:45:25 -, Don MacQueen [EMAIL PROTECTED] wrote: How did you set the TZ system variable? If you did not use Sys.putenv(), try using it instead. Otherwise, I think you have to ask the package maintainer. You may be misleading yourself by using Sys.time() to test whether TZ is set. What does Sys.getenv() tell you? I get a timezone code from Sys.time() even when TZ is not defined (see example below). (but I do have a different OS) Sys.timezone() [1] Sys.time() [1] 2005-07-06 07:34:15 PDT Sys.getenv('TZ') TZ Sys.putenv(TZ='US/Pacific') Sys.timezone() [1] US/Pacific Sys.getenv('TZ') TZ US/Pacific Sys.time() [1] 2005-07-06 07:34:38 PDT Sys.putenv(TZ='GMT') Sys.time() [1] 2005-07-06 14:35:45 GMT version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0status major2 minor1.1 year 2005month06 day 20 language R At 9:55 AM + 7/5/05, Martin Keller-Ressel wrote: Hi, Im using R 2.1.1 and running Code that previously worked (on R 2.1.0 I believe) using the 'timeDate' function from the fCalendar package. The code now throws an error: Error in if (Sys.timezone() != GMT) warning(Set timezone to GMT!) However I have read the documentation of the fCalendar package and I have set my system variable TZ to GMT. I tracked the error down to the function Sys.timezone() which returns NA in spite of what Sys.time() returns. Sys.timezone() [1] NA Sys.time() [1] 2005-07-05 08:41:53 GMT My version: version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Any help is appreciated, Martin Keller-Ressel --- Martin Keller-Ressel Research Unit of Financial and Actuarial Mathematics TU Vienna __ R-help@stat.math.ethz.ch mailing list
Re: [R] function par(mfrow....)
Navarre Sabine wrote: Hi, I have made 3 barplots differents in the some window plot with the function par(mfrow), but is it possible to give different dimension to this 3 parts. for example, I want the first part smaller than the others. ... Here is one approach using split.screen() : split.screen(fig = rbind(c(0, 0.25, 0.25, 0.75), c(0.25, 0.625, 0, 1), c(0.625, 1, 0, 1))) screen(1) barplot(runif(5), main=Smaller) screen(2) barplot(runif(8), main=Bigger) screen(3) barplot(runif(8), main=Bigger) close.screen(all=T) -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ 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
[R] Fwd: Plotting confidence intervals for lme
-- Forwarded message -- From: Ghislain Vieilledent [EMAIL PROTECTED] Date: 7 juil. 2005 11:38 Subject: Re: [R] Plotting confidence intervals for lme To: Spencer Graves [EMAIL PROTECTED] That's what I was looking for. Thanks a lot! That's true units are mixing and that values of coef depend on the contrasts but I want to use this graph in order to compare levels' coefficient of each of the factor taken independantly, not to compare factors' coefficients to eachothers. Does it mean something? Thanks again. Ghislain Vieilledent. 2005/7/6, Spencer Graves [EMAIL PROTECTED]: Consider the following extension of an example in ?lme: fm2 - lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) int - intervals(fm2) class(int$fixed) kf - dim(int$fixed)[1] plot(int$fixed[,2], kf:1, xlab=x, ylab=, xlim=range(int$fixed), axes=FALSE) axis(1) axis(2, kf:1, dimnames(int$fixed)[[1]]) segments(int$fixed[,1], kf:1, int$fixed[,3], kf:1) abline(v=0) However, we are mixing units, i.e., the units for the intercept are distance, while for age are distance/time, and the interpretation of the coefficient of a factor like Sex depends on contrasts used. Thus, I don't know how much sense it makes to prepare plots like this. For similar plots that make more sense, see Pinheiro and Bates (2000 Mixed-Effects Models in S and S-PLUS (Springer). spencer graves Ghislain Vieilledent wrote: Hello and sorry to disturb. I'm trying to plot the confidence intervals for the fixed effects of a lme. I want to obtain graphically, if it is possible, a bar with Estimate, upper and lower CI for each level of the factors. I know how to do for a lm model but for a lme one, I tried with plot(intervals(...)) and plot(ci(...)) from the gmodels package but it doesn't work well. Thanks for you help and have a good day. -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 -- Ghislain Vieilledent 30, rue Bernard Ortet 31 500 TOULOUSE 06 24 62 65 07 -- Ghislain Vieilledent 30, rue Bernard Ortet 31 500 TOULOUSE 06 24 62 65 07 [[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
Re: [R] function par(mfrow....)
Hi, Is layout the function you will need? ?layout E.g.: l - matrix(c(rep(1,4), rep(2,8),rep(3,8)), ncol=5) layout(l) layout.show(3) plot(1,1) plot(1:25,pch=1:25) plot(2,5) Best regards, Matthias Hi, I have made 3 barplots differents in the some window plot with the function par(mfrow), but is it possible to give different dimension to this 3 parts. for example, I want the first part smaller than the others. I have attached my plot! thanks Sabine - __ 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
Re: [R] How to get the minimum ?
Dear Philipe You can use optimize (see ?optimize), e.g. : funToMin - function(x, data, a = 1, b = 1) { sum((data[data[,group]==A,y] - x)^2) + sum((data[data[,group]==B,y] - a*x - b)^2) } dat - data.frame(y = rnorm(100), group = rep(c(A,B), each = 50)) (m - optimize(function(x) funToMin(x,dat), interval = c(-10,10))) Please be careful. This function is only for demonstration issue. It is bad programmed. It works if x is only 1 number, but if you call the function, using a vector instead of a single number (and I do not prevent this by checking it), you will get warnings or errors. Therefore it will be better to use your own, hopefully better programmed function in optimize. Regards, Christoph Buser -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Philippe Lamy writes: Hi, I have a model with differents observations Xi. Each observation belongs to a group, either A or B. I would like to minimize a fonction like : sum( Xi - Z)^2 + sum (Xi - aZ -b)^2 AB The first sum contains all observations from group A and the second all observations from group B. I want to find the Z-value wich minimize this function. a and b are predefined parameters. Thanks for help. Philippe __ __ 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
Re: [R] timezone problems
I cannot reproduce Don's results below on my system. However I do not know if timezone names can be expected to be compatible across systems/country settings/etc... I get: Sys.putenv(TZ='US/Pacific') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] \001S/Pacific US/ Pac which looks very ugly. I also tried Sys.putenv(TZ='MESZ') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] \001ESZ MES Z which is also probably not intended. I filed a bug report a few hours ago (#7994) but only pointed out the problems regarding timezone 'GMT' discussed in the last mail, not the 'new' problems associated with setting another timezone. Martin Keller-Ressel On Thu, 07 Jul 2005 14:58:46 -, Don MacQueen [EMAIL PROTECTED] wrote: ?POSIXt says: 'POSIXlt' objects will often have an attribute 'tzone', a character vector of length 3 giving the timezone name from the 'TZ' environment variable and the names of the base timezone and the alternate (daylight-saving) timezone. Sometimes this may just be of length one, giving the timezone name. Therefore, any function that relies on either (1) the presence of a tzone attribute, or (2) when it is present, it necessarily has a length 3 is relying on something that is documented not to be reliable. Sys.timezone(), as defined on Martin's system (see his email below) does both of these, so that would appear to be the problem. It is not hard to verify that the tzone attribute is not always present, and when present, may be of length one or three. Sys.putenv(TZ='US/Pacific') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] US/Pacific PSTPDT Sys.putenv(TZ='GMT') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] GMT Sys.putenv(TZ='US/Eastern') z - as.POSIXlt(Sys.time()) attributes(z)$tzone [1] US/Eastern ESTEDT z - as.POSIXlt(c('2005-1-1','2005-6-1')) names(attributes(z)) [1] names class -Don At 11:57 AM +0200 7/7/05, Uwe Ligges wrote: Martin Keller-Ressel wrote: Thank you Don for your hints. I have checked my environment vairable TZ again. But everything is set correctly. I think the problem is with Sys.timezone(). Maybe it is a conflict between how my system formats the time/date and what Sys.timezone() expects. This is what I get on my system: Sys.getenv(TZ) TZ GMT Sys.time() [1] 2005-07-07 07:32:39 GMT ## everything fine so far Sys.timezone() [1] NA ## This is what Sys.timezone looks like: Sys.timezone function () { z - as.POSIXlt(Sys.time()) attr(z, tzone)[2 + z$isdst] } environment: namespace:base z - as.POSIXlt(Sys.time()) attributes(z) $names [1] sec min hour mday mon year wday yday isdst $class [1] POSIXt POSIXlt $tzone [1] GMT attr(z,tzone) [1] GMT z$isdst [1] 0 attr(z,tzone)[2] [1] NA I dont understand why Sys.timezone doesn't use attr(z,tzone) but tries to read its (2+z$isdst)-th element. Of course it would be easy to write a workaround, but I wonder why nobody else is having this problem. I can confirm for R-2.1.1 under Windows NT 4.0 and it looks like a bug (somewhere down the way from as.POSIXlt). Don't have the time to look at it more closely, perhaps Brian knows it at once? If this is not already in the bug repository (please check at first), can you submit a report, please? Thanks! Uwe Ligges best regards, Martin Keller-Ressel On Wed, 06 Jul 2005 14:45:25 -, Don MacQueen [EMAIL PROTECTED] wrote: How did you set the TZ system variable? If you did not use Sys.putenv(), try using it instead. Otherwise, I think you have to ask the package maintainer. You may be misleading yourself by using Sys.time() to test whether TZ is set. What does Sys.getenv() tell you? I get a timezone code from Sys.time() even when TZ is not defined (see example below). (but I do have a different OS) Sys.timezone() [1] Sys.time() [1] 2005-07-06 07:34:15 PDT Sys.getenv('TZ') TZ Sys.putenv(TZ='US/Pacific') Sys.timezone() [1] US/Pacific Sys.getenv('TZ') TZ US/Pacific Sys.time() [1] 2005-07-06 07:34:38 PDT Sys.putenv(TZ='GMT') Sys.time() [1] 2005-07-06 14:35:45 GMT version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0status major2 minor1.1 year 2005month06 day 20 language R At 9:55 AM + 7/5/05, Martin Keller-Ressel wrote: Hi, Im using R 2.1.1 and running Code that previously worked (on R 2.1.0 I believe) using the 'timeDate' function from the fCalendar package. The code now throws an error: Error in if
[R] Plotting Character Variable
Any ideas about the following problem: I have a matrix (A) that looks like this: gene_names values hsa-mir-124 0.3 hsa-mir-234 0.1 hsa-mir-344 0.4 hsa-mir-333 0.7 . ... (This is a 2 by 22283 matrix: quite large) I would like to plot the values, but output the gene_names as the plotting symbol. I have tried regular x,y plots, but since the gene_names are quite large and there are 22283 of them, it's impossible to fit them on the x-axis. Basically, can I plot the above matrix plot(gene_names, value) where the gene_names are used as the plotting symbol. thank you, __ 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
[R] plotcp
win2000/R 2.0.1/rpart-version: 3.1-23 I use the plotcp-function of the rpart-package and it works very well. however, plotcp plots the cv-estimated relative errors only until the minimum of the curve. How can I plot the values after the minimum? Choosing the size-option for generating the tree object does not help because in this case plotcp plots only the resubstitution estimates. Thanks. Pedro __ Nuevos servicios, más seguridad __ 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
Re: [R] Tempfile error
We just explored the issue a little further here and here is what we have found. If we look in the temp directory we noticed that the last temp file name is rf32767. This number coincides with 2^16 with a 16 bit signed integer. Is there a way to modify the temp file settings to use an unsigned or 32 bit integer for temp file names? We changed the location where temp files are stored. We also disabled the realtime virus protection, but do not think this has anything to do with the problem. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold Sent: Thursday, July 07, 2005 10:46 AM To: Uwe Ligges; Sean O'Riordain Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Tempfile error Dear Uwe and Sean: Thank you for your reply. I think I did a poor job framing my problem. Here are a few things I should have added. First, I previously stated that the program would halt in random places. This is *not* true. It always halts at the same row, which happens to be row 1038. There isn't a logical reason for stopping in this row as far as I can tell, all data needed to generate the file are present. I am using R version 2.10 for Windows on an XP machine with 2 gb ram. My tex distribution is MikTex (I'm not sure if that matters). Traceback gives the following information traceback() 9: file() 8: driver$runcode(drobj, chunk, chunkopts) 7: Sweave(fam_template.Rnw, output = tmp2) 6: eval.with.vis(expr, envir, enclos) 5: eval.with.vis(ei, envir) 4: source(run_fam.r) 3: eval.with.vis(expr, envir, enclos) 2: eval.with.vis(ei, envir) 1: source(file.choose()) I did tempfile() to identify the location of the files and have cleaned that out repeatedly. I've searched the archives and have seen some discussion regarding and on.exit() command, but I'm not sure I see how it would be utilized here. Here is the code for the looping file that subsets the dataframe. I wonder if I need to add something here that would close a connection or generate a random tempfile name to avoid this problem in the loop. list - unique(wide$stuid) master = master.tex for (i in list){ tmp1 - subset(wide, stuid==i) tmp2 - paste(i, tex, sep=.) Sweave(fam_template.Rnw, output=tmp2) file.append(fam_master.tex, tmp2) } Thanks for your time on this, Harold -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Thursday, July 07, 2005 4:52 AM To: Doran, Harold Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Tempfile error Doran, Harold wrote: Dear List: I am encountering an error that I can't resolve. I'm looping through rows of a dataframe to generate individual tex files using Sweave. At random points along the way, I encounter the following error Error in file() : cannot find unused tempfile name Which version of R is this? I think during one of the latest releases tempfile() name generation has been imporved, because R did not tried hard enough to find new (random) filenames for tempfiles in older releases of R. Uwe Ligges At which point Sweave halts. There isn't a logical pattern that I can identify in terms of why the program stops at certain points. It just seems to be random as far as I can tell. I've searched the archives and of course Sweave FAQs but haven't found much that sheds light on what this error indicates and what I should do to resolve it. There are approximately 20,000 rows, meaning that about 20,000 tex files are created. If I sample 5,000 or even 10,000 and run the program, I do not encounter an error. It only occurs when I run the program on the full dataframe and even then the error is not occuring at the same point. That is, the row at which the program halts varies each time. Does anyone have any thoughts on this problem? -Harold [[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 __ 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 __ 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
Re: [R] tcltk package [SOLVED]
Kurt == Kurt Sys [EMAIL PROTECTED] on Thu, 07 Jul 2005 15:07:52 +0200 writes: Kurt I had R 2.0.1... It's not included in that distribution of R. That's not correct. The tcltk package has been part of R for a very long time. The question is where you got the version of 'R 2.0.1' from that you mentioned. It must have been built by someone who didn't know how to make tcltk work ((and the R Installation Administration Manual tells you about this)) Kurt It's ok in distribution 2.1.1. i.e., in the one you got. Note that it is really a matter of properly building R ... see above. Martin Kurt thx (to all that've been replying that it's included in the base Kurt distribution), Kurt Kurt. Kurt Liaw, Andy wrote: It's included in the base R distribution, I believe. Andy From: Kurt Sys Hi all, I have a package depending on the tcltk-package. However, I see that this package has been disappeared... Is there a reason why package 'tcltk' is not available anymore? Or is it replaced by another one? thx, Kurt. Kurt __ Kurt R-help@stat.math.ethz.ch mailing list Kurt https://stat.ethz.ch/mailman/listinfo/r-help Kurt PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Kurt !DSPAM:42cd2d5784811931259031! __ 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
Re: [R] Plotting Character Variable
On Thu, 2005-07-07 at 11:47 -0400, [EMAIL PROTECTED] wrote: Any ideas about the following problem: I have a matrix (A) that looks like this: gene_names values hsa-mir-124 0.3 hsa-mir-234 0.1 hsa-mir-344 0.4 hsa-mir-333 0.7 . ... (This is a 2 by 22283 matrix: quite large) To split hairs, it would be a 22283 by 2 object in R's [row, column] approach to indexing. I am also presuming that A is a data frame, since you seem to have two different data types above, with gene_names being a factor? I would like to plot the values, but output the gene_names as the plotting symbol. I have tried regular x,y plots, but since the gene_names are quite large and there are 22283 of them, it's impossible to fit them on the x-axis. Basically, can I plot the above matrix plot(gene_names, value) where the gene_names are used as the plotting symbol. thank you, Well... I would defer to those with more experience in plotting genetic data, but from a practical standpoint, it seems to me to be highly problematic to plot 20,000 data points with labels and have them be human readable without an STMunless you have _very_ wide paper on a large format plotter ;-) That being said, one approach is to rotate the x axis labels vertically, to make more room, while using points for the plotting symbols: # Adjust bottom margin to make room for vertical labels par(mar = c(7, 4, 4, 2)) plot(1:nrow(A), A$values, xaxt = n, ann = FALSE, las = 2) # use 'las = 3' to rotate the labels axis(1, at = 1:nrow(A), labels = as.character(A$gene_names), las = 3) You might want to review some of the tools available at the Bioconductor site to see if there are specialized plotting functions for this type of data: http://www.bioconductor.org/ HTH, Marc Schwartz __ 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
[R] Segmentation fault on exit
q() Segmentation fault I wrote a library and whenever this library is loaded R sigfaults on exit. This is not hurting the running of my application since it happens on exit but does anyone have an idea why might this happen? The library is a collection of R scripts and has no C or FORTRAN code under the src/ directory. __ 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
[R] Failing to install Hmisc on Mac OS 10.3.9, R Version 2.1.0 Patched (2005-05-12)
Kindly cc me when replying to the list. trying URL 'http://www.biometrics.mtu.edu/CRAN/src/contrib/Hmisc_3.0-6.tar.gz' Content type 'application/x-gzip' length 462535 bytes opened URL == downloaded 451Kb * Installing *source* package 'Hmisc' ... ** libs g77 -fno-common -g -O2 -c cidxcn.f -o cidxcn.o g77 -fno-common -g -O2 -c cidxcp.f -o cidxcp.o g77 -fno-common -g -O2 -c hoeffd.f -o hoeffd.o g77 -fno-common -g -O2 -c jacklins.f -o jacklins.o g77 -fno-common -g -O2 -c largrec.f -o largrec.o gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include -fno-common -g -O2 -c ranksort.c -o ranksort.o g77 -fno-common -g -O2 -c rcorr.f -o rcorr.o g77 -fno-common -g -O2 -c wclosest.f -o wclosest.o gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/local/lib -o Hmisc.so cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o ranksort.o rcorr.o wclosest.o -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c -lSystem -lcc_dynamic -framework R ** R ** preparing package for lazy loading Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/Library/Frameworks/R.framework/Resources/library/grDevices/libs/ grDevices.so': dlcompat: dyld: /Library/Frameworks/R.framework/Resources/bin/exec/R version mismatch for library: /usr/local/lib/libxml2.2.dylib (compatibility version of user: 9.0.0 greater than library's version: 8.0.0) Loading required package: grDevices Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/Library/Frameworks/R.framework/Resources/library/grDevices/libs/ grDevices.so': dlcompat: dyld: /Library/Frameworks/R.framework/Resources/bin/exec/R version mismatch for library: /usr/local/lib/libxml2.2.dylib (compatibility version of user: 9.0.0 greater than library's version: 8.0.0) In addition: Warning message: package grDevices in options(defaultPackages) was not found ** Removing '/Library/Frameworks/R.framework/Versions/2.1.0/Resources/library/ Hmisc' ** Restoring previous '/Library/Frameworks/R.framework/Versions/2.1.0/Resources/library/ Hmisc' Error: package 'grDevices' could not be loaded Execution halted ERROR: lazy loading failed for package 'Hmisc' When I try install.packages(grDevices) Warning message: no package 'grDevices' at the repositories in: download.packages(pkgs, destdir = tmpd, available = available, _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ 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
[R] xmat[1, 2:3] - NULL
I have a situation where I'm filling out a dataframe from a database. Sometimes the database query doesn't get anything, so I end up trying to place NULL in the dataframe like below. temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat[1, 2:3] - temp Error in if (m n * p (n * p)%%m) stop(gettextf(replacement has %d items, need %d, : missing value where TRUE/FALSE needed I can't get the programme to accept that sometimes what the query looks for just doesn't exist, and I just want to move on to the next calculation leaving the dataframe with a missing value in the given cell. It's a real show stopper and I haven't found a way round it. Best wishes, Mikkel PS. I'm using dbGetQuery to query an SQLite database. __ 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
Re: [R] xmat[1, 2:3] - NULL
On Thu, 2005-07-07 at 10:20 -0700, Mikkel Grum wrote: I have a situation where I'm filling out a dataframe from a database. Sometimes the database query doesn't get anything, so I end up trying to place NULL in the dataframe like below. temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat[1, 2:3] - temp Error in if (m n * p (n * p)%%m) stop(gettextf(replacement has %d items, need %d, : missing value where TRUE/FALSE needed I can't get the programme to accept that sometimes what the query looks for just doesn't exist, and I just want to move on to the next calculation leaving the dataframe with a missing value in the given cell. It's a real show stopper and I haven't found a way round it. Best wishes, Mikkel PS. I'm using dbGetQuery to query an SQLite database. NULL represents a zero length object in R. Thus, trying to set only the first row in a data frame to NULL makes no sense, since you cannot have a 0 length object that also has a single row (as you seem to be trying to do above). Since a data frame is a series of lists, you could do the following: temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat V1 V2 V3 1 NA NA NA 2 NA NA NA xmat[, 1] - temp xmat V2 V3 1 NA NA 2 NA NA which removes the first column in the data frame. This is the same as: xmat[, -1] V2 V3 1 NA NA 2 NA NA You could also set the entire xmat to NULL as follows: xmat V1 V2 V3 1 NA NA NA 2 NA NA NA xmat - NULL xmat NULL You can then test to see if 'xmat' is a NULL: is.null(xmat) [1] TRUE and base a boolean expression and resultant action on that result: if (!is.null(xmat)) { do_calculations... } If your calculations are on a row by row basis, where NA's represent missing data, you can also use one of several functions to eliminate those rows. See ?na.action, ?na.omit and ?complete.cases for more information and examples. HTH, Marc Schwartz __ 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
Re: [R] Segmentation fault on exit
Omar Lakkis wrote: q() Segmentation fault I wrote a library and whenever this library is loaded R sigfaults on exit. This is not hurting the running of my application since it happens on exit but does anyone have an idea why might this happen? The library is a collection of R scripts and has no C or FORTRAN code under the src/ directory. You are talking about a *package*, not a library. We do not know, and cannot reproduce anything, obviously... The posting guide asks you to specify reproducible examples. Which version of R is this, and which OS? Uwe Ligges __ 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 __ 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
Re: [R] xmat[1, 2:3] - NULL
Mikkel Grum wrote: I have a situation where I'm filling out a dataframe from a database. Sometimes the database query doesn't get anything, so I end up trying to place NULL in the dataframe like below. temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat[1, 2:3] - temp Error in if (m n * p (n * p)%%m) stop(gettextf(replacement has %d items, need %d, : missing value where TRUE/FALSE needed I can't get the programme to accept that sometimes what the query looks for just doesn't exist, and I just want to move on to the next calculation leaving the dataframe with a missing value in the given cell. It's a real show stopper and I haven't found a way round it. See ?try Uwe Ligges Best wishes, Mikkel PS. I'm using dbGetQuery to query an SQLite database. __ 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 __ 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
Re: [R] xmat[1, 2:3] - NULL
Maybe I have it wrong, but I think you merely want: temp - NA Patrick Burns Burns Statistics [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Mikkel Grum wrote: I have a situation where I'm filling out a dataframe from a database. Sometimes the database query doesn't get anything, so I end up trying to place NULL in the dataframe like below. temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat[1, 2:3] - temp Error in if (m n * p (n * p)%%m) stop(gettextf(replacement has %d items, need %d, : missing value where TRUE/FALSE needed I can't get the programme to accept that sometimes what the query looks for just doesn't exist, and I just want to move on to the next calculation leaving the dataframe with a missing value in the given cell. It's a real show stopper and I haven't found a way round it. Best wishes, Mikkel PS. I'm using dbGetQuery to query an SQLite database. __ 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 __ 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
Re: [R] plotting on a reverse log scale
Thanks to all who replied, particularly Duncan Murdoch, whose solution I adopted. It thought it might be of interest to some to see the results and compare these ways of representing the distribution of historical events over time. The events are the items I record on my site, Milestones in the History of Data Visualization, http://www.math.yorku.ca/SCS/Gallery/milestones Here is the subset of events post 1500: subset- c(1530, 1533, 1545, 1550, 1556, 1562, 1569, 1570, 1572, 1581, 1605, 1603, 1603, 1614, 1617, 1624, 1623, 1626, 1632, 1637, 1644, 1646, 1654, 1654, 1657, 1663, 1662, 1666, 1669, 1671, 1686, 1686, 1687, 1693, 1693, 1701, 1710, 1711, 1712, 1724, 1727, 1745, 1741, 1748, 1752, 1752, 1752, 1753, 1765, 1760, 1763, 1765, 1765, 1781, 1776, 1778, 1779, 1782, 1782, 1782, 1785, 1786, 1787, 1794, 1795, 1796, 1798, 1798, 1800, 1800, 1801, 1801, 1809, 1811, 1817, 1819, 1825, 1821, 1822, 1825, 1827, 1828, 1832, 1830, 1832, 1833, 1833, 1833, 1833, 1836, 1836, 1837, 1838, 1839, 1839, 1843, 1843, 1843, 1844, 1846, 1846, 1851, 1852, 1853, 1855, 1857, 1857, 1857, 1861, 1861, 1863, 1868, 1869, 1869, 1869, 1872, 1872, 1872, 1872, 1873, 1874, 1874, 1874, 1874, 1875, 1875, 1877, 1877, 1877, 1878, 1878, 1879, 1879, 1889, 1880, 1882, 1882, 1883, 1884, 1884, 1884, 1884, 1884, 1885, 1885, 1885, 1888, 1892, 1895, 1896, 1899, 1901, 1904, 1905, 1910, 1910, 1911, 1912, 1913, 1913, 1913, 1913, 1914, 1914, 1915, 1920, 1916, 1917, 1925, 1919, 1920, 1923, 1923, 1924, 1925, 1926, 1929, 1928, 1928, 1929, 1930, 1931, 1933, 1942, 1937, 1939, 1944, 1944, 1957, 1957, 1958, 1962, 1965, 1966, 1965, 1967, 1968, 1969, 1969, 1969, 1971, 1971, 1972, 1973, 1973, 1974, 1974, 1974, 1974, 1975, 1975, 1975, 1975, 1975, 1976, 1977, 1977, 1978, 1978, 1979, 1981, 1981, 1981, 1982, 1982, 1983, 1983, 1985, 1985, 1987, 1988, 1988, 1989, 1989, 1990, 1990, 1990, 1990, 1990, 1991, 1991, 1993, 1992, 1994, 1996, 1999) The standard density plot, labeled according to periods of time shows quite interpretable trends, # standard plot plot(density(subset, from=1500, to=1990, bw=sj), main=Milestones: Time course of development, xlab=Year) ref -c(1600, 1700, 1800, 1850, 1900, 1950, 1975) abline(v= ref, lty=3, col=blue) labx-c(1550, 1650, 1750, 1825, 1875, 1925, 1962, 1987) laby- 0.003 + 0.0003 * c(0, 1, 2, 3, 5, 3, 5, 2) txt1 -c(Early maps, Measurement\n theory, New graphic\nforms, Modern\nage, Golden Age, Modern dark\nages, Re-birth, Hi-D Vis) text(labx, laby, labels=txt1, cex=1.25, xpd=TRUE) rug(subset, quiet=TRUE) The idea of a reverse log scale for representing events in time was suggested by \whom{Heinz}{Von Foerster} in 1930, and this (below) produces the corresponding plot; you might imagine this as a view of the density of events standing at the year 2000, and looking back at time through a log-scaled telescope. I wanted to see what this looked like, but I'm not sure it is of particularly greater use here, except to suggest alternative ways to represent historical time. Any comments? # reverse log plot rlogyear - -log(2000-subset) #from - -log(2000-1990) #to - -log(2000-start) # need to swap, so from to for density to - -log(2000-1990) from - -log(2000-start) plot(density(rlogyear, from=from, to=to, bw=sj), axes=F, main=Milestones: Time course of development, xlab=Year (reverse log scale)) rug(rlogyear, quiet=TRUE) labels - pretty(subset) labels - c(labels[labels2000], 1950, 1975, 1990) axis(1, labels, at=-log(2000-labels)) minorticks - pretty(subset, n=30) minorticks - minorticks[minorticks2000] axis(1, labels=FALSE, at=-log(2000-minorticks), tcl=-0.25) axis(2) ref -c(1600, 1700, 1800, 1850, 1900, 1950, 1975) abline(v= -log(2000-ref), lty=3, col=blue) labx-c(1550, 1650, 1750, 1825, 1875, 1925, 1962, 1987) laby- 0.35 + 0.03 * c(-1, .5, 2.2, 4, 1.6, .3, -1, -2) text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE) box() Final question: How can I reduce the interline space in multiline strings? From ?par, I tried lheight: text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE, lheight=.8) NULL Warning message: parameter lheight couldn't be set in high-level plot() function -- Michael Friendly Email: [EMAIL PROTECTED] Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA __ 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
Re: [R] plotting on a reverse log scale
Michael Friendly wrote: Thanks to all who replied, particularly Duncan Murdoch, whose solution I adopted. It thought it might be of interest to some to see the results and compare these ways of representing the distribution of historical events over time. The events are the items I record on my site, Milestones in the History of Data Visualization, http://www.math.yorku.ca/SCS/Gallery/milestones Here is the subset of events post 1500: subset- c(1530, 1533, 1545, 1550, 1556, 1562, 1569, 1570, 1572, 1581, 1605, 1603, 1603, 1614, 1617, 1624, 1623, 1626, 1632, 1637, 1644, 1646, 1654, 1654, 1657, 1663, 1662, 1666, 1669, 1671, 1686, 1686, 1687, 1693, 1693, 1701, 1710, 1711, 1712, 1724, 1727, 1745, 1741, 1748, 1752, 1752, 1752, 1753, 1765, 1760, 1763, 1765, 1765, 1781, 1776, 1778, 1779, 1782, 1782, 1782, 1785, 1786, 1787, 1794, 1795, 1796, 1798, 1798, 1800, 1800, 1801, 1801, 1809, 1811, 1817, 1819, 1825, 1821, 1822, 1825, 1827, 1828, 1832, 1830, 1832, 1833, 1833, 1833, 1833, 1836, 1836, 1837, 1838, 1839, 1839, 1843, 1843, 1843, 1844, 1846, 1846, 1851, 1852, 1853, 1855, 1857, 1857, 1857, 1861, 1861, 1863, 1868, 1869, 1869, 1869, 1872, 1872, 1872, 1872, 1873, 1874, 1874, 1874, 1874, 1875, 1875, 1877, 1877, 1877, 1878, 1878, 1879, 1879, 1889, 1880, 1882, 1882, 1883, 1884, 1884, 1884, 1884, 1884, 1885, 1885, 1885, 1888, 1892, 1895, 1896, 1899, 1901, 1904, 1905, 1910, 1910, 1911, 1912, 1913, 1913, 1913, 1913, 1914, 1914, 1915, 1920, 1916, 1917, 1925, 1919, 1920, 1923, 1923, 1924, 1925, 1926, 1929, 1928, 1928, 1929, 1930, 1931, 1933, 1942, 1937, 1939, 1944, 1944, 1957, 1957, 1958, 1962, 1965, 1966, 1965, 1967, 1968, 1969, 1969, 1969, 1971, 1971, 1972, 1973, 1973, 1974, 1974, 1974, 1974, 1975, 1975, 1975, 1975, 1975, 1976, 1977, 1977, 1978, 1978, 1979, 1981, 1981, 1981, 1982, 1982, 1983, 1983, 1985, 1985, 1987, 1988, 1988, 1989, 1989, 1990, 1990, 1990, 1990, 1990, 1991, 1991, 1993, 1992, 1994, 1996, 1999) The standard density plot, labeled according to periods of time shows quite interpretable trends, # standard plot plot(density(subset, from=1500, to=1990, bw=sj), main=Milestones: Time course of development, xlab=Year) ref -c(1600, 1700, 1800, 1850, 1900, 1950, 1975) abline(v= ref, lty=3, col=blue) labx-c(1550, 1650, 1750, 1825, 1875, 1925, 1962, 1987) laby- 0.003 + 0.0003 * c(0, 1, 2, 3, 5, 3, 5, 2) txt1 -c(Early maps, Measurement\n theory, New graphic\nforms, Modern\nage, Golden Age, Modern dark\nages, Re-birth, Hi-D Vis) text(labx, laby, labels=txt1, cex=1.25, xpd=TRUE) rug(subset, quiet=TRUE) The idea of a reverse log scale for representing events in time was suggested by \whom{Heinz}{Von Foerster} in 1930, and this (below) produces the corresponding plot; you might imagine this as a view of the density of events standing at the year 2000, and looking back at time through a log-scaled telescope. I wanted to see what this looked like, but I'm not sure it is of particularly greater use here, except to suggest alternative ways to represent historical time. Any comments? # reverse log plot rlogyear - -log(2000-subset) #from - -log(2000-1990) #to - -log(2000-start) # need to swap, so from to for density to - -log(2000-1990) from - -log(2000-start) plot(density(rlogyear, from=from, to=to, bw=sj), axes=F, main=Milestones: Time course of development, xlab=Year (reverse log scale)) rug(rlogyear, quiet=TRUE) labels - pretty(subset) labels - c(labels[labels2000], 1950, 1975, 1990) axis(1, labels, at=-log(2000-labels)) minorticks - pretty(subset, n=30) minorticks - minorticks[minorticks2000] axis(1, labels=FALSE, at=-log(2000-minorticks), tcl=-0.25) axis(2) ref -c(1600, 1700, 1800, 1850, 1900, 1950, 1975) abline(v= -log(2000-ref), lty=3, col=blue) labx-c(1550, 1650, 1750, 1825, 1875, 1925, 1962, 1987) laby- 0.35 + 0.03 * c(-1, .5, 2.2, 4, 1.6, .3, -1, -2) text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE) box() Final question: How can I reduce the interline space in multiline strings? From ?par, I tried lheight: text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE, lheight=.8) NULL Warning message: parameter lheight couldn't be set in high-level plot() function __ 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
Re: [R] plotting on a reverse log scale
Michael Friendly wrote: Thanks to all who replied, particularly Duncan Murdoch, whose solution I adopted. It thought it might be of interest to some to see the results and compare these ways of representing the distribution of historical events over time. The events are the items I record on my site, Milestones in the History of Data Visualization, http://www.math.yorku.ca/SCS/Gallery/milestones Here is the subset of events post 1500: subset- c(1530, 1533, 1545, 1550, 1556, 1562, 1569, 1570, 1572, 1581, 1605, 1603, 1603, 1614, 1617, 1624, 1623, 1626, 1632, 1637, 1644, 1646, 1654, 1654, 1657, 1663, 1662, 1666, 1669, 1671, 1686, 1686, 1687, 1693, 1693, 1701, 1710, 1711, 1712, 1724, 1727, 1745, 1741, 1748, 1752, 1752, 1752, 1753, 1765, 1760, 1763, 1765, 1765, 1781, 1776, 1778, 1779, 1782, 1782, 1782, 1785, 1786, 1787, 1794, 1795, 1796, 1798, 1798, 1800, 1800, 1801, 1801, 1809, 1811, 1817, 1819, 1825, 1821, 1822, 1825, 1827, 1828, 1832, 1830, 1832, 1833, 1833, 1833, 1833, 1836, 1836, 1837, 1838, 1839, 1839, 1843, 1843, 1843, 1844, 1846, 1846, 1851, 1852, 1853, 1855, 1857, 1857, 1857, 1861, 1861, 1863, 1868, 1869, 1869, 1869, 1872, 1872, 1872, 1872, 1873, 1874, 1874, 1874, 1874, 1875, 1875, 1877, 1877, 1877, 1878, 1878, 1879, 1879, 1889, 1880, 1882, 1882, 1883, 1884, 1884, 1884, 1884, 1884, 1885, 1885, 1885, 1888, 1892, 1895, 1896, 1899, 1901, 1904, 1905, 1910, 1910, 1911, 1912, 1913, 1913, 1913, 1913, 1914, 1914, 1915, 1920, 1916, 1917, 1925, 1919, 1920, 1923, 1923, 1924, 1925, 1926, 1929, 1928, 1928, 1929, 1930, 1931, 1933, 1942, 1937, 1939, 1944, 1944, 1957, 1957, 1958, 1962, 1965, 1966, 1965, 1967, 1968, 1969, 1969, 1969, 1971, 1971, 1972, 1973, 1973, 1974, 1974, 1974, 1974, 1975, 1975, 1975, 1975, 1975, 1976, 1977, 1977, 1978, 1978, 1979, 1981, 1981, 1981, 1982, 1982, 1983, 1983, 1985, 1985, 1987, 1988, 1988, 1989, 1989, 1990, 1990, 1990, 1990, 1990, 1991, 1991, 1993, 1992, 1994, 1996, 1999) The standard density plot, labeled according to periods of time shows quite interpretable trends, # standard plot plot(density(subset, from=1500, to=1990, bw=sj), main=Milestones: Time course of development, xlab=Year) ref -c(1600, 1700, 1800, 1850, 1900, 1950, 1975) abline(v= ref, lty=3, col=blue) labx-c(1550, 1650, 1750, 1825, 1875, 1925, 1962, 1987) laby- 0.003 + 0.0003 * c(0, 1, 2, 3, 5, 3, 5, 2) txt1 -c(Early maps, Measurement\n theory, New graphic\nforms, Modern\nage, Golden Age, Modern dark\nages, Re-birth, Hi-D Vis) text(labx, laby, labels=txt1, cex=1.25, xpd=TRUE) rug(subset, quiet=TRUE) The idea of a reverse log scale for representing events in time was suggested by \whom{Heinz}{Von Foerster} in 1930, and this (below) produces the corresponding plot; you might imagine this as a view of the density of events standing at the year 2000, and looking back at time through a log-scaled telescope. I wanted to see what this looked like, but I'm not sure it is of particularly greater use here, except to suggest alternative ways to represent historical time. Any comments? # reverse log plot rlogyear - -log(2000-subset) #from - -log(2000-1990) #to - -log(2000-start) # need to swap, so from to for density to - -log(2000-1990) from - -log(2000-start) plot(density(rlogyear, from=from, to=to, bw=sj), axes=F, main=Milestones: Time course of development, xlab=Year (reverse log scale)) rug(rlogyear, quiet=TRUE) labels - pretty(subset) labels - c(labels[labels2000], 1950, 1975, 1990) axis(1, labels, at=-log(2000-labels)) minorticks - pretty(subset, n=30) minorticks - minorticks[minorticks2000] axis(1, labels=FALSE, at=-log(2000-minorticks), tcl=-0.25) axis(2) ref -c(1600, 1700, 1800, 1850, 1900, 1950, 1975) abline(v= -log(2000-ref), lty=3, col=blue) labx-c(1550, 1650, 1750, 1825, 1875, 1925, 1962, 1987) laby- 0.35 + 0.03 * c(-1, .5, 2.2, 4, 1.6, .3, -1, -2) text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE) box() Final question: How can I reduce the interline space in multiline strings? From ?par, I tried lheight: text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE, lheight=.8) NULL Warning message: parameter lheight couldn't be set in high-level plot() function (sorry, it send on the wrong reply) Try: olpar - par(lheight = 0.8, no.readonly = TRUE) text(-log(2000-labx), laby, labels=txt1, cex=1.2, xpd=TRUE) par(olpar) HTH, --sundar __ 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
Re: [R] What method I should to use for these data?
I'm sorry, but I do not understand your question well enough to comment. Are you familiar with www.bioconductor.org? They have their own list serve and might be better equipped to help you. Beyond this, I suggest you read the posting guide, http://www.R-project.org/posting-guide.html;. Many people have found answers in the course of following that procedure. Moreover, following that procedure should increase the chances that you will receive a useful reply. Good Luck! spencer graves luan_sheng wrote: -Original Message- From: luan_sheng [mailto:[EMAIL PROTECTED] Sent: Thursday, July 07, 2005 9:46 PM To: (r-help@stat.math.ethz.ch) Cc: ([EMAIL PROTECTED]) Subject: What method I should to use for these data? Dear R user: I am studying the allele data of two populations. the following is the data: a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 pop1 0.0217 0. 0.0109 0.0435 0.0435 0. 0.0109 0.0543 0.17390.0761 0.1413 0.1522 0.1087 0.0870 0.0435 0.0217 0.0109 pop2 0.0213 0.0213 0. 0. 0. 0.0426 0.1702 0.2128 0.15960.1809 0.0957 0.0745 0.0106 0.0106 0. 0. 0. a1,a2,a3 .. a17 is the frequency of 17 alleles , the sum is 1. I want to test the significance of the distribution of 17 alleles between two populations. How can I do? I want to use chisquare, is is right for these data ? can anyone help me ? Thanks!! luan Yellow Sea Fisheries Research Institute , Chinese Academy of Fishery Sciences , Qingdao , 266071 __ ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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
[R] randomForest
Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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 __ 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 -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ 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
[R] look for help on nlm in R
Hi, I had a hard time in learning nlm in R and appreciate any help. I encounted the following error message from time to time when I tried different starting parameter values (three parameter values in this case) in nlm(f=SS.fun,p=c(0.1/40,0.1,2),hessian = FALSE,N.measure=object,h=20) Error in f(x, ...) : only 0's may mix with negative subscripts Basically I know the three parameter values should all be positive numbers. So, how to select appropriate starting parameter values to prevent this kind of error message? Thanks much Sincerely, Maggie Zhu This communication is for use by the intended recipient and ...{{dropped}} __ 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
[R] Orthogonal Distance Regressions
Hi, I work with environmental data and want to determine correlations between variables that either have no dependent/independent relationship or the relationship is unknown. Therefore I prefer to use orthogonal distance regression (orthogonal linear regression, perpendicular sum of squares, etc.). I am trying to get set up to do this in R, but the various terminologies are making it challenging for me to determine whether this capability exists in the base packages (it doesn't look like it to me) or which other package I should download to do this. Searching the R website for any of the three terminologies above has not given me any obvious solutions. I would appreciate any assistance from folks with experience doing this type of regression. Thanks in advance! Peter Peter J. Hernes, Ph.D. Land, Air and Water Resources - Hydrology University of California One Shields Avenue Davis, CA 95616-8628 Tel: 530-752-7827 Fax: 530-752-5262 E-mail: [EMAIL PROTECTED] Faculty webpage: http://lawr.ucdavis.edu/faculty/hernes/ __ 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
Re: [R] randomForest
On 7/7/2005 3:38 PM, Weiwei Shi wrote: Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? The sum() function knows what to do on a vector, but not on a list. You can turn your sample.size variable into a vector using unlist(sample.size) Duncan Murdoch btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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 __ 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 __ 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
Re: [R] randomForest
it works. thanks, but: (just curious) why i tried previously and i got is.vector(sample.size) [1] TRUE i also tried as.vector(sample.size) and assigned it to sampsz,it still does not work. On 7/7/05, Duncan Murdoch [EMAIL PROTECTED] wrote: On 7/7/2005 3:38 PM, Weiwei Shi wrote: Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? The sum() function knows what to do on a vector, but not on a list. You can turn your sample.size variable into a vector using unlist(sample.size) Duncan Murdoch btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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 __ 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 -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ 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
[R] manupulating a data frame column
Could someone tell me how to fix the following error? It looks like that the reason is that df$x is of the class factor. Thanks! x1-LETTERS[1:8]; x2-letters[1:8]; x1[2]-NA; x1[4]-NA; df-data.frame(x1=x1, x2=x2) idx-which(is.na(df$x1)) df[idx,1]-df[idx,2] Warning message: invalid factor level, NAs generated in: [-.factor(`*tmp*`, iseq, value = c(2, 4)) __ 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
Re: [R] randomForest
From: Weiwei Shi it works. thanks, but: (just curious) why i tried previously and i got is.vector(sample.size) [1] TRUE Because a list is also a vector: a - c(list(1), list(2)) a [[1]] [1] 1 [[2]] [1] 2 is.vector(a) [1] TRUE is.numeric(a) [1] FALSE Actually, the way I initialize a list of known length is by something like: myList - vector(mode=list, length=veryLong) Andy i also tried as.vector(sample.size) and assigned it to sampsz,it still does not work. On 7/7/05, Duncan Murdoch [EMAIL PROTECTED] wrote: On 7/7/2005 3:38 PM, Weiwei Shi wrote: Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? The sum() function knows what to do on a vector, but not on a list. You can turn your sample.size variable into a vector using unlist(sample.size) Duncan Murdoch btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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 __ 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 -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ 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 __ 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
Re: [R] randomForest
On 7/7/2005 3:47 PM, Weiwei Shi wrote: it works. thanks, but: (just curious) why i tried previously and i got is.vector(sample.size) [1] TRUE i also tried as.vector(sample.size) and assigned it to sampsz,it still does not work. Sorry, I used vector incorrectly. Lists are vectors. What sum needs is a numeric or complex vector, and lists are vectors of objects, not vectors of numbers. You should use is.numeric(sample.size) to test whether you can sum sample.size. Duncan Murdoch On 7/7/05, Duncan Murdoch [EMAIL PROTECTED] wrote: On 7/7/2005 3:38 PM, Weiwei Shi wrote: Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? The sum() function knows what to do on a vector, but not on a list. You can turn your sample.size variable into a vector using unlist(sample.size) Duncan Murdoch btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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 __ 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 __ 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
Re: [R] randomForest
thanks. but can you suggest some ways for the classification problems since for some specific class, there are too few observations. the following is from adding sample.size : najie.rf.2 - randomForest(Diag~., data=one.df[ind==1,4:ncol(one.df)], importance=T, sampsize=unlist(sample.size)) najie.pred.2- predict(najie.rf.2, one.df[ind==2,]) table(observed=one.df[ind==2,Diag], predicted=najie.pred.2) predicted observed 1 2 3 4 5 6 1 6 0 1 0 0 1 2 0 4 0 0 0 0 3 1 0 37 0 0 0 4 0 0 3 5 0 0 5 1 0 3 0 8 0 6 0 0 0 3 0 5 and class number returned from sample.size is like: 28, 8, 82, 28, 18, 22 Should I use gbm to try it since it might focus more on misplaced cases? thanks, weiwei On 7/7/05, Liaw, Andy [EMAIL PROTECTED] wrote: From: Weiwei Shi it works. thanks, but: (just curious) why i tried previously and i got is.vector(sample.size) [1] TRUE Because a list is also a vector: a - c(list(1), list(2)) a [[1]] [1] 1 [[2]] [1] 2 is.vector(a) [1] TRUE is.numeric(a) [1] FALSE Actually, the way I initialize a list of known length is by something like: myList - vector(mode=list, length=veryLong) Andy i also tried as.vector(sample.size) and assigned it to sampsz,it still does not work. On 7/7/05, Duncan Murdoch [EMAIL PROTECTED] wrote: On 7/7/2005 3:38 PM, Weiwei Shi wrote: Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? The sum() function knows what to do on a vector, but not on a list. You can turn your sample.size variable into a vector using unlist(sample.size) Duncan Murdoch btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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 __ 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 -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ 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
[R] Question
Hi I am statistician and now I am starting to work with R. I have a question ,I want to see more than 1 figure in working directory and I can't do this. for example when I run plot(...) ,I see a plot ,if I run another plot(...) the first plot change to second plot and first plot disappear . How can I see more than 1 figure in working directory? __ 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
[R] Main Title for multiple charts
Hi R ! I have the following set up: par(mfrow=c(2,2)) curve(dexp,from=0,to=5) hist(z1,main=Size 5) hist(z2,main=Size 15) hist(z3,main=Size 30) I would like to put a title at the very top of the page that ties the theme of all the charts together. How would this be done, please? Thanks in advance! Laura Holt mailto: [EMAIL PROTECTED] _ Dont just search. Find. Check out the new MSN Search! __ 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
Re: [R] Main Title for multiple charts
Laura Holt wrote: Hi R ! I have the following set up: par(mfrow=c(2,2)) curve(dexp,from=0,to=5) hist(z1,main=Size 5) hist(z2,main=Size 15) hist(z3,main=Size 30) I would like to put a title at the very top of the page that ties the theme of all the charts together. How would this be done, please? How about this: z1 - rexp(100) z2 - rexp(100) z3 - rexp(100) par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) curve(dexp,from=0,to=5) hist(z1,main=Size 5) hist(z2,main=Size 15) hist(z3,main=Size 30) mtext(Densities, outer = TRUE, cex = 2) --sundar __ 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
Re: [R] xmat[1, 2:3] - NULL
Thanks a lot!! This was really a big help. The following solves my problem: xmat - as.data.frame(matrix(NA, 2, 3)) temp - dbGetQuery(...) if (!is.null(temp)) {xmat[i, 2:3] - temp} I'm adding data to only some columns of a larger matrix, on a row-by-row basis. Best wishes, Mikkel --- Marc Schwartz (via MN) [EMAIL PROTECTED] wrote: On Thu, 2005-07-07 at 10:20 -0700, Mikkel Grum wrote: I have a situation where I'm filling out a dataframe from a database. Sometimes the database query doesn't get anything, so I end up trying to place NULL in the dataframe like below. temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat[1, 2:3] - temp Error in if (m n * p (n * p)%%m) stop(gettextf(replacement has %d items, need %d, : missing value where TRUE/FALSE needed I can't get the programme to accept that sometimes what the query looks for just doesn't exist, and I just want to move on to the next calculation leaving the dataframe with a missing value in the given cell. It's a real show stopper and I haven't found a way round it. Best wishes, Mikkel PS. I'm using dbGetQuery to query an SQLite database. NULL represents a zero length object in R. Thus, trying to set only the first row in a data frame to NULL makes no sense, since you cannot have a 0 length object that also has a single row (as you seem to be trying to do above). Since a data frame is a series of lists, you could do the following: temp - NULL xmat - as.data.frame(matrix(NA, 2, 3)) xmat V1 V2 V3 1 NA NA NA 2 NA NA NA xmat[, 1] - temp xmat V2 V3 1 NA NA 2 NA NA which removes the first column in the data frame. This is the same as: xmat[, -1] V2 V3 1 NA NA 2 NA NA You could also set the entire xmat to NULL as follows: xmat V1 V2 V3 1 NA NA NA 2 NA NA NA xmat - NULL xmat NULL You can then test to see if 'xmat' is a NULL: is.null(xmat) [1] TRUE and base a boolean expression and resultant action on that result: if (!is.null(xmat)) { do_calculations... } If your calculations are on a row by row basis, where NA's represent missing data, you can also use one of several functions to eliminate those rows. See ?na.action, ?na.omit and ?complete.cases for more information and examples. HTH, Marc Schwartz __ 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
Re: [R] Orthogonal Distance Regressions
I think you want principal components analysis. Google on this and ?prcomp in R for more details. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter J. Hernes Sent: Thursday, July 07, 2005 12:42 PM To: r-help@stat.math.ethz.ch Subject: [R] Orthogonal Distance Regressions Hi, I work with environmental data and want to determine correlations between variables that either have no dependent/independent relationship or the relationship is unknown. Therefore I prefer to use orthogonal distance regression (orthogonal linear regression, perpendicular sum of squares, etc.). I am trying to get set up to do this in R, but the various terminologies are making it challenging for me to determine whether this capability exists in the base packages (it doesn't look like it to me) or which other package I should download to do this. Searching the R website for any of the three terminologies above has not given me any obvious solutions. I would appreciate any assistance from folks with experience doing this type of regression. Thanks in advance! Peter Peter J. Hernes, Ph.D. Land, Air and Water Resources - Hydrology University of California One Shields Avenue Davis, CA 95616-8628 Tel: 530-752-7827 Fax: 530-752-5262 E-mail: [EMAIL PROTECTED] Faculty webpage: http://lawr.ucdavis.edu/faculty/hernes/ __ 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 __ 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
Re: [R] Main Title for multiple charts
Sundar Dorai-Raj [EMAIL PROTECTED] writes: I would like to put a title at the very top of the page that ties the theme of all the charts together. How would this be done, please? How about this: z1 - rexp(100) z2 - rexp(100) z3 - rexp(100) par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) curve(dexp,from=0,to=5) hist(z1,main=Size 5) hist(z2,main=Size 15) hist(z3,main=Size 30) mtext(Densities, outer = TRUE, cex = 2) or even title(Densities, outer = TRUE, cex.main=2) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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
Re: [R] Question
mjs sad wrote: Hi I am statistician and now I am starting to work with R. I have a question ,I want to see more than 1 figure in working directory and I can't do this. for example when I run plot(...) ,I see a plot ,if I run another plot(...) the first plot change to second plot and first plot disappear . How can I see more than 1 figure in working directory? YOur question is rather unclear and I don't see the relationship between multiple figures and the working directory, but I guess you are going to start more than one device at once, such as: x11() plot(1:10) x11() plot(1:55) or maybe you are looking for argumet mfrow in ?par Please read the posting guide. Uwe Ligges __ 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 __ 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
Re: [R] randomForest
With small sample sizes the variability for estimate of test set error will be large. Instead of splitting the data once, you should consider cross-validation or bootstrap for estimating performance. AFAIK gbm as is won't handle more than two classes. You will need to do quite a bit of work to get it to do what MART does. Andy From: Weiwei Shi thanks. but can you suggest some ways for the classification problems since for some specific class, there are too few observations. the following is from adding sample.size : najie.rf.2 - randomForest(Diag~., data=one.df[ind==1,4:ncol(one.df)], importance=T, sampsize=unlist(sample.size)) najie.pred.2- predict(najie.rf.2, one.df[ind==2,]) table(observed=one.df[ind==2,Diag], predicted=najie.pred.2) predicted observed 1 2 3 4 5 6 1 6 0 1 0 0 1 2 0 4 0 0 0 0 3 1 0 37 0 0 0 4 0 0 3 5 0 0 5 1 0 3 0 8 0 6 0 0 0 3 0 5 and class number returned from sample.size is like: 28, 8, 82, 28, 18, 22 Should I use gbm to try it since it might focus more on misplaced cases? thanks, weiwei On 7/7/05, Liaw, Andy [EMAIL PROTECTED] wrote: From: Weiwei Shi it works. thanks, but: (just curious) why i tried previously and i got is.vector(sample.size) [1] TRUE Because a list is also a vector: a - c(list(1), list(2)) a [[1]] [1] 1 [[2]] [1] 2 is.vector(a) [1] TRUE is.numeric(a) [1] FALSE Actually, the way I initialize a list of known length is by something like: myList - vector(mode=list, length=veryLong) Andy i also tried as.vector(sample.size) and assigned it to sampsz,it still does not work. On 7/7/05, Duncan Murdoch [EMAIL PROTECTED] wrote: On 7/7/2005 3:38 PM, Weiwei Shi wrote: Hi there: I have a question on random foresst: recently i helped a friend with her random forest and i came with this problem: her dataset has 6 classes and since the sample size is pretty small: 264 and the class distr is like this (Diag is the response variable) sample.size - lapply(1:6, function(i) sum(Diag==i)) sample.size [[1]] [1] 36 [[2]] [1] 12 [[3]] [1] 120 [[4]] [1] 36 [[5]] [1] 30 [[6]] [1] 30 I assigned this sample.size to sampsz for a stratiefied sampling purpose and i got the following error: Error in sum(..., na.rm = na.rm) : invalid 'mode' of argument if I use sampsz=c(36, 12, 120, 36, 30, 30), then it is fine. Could you tell me why? The sum() function knows what to do on a vector, but not on a list. You can turn your sample.size variable into a vector using unlist(sample.size) Duncan Murdoch btw, as to classification problem for this with uneven class number situation, do u have some suggestions to improve its accuracy? I tried to use c() way to make the sampsz works but the result is similar. Thanks, weiwei On 6/30/05, Liaw, Andy [EMAIL PROTECTED] wrote: The limitation comes from the way categorical splits are represented in the code: For a categorical variable with k categories, the split is represented by k binary digits: 0=right, 1=left. So it takes k bits to store each split on k categories. To save storage, this is `packed' into a 4-byte integer (32-bit), thus the limit of 32 categories. The current Fortran code (version 5.x) by Breiman and Cutler gets around this limitation by storing the split in an integer array. While this lifts the 32-category limit, it takes much more memory to store the splits. I'm still trying to figure out a more memory efficient way of storing the splits without imposing the 32-category limit. If anyone has suggestions, I'm all ears. Best, Andy From: [EMAIL PROTECTED] Hello, I'm using the random forest package. One of my factors in the data set contains 41 levels (I can't code this as a numeric value - in terms of linear models this would be a random factor). The randomForest call comes back with an error telling me that the limit is 32 categories. Is there any reason for this particular limit? Maybe it's possible to recompile the module with a different cutoff? thanks a lot for your help, kind regards, Arne __ 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
Re: [R] manupulating a data frame column
Steven T. wrote: Could someone tell me how to fix the following error? It looks like that the reason is that df$x is of the class factor. Thanks! You are right. Either don't make it a factor, if you don't want, or try something like the following in order to add the relevant levels to df$x1: x1-LETTERS[1:8]; x2-letters[1:8]; x1[2]-NA; x1[4]-NA df-data.frame(x1=x1, x2=x2) levels(df$x1) - c(levels(df$x1), levels(df$x2)) idx-which(is.na(df$x1)) df[idx,1]-df[idx,2] Uwe Ligges x1-LETTERS[1:8]; x2-letters[1:8]; x1[2]-NA; x1[4]-NA; df-data.frame(x1=x1, x2=x2) idx-which(is.na(df$x1)) df[idx,1]-df[idx,2] Warning message: invalid factor level, NAs generated in: [-.factor(`*tmp*`, iseq, value = c(2, 4)) __ 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 __ 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
Re: [R] What method I should to use for these data?
luan_sheng wrote: -Original Message- From: luan_sheng [mailto:[EMAIL PROTECTED] Sent: Thursday, July 07, 2005 9:46 PM To: (r-help@stat.math.ethz.ch) Cc: ([EMAIL PROTECTED]) Subject: What method I should to use for these data? Dear R user: I am studying the allele data of two populations. the following is the data: a1 a2 a3 a4 a5 a6 a7 a8 a9 a10a11 a12 a13 a14 a15 a16 a17 pop1 0.0217 0. 0.0109 0.0435 0.0435 0. 0.0109 0.0543 0.1739 0.0761 0.1413 0.1522 0.1087 0.0870 0.0435 0.0217 0.0109 pop2 0.0213 0.0213 0. 0. 0. 0.0426 0.1702 0.2128 0.1596 0.1809 0.0957 0.0745 0.0106 0.0106 0. 0. 0. a1,a2,a3 .. a17 is the frequency of 17 alleles , the sum is 1. I want to test the significance of the distribution of 17 alleles between two populations. How can I do? I want to use chisquare, is is right for these data ? If you want to use chisquare, you need the counts and not only the proportions. If that is right can be answered only if we know your hypothesis. Kjetil can anyone help me ? Thanks!! luan Yellow Sea Fisheries Research Institute , Chinese Academy of Fishery Sciences , Qingdao , 266071 __ ÑÅ»¢Ãâ·ÑGÓÊÏä£ÖйúµÚÒ»¾øÎÞÀ¬»øÓʼþɧÈų¬´óÓÊÏä __ 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 -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra __ 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
[R] spurious regression in R
Hi: I am trying to do a spurious regression in R but I can not find the function. Anybody used it before? The problem I have is try to do a regression with several time series. An alternative is to use the GLS function to fit the linear regression with the correlation structure AR(3) for the response (or residual). I hope the residuals after the GLS regression will be independent judged by Box-Ljung test. However, I dont know how the residuals are defined in the GLS function. Is it just y-yhat or y-yhat times the (covariance matrix)^(-1/2). Because y-yhat still has the AR(3) covariance structure and surely be rejected by the Box-Ljung test. The latter will be independent if the assumption of AR(3) correlation structure is right. Any suggestion are highly appreciated. Thx! __ 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
[R] multivariate regression using R
Does anyone know if there is a way to run multivariate linear regression in R? I tried using the lm function (e.g., lm(dv1, dv2~iv1+iv2+iv3), but got error messages. Is my syntax wrong, or do I need a particular package? Thanks, Jeff-- Jeffrey J. Lusk, Ph.D. Postdoctoral Research Associate Department of Forestry Natural Resources and Purdue and Climate Change Research Center 715 West State Street; Pfendler Hall Purdue University West Lafayette, IN 47907 Phone: 765-494-9701 E-mail: [EMAIL PROTECTED] Web: http://www.geocities.com/jefflusk2002 [[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
[R] q() == Segmentation fault
I created the simple library, attached. When I terminate an R session where the library has been loaded with q() a segmentation fault is thrown. Is there any cleaning that I should be doing? From R session: q() Segmentation fault or from shell: $ R CMD BATCH r.in /usr/lib/R/bin/BATCH: line 55: 17359 Done( echo invisible(options(echo = TRUE)); cat ${in}; echo proc.time() ) 17360 Segmentation fault | ${R_HOME}/bin/R ${opts} ${out} 21 Attached, please, find the librray tmc.tmp. The library contains the three files below. I am using R 2.1.0 and RODBC 1.1-3 on debian. :: R/zzz.R :: .First.lib - function (which.lib.loc, package, ...) { library(RODBC) connect() } .Last.lib - function (libpath, ...) { } :: R/db.R :: connect - function() { conn - odbcConnect('tmc', believeNRows = FALSE) } :: data/data.r :: conn - NULL __ 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
Re: [R] multivariate regression using R
Lusk, Jeffrey J [EMAIL PROTECTED] writes: Does anyone know if there is a way to run multivariate linear regression in R? I tried using the lm function (e.g., lm(dv1, dv2~iv1+iv2+iv3), but got error messages. Is my syntax wrong, or do I need a particular package? You need a matrix response: lm(cbind(dv1,dv2)~iv1+iv2+iv3) should do. There is an anova() method for comparing the resulting mlm objects. And yes, your syntax is wrong: you're calling lm with 2 arguments, dv1 and dv2~iv1+iv2+iv3. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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
[R] How do you sort a data frame on a selection of columns?
This is what to start with: Data Frame A BC D c1 4 y 5 c3 6 d 7 c1 5 t 6 Now sort on A then C This is what to end with: Data Frame A B C D c1 5 t 6 c1 4 y 5 c3 6 d 7 I assume it is something like this: attach(DF) sort(DF,partial=c(A,C)) Thanks in advance. Meredith [[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
Re: [R] How do you sort a data frame on a selection of columns?
Briggs, Meredith M [EMAIL PROTECTED] writes: This is what to start with: Data Frame A B C D c1 4 y 5 c3 6 d 7 c1 5 t 6 Now sort on A then C This is what to end with: Data Frame A B C D c1 5 t 6 c1 4 y 5 c3 6 d 7 I assume it is something like this: attach(DF) Attaching data frames before modifying them is not usually a good idea. Especially if you forget to detach them again. sort(DF,partial=c(A,C)) o - with(DF, order(A,C)) # or just order(DF$A, DF$C) DF - DF[o,] -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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
Re: [R] How do you sort a data frame on a selection of columns?
On 7/7/05, Briggs, Meredith M [EMAIL PROTECTED] wrote: This is what to start with: Data Frame A BC D c1 4 y 5 c3 6 d 7 c1 5 t 6 Now sort on A then C This is what to end with: Data Frame A B C D c1 5 t 6 c1 4 y 5 c3 6 d 7 DF[order(DF$A, DF$C),] There is also a function posted on r-help that can do this easier. Try RSiteSearch(sort.data.frame) __ 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
[R] Problem compiling R 2.1.* on SUSE 9.2
I have been unable to compile either R 2.1.0 or 2.1.1 under SUSE 9.2. The system simply hangs as far as I can tell. All key board and mouse service dies. I have had no problem compiling earlier versions of R through 2.0.1, aside from remembering to include readline in the configuration. Configure runs without any warnings except that Info or html versions of the R Manuals. The SUSE 9.2 install is generic with KDE 3.3 as the principal GUI. Compiling also crashes under GNOME. Because of the system hang, I can't provide any error codes. Perusing /var/log/messages doesn't seem to yield any clues. The system is a KDE AMD XP 2100, there is 1 GB of system ram, less than 10% of the harddisk space is in use, videocard is an nVidia GeForce4 Ti 4400. The OS is SUSE 9.2 and it has current updates for security. JWDougherty __ 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
Re: [R] How do you sort a data frame on a selection of columns?
Does order do what you want? spencer graves Briggs, Meredith M wrote: This is what to start with: Data Frame A B C D c1 4 y 5 c3 6 d 7 c1 5 t 6 Now sort on A then C This is what to end with: Data Frame A B C D c1 5 t 6 c1 4 y 5 c3 6 d 7 I assume it is something like this: attach(DF) sort(DF,partial=c(A,C)) Thanks in advance. Meredith [[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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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
Re: [R] spurious regression in R
R has extensive time series capabilities within base R and especially add-on packages like the dse bundle and the several packages associated with www.rmetrics.org. I'm still a novice in this area. The source I've found most useful so far is the time series chapter in Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer). Also, are you familiar with vignette()? I found interesting the vignettes for zoo, dse1, and dse2, accessed for example as follows: z - vignette(zoo) z # This brings up a tutorial in Adobe Acrobat edit(z) # This extracts the R commands from the tutorial # into a separate file that can be processed line by line, # edited to test alternatives, etc. # NOTE: edit(z) did NOT work for me under XEmacs. # If you use XEmacs, try Stangle(z$file); # this should create a *.R file in getwd() I suspect this will not answer your questions, but I hope it helps. Feel free to submit another question. However, before you do, I suggest you read the posting guide! http://www.R-project.org/posting-guide.html;. It might help you answer many of your questions yourself and increase the utility of answers you receive to other questions you post to this list. spencer graves yyan liu wrote: Hi: I am trying to do a spurious regression in R but I can not find the function. Anybody used it before? The problem I have is try to do a regression with several time series. An alternative is to use the GLS function to fit the linear regression with the correlation structure AR(3) for the response (or residual). I hope the residuals after the GLS regression will be independent judged by Box-Ljung test. However, I dont know how the residuals are defined in the GLS function. Is it just y-yhat or y-yhat times the (covariance matrix)^(-1/2). Because y-yhat still has the AR(3) covariance structure and surely be rejected by the Box-Ljung test. The latter will be independent if the assumption of AR(3) correlation structure is right. Any suggestion are highly appreciated. Thx! __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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
[R] pairs() uses col argument for axes coloring
Hi list, not sure if this is the wanted behavior, but running the following code: version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R n - 500 d - 4 m - matrix(runif(n*d, -1, 1), ncol=d) c - hsv(apply(m, 1, function(x) {sum(x*x)/d}), 1, 1) pairs(m, col=c) gives me the desired coloring of the points but also colors the axes. Looking at the source for pairs() suggests, that this is the case because col is part of the ... argument list which is passed on to localAxis (and from there to axis). Wouldn't it be more approptiate to use the same color box() uses to draw the border around each scatterplot? If yes, should I open a bug for this or how would such a feature request be handled? -- Olaf Mersmann __ 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
Re: [R] Problems with nlme: Quinidine example
Since I've seen no reply to this so far, I will venture a few questions / suggestions. I have not used nlme (nor nln for Maggie Zhu), so I can not comment on the specifics. I have two general procedures for debugging when I get a cryptic error message. First, in R, I can get the source just by entering the name of the function. I copy the results into a script file and trace the code line by line until I identify what crashes the code. Then I can work to identify what change I need to make, either to the code or prefereably to my argument(s), to make it work. Requestion nlme produces the following: nlme function (model, data = sys.frame(sys.parent()), fixed, random = fixed, groups, start, correlation = NULL, weights = NULL, subset, method = c(ML, REML), na.action = na.fail, naPattern, control = list(), verbose = FALSE) { UseMethod(nlme) } This is not particularly helpful by itself. However, 'methods(nlme)' returns the following: [1] nlme.formula nlme.nlsList I can list these two functions [or access them via getAnywhere if the name is followed by an asterisk (*)] and get more detail. Second, with a complicated function call like the two nlme examples, I can try to delete or simplify arguments, e.g., delete terms from a formula, until I get something that either changes or eliminates the error message. Finally, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html;. It can help you formulate a question to increase the chances of a useful reply -- and you may even find the answer without waiting for someone on the list to reply. spencer graves [EMAIL PROTECTED] wrote: This concerns the Clinical Study of Quinidine example on page 380 of the book Mixed-Effects Models in S and S-PLUS by Pinheiro and Bates (2000). I have tried to reproduce the example, but get an error: library(nlme) fm1Quin.nlme - nlme(conc ~ quinModel(Subject, time, conc, dose, interval, lV, lKa, lCl), + data=Quinidine, + fixed=lV + lKa + lCl ~ 1, + random=pdDiag(lV + lCl ~ 1), + groups= ~ Subject, + start=list(fixed=c(5, -0.3, 2)), + na.action=na.pass, naPattern= ~ !is.na(conc)) Error in solve.default(estimates[dimE[1] - (p:1), dimE[2] - (p:1), drop = FALSE]) : system is computationally singular: reciprocal condition number = 6.61723e-17 Note: - I am running R version 2.1.0 on Linux. - The only difference between the code in the book and the code above is that I use na.pass instead of na.include for the na.action argument, but I don't think this is significant. I would appreciate help from anybody who has been able to get this example to work. __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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
Re: [R] fail in adding library in new version.
Dear all, I really appreciate your help. I think I have a little advancement. ^_^ When I enter the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ bin\R CMD install /example example is in the d:\, which include the R folder and DESCRIPTION file, But I wrote nothing in the DESCRIPTION file. Actually, I don't know what I should write in it. Well, there are still aother error: -- Making package example adding build stamp to DESCRIPTION error happened.read_description(dfile) : file 'D:/example/DESCRIPTION' is not in valid DCF format Stop execute make[2]: *** [frontmatter] Error 1 make[1]: *** [all] Error 2 make: *** [pkg-example] Error 2 *** Installation of example failed *** Removing 'D:/PROGRA~1/R/rw2011/library/example' Please tell me which step is wrong? Thanks a lot! BG Ivy_Li -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年7月7日 20:57 收件人: Uwe Ligges 抄送: Ivy_Li; r-help@stat.math.ethz.ch 主题: Re: 答复: 答复: [R] fail in adding library in new version. On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example Another possibility is to put Rcmd.bat from the batch file collection http://cran.r-project.org/contrib/extra/batchfiles/ in your path. It will use the registry to find R so you won't have to modify your path (nor would you have to remodify it every time you install a new version of R which is what you would otherwise have to do): cd \MyPackages Rcmd install example Just for the records: 1. cd \MyPackages won't work, as I have already explained above. If MyPackages is not a top level directory in the current drive then it will not work. Otherwise it does work. 2. I do *not* recommend this way, in particular I find it misleading to provide these batch files on CRAN. The alternative, at least as discussed in your post, is more work since one will then have to change one's path every time one reinstalls R. This is just needless extra work and is error prone. If you forget to do it then you will be accessing the bin directory of the wrong version of R. There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\ 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable (In your previous mail, you said put these at the beginning of the path, I don't understand what is your meaning. Which path?) If in the console you enter the command: path then it will display a semicolon separated list of folders. You want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior
Re: [R] fail in adding library in new version.
You cannot use an empty DESCRIPTION file. To get more info on the DESCRIPTION file see 1.1.1 of the Writing Extensions manual which you can get to from the Help | Manuals menu entry in the Windows R GUI. There is also an example in that section. Also \Program Files\R\rw2011\library contains one directory per package and you can look at the DESCRIPTION files in each for additional examples (although these are built files and you don't need the Packaged and Built lines since those were added automatically). On 7/7/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear all, I really appreciate your help. I think I have a little advancement. ^_^ When I enter the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ bin\R CMD install /example example is in the d:\, which include the R folder and DESCRIPTION file, But I wrote nothing in the DESCRIPTION file. Actually, I don't know what I should write in it. Well, there are still aother error: -- Making package example adding build stamp to DESCRIPTION error happened.read_description(dfile) : file 'D:/example/DESCRIPTION' is not in valid DCF format Stop execute make[2]: *** [frontmatter] Error 1 make[1]: *** [all] Error 2 make: *** [pkg-example] Error 2 *** Installation of example failed *** Removing 'D:/PROGRA~1/R/rw2011/library/example' Please tell me which step is wrong? Thanks a lot! BG Ivy_Li -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年7月7日 20:57 收件人: Uwe Ligges 抄送: Ivy_Li; r-help@stat.math.ethz.ch 主题: Re: 答复: 答复: [R] fail in adding library in new version. On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example Another possibility is to put Rcmd.bat from the batch file collection http://cran.r-project.org/contrib/extra/batchfiles/ in your path. It will use the registry to find R so you won't have to modify your path (nor would you have to remodify it every time you install a new version of R which is what you would otherwise have to do): cd \MyPackages Rcmd install example Just for the records: 1. cd \MyPackages won't work, as I have already explained above. If MyPackages is not a top level directory in the current drive then it will not work. Otherwise it does work. 2. I do *not* recommend this way, in particular I find it misleading to provide these batch files on CRAN. The alternative, at least as discussed in your post, is more work since one will then have to change one's path every time one reinstalls R. This is just needless extra work and is error prone. If you forget to do it then you will be accessing the bin directory of the wrong version of R. There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of
Re: [R] fail in adding library in new version.
There is also an even larger source of examples at: http://cran.r-project.org/src/contrib/Descriptions/ although the built caveat mentioned below applies here as well. On 7/7/05, Gabor Grothendieck [EMAIL PROTECTED] wrote: You cannot use an empty DESCRIPTION file. To get more info on the DESCRIPTION file see 1.1.1 of the Writing Extensions manual which you can get to from the Help | Manuals menu entry in the Windows R GUI. There is also an example in that section. Also \Program Files\R\rw2011\library contains one directory per package and you can look at the DESCRIPTION files in each for additional examples (although these are built files and you don't need the Packaged and Built lines since those were added automatically). On 7/7/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear all, I really appreciate your help. I think I have a little advancement. ^_^ When I enter the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ bin\R CMD install /example example is in the d:\, which include the R folder and DESCRIPTION file, But I wrote nothing in the DESCRIPTION file. Actually, I don't know what I should write in it. Well, there are still aother error: -- Making package example adding build stamp to DESCRIPTION error happened.read_description(dfile) : file 'D:/example/DESCRIPTION' is not in valid DCF format Stop execute make[2]: *** [frontmatter] Error 1 make[1]: *** [all] Error 2 make: *** [pkg-example] Error 2 *** Installation of example failed *** Removing 'D:/PROGRA~1/R/rw2011/library/example' Please tell me which step is wrong? Thanks a lot! BG Ivy_Li -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年7月7日 20:57 收件人: Uwe Ligges 抄送: Ivy_Li; r-help@stat.math.ethz.ch 主题: Re: 答复: 答复: [R] fail in adding library in new version. On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: On 7/7/05, Uwe Ligges [EMAIL PROTECTED] wrote: Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example Another possibility is to put Rcmd.bat from the batch file collection http://cran.r-project.org/contrib/extra/batchfiles/ in your path. It will use the registry to find R so you won't have to modify your path (nor would you have to remodify it every time you install a new version of R which is what you would otherwise have to do): cd \MyPackages Rcmd install example Just for the records: 1. cd \MyPackages won't work, as I have already explained above. If MyPackages is not a top level directory in the current drive then it will not work. Otherwise it does work. 2. I do *not* recommend this way, in particular I find it misleading to provide these batch files on CRAN. The alternative, at least as discussed in your post, is more work since one will then have to change one's path every time one reinstalls R. This is just needless extra work and is error prone. If you forget to do it then you will be accessing the bin directory of the wrong version of R. There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor
Re: [R] PCA and overlaying points
Hi Renaud, Thanks a lot for helping ! Actually, I did think about such a function (jitter), but it didn't really solve the problem, as it may change nothing for some overlaying points and even create new cases of overlaying points. Moreover, it modifies every coordinates, even if it is not necessary. I hoped there might be an heavier function able to change coordinates in an let's say intelligent or surgical manner... jacques Renaud Lancelot a écrit : Jacques VESLOT a écrit : Dear R-users, Is there an easy way to avoid points one upon another when ploting rows and columns of 'dudi' objects ? Maybe there is a function in ade4 or in an other package, or maybe someone has his or her own function to do this (for example to automatically modify a little the coordinates of these points to get a readable plot ?). Thanks in advance. Best regards, Jacques VESLOT __ 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 Hello Jacques, Have a look at ?jitter Best, Renaud __ 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
Re: [R] timezone problems
Thank you Don for your hints. I have checked my environment vairable TZ again. But everything is set correctly. I think the problem is with Sys.timezone(). Maybe it is a conflict between how my system formats the time/date and what Sys.timezone() expects. This is what I get on my system: Sys.getenv(TZ) TZ GMT Sys.time() [1] 2005-07-07 07:32:39 GMT ## everything fine so far Sys.timezone() [1] NA ## This is what Sys.timezone looks like: Sys.timezone function () { z - as.POSIXlt(Sys.time()) attr(z, tzone)[2 + z$isdst] } environment: namespace:base z - as.POSIXlt(Sys.time()) attributes(z) $names [1] sec min hour mday mon year wday yday isdst $class [1] POSIXt POSIXlt $tzone [1] GMT attr(z,tzone) [1] GMT z$isdst [1] 0 attr(z,tzone)[2] [1] NA I dont understand why Sys.timezone doesn't use attr(z,tzone) but tries to read its (2+z$isdst)-th element. Of course it would be easy to write a workaround, but I wonder why nobody else is having this problem. best regards, Martin Keller-Ressel On Wed, 06 Jul 2005 14:45:25 -, Don MacQueen [EMAIL PROTECTED] wrote: How did you set the TZ system variable? If you did not use Sys.putenv(), try using it instead. Otherwise, I think you have to ask the package maintainer. You may be misleading yourself by using Sys.time() to test whether TZ is set. What does Sys.getenv() tell you? I get a timezone code from Sys.time() even when TZ is not defined (see example below). (but I do have a different OS) Sys.timezone() [1] Sys.time() [1] 2005-07-06 07:34:15 PDT Sys.getenv('TZ') TZ Sys.putenv(TZ='US/Pacific') Sys.timezone() [1] US/Pacific Sys.getenv('TZ') TZ US/Pacific Sys.time() [1] 2005-07-06 07:34:38 PDT Sys.putenv(TZ='GMT') Sys.time() [1] 2005-07-06 14:35:45 GMT version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0status major2 minor1.1 year 2005month06 day 20 language R At 9:55 AM + 7/5/05, Martin Keller-Ressel wrote: Hi, Im using R 2.1.1 and running Code that previously worked (on R 2.1.0 I believe) using the 'timeDate' function from the fCalendar package. The code now throws an error: Error in if (Sys.timezone() != GMT) warning(Set timezone to GMT!) However I have read the documentation of the fCalendar package and I have set my system variable TZ to GMT. I tracked the error down to the function Sys.timezone() which returns NA in spite of what Sys.time() returns. Sys.timezone() [1] NA Sys.time() [1] 2005-07-05 08:41:53 GMT My version: version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Any help is appreciated, Martin Keller-Ressel --- Martin Keller-Ressel Research Unit of Financial and Actuarial Mathematics TU Vienna __ 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 -- Martin Keller-Ressel Research Unit of Financial and Actuarial Mathematics TU Vienna __ 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
Re: [R] rlm/M/MM-estimator questions
Christian Hennig wrote: Hi list, 1) How can the MM-estimator method=MM in function rlm be tuned to 85% efficiency? It seems that there is a default tuning to 95%. I presume, but am not sure, that the MM-estimator uses phi=phi.bisquare as default and the tuning constant could be set by adding a parameter c=... Is this true? Which value to use for 85%? (In principle I should be able to figure that out theoretically, but it would be much easier if somebody already knew the constant or a straightforward way to compute it.) Hi Christian, I have not calculated the efficiency myself ... But the thesis of Matias Salibian-Barrera (SB 2000) might help you to find the answer (cf. Chapter 4). See: http://mathstat.math.carleton.ca:16080/~matias/thesis.pdf As far as I understand the choice k0=1.548 is to obtain a breakdown point 0.5 whereas k0=1.988 leads to a breakdown point of 0.4 - at least in the location case; confer p. 60 of SB 2000. In the article Optimal robust $M$-estimates of location by Fraiman, Yohai and Zamar (Ann. Stat. 29(1): 194 - 223) which is, of course, concerned with the location case, the authors recommend to use k0=1.988 instead of k0=1.548 (cf. p. 206). Hope that helps! Matthias 2) The M-estimator with bisquare uses rescaled MAD of the residuals as scale estimator according to the rlm help page. Does this mean that a scale estimator is used which is computed from least squares residuals? Are M-estimator and residual scale estimator iterated until convergence of them both? (Does this converge?) Or what else? What does rescaled mean? Thank you, Christian *** NEW ADDRESS! *** Christian Hennig University College London, Department of Statistical Science Gower St., London WC1E 6BT, phone +44 207 679 1698 [EMAIL PROTECTED], www.homepages.ucl.ac.uk/~ucakche __ 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 __ 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
[R] r: LOOPING
hi all i know that one should try and limit the amount of looping in R programs. i have supplied some code below. i am interested in seeing how the code cold be rewritten if we dont use the loops. a brief overview of what is done in the code. == == == 1. the input file contains 120*500*61 cells. 120*500 rows and 61 columns. 2. we need to import the cells in 500 at a time and perform the same operations on each sub group 3. the file contais numeric values. there are quite a lot of missing values. this has been coded as NA in the text file (the file that is imported) 4. for each variable we check for outliers. this is done by setting all values that are greater than 3 standard deviations (sd) from the mean of a variable to be equal to the 3 sd value. 5. the data set has one response variable , the first column, and 60 explanatory variables. 6. we regress each of the explanatory variables against the response and record the slope of the explanatory variable. (i.e. simple linear regression is performed) 7. nsize = 500 since we import 500 rows at a time 8. nruns = how many groups you want to run the analysis on == == == TRY-function(nsize=500,filename=C:/A.txt,nvar=61,nruns=1) { #the matrix with the payoff weights fit.reg-matrix(nrow=nruns,ncol=nvar-1) for (ii in 1:nruns) { skip=1+(ii-1)*nsize #import the data in batches of nsize*nvar #save as a matrix and then delete dscan to save memory space dscan-scan(file=filename,sep=\t,skip=skip,nlines=nsize,fill=T,quiet=T) dm-matrix(dscan,nrow=nsize,byrow=T) rm(dscan) #this calculates which of the columns have entries in the columns #that are not NA #only perform regressions on those with more than 2 data points #obviously the number of points has to be much larger than 2 #col.points = the number of points in the column that are not NA col.points-apply(dm,2,function(x) sum(match(x,rep(NA,nsize),nomatch=0))) col.points #adjust for outliers dm.new-dm mean.dm.new-apply(dm.new,2,function(x) mean(x,na.rm=T)) sd.dm.new-apply(dm.new,2,function(x) sd(x,na.rm=T)) top.dm.new-mean.dm.new+3*sd.dm.new bottom.dm.new-mean.dm.new-3*sd.dm.new for (i in 1:nvar) { dm.new[,i][dm.new[,i]top.dm.new[i]]-top.dm.new[i] dm.new[,i][dm.new[,i]bottom.dm.new[i]]-bottom.dm.new[i] } #standardize the variables #we dont have to change the variable names here but i did! means.dm.new-apply(dm.new,2,function(x) mean(x,na.rm=T)) std.dm.new-apply(dm.new,2,function(x) sd(x,na.rm=T)) dm.new-sweep(sweep(dm.new,2,means.dm.new,-),2,std.dm.new,/) for (j in 2:nvar) { 'WE DO NOT PERFORM THE REGRESSION IF ALL VALUES IN THE COLUMN ARE NA if (col.points[j]!=nsize) { #fit the regression equations fit.reg[ii,j-1]-summary(lm(dm.new[,1]~dm.new[,j]))$coef[2,1] } else fit.reg[ii,j-1]-L } } dm.names-scan(file=filename,sep=\t,skip=0,nlines=1,fill=T,quiet=T,what=charachter) dm.names-matrix(dm.names,nrow=1,ncol=nvar,byrow=T) colnames(fit.reg)-dm.names[-1] output-c($fit.reg) list(fit.reg=fit.reg,output=output) } a=TRY(nsize=500,filename=C:/A.txt,nvar=61,nruns=1) == == == thanking you in advance / allan__ 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
[R] R under suse linux 9.3
Hi, dear list members, I've been using R under windows XP and I am now changing my system to SUSE LINUX 9.3. I could figure out that there is no precompiled version of R for LINUX. To get me going, I would like your help regarding what I need to setup R under my SUSE LINUX. Which compiler do I need to be able to compile the source and I was wondering if I could get GNU compiler? I highly appreciate your help and for taking your time. Looking forward to hearing from you Regards Mahdi -- --- Mahdi Osman (PhD) E-mail: [EMAIL PROTECTED] __ 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
Re: [R] Tempfile error
Doran, Harold wrote: Dear List: I am encountering an error that I can't resolve. I'm looping through rows of a dataframe to generate individual tex files using Sweave. At random points along the way, I encounter the following error Error in file() : cannot find unused tempfile name Which version of R is this? I think during one of the latest releases tempfile() name generation has been imporved, because R did not tried hard enough to find new (random) filenames for tempfiles in older releases of R. Uwe Ligges At which point Sweave halts. There isn't a logical pattern that I can identify in terms of why the program stops at certain points. It just seems to be random as far as I can tell. I've searched the archives and of course Sweave FAQs but haven't found much that sheds light on what this error indicates and what I should do to resolve it. There are approximately 20,000 rows, meaning that about 20,000 tex files are created. If I sample 5,000 or even 10,000 and run the program, I do not encounter an error. It only occurs when I run the program on the full dataframe and even then the error is not occuring at the same point. That is, the row at which the program halts varies each time. Does anyone have any thoughts on this problem? -Harold [[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 __ 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
Re: [R] Discriminant Function Analysis
Thanks for the answers Uwe! So this is a common problem in biology - few number of cases and many, many variables (genes, proteins, metabolites, etc etc)! Under these conditions, is discriminant function analysis not an ideal method to use then? Are there alternatives? 1) First problem, I got this error message: z - lda(C0GRP_NA ~ ., dpi30) Warning message: variables are collinear in: lda.default(x, grouping, ...) I guess this is not a good thing, however, I *did* get a result and it discriminated perfectly between my groups. Can anyone explain what this means? Does it invalidate my results? Well, 14 cases and 37 variables mean that not that many degrees of freedom are left ;-) Of course, you get a perfect fit - with arbitrary data. __ 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
Re: [R] Discriminant Function Analysis
michael watson (IAH-C) wrote: Thanks for the answers Uwe! So this is a common problem in biology - few number of cases and many, many variables (genes, proteins, metabolites, etc etc)! Under these conditions, is discriminant function analysis not an ideal method to use then? Are there alternatives? No, obviously not an ideal method, if used as is on the whole data. Alternatives are certainly described in the literature - I am not specialised in this field (I mean, this gene stuff), hence do not want to specify misleading references here. Uwe Ligges 1) First problem, I got this error message: z - lda(C0GRP_NA ~ ., dpi30) Warning message: variables are collinear in: lda.default(x, grouping, ...) I guess this is not a good thing, however, I *did* get a result and it discriminated perfectly between my groups. Can anyone explain what this means? Does it invalidate my results? Well, 14 cases and 37 variables mean that not that many degrees of freedom are left ;-) Of course, you get a perfect fit - with arbitrary data. __ 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
Re: [R] R under suse linux 9.3
Mahdi Osman wrote: Hi, dear list members, I've been using R under windows XP and I am now changing my system to SUSE LINUX 9.3. I could figure out that there is no precompiled version of R for LINUX. To get me going, I would like your help regarding what I need to setup R under my SUSE LINUX. Which compiler do I need to be able to compile the source and I was wondering if I could get GNU compiler? I highly appreciate your help and for taking your time. Looking forward to hearing from you Regards Mahdi Hi Mahdi, Just uncompress the file tar -xzf R-2.1.0.tar.gz cd into the directory and do ./configure --prefix=/usr/local make make install It might happen that some packages are not installed, the most common is not to have the devel version of readline and f2c. Just start yast and install these packages. Another issue is that you should run the previous commands with your user and the make install has root. Regards EJ __ 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
[R] How to get the minimum ?
Hi, I have a model with differents observations Xi. Each observation belongs to a group, either A or B. I would like to minimize a fonction like : sum( Xi - Z)^2 + sum (Xi - aZ -b)^2 AB The first sum contains all observations from group A and the second all observations from group B. I want to find the Z-value wich minimize this function. a and b are predefined parameters. Thanks for help. Philippe __ 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
Re: [R] R under suse linux 9.3
Ernesto Jardim [EMAIL PROTECTED] writes: Mahdi Osman wrote: Hi, dear list members, I've been using R under windows XP and I am now changing my system to SUSE LINUX 9.3. I could figure out that there is no precompiled version of R for LINUX. To get me going, I would like your help regarding what I need to setup R under my SUSE LINUX. Which compiler do I need to be able to compile the source and I was wondering if I could get GNU compiler? I highly appreciate your help and for taking your time. Looking forward to hearing from you Regards Mahdi Hi Mahdi, Just uncompress the file tar -xzf R-2.1.0.tar.gz Er, 2.1.1 has been out a couple of weeks... cd into the directory and do ./configure --prefix=/usr/local make make install It might happen that some packages are not installed, the most common is not to have the devel version of readline and f2c. Just start yast and install these packages. f2c ?? gcc-g77 more likely. Plus various other stuff relating to tcl/tk, etc. Another issue is that you should run the previous commands with your user and the make install has root. Yes, but what was ever wrong with http://cran.r-project.org/bin/linux/suse/9.3/RPMS/i586/R-base-2.1.1-1.i586.rpm ? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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
Re: [R] R under suse linux 9.3
Peter Dalgaard wrote: Ernesto Jardim [EMAIL PROTECTED] writes: Mahdi Osman wrote: Hi, dear list members, I've been using R under windows XP and I am now changing my system to SUSE LINUX 9.3. I could figure out that there is no precompiled version of R for LINUX. To get me going, I would like your help regarding what I need to setup R under my SUSE LINUX. Which compiler do I need to be able to compile the source and I was wondering if I could get GNU compiler? I highly appreciate your help and for taking your time. Looking forward to hearing from you Regards Mahdi Hi Mahdi, Just uncompress the file tar -xzf R-2.1.0.tar.gz Er, 2.1.1 has been out a couple of weeks... cd into the directory and do ./configure --prefix=/usr/local make make install It might happen that some packages are not installed, the most common is not to have the devel version of readline and f2c. Just start yast and install these packages. f2c ?? gcc-g77 more likely. Plus various other stuff relating to tcl/tk, etc. Another issue is that you should run the previous commands with your user and the make install has root. Yes, but what was ever wrong with http://cran.r-project.org/bin/linux/suse/9.3/RPMS/i586/R-base-2.1.1-1.i586.rpm ? Hi, Probably nothing is wrong with the rpm, I just prefer to compile it myself ... Regards EJ __ 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
Re: [R] timezone problems
Martin Keller-Ressel wrote: Thank you Don for your hints. I have checked my environment vairable TZ again. But everything is set correctly. I think the problem is with Sys.timezone(). Maybe it is a conflict between how my system formats the time/date and what Sys.timezone() expects. This is what I get on my system: Sys.getenv(TZ) TZ GMT Sys.time() [1] 2005-07-07 07:32:39 GMT ## everything fine so far Sys.timezone() [1] NA ## This is what Sys.timezone looks like: Sys.timezone function () { z - as.POSIXlt(Sys.time()) attr(z, tzone)[2 + z$isdst] } environment: namespace:base z - as.POSIXlt(Sys.time()) attributes(z) $names [1] sec min hour mday mon year wday yday isdst $class [1] POSIXt POSIXlt $tzone [1] GMT attr(z,tzone) [1] GMT z$isdst [1] 0 attr(z,tzone)[2] [1] NA I dont understand why Sys.timezone doesn't use attr(z,tzone) but tries to read its (2+z$isdst)-th element. Of course it would be easy to write a workaround, but I wonder why nobody else is having this problem. I can confirm for R-2.1.1 under Windows NT 4.0 and it looks like a bug (somewhere down the way from as.POSIXlt). Don't have the time to look at it more closely, perhaps Brian knows it at once? If this is not already in the bug repository (please check at first), can you submit a report, please? Thanks! Uwe Ligges best regards, Martin Keller-Ressel On Wed, 06 Jul 2005 14:45:25 -, Don MacQueen [EMAIL PROTECTED] wrote: How did you set the TZ system variable? If you did not use Sys.putenv(), try using it instead. Otherwise, I think you have to ask the package maintainer. You may be misleading yourself by using Sys.time() to test whether TZ is set. What does Sys.getenv() tell you? I get a timezone code from Sys.time() even when TZ is not defined (see example below). (but I do have a different OS) Sys.timezone() [1] Sys.time() [1] 2005-07-06 07:34:15 PDT Sys.getenv('TZ') TZ Sys.putenv(TZ='US/Pacific') Sys.timezone() [1] US/Pacific Sys.getenv('TZ') TZ US/Pacific Sys.time() [1] 2005-07-06 07:34:38 PDT Sys.putenv(TZ='GMT') Sys.time() [1] 2005-07-06 14:35:45 GMT version _ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0status major2 minor1.1 year 2005month06 day 20 language R At 9:55 AM + 7/5/05, Martin Keller-Ressel wrote: Hi, Im using R 2.1.1 and running Code that previously worked (on R 2.1.0 I believe) using the 'timeDate' function from the fCalendar package. The code now throws an error: Error in if (Sys.timezone() != GMT) warning(Set timezone to GMT!) However I have read the documentation of the fCalendar package and I have set my system variable TZ to GMT. I tracked the error down to the function Sys.timezone() which returns NA in spite of what Sys.time() returns. Sys.timezone() [1] NA Sys.time() [1] 2005-07-05 08:41:53 GMT My version: version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Any help is appreciated, Martin Keller-Ressel --- Martin Keller-Ressel Research Unit of Financial and Actuarial Mathematics TU Vienna __ 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 __ 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
Re: [R] R under suse linux 9.3
I've been successfully using R on SuSe linux for the last 2 years and I use the rpm :-) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ernesto Jardim Sent: 07 July 2005 10:48 Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R under suse linux 9.3 Peter Dalgaard wrote: Ernesto Jardim [EMAIL PROTECTED] writes: Mahdi Osman wrote: Hi, dear list members, I've been using R under windows XP and I am now changing my system to SUSE LINUX 9.3. I could figure out that there is no precompiled version of R for LINUX. To get me going, I would like your help regarding what I need to setup R under my SUSE LINUX. Which compiler do I need to be able to compile the source and I was wondering if I could get GNU compiler? I highly appreciate your help and for taking your time. Looking forward to hearing from you Regards Mahdi Hi Mahdi, Just uncompress the file tar -xzf R-2.1.0.tar.gz Er, 2.1.1 has been out a couple of weeks... cd into the directory and do ./configure --prefix=/usr/local make make install It might happen that some packages are not installed, the most common is not to have the devel version of readline and f2c. Just start yast and install these packages. f2c ?? gcc-g77 more likely. Plus various other stuff relating to tcl/tk, etc. Another issue is that you should run the previous commands with your user and the make install has root. Yes, but what was ever wrong with http://cran.r-project.org/bin/linux/suse/9.3/RPMS/i586/R-base-2.1.1-1. i586.rpm ? Hi, Probably nothing is wrong with the rpm, I just prefer to compile it myself ... Regards EJ __ 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 __ 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
Re: [R] r: LOOPING
Clark Allan wrote: hi all i know that one should try and limit the amount of looping in R programs. i have supplied some code below. i am interested in seeing how the code cold be rewritten if we dont use the loops. It is not always a good thing to remove loops (without having looked at each details of the code below). One case seems to be described below, where you probably already get memory problems and hence cannot (at least not without memory penalty) vectorize any more. Compromise is the keyword. Best, Uwe Ligges a brief overview of what is done in the code. == == == 1. the input file contains 120*500*61 cells. 120*500 rows and 61 columns. 2. we need to import the cells in 500 at a time and perform the same operations on each sub group 3. the file contais numeric values. there are quite a lot of missing values. this has been coded as NA in the text file (the file that is imported) 4. for each variable we check for outliers. this is done by setting all values that are greater than 3 standard deviations (sd) from the mean of a variable to be equal to the 3 sd value. 5. the data set has one response variable , the first column, and 60 explanatory variables. 6. we regress each of the explanatory variables against the response and record the slope of the explanatory variable. (i.e. simple linear regression is performed) 7. nsize = 500 since we import 500 rows at a time 8. nruns = how many groups you want to run the analysis on == == == TRY-function(nsize=500,filename=C:/A.txt,nvar=61,nruns=1) { #the matrix with the payoff weights fit.reg-matrix(nrow=nruns,ncol=nvar-1) for (ii in 1:nruns) { skip=1+(ii-1)*nsize #import the data in batches of nsize*nvar #save as a matrix and then delete dscan to save memory space dscan-scan(file=filename,sep=\t,skip=skip,nlines=nsize,fill=T,quiet=T) dm-matrix(dscan,nrow=nsize,byrow=T) rm(dscan) #this calculates which of the columns have entries in the columns #that are not NA #only perform regressions on those with more than 2 data points #obviously the number of points has to be much larger than 2 #col.points = the number of points in the column that are not NA col.points-apply(dm,2,function(x) sum(match(x,rep(NA,nsize),nomatch=0))) col.points #adjust for outliers dm.new-dm mean.dm.new-apply(dm.new,2,function(x) mean(x,na.rm=T)) sd.dm.new-apply(dm.new,2,function(x) sd(x,na.rm=T)) top.dm.new-mean.dm.new+3*sd.dm.new bottom.dm.new-mean.dm.new-3*sd.dm.new for (i in 1:nvar) { dm.new[,i][dm.new[,i]top.dm.new[i]]-top.dm.new[i] dm.new[,i][dm.new[,i]bottom.dm.new[i]]-bottom.dm.new[i] } #standardize the variables #we dont have to change the variable names here but i did! means.dm.new-apply(dm.new,2,function(x) mean(x,na.rm=T)) std.dm.new-apply(dm.new,2,function(x) sd(x,na.rm=T)) dm.new-sweep(sweep(dm.new,2,means.dm.new,-),2,std.dm.new,/) for (j in 2:nvar) { 'WE DO NOT PERFORM THE REGRESSION IF ALL VALUES IN THE COLUMN ARE NA if (col.points[j]!=nsize) { #fit the regression equations fit.reg[ii,j-1]-summary(lm(dm.new[,1]~dm.new[,j]))$coef[2,1] } else fit.reg[ii,j-1]-L } } dm.names-scan(file=filename,sep=\t,skip=0,nlines=1,fill=T,quiet=T,what=charachter) dm.names-matrix(dm.names,nrow=1,ncol=nvar,byrow=T) colnames(fit.reg)-dm.names[-1] output-c($fit.reg) list(fit.reg=fit.reg,output=output) } a=TRY(nsize=500,filename=C:/A.txt,nvar=61,nruns=1) == == == thanking you in advance / allan __ 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 __ 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
答复: 答复: [R] fail in adding library i n new version.
Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ bin\R CMD install /MyRpackages/example There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\ 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable (In your previous mail, you said put these at the beginning of the path, I don't understand what is your meaning. Which path?) If in the console you enter the command: path then it will display a semicolon separated list of folders. You want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior to the one where the tools are stored. 5. I tried an library example. I set a new folder named example in the c:\MyRpackages\. And In the example folder, it contain an DESCRIPTION file and R folder. in R folder contain a example file. I just write very simple script in it: a-2; b-3;sum - sum(a,b); print(paste(a,+,b,=,sum)) 6. I opened the DOS environment. Into the D:\ Type the following code: cd \Program Files\R\rw2010 But I don't understand the second line you writed in your previous mail: bin\R cmd install /MyRPackages/example I was assuming that MyRPackages and R are on the same disk. If they are not then you need to specify the disk too. That is if MyRPackages is on C and R is installed on D then install your package via: d: cd \Program Files\R\rw2010 bin\R CMD install c:/MyRPackages/example Note that bin\R means to run R.exe in the bin subfolder of the current folder using command script install and the indicated source package. I am not sure that I set up R in D:\ But I do so much action in C:\ Did I do the correct action? Did I do the action into the correct path? If you are not sure where R is installed then enter the following at the Windows console prompt to find out (this will work provided you let it install the key into the registry when you installed R initially). The reg command is a command built into Windows (I used XP but I assume its the same on other versions) that will query the Windows registry: reg query hklm\software\r-core\r /v InstallPath I still need your and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月6日 10:21 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: [R] fail in adding library in new version. On 6/5/05, Ivy_Li [EMAIL PROTECTED] wrote: Hello everybody, Could I consult you a question? I always use R old version 1.9.1 . Because I can not add my library into the new version 2.0.0 by the same method as old version. Getting the latest version of R is strongly recommended. The suggestions below all assume the latest version and may or may not work if you do not upgrade. * I have read the webpage http://www.stats.ox.ac.uk/pub/Rtools * Download the tools.zip * Unpack tools.zip into c:\cygwin * Install Active Perl in c:\Perl * Install the mingw32 port of gcc in c:\mingwin * Then go to Control Panel - System - Advanced - Environment Variables - Path - Variable Balue add ;c:\cygwin;c:\mingwin\bin You may need to put these at the beginning of the path rather than the end. Also just as a check enter path at the console to make sure that you have them. You will likely have to start a new console session and possibly even reboot. Also you need the Microsoft Help
Re: [R] Lack of independence in anova()
My first reaction to Duncan's example was Touché -- with apologies to Göran for suspecting on over-trivial example! I had not thought long enough about possible cases. Duncan is right; and maybe it is the same example as Göran was thinking of. Regarding Spencer's argument below, in Duncan's statement he says Z is supported on +/- A (i.e. Z = A or Z = -A), so P(|Z| 1) = 0 and so Spencer's 1-2z = 0 and z=1/2 (but Spencer stipulates that Z is symmetric). In general, suppose P(Z = A) = p 0 and P(Z = -A) = q = 1-p. Since X and Y are symmetric, X/A has the same distribution as X/(-A) and similarly for Y; hence for any v and w, P(X/Z = v | X = z) is independent of z = +/- A, therefore = P(X/Z = v); and similarly for Y. Also X/A, Y/A are independent, and so are X/(-A) and Y/(-A). Hence P(X/Z = v and Y/Z = w) = p*P(X/Z = v | Z = A)*P(Y/Z = w | Z = A) + q*P(X/Z = v | Z = -A)*P(Y/Z = w | Z = -A) = (p + q)*P(X/Z = v)*P(Y/Z = w) = P(X/Z = v)*P(Y/Z = w) so X/Z and Y/Z are independent. However, interesting though it maybe, this is a side-issue to the original question concerning independence of the F-ratios in an ANOVA. Here, numerators and denominator are all positive, so examples like the above are not relevant. The original argument (that increasing Z diminishes both X/Z and Y/Z simultaneously) applies; but it is also possible to demonstrate analytically that P(X/Z = v and Y/Z = w) is greater than P(X/Z = v)*P(Y/Z = w). The original issue also was that, in R, there might be a bug in anova(). However, one can, in R and independently of the behaviour of anova(), demonstrate this positive correlation: C-numeric(1); for(i in (1:1)){ X-rchisq(1000,5)/5 Y-rchisq(1000,5)/5 Z-rchisq(1000,20)/20 C[i]-cor(X/Z,Y/Z) } hist(C) which shows that all 1 correlations are positive. Best wishes to all, Ted. On 07-Jul-05 Spencer Graves wrote: Hi, Duncan Göran: Consider the following: X, Y, Z have symmetric distributions with the following restrictions: P(X=1)=P(X=-1)=x with P(|X|1)=0 so P(|X|1)=1-2x. P(Y=1)=P(Y=-1)=y with P(|Y|1)=0 so P(|Y|1)=1-2y. P(Z=1)=P(Z=-1)=z with P(|Z|1)=0 so P(|Z|1)=1-2z. Then P(X/Z=1)=2xz, P(Y/Z=1)=2yz, and P{(X/Z=1)(Y/Z)=1}=2xyz. Independence requires that this last probability is 4xyz^2. This is true only if z=0.5. If z0.5, then X/Z and Y/Z are clearly dependent. How's this? spencer graves Duncan Murdoch wrote: (Ted Harding) wrote: On 06-Jul-05 Göran Broström wrote: On Wed, Jul 06, 2005 at 10:06:45AM -0700, Thomas Lumley wrote: (...) If X, Y, and Z are independent and Z takes on more than one value then X/Z and Y/Z can't be independent. Not really true. I can produce a counterexample on request (admittedly quite trivial though). Göran Broström But true if both X and Y have positive probability of being non-zero, n'est-pas? Tut, tut, Göran! If X and Y are independent with symmetric distributions about zero, and Z is is supported on +/- A for some non-zero constant A, then X/Z and Y/Z are still independent. There are probably other special cases too. Duncan Murdoch __ 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 -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ 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 E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 07-Jul-05 Time: 11:18:04 -- XFMail -- __ 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
Re: 答复: 答复: [R] fail in adding librar y in new version.
Ivy_Li wrote: Dear all, I have done every step as the previous mail. 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable , and they are in the beginning of the Path ^ such blanks are not allowed in the PATH variable Because I install R in the D drive, so I set a fold MyRpackages in the same drive. Into the MyRpackages folder I write a R library named example, include DESCRIPTION file and R folder. In the R folder, the example file just content very simple code as the previous mail said. So in the Dos environment, at first, into the D:\, I type the following code: cd Program Files\R\rw2011\ MyRpackages does not need to be here. bin\R CMD install /MyRpackages/example The first slash in /MyRPackages sugests that this is a top level directory, which does not exist. Even better, cd to MyRpackages, add R's bin dir to your path variable, and simply say: R CMD INSTALL example There are some error: 'make' is neither internal or external command, nor executable operation or batch file *** installation of example failed *** Well, make.exe is not find in your path. Please check whether the file exists and the path has been added. Uwe Ligges Removing 'D:/PROGRA~1/R/rw2011/library/example' I think I have closed to success. heehee~ Thank you for your help. I still need you and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月30日 19:16 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: 答复: [R] fail in adding library in new version. On 6/30/05, Ivy_Li [EMAIL PROTECTED] wrote: Dear Gabor, Thank your for helping me so much! I have loaded R the newest version 2.1.1. Then I setup it in the path of D:\program files\R\ 1. unpack tools.zip into c:\cygwin 2. install Active perl in c:\Perl 3. install the mingw32 in c:\mingwin 4. add c:\cygwin; c:\mingwin\bin in Control Panel - System - Advanced - Environment Variables - Path - Variable (In your previous mail, you said put these at the beginning of the path, I don't understand what is your meaning. Which path?) If in the console you enter the command: path then it will display a semicolon separated list of folders. You want the folder that contains the tools to be at the beginning so that you eliminate the possibility of finding a different program of the same name first in a folder that comes prior to the one where the tools are stored. 5. I tried an library example. I set a new folder named example in the c:\MyRpackages\. And In the example folder, it contain an DESCRIPTION file and R folder. in R folder contain a example file. I just write very simple script in it: a-2; b-3;sum - sum(a,b); print(paste(a,+,b,=,sum)) 6. I opened the DOS environment. Into the D:\ Type the following code: cd \Program Files\R\rw2010 But I don't understand the second line you writed in your previous mail: bin\R cmd install /MyRPackages/example I was assuming that MyRPackages and R are on the same disk. If they are not then you need to specify the disk too. That is if MyRPackages is on C and R is installed on D then install your package via: d: cd \Program Files\R\rw2010 bin\R CMD install c:/MyRPackages/example Note that bin\R means to run R.exe in the bin subfolder of the current folder using command script install and the indicated source package. I am not sure that I set up R in D:\ But I do so much action in C:\ Did I do the correct action? Did I do the action into the correct path? If you are not sure where R is installed then enter the following at the Windows console prompt to find out (this will work provided you let it install the key into the registry when you installed R initially). The reg command is a command built into Windows (I used XP but I assume its the same on other versions) that will query the Windows registry: reg query hklm\software\r-core\r /v InstallPath I still need your and others help. Thank you very much! -原始邮件- 发件人: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 发送时间: 2005年6月6日 10:21 收件人: Ivy_Li 抄送: r-help@stat.math.ethz.ch 主题: Re: [R] fail in adding library in new version. On 6/5/05, Ivy_Li [EMAIL PROTECTED] wrote: Hello everybody, Could I consult you a question? I always use R old version 1.9.1 . Because I can not add my library into the new version 2.0.0 by the same method as old version. Getting the latest version of R is strongly recommended. The suggestions below all assume the latest version and may or may not work if you do not upgrade. * I have read the webpage http://www.stats.ox.ac.uk/pub/Rtools * Download the tools.zip * Unpack tools.zip into c:\cygwin * Install Active Perl in
[R] Making Package, Chm error, Html Help Workshop
Hello, When building my package (R CMD check) following error message occurs: ... varinf.plot text html latex example xtext html latex example make[2]: *** No rule to make target `disclosure.chm`. Stop. cp: cannot stat 'D:/Programme/R/rw2010dev/disclosure/chm/disclosure.chm`: No such file or directory make[1]: *** [chm-disclosure] Error 1 make: *** [pkg-disclosure] Error 2 *** Installation of disclosure failed *** Removing `D:/Programme/R/rw2010dev/bin/disclosure.Rcheck/disclosure' ERROR Installation failed. It seems, that there is a problem with HTML Workshop. No chm´s were built. When I uninstall the HTML Help Workshop and remove the entry in the path environmental variable and doing packaging after this, the same error occurs. I´m sure, that I have written the right entry (the path of the HTML help Workschop, where the hhc.exe file is) in the path of the environmental variable as the instructions said. (Windows XP, Intel, R 2.1.0, HTML Workshop 1.32) Has anybody seen such a problem before? Can anybody give me a hint, please? Thank you very much, Matthias __ 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
[R] about image() function in R and colors
Hi! I've got a map in R imported from a GIS (GRASS) as a vector of factors. So I've got 20 different levels in the map and I've created a vector of custom colors of exactly 20 colors in lenght. I'm trying to use image() (really plot.grassmeta() that call image()) to plot the map with those colors but it doesnt work and the colors are changed. I would like that all points belonging to level1 are color 1 , and so on... Please could you tell me if this procedure is not correct? Best regards, Javier -- A. Javier Garcia Water and Soil conservation department CEBAS-CSIC Campus Universitario Espinardo PO BOX 164 30100 Murcia (SPAIN) Phone: +34 968 39 62 57 Fax: +34 968 39 62 13 email: [EMAIL PROTECTED] __ 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
[R] Problems with nlme: Quinidine example
This concerns the Clinical Study of Quinidine example on page 380 of the book Mixed-Effects Models in S and S-PLUS by Pinheiro and Bates (2000). I have tried to reproduce the example, but get an error: library(nlme) fm1Quin.nlme - nlme(conc ~ quinModel(Subject, time, conc, dose, interval, lV, lKa, lCl), + data=Quinidine, + fixed=lV + lKa + lCl ~ 1, + random=pdDiag(lV + lCl ~ 1), + groups= ~ Subject, + start=list(fixed=c(5, -0.3, 2)), + na.action=na.pass, naPattern= ~ !is.na(conc)) Error in solve.default(estimates[dimE[1] - (p:1), dimE[2] - (p:1), drop = FALSE]) : system is computationally singular: reciprocal condition number = 6.61723e-17 Note: - I am running R version 2.1.0 on Linux. - The only difference between the code in the book and the code above is that I use na.pass instead of na.include for the na.action argument, but I don't think this is significant. I would appreciate help from anybody who has been able to get this example to work. __ 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
[R] Tables: Invitation to make a collective package
Hi All, I would like to make an invitation to make a collective package with all functions related to TABLES. I know that there are many packages with these functions, the original idea is collect all this functions and to make a single package, because is arduous for the user know all this functions broadcast in many packages. So, I think that the original packages can continue with its original functions, but, is very good to know that exist one package with many (I dream all) the functions related to tables. I've been working with these functions (while I am learning R programming): ### # Tables - Package # ### # # 1. Tables # # # Common function # tb.make.table.I - function(x, start, end, h, right) { f- table(cut(x, br=seq(start, end, h), right=right)) # Absolut freq fr - f/length(x) # Relative freq frP - 100*(f/length(x)) # Relative freq, % fac - cumsum(f) # Cumulative freq facP - 100*(cumsum(f/length(x))) # Cumulative freq, % fi - round(f, 2) fr - round(as.numeric(fr), 2) frP - round(as.numeric(frP), 2) fac - round(as.numeric(fac), 2) facP - round(as.numeric(facP),2) res - data.frame(fi, fr, frP, fac, facP)# Make final table names(res) - c('Class limits', 'fi', 'fr', 'fr(%)', 'fac', 'fac(%)') return(res) } # # Common function # tb.make.table.II - function (x, k, breaks=c('Sturges', 'Scott', 'FD'), right=FALSE) { x - na.omit(x) # User defines only x and/or 'breaks' # (x, {k,}[breaks, right]) if (missing(k)) { brk - match.arg(breaks) switch(brk, Sturges = k - nclass.Sturges(x), Scott = k - nclass.scott(x), FD = k - nclass.FD(x)) tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/k } # User defines 'x' and 'k' # (x, k,[breaks, right]) else { tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/abs(k) } tbl - tb.make.table.I(x, start, end, h, right) return(tbl) } # # With Gabor Grotendieck suggestions (thanks Gabor, very much!) # tb.table - function(x, ...) UseMethod(tb.table) # # Table form vectors # tb.table.default - function(x, k, start, end, h, breaks=c('Sturges', 'Scott', 'FD'), right=FALSE) { # User defines nothing or not 'x' isn't numeric - stop stopifnot(is.numeric(x)) x - na.omit(x) # User defines only 'x' # (x, {k, start, end, h}, [breaks, right]) if (missing(k) missing(start) missing(end) missing(h) ) { brk - match.arg(breaks) switch(brk, Sturges = k - nclass.Sturges(x), Scott = k - nclass.scott(x), FD = k - nclass.FD(x)) tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/k } # User defines 'x' and 'k' # (x, k, {start, end, h}, [breaks, right]) else if (missing(start) missing(end) missing(h)) { stopifnot(length(k) = 1) tmp - range(x) start - tmp[1] - abs(tmp[2])/100 end - tmp[2] + abs(tmp[2])/100 R - end-start h - R/abs(k) } # User defines 'x', 'start' and 'end' # (x, {k,} start, end, {h,} [breaks, right]) else if (missing(k) missing(h)) { stopifnot(length(start) = 1, length(end) =1) tmp - range(x) R - end-start k - sqrt(abs(R)) if (k 5) k - 5 # min value of k h - R/k } # User defines 'x', 'start', 'end' and 'h' # (x, {k,} start, end, h, [breaks, right]) else if (missing(k)) { stopifnot(length(start) = 1, length(end) = 1, length(h) = 1) } else stop('Error, please, see the function sintax!') tbl - tb.make.table.I(x, start, end, h, right) return(tbl) } # # Table form data.frame # tb.table.data.frame - function(df, k, by, breaks=c('Sturges', 'Scott', 'FD'), right=FALSE) { stopifnot(is.data.frame(df)) tmpList - list() nameF - character() nameY - character() # User didn't defines a factor if (missing(by)) { logCol - sapply(df, is.numeric) for (i in 1:ncol(df)) { if (logCol[i]) { x - as.matrix(df[ ,i]) tbl - tb.make.table.II(x, k,
[R] About ade4 and overlaying points
Dear R-users, Is there an easy way to avoid points one upon another when ploting rows and columns of 'dudi' objects ? Maybe there is a function in ade4 or in an other package, or maybe someone has his or her own function to do this (for example to automatically modify a little the coordinates of these points to get a readable plot ?). Thanks in advance. Best regards, Jacques VESLOT __ 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
Re: [R] about image() function in R and colors
I do not know the solution to your problem, but I had the similar problems with image() function and most of derived functions. It seems that 'image' function was really not meant for displaying image data, instead it was designed to display matrices in the image format. Matlab had the same problem and ended up creating 2 functions: 'image' (similar to R's 'image') and 'imshow' (designed for displaying image data). There are three major processing steps in the 'image' that are hard to control or reverse: 1) scaling of the data intensities ( problem explained by Javier). Scaling is not much of a problem if continuous palette of colors is used , or to quote ?image when 'col' is a list of colors such as that generated by 'rainbow', 'heat.colors', 'topo.colors', 'terrain.colors' or similar functions. However scaling causes problems in case of discontinuous color-maps (palettes). 2) scaling of the data dimensions so it fits in default size window instead of scaling of the window to fit the data. This results in image with non-square pixels. There might be a way to force 'image' not to scale dimensions, I just did not spend much time looking for it yet. 3) Flipping of the image. As ?image shows one needs to transpose and flip matrix horizontally or perform image(t(volcano)[ncol(volcano):1,]) for the image data to be visualized in proper orientation. All those steps make sense in case of visualizing 2D data, but they are a hindrance in case of visualizing images. Jarek \=== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation \__,| (703) 676-4192 \ [EMAIL PROTECTED] `\ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of javier garcia Sent: Thursday, July 07, 2005 7:23 AM To: R-Help Cc: [EMAIL PROTECTED] Subject: [R] about image() function in R and colors Hi! I've got a map in R imported from a GIS (GRASS) as a vector of factors. So I've got 20 different levels in the map and I've created a vector of custom colors of exactly 20 colors in lenght. I'm trying to use image() (really plot.grassmeta() that call image()) to plot the map with those colors but it doesnt work and the colors are changed. I would like that all points belonging to level1 are color 1 , and so on... Please could you tell me if this procedure is not correct? Best regards, Javier -- A. Javier Garcia Water and Soil conservation department CEBAS-CSIC Campus Universitario Espinardo PO BOX 164 30100 Murcia (SPAIN) Phone: +34 968 39 62 57 Fax: +34 968 39 62 13 email: [EMAIL PROTECTED] __ 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 __ 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