Re: [R] NotePad++ Syntax file
Thanks, Bjørn-Helge Mevik wrote: [Ricardo Rodriguez] Your XEN ICT Team webmas...@xen.net writes: John Kane wrote: No but have you had a look at Tinn-R http://www.sciviews.org/Tinn-R/. Any similar option for Mac OS X? I guess you can use Emacs on Mac OS X. I've downloaded and installed Aquamacs Emacs (http://aquamacs.org/download.shtml). It includes ESS by default and works great. As another also great option, there is a R TextMate (commercial http://macromates.com/) bundled available... svn checkout http://svn.textmate.org/trunk/Review/Bundles/ $HOME/Desktop/textmate-temp I am not able to compare them by now. Cheers, Ricardo -- Ricardo Rodríguez Your XEN ICT Team __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simulation Function - Save results
in order to return more multiple variables, you can put them in a list and then return this list. e.g. #Function A boot-function(a,b,c){ mean_boot-(a+b)/2 var_boot-c list(mean_boot = mean_boot, var_boot = var_boot) } out - boot(1,2,3) out $mean_boot [1] 1.5 $var_boot [1] 3 On Fri, Aug 14, 2009 at 1:15 PM, MarcioRibeiromes...@pop.com.br wrote: Hi listers, I am working on a simulation... But I am having some troubles... Suppose I have a function A which produces two results (mean and variance)... Then I would like to simulate this function A with a function B many times using the results from function A For example: #Function A boot-function(a,b,c){ mean_boot-(a+b)/2 var_boot-c #list(a=a,b=b,c=c) return(a) } Then I would like to create 2 vectors with the mean and var results from S simulations #Function B simul-function(S){ teste-rep(0,S) for(i in 1:S){ teste[i]-boot(10,12,15) #ACCORDING TO FUNCTION A I AM SAVING JUST THE MEAN_BOOT, BUT I ALSO NEED THE RESULT OF VAR_BOOT } var-var(teste) mean_emp-mean(var_boot) #THIS IS NOT WORKING, BECAUSE I DONT HAVE THE VAR_BOOT AT MY VECTOR var_emp-(sum((var_boot-var)**2))/S #THIS IS NOT WORKING, BECAUSE I DONT HAVE THE VAR_BOOT AT MY VECTOR } simul(5) But my problem is that I don't know how to save my results in 2 vectors in order to use then at function B. Thanks in advance, Marcio -- View this message in context: http://www.nabble.com/Simulation-Function---Save-results-tp24977851p24977851.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] re ading transposed data in read.csv
I have a data set (csv); e.g., ID samp1 samp2 samp3 samp4 G1 2332 12 87 G2 8545 49 76 G3 1246 39 28 G4 7326 18 13 and read it: data1-(read.csv(Datafolder/rawdata.csv,header=T)) It is fine with reading as above, but, if it is read as transposed values like: data1-t(read.csv(Datafolder/rawdata.csv,header=T)) ID G1 G2 G3 G4 samp1 238512 73 ... all values are shown in. How to get this transposed data as numerical values? Thank you in advance, Jin -- View this message in context: http://www.nabble.com/reading-transposed-data-in-read.csv-tp24979445p24979445.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to use R to perform prediction based on history data
Say I have a csv file, each row contains several fields, one of them are whether the row is success. In history data, I have all the fields including the result of whether it is success. In future data, I only have fields without the result. For example: history data: Field1 Field2 Field3 Field4 ResultField 1231CA TRUE443TRUE 23231 NC TRUE123FALSE 1231CAFALSE243TRUE The future data: Field1 Field2 Field3 Field4 23231 NC TRUE123 I am newbie in R and statistics, I just feel R could have some mechanism to give the probably of success rate based on history data. I tried to read in the csv data, and try to call factor on the list, but I am seeing error message: Error in sort.list(unique.default(x), na.last = TRUE) : Any idea are highly welcome. Thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Building 'R' from source for Windows.
rkevinbur...@charter.net wrote: I know I am going to catch alot of comments for this question but I am really stuck. If there is some written documentation that I have missed please redirect me. I want to build 'R' from source on a Windows Platform. The main reasons are that I want to check out a debugging some existing packages so I need to build with debug symbols and I want to check out a 64-bit version of 'R'. So I read the instuructions and downloaded and installed 'rtools' and extracted the source. Then I ran into this statement in R-admin.pdf: Open a command window at ‘R_HOME/src/gnuwin32’. Edit ‘MkRules’ to set the appropriate paths as needed and to set the type(s) of help that you want built. Beware: ‘MkRules’ contains tabs and some editors (e.g., WinEdt) silently remove them. Then run make all recommended and sit back and wait while the basic compile takes place. But when I go to this directory I don't see MkRules. In fact I don't see any files, just folders (bitmap and unicode). Are the instructions wrong ? Have I missed a step? Or is there somewhere I can retrieve the missing file (MkRules)? Thank you. Kevin It should be there. Three possibilities: - Your editor is not showing it because of extension issues (look for All files) - You are misinterpreting R_HOME as something other than the source directory. (Could this be a typo? R_HOME is usually the destination dir, but source is what makes sense here. Or are the instructions assuming builddir=srcdir=destdir?) - You unpacked it incorrectly or got the wrong source file. I checked http://cran.r-project.org/src/base/R-2/R-2.9.1.tar.gz and it does have the file in the right place. -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] re ading transposed data in read.csv
sandsky wrote: I have a data set (csv); e.g., ID samp1 samp2 samp3 samp4 G1 2332 12 87 G2 8545 49 76 G3 1246 39 28 G4 7326 18 13 and read it: data1-(read.csv(Datafolder/rawdata.csv,header=T)) It is fine with reading as above, but, if it is read as transposed values like: data1-t(read.csv(Datafolder/rawdata.csv,header=T)) ID G1 G2 G3 G4 samp1 238512 73 ... all values are shown in. How to get this transposed data as numerical values? Because ID is not numeric, and in a data frame each column must have the same data type. The least common denominator is character. Written explicitly, you have to transpose the numeric part, and paste in the names later. This could be shortened, but the example below gives the idea. Dieter d = data.frame(ID=c(G1,G2), samp1=1:2,samp2=5:6) d t(d) dt = as.data.frame(t(d[-1])) names(dt)= d[,1] -- View this message in context: http://www.nabble.com/reading-transposed-data-in-read.csv-tp24979445p24982142.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] re ading transposed data in read.csv
On Sat, 15 Aug 2009 09:20:04 +0200, Dieter Menne dieter.me...@menne-biomed.de wrote: sandsky wrote: I have a data set (csv); e.g., ID samp1 samp2 samp3 samp4 G1 2332 12 87 G2 8545 49 76 G3 1246 39 28 G4 7326 18 13 and read it: data1-(read.csv(Datafolder/rawdata.csv,header=T)) It is fine with reading as above, but, if it is read as transposed values like: data1-t(read.csv(Datafolder/rawdata.csv,header=T)) ID G1 G2 G3 G4 samp1 238512 73 ... all values are shown in. How to get this transposed data as numerical values? Because ID is not numeric, and in a data frame each column must have the same data type. The least common denominator is character. Written explicitly, you have to transpose the numeric part, and paste in the names later. This could be shortened, but the example below gives the idea. Dieter d = data.frame(ID=c(G1,G2), samp1=1:2,samp2=5:6) d t(d) dt = as.data.frame(t(d[-1])) names(dt)= d[,1] As Dieter has already said elements in each of column of a data.frame must be of the same type. But this is probably what you really after: tdf - read.table(textConnection(ID samp1 samp2 samp3 samp4 + G1 2332 12 87 + G2 8545 49 76 + G3 1246 39 28 + G4 7326 18 13 + ), header=T) library(reshape) recast(tdf, ...~ID) Using ID as id variables variable G1 G2 G3 G4 1samp1 23 85 12 73 2samp2 32 45 46 26 3samp3 12 49 39 18 4samp4 87 76 28 13 see reshape and plyr packages for this kind of data manipulation. -Vitalie. -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Solutions of equation systems
Greg Snow wrote: ?solve Dear Greg, I tried to use function solve, but I have some problems with it. Let's try with a simple equation: x + 3y -2z = 5 3x + 5y + 6z =7 a-matrix(c(1,3,-2,3,5,6),nrow=2,ncol=3) a [,1] [,2] [,3] [1,]1 -25 [2,]336 b-matrix(c(5,7),nrow=2,ncol=1) b [,1] [1,]5 [2,]7 When I try to solve this system, I find this error: solve(a,b) Error in solve.default(a, b) : 'b' must be compatible with 'a' Also, when i try to solve a system with n equation and n variables, solve works perfectly. Thanks in advance! Moreno __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading in mdb and outputting to sql (GIS application)
stephen sefick wrote: library(Hmisc) # Read all tables in the Microsoft Access database blabla.mdb # perhaps better change to Locale in which the .mdb file was # generated to avoid that accented table column names are # getting lost.file first Sys.setenv(PATH=paste(Sys.getenv('PATH'),'/sw/bin',sep=':')) d - mdb.get('/Users/sefick/Desktop/FtBragg_GeoDataBase_AuburnUNV.mdb') This is what I get when I try the above code Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings = character(0L)) : invalid multibyte string at 'faff' If you can e-mail me a relatively small mdb file that fails for you I'll debug. Also try specifying tables=TRUE to mdb.get to see if it can return the list of tables in the database without an error. Frank On Fri, Aug 14, 2009 at 12:27 PM, stephen sefickssef...@gmail.com wrote: thank you all- I will report back when I have tried on my computer at home. On Fri, Aug 14, 2009 at 12:24 PM, Phil Spectorspec...@stat.berkeley.edu wrote: Stephen - You can modify your path on the fly with Sys.setenv: Sys.setenv(PATH=paste(Sys.getenv('PATH'),'/sw/bin',sep=':')) should make executables installed in /sw/bin available to R. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Fri, 14 Aug 2009, stephen sefick wrote: Frank, I have tried to use this package, but because I am using fink to install packages the mdbtools binary they are not accessible by the function from within R. I checked this by just trying to call it with the system function and R returned /bin/sh not found. I can access the binary from the terminal, so the /sw/bin directory where mdbtools is located is in my PATH- at least at a terminal. thanks for the help, Stephen Sefick On Fri, Aug 14, 2009 at 11:27 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: The R Hmisc package interfaces these tools - see its mdb.get function. Frank Marc Schwartz wrote: On Aug 14, 2009, at 10:29 AM, stephen sefick wrote: I have a geodatabase and would like to import it into GRASS, but it is in .mbf. I use mac and linux, and don't have access to access on the machines that I normally use. I do have access to access at school, but I would like to find a way around this if possible. Any thoughts, comments, or suggestions would be welcome. thanks, I think that on Linux and OSX, from an open source perspective, the only option is to use MDB Tools, though I have seen mixed reports of success, including some threads in the R-Help archives. It also appears that there has been no development on the package for about 5 years, as the current version (0.6pre1) dates from 2004. That may suggest limited, if any, compatibility with recent versions of Access file formats. You can download the source tarball here: http://sourceforge.net/projects/mdbtools/ For OSX, it is available via MacPorts: http://trac.macports.org/browser/trunk/dports/databases/mdbtools/Portfile and for major Linux distributions, there are typically pre-compiled binaries available via the standard repos and installation tools (eg. yum and apt-get). There was also some work by the OO.org folks a while back to embed MDB Tools in OpenOffice, but I am not aware of the current state of the project or if it is even active any longer. There is a commercial option from Actual Technologies: http://www.actualtechnologies.com/product_access.php which appears to provide an ODBC driver for Access on OSX. The page focuses on the use of either Excel or FileMaker Pro with the driver. However, you may be able to get it to work with RODBC. I use Actual's ODBC driver for Oracle on OSX via RODBC, since Oracle has not seen fit to provide a free one as they do for Linux and have been very pleased. It was easy to install and configure, so take that for what it's worth. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
Re: [R] reading in mdb and outputting to sql (GIS application)
tables=TRUE does return a list of tables with no error. The problem is that I can't get into the database because I am on a macintosh. I would send you the database, but it is for a military base and I don't believe that I am allowed. I'll see if I can't figure it out. Thanks for all of the help. Stephen Sefick On Sat, Aug 15, 2009 at 7:44 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: stephen sefick wrote: library(Hmisc) # Read all tables in the Microsoft Access database blabla.mdb # perhaps better change to Locale in which the .mdb file was # generated to avoid that accented table column names are # getting lost.file first Sys.setenv(PATH=paste(Sys.getenv('PATH'),'/sw/bin',sep=':')) d - mdb.get('/Users/sefick/Desktop/FtBragg_GeoDataBase_AuburnUNV.mdb') This is what I get when I try the above code Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings = character(0L)) : invalid multibyte string at 'faff' If you can e-mail me a relatively small mdb file that fails for you I'll debug. Also try specifying tables=TRUE to mdb.get to see if it can return the list of tables in the database without an error. Frank On Fri, Aug 14, 2009 at 12:27 PM, stephen sefickssef...@gmail.com wrote: thank you all- I will report back when I have tried on my computer at home. On Fri, Aug 14, 2009 at 12:24 PM, Phil Spectorspec...@stat.berkeley.edu wrote: Stephen - You can modify your path on the fly with Sys.setenv: Sys.setenv(PATH=paste(Sys.getenv('PATH'),'/sw/bin',sep=':')) should make executables installed in /sw/bin available to R. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Fri, 14 Aug 2009, stephen sefick wrote: Frank, I have tried to use this package, but because I am using fink to install packages the mdbtools binary they are not accessible by the function from within R. I checked this by just trying to call it with the system function and R returned /bin/sh not found. I can access the binary from the terminal, so the /sw/bin directory where mdbtools is located is in my PATH- at least at a terminal. thanks for the help, Stephen Sefick On Fri, Aug 14, 2009 at 11:27 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: The R Hmisc package interfaces these tools - see its mdb.get function. Frank Marc Schwartz wrote: On Aug 14, 2009, at 10:29 AM, stephen sefick wrote: I have a geodatabase and would like to import it into GRASS, but it is in .mbf. I use mac and linux, and don't have access to access on the machines that I normally use. I do have access to access at school, but I would like to find a way around this if possible. Any thoughts, comments, or suggestions would be welcome. thanks, I think that on Linux and OSX, from an open source perspective, the only option is to use MDB Tools, though I have seen mixed reports of success, including some threads in the R-Help archives. It also appears that there has been no development on the package for about 5 years, as the current version (0.6pre1) dates from 2004. That may suggest limited, if any, compatibility with recent versions of Access file formats. You can download the source tarball here: http://sourceforge.net/projects/mdbtools/ For OSX, it is available via MacPorts: http://trac.macports.org/browser/trunk/dports/databases/mdbtools/Portfile and for major Linux distributions, there are typically pre-compiled binaries available via the standard repos and installation tools (eg. yum and apt-get). There was also some work by the OO.org folks a while back to embed MDB Tools in OpenOffice, but I am not aware of the current state of the project or if it is even active any longer. There is a commercial option from Actual Technologies: http://www.actualtechnologies.com/product_access.php which appears to provide an ODBC driver for Access on OSX. The page focuses on the use of either Excel or FileMaker Pro with the driver. However, you may be able to get it to work with RODBC. I use Actual's ODBC driver for Oracle on OSX via RODBC, since Oracle has not seen fit to provide a free one as they do for Linux and have been very pleased. It was easy to install and configure, so take that for what it's worth. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
[R] VAR (pckg: vars) and memory problem
Hi all, When I tried to estimate a VAR (package vars) of a rather large dataset with 5 lags: dim(trial.var) [1] 20388 2 I ran into memory troubles: summary(VAR(trial.var, type=none, p=5)) Error: cannot allocate vector of size 3.1 Gb In addition: Warning messages: 1: In diag(resids %*% solve(Sigma) %*% t(resids)) : Reached total allocation of 1535Mb: see help(memory.size) 2: In diag(resids %*% solve(Sigma) %*% t(resids)) : Reached total allocation of 1535Mb: see help(memory.size) 3: In diag(resids %*% solve(Sigma) %*% t(resids)) : Reached total allocation of 1535Mb: see help(memory.size) 4: In diag(resids %*% solve(Sigma) %*% t(resids)) : Reached total allocation of 1535Mb: see help(memory.size) Luckily, I was able to slice and dice my dataset into individual days with ca. 3000 lines each and estimated each subset. Now, I nonetheless would like to run the VAR over the whole set. Is there any way I can extend the memory used by R? Perhaps forcing it? I am running R on a XP box with 1GB RAM. Many thanks for any pointers. Bernd -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Solutions of equation systems
Moreno Mancosu wrote: Dear Greg, I tried to use function solve, but I have some problems with it. Let's try with a simple equation: x + 3y -2z = 5 3x + 5y + 6z =7 a-matrix(c(1,3,-2,3,5,6),nrow=2,ncol=3) a [,1] [,2] [,3] [1,]1 -25 [2,]336 b-matrix(c(5,7),nrow=2,ncol=1) b [,1] [1,]5 [2,]7 When I try to solve this system, I find this error: solve(a,b) Error in solve.default(a, b) : 'b' must be compatible with 'a' Also, when i try to solve a system with n equation and n variables, solve works perfectly. If you do ?solve then you will see that the matrix a must be non square (it says so in the description of a in section Arguments)/ and in section Details right at the end it is written that qr.solve can handle non-square systems. Your example can be solved in several ways. See this example A - matrix(c(1,2,3,5,6,7),nrow=2,byrow=T) b - c(2,8) A - matrix(c(1,3,-2,3,5,6),nrow=2,ncol=3) b - matrix(c(5,7),nrow=2,ncol=1) # a particular solution xsolve - qr.solve(A,b) xsolve # another particular solution xany - solve(qr(A,LAPACK=T),b) xany # QR decomposition of A-transposed ATQR - qr(t(A),LAPACK=TRUE) ATQR qr.Q(ATQR) qr.R(ATQR) # minimum norm solution comes from QR decomposition of t(A) # and solving t(R) %*% t(Q) %*% x = b in two steps # ! Lapack does a pivoted QR z - solve(t(qr.R(ATQR)),b[ATQR$pivot]) xmin - qr.Q(ATQR) %*% z xmin # null space of A library(MASS) A.null - Null(t(A)) A.null # test A %*% (xmin+5*A.null) /example ! Use the manual Berend -- View this message in context: http://www.nabble.com/Solutions-of-equation-systems-tp24958261p24984875.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading in mdb and outputting to sql (GIS application)
stephen sefick wrote: tables=TRUE does return a list of tables with no error. The problem is that I can't get into the database because I am on a macintosh. I would send you the database, but it is for a military base and I don't believe that I am allowed. I'll see if I can't figure it out. Thanks for all of the help. Stephen Sefick Then you'll need to get mdb-tools to work outside of R on your Mac before proceeding. Don't send any real database; only send a fake test database that fails. Frank On Sat, Aug 15, 2009 at 7:44 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: stephen sefick wrote: library(Hmisc) # Read all tables in the Microsoft Access database blabla.mdb # perhaps better change to Locale in which the .mdb file was # generated to avoid that accented table column names are # getting lost.file first Sys.setenv(PATH=paste(Sys.getenv('PATH'),'/sw/bin',sep=':')) d - mdb.get('/Users/sefick/Desktop/FtBragg_GeoDataBase_AuburnUNV.mdb') This is what I get when I try the above code Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings = character(0L)) : invalid multibyte string at 'faff' If you can e-mail me a relatively small mdb file that fails for you I'll debug. Also try specifying tables=TRUE to mdb.get to see if it can return the list of tables in the database without an error. Frank On Fri, Aug 14, 2009 at 12:27 PM, stephen sefickssef...@gmail.com wrote: thank you all- I will report back when I have tried on my computer at home. On Fri, Aug 14, 2009 at 12:24 PM, Phil Spectorspec...@stat.berkeley.edu wrote: Stephen - You can modify your path on the fly with Sys.setenv: Sys.setenv(PATH=paste(Sys.getenv('PATH'),'/sw/bin',sep=':')) should make executables installed in /sw/bin available to R. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Fri, 14 Aug 2009, stephen sefick wrote: Frank, I have tried to use this package, but because I am using fink to install packages the mdbtools binary they are not accessible by the function from within R. I checked this by just trying to call it with the system function and R returned /bin/sh not found. I can access the binary from the terminal, so the /sw/bin directory where mdbtools is located is in my PATH- at least at a terminal. thanks for the help, Stephen Sefick On Fri, Aug 14, 2009 at 11:27 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: The R Hmisc package interfaces these tools - see its mdb.get function. Frank Marc Schwartz wrote: On Aug 14, 2009, at 10:29 AM, stephen sefick wrote: I have a geodatabase and would like to import it into GRASS, but it is in .mbf. I use mac and linux, and don't have access to access on the machines that I normally use. I do have access to access at school, but I would like to find a way around this if possible. Any thoughts, comments, or suggestions would be welcome. thanks, I think that on Linux and OSX, from an open source perspective, the only option is to use MDB Tools, though I have seen mixed reports of success, including some threads in the R-Help archives. It also appears that there has been no development on the package for about 5 years, as the current version (0.6pre1) dates from 2004. That may suggest limited, if any, compatibility with recent versions of Access file formats. You can download the source tarball here: http://sourceforge.net/projects/mdbtools/ For OSX, it is available via MacPorts: http://trac.macports.org/browser/trunk/dports/databases/mdbtools/Portfile and for major Linux distributions, there are typically pre-compiled binaries available via the standard repos and installation tools (eg. yum and apt-get). There was also some work by the OO.org folks a while back to embed MDB Tools in OpenOffice, but I am not aware of the current state of the project or if it is even active any longer. There is a commercial option from Actual Technologies: http://www.actualtechnologies.com/product_access.php which appears to provide an ODBC driver for Access on OSX. The page focuses on the use of either Excel or FileMaker Pro with the driver. However, you may be able to get it to work with RODBC. I use Actual's ODBC driver for Oracle on OSX via RODBC, since Oracle has not seen fit to provide a free one as they do for Linux and have been very pleased. It was easy to install and configure, so take that for what it's worth. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair
Re: [R] re ading transposed data in read.csv
tdf - read.table(textConnection(ID samp1 samp2 samp3 samp4 + G1 2332 12 87 + G2 8545 49 76 + G3 1246 39 28 + G4 7326 18 13 + ), header=T) library(reshape) recast(tdf, ...~ID) Using ID as id variables variable G1 G2 G3 G4 1samp1 23 85 12 73 2samp2 32 45 46 26 3samp3 12 49 39 18 4samp4 87 76 28 13 see reshape and plyr packages for this kind of data manipulation. These packages can be helpful if you know what you want, but to start off it is sometimes more important to do things explicitly. While I think that plyr is definitively a must, getting the syntax right in reshape often needs longer than writing the explicit code. Dieter -- View this message in context: http://www.nabble.com/reading-transposed-data-in-read.csv-tp24979445p24985038.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] aov p values for levels of a factor.
John Sorkin wrote: I am running an balanced aov, in which Time has 4 levels, Group has 2 levels: fit2-aov(Post ~ as.factor(Time) +as.factor(Group)+as.factor(Group*Time)+Error(SS), alldata) I would like to get a p value for each level of time, each level of Group and each level of Group*Time. How can I do this? I get this, which appears to be omnibus p values for the factors: Whatever method you use, I recommend to convert to factors in the data frame and leave out the as.factor, because contrast can look messy otherwise and you could be caught by typos when defining these. For lm, use estimable in package gmodels; after a slight reformulation, you could also use contrast in Frank Harrell's Design package. Dieter -- View this message in context: http://www.nabble.com/aov---p-values-for-levels-of-a-factor.-tp24977991p24985429.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to use R to perform prediction based on history data
Please have a look at the posting guide. For your problem of loading the data, we do not know what you have done and, therefore, cannot even try to guess what the reason for the error message may be. So at least we need information what you did in R (the code). Second, the posting guide generally requires to provide minimally self-contained code. In other words, an example that we just have to copy in the R prompt that reproduces your problem. Often the attempt to create such an example makes you find the source of the error yourself. As for the modeling question, yes, R allows you to predict for many estimated models. However, this is dangerous if you are new to statistics and don't really know what you are doing. You should ask your/a local statistician/econometrician to help you with modeling your data. Everything we could do from a distance is vague, especially given the vague description of your data. Best, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Jack Su Gesendet: Friday, August 14, 2009 10:28 PM An: r-help@r-project.org Betreff: [R] How to use R to perform prediction based on history data Say I have a csv file, each row contains several fields, one of them are whether the row is success. In history data, I have all the fields including the result of whether it is success. In future data, I only have fields without the result. For example: history data: Field1 Field2 Field3 Field4 ResultField 1231CA TRUE443TRUE 23231 NC TRUE123FALSE 1231CAFALSE243TRUE The future data: Field1 Field2 Field3 Field4 23231 NC TRUE123 I am newbie in R and statistics, I just feel R could have some mechanism to give the probably of success rate based on history data. I tried to read in the csv data, and try to call factor on the list, but I am seeing error message: Error in sort.list(unique.default(x), na.last = TRUE) : Any idea are highly welcome. Thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error in running RWeka Clusteres
Hi, I have a question about using RWeka Clusterers.If you could supply answer or insight, I would really appreciate it. When I run a simple code which uses a clusterer from RWeka I get an error. the sample codes and errors are mentioned below Code: library(RWeka) Cobweb(iris[,-5],control=NULL) Error: Error in names(class_ids) - nms : 'names' attribute [150] must be the same length as the vector [0] In addition: Warning message: In is.nan(class) : is.nan() applied to non-(list or vector) of type 'NULL' another example of such an error is: Code: library(RWeka) cl1 - SimpleKMeans(iris[, -5], Weka_control(N = 3)) Error: Error in names(class_ids) - nms : 'names' attribute [150] must be the same length as the vector [0] In addition: Warning message: In is.nan(class) : is.nan() applied to non-(list or vector) of type 'NULL' I even copied the last code from Package RWeka manual but it still has the problem. for all clusterers in RWeka I have the same problem. I also used make_Weka_clusterer but the same error occures. I used different data sets and again the same error. I'm using R version 2.9.1 How can I use the clusterers of RWeka without any error? I'd really appreciate it if you could help me on this problem. Thank you, - Farid [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Solutions of equation systems
Since you have an under-determined system of linear equations, you have infinitely many solutions. One reasonable solution is the minimum-norm solution. You can obtain this from singular-value decomposition as follows: # Minimum norm solution `x': A %*% x = b, such that ||x|| is minumum d - svd(A) x.min - c(d$v %*% diag(1/d$d, length(d$d)) %*% t(d$u) %*% b) # min-norm solution Hope this helps, Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Berend Hasselman b...@xs4all.nl Date: Saturday, August 15, 2009 10:03 am Subject: Re: [R] Solutions of equation systems To: r-help@r-project.org Moreno Mancosu wrote: Dear Greg, I tried to use function solve, but I have some problems with it. Let's try with a simple equation: x + 3y -2z = 5 3x + 5y + 6z =7 a-matrix(c(1,3,-2,3,5,6),nrow=2,ncol=3) a [,1] [,2] [,3] [1,]1 -25 [2,]336 b-matrix(c(5,7),nrow=2,ncol=1) b [,1] [1,]5 [2,]7 When I try to solve this system, I find this error: solve(a,b) Error in solve.default(a, b) : 'b' must be compatible with 'a' Also, when i try to solve a system with n equation and n variables, solve works perfectly. If you do ?solve then you will see that the matrix a must be non square (it says so in the description of a in section Arguments)/ and in section Details right at the end it is written that qr.solve can handle non-square systems. Your example can be solved in several ways. See this example A - matrix(c(1,2,3,5,6,7),nrow=2,byrow=T) b - c(2,8) A - matrix(c(1,3,-2,3,5,6),nrow=2,ncol=3) b - matrix(c(5,7),nrow=2,ncol=1) # a particular solution xsolve - qr.solve(A,b) xsolve # another particular solution xany - solve(qr(A,LAPACK=T),b) xany # QR decomposition of A-transposed ATQR - qr(t(A),LAPACK=TRUE) ATQR qr.Q(ATQR) qr.R(ATQR) # minimum norm solution comes from QR decomposition of t(A) # and solving t(R) %*% t(Q) %*% x = b in two steps # ! Lapack does a pivoted QR z - solve(t(qr.R(ATQR)),b[ATQR$pivot]) xmin - qr.Q(ATQR) %*% z xmin # null space of A library(MASS) A.null - Null(t(A)) A.null # test A %*% (xmin+5*A.null) /example ! Use the manual Berend -- View this message in context: Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Estimate Discrete Choice Models with R
Thanks for the replies. What I'm really interest in are the functions that can do GEV, probit, and mixed logit. I searched R, and I did find the function that can do the regular multinomial logit model, but I did not see the function that can do GEV, probit, and mixed logit. Any further advices? Thanks. Harry On Fri, Aug 14, 2009 at 3:49 PM, Hongwei Dong pdxd...@gmail.com wrote: Hi, R users, Does anyone know whether there are any Discrete Choice Modeling modules for R? Any books or websites discussing this? Thanks Harry [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Filling in a uniform dist plot
Hi all, Apologies in advance if this is really too simple, but I have given a good shot at this. I'm generating a standard uniform distibution y - dunif(x) plot(x,y,type=l) This will draw a horizontal line at y = 1. I want to fill the area from x=(0,1) with a color. I've tried the polygon command to create a polygon of the same shape, but can't seem to set the parameters to fill the figure from x=(0,1). I'm sure there is an easy way to do this, but any advice would be welcome. Thanks in advance. David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Filling in a uniform dist plot
David Kaplan wrote: Hi all, Apologies in advance if this is really too simple, but I have given a good shot at this. I'm generating a standard uniform distibution y - dunif(x) plot(x,y,type=l) This will draw a horizontal line at y = 1. I want to fill the area from x=(0,1) with a color. I've tried the polygon command to create a polygon of the same shape, but can't seem to set the parameters to fill the figure from x=(0,1). I'm sure there is an easy way to do this, but any advice would be welcome. Thanks in advance. Something like x - seq(0,1,,10) y - dunif(x) plot(x,y, ylim=range(0,y)) polygon(c(0,x,1), c(0,y,0), col=red, border=NA) David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error in running RWeka Clusteres
Hi all, The problem is solved uninstalling the R and restarting the system and installing it again. I don't know what caused the error but reinstalling the R was not enough and the system must be restarted. Thanks Farid -Original Message- From: Farid Seifi fa...@comp.iust.ac.ir To: R-help@r-project.org Date: Sat, 15 Aug 2009 20:02:42 +0330 Subject: [R] Error in running RWeka Clusteres Hi, I have a question about using RWeka Clusterers.If you could supply answer or insight, I would really appreciate it. When I run a simple code which uses a clusterer from RWeka I get an error. the sample codes and errors are mentioned below Code: library(RWeka) Cobweb(iris[,-5],control=NULL) Error: Error in names(class_ids) - nms : 'names' attribute [150] must be the same length as the vector [0] In addition: Warning message: In is.nan(class) : is.nan() applied to non-(list or vector) of type 'NULL' another example of such an error is: Code: library(RWeka) cl1 - SimpleKMeans(iris[, -5], Weka_control(N = 3)) Error: Error in names(class_ids) - nms : 'names' attribute [150] must be the same length as the vector [0] In addition: Warning message: In is.nan(class) : is.nan() applied to non-(list or vector) of type 'NULL' I even copied the last code from Package RWeka manual but it still has the problem. for all clusterers in RWeka I have the same problem. I also used make_Weka_clusterer but the same error occures. I used different data sets and again the same error. I'm using R version 2.9.1 How can I use the clusterers of RWeka without any error? I'd really appreciate it if you could help me on this problem. Thank you, - Farid [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help [https://stat.ethz.ch/mailman/listinfo/r-help] PLEASE do read the posting guide http://www.R-project.org/posting-guide.html [http://www.r-project.org/posting-guide.html] and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Filling in a uniform dist plot
Yep. That's it. Thanks. David Peter Dalgaard wrote: David Kaplan wrote: Hi all, Apologies in advance if this is really too simple, but I have given a good shot at this. I'm generating a standard uniform distibution y - dunif(x) plot(x,y,type=l) This will draw a horizontal line at y = 1. I want to fill the area from x=(0,1) with a color. I've tried the polygon command to create a polygon of the same shape, but can't seem to set the parameters to fill the figure from x=(0,1). I'm sure there is an easy way to do this, but any advice would be welcome. Thanks in advance. Something like x - seq(0,1,,10) y - dunif(x) plot(x,y, ylim=range(0,y)) polygon(c(0,x,1), c(0,y,0), col=red, border=NA) David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] extracting text from wordnet using synonym()
Dear group, There are postings on extracting partial string using sub()/gsub()/gsubfn() but I still couldn't figure this one out. Supposed I am pulling the synonyms of help using synonyms(help) from wordnet and get the followings: synonyms(help) [1] c(\aid\, \assist\, \assistance\, \help\) [2] c(\aid\, \assistance\, \help\) How can I get a one character string at the end that looks like this: [1] aid assist assistance help aid assist help Thanks for the help! Kelvin -- View this message in context: http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting text from wordnet using synonym()
Try this: Str - c(c(\aid\, \assist\, \assistance\, \help\), c(\aid\, \assistance\, \help\)) unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE)) On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam lamk...@gmail.com wrote: Dear group, There are postings on extracting partial string using sub()/gsub()/gsubfn() but I still couldn't figure this one out. Supposed I am pulling the synonyms of help using synonyms(help) from wordnet and get the followings: synonyms(help) [1] c(\aid\, \assist\, \assistance\, \help\) [2] c(\aid\, \assistance\, \help\) How can I get a one character string at the end that looks like this: [1] aid assist assistance help aid assist help Thanks for the help! Kelvin -- View this message in context: http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting text from wordnet using synonym()
Or a variation: unlist(lapply(parse(text = Str), eval)) [1] aidassist assistance help aid [6] assistance help On Sat, Aug 15, 2009 at 5:55 PM, Henrique Dallazuannawww...@gmail.com wrote: Try this: Str - c(c(\aid\, \assist\, \assistance\, \help\), c(\aid\, \assistance\, \help\)) unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE)) On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam lamk...@gmail.com wrote: Dear group, There are postings on extracting partial string using sub()/gsub()/gsubfn() but I still couldn't figure this one out. Supposed I am pulling the synonyms of help using synonyms(help) from wordnet and get the followings: synonyms(help) [1] c(\aid\, \assist\, \assistance\, \help\) [2] c(\aid\, \assistance\, \help\) How can I get a one character string at the end that looks like this: [1] aid assist assistance help aid assist help Thanks for the help! Kelvin -- View this message in context: http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Building 'R' from source for Windows.
Thank you for looking into this. It turns out the problem was You are misinterpreting R_HOME. . . I thought R_HOME was were I installed R not the directory where I was trying to compile the source. Once I moved the extra stuff that RTools.exe installed in what I thought was the R installation directory to where I was trying to cimpile the R source it became apparent what I had done wrong. Thanks again. But unfortunately this brings up two more questions. One the function or project that I would like to start debugging is in appl (I would like to step into the L-LBFGSB lbfgsb.c code). The documentation that was with the RTools code mentioned that if I built a package like 'make DEBUG=T package' it would insert -gdwarf-2 in the compiler swtiches and that would allow be to set a breakpoint. Well I am not sure if the fact that this is not a package if that is why it didn't work but if I go to the appl directory and enter 'make DEBUG=T', I don't see gcc called with -gdwarf-2. If I go to the gnuwin32 directory and try to build all of 'R' like 'make DEBUG=T all recommended' I see the -gdwarf=2 flag added to compilation of each file. But I would rather not add debugging information to all the source in R. Any suggestions? The second question is kind of like 'Where do I go from here?'. From the instructions I get that I probably need to use 'Inno' to build an installation. Hopefully once the first problem is solved this installation will have debugging symbols where I need them. If I run the resultant self-extracting installer will that just overwrite my R installation and now I debug with that? Again, thanks for the additional tips. It has been a long time since I last debugged with anything other than Windows Visual Studio and this will take some getting used to. Kevin Peter Dalgaard p.dalga...@biostat.ku.dk wrote: rkevinbur...@charter.net wrote: I know I am going to catch alot of comments for this question but I am really stuck. If there is some written documentation that I have missed please redirect me. I want to build 'R' from source on a Windows Platform. The main reasons are that I want to check out a debugging some existing packages so I need to build with debug symbols and I want to check out a 64-bit version of 'R'. So I read the instuructions and downloaded and installed 'rtools' and extracted the source. Then I ran into this statement in R-admin.pdf: Open a command window at ‘R_HOME/src/gnuwin32’. Edit ‘MkRules’ to set the appropriate paths as needed and to set the type(s) of help that you want built. Beware: ‘MkRules’ contains tabs and some editors (e.g., WinEdt) silently remove them. Then run make all recommended and sit back and wait while the basic compile takes place. But when I go to this directory I don't see MkRules. In fact I don't see any files, just folders (bitmap and unicode). Are the instructions wrong ? Have I missed a step? Or is there somewhere I can retrieve the missing file (MkRules)? Thank you. Kevin It should be there. Three possibilities: - Your editor is not showing it because of extension issues (look for All files) - You are misinterpreting R_HOME as something other than the source directory. (Could this be a typo? R_HOME is usually the destination dir, but source is what makes sense here. Or are the instructions assuming builddir=srcdir=destdir?) - You unpacked it incorrectly or got the wrong source file. I checked http://cran.r-project.org/src/base/R-2/R-2.9.1.tar.gz and it does have the file in the right place. -- 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 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] System is computationally singular and scale of covariates
Dear all, I'm running a self-written numerical optimization routine (hazard model) which includes computing the inverse of the outer product of the score. I have been getting the above error message (System is computationally singular), and after some tweaking, I realized that these variables have some high numbers and the problem could be circumvented by scaling them down (i.e. dividing them by 100 or taking log). Since this is obviously not the best procedure, and since I have to estimate more complex models down the rode, I would like to understand better the reason which causes this problem. It is not a multicollinearity issue (I get the error even when using one single variable), and I think my code is clean (better be paranoid though). My sense is that the outer product just becomes large, and these are hard to invert. Maybe there are restrictions concering R in the size of the numbers? If that is the case, I think I would fare better scaling down the outer product rather than the variable itself, but I first wanted to ask the community to get and understanding of what could be the problem. Thanks a lot, Stephan Lindner -- --- Stephan Lindner University of Michigan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] question
Hi, How to compute survival tree based on logrank statistics from R package? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to plot 3-D surface graph from lmer mixed models?
Hi, First of all, I thank Professor Murdoch and Dr Sarkar for providing important information. Now, this problem has been basically solved. The package akima helps to fultil the objective originally resorting to expand.grid. Now, I can use contour or perspective 3-D plot. Hopefully, this experience can do some help to other users with similar problems. However, I am still trying to use the method suggested by Dr Sarkar, since I think wireframe or levelplot may produce more beautiful pictures. Thank you again! Cheers! willow1980 wrote: Dear R users, I have a problem in plotting 3 dimensional graph using mixed models. My model is sur_prop ~ afr_c+I(afr_c^2)+I(afr_c^3)+byear_c+I(byear_c^2)+I(byear_c^3)+I(byear_c^4)+(1|Studyparish)+afr_c:byear_c +afr_c:I(byear_c^2)+afr_c:I(byear_c^3)+afr_c:I(byear_c^4)+I(afr_c^2):byear_c+I(afr_c^2):I(byear_c^2)+I(afr_c^2):I(byear_c^3)+I(afr_c^2):I(byear_c^4) This is a study on the effect of mothers' age and cohort year on children's survival. I can extract predicted value using a suggested method from website: mo...@x%*%fixef(model). To my knowledge, this method is reasonable. It is a bit alike matrix representation in multiple regression. However, I cannot use such predicted values together with age and cohort values to plot a 3-D surface plot. Since my dataset is very large, it is certainly useless to plot 3-D points scatter plot, which is very difficult to discern the pattern. By the way, I have tried plot3d, scatterplot and regr2.plot to give scatter plot. So, do you have any suggestion on how to plot a surface plot given above information? For example, how to use persp or wireframe in case of lmer with more than two explanatory variables? Thank you very much for helping! Best wishes! -- View this message in context: http://www.nabble.com/How-to-plot-3-D-surface-graph-from-lmer-mixed-models--tp24952273p24984809.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] coefficient p-value in ridge regression
Hello. I'have a problem with RIDGE REGRESSION. I've used lm.ridge function to estimate coefficients of my model. Why in the summary of models not appears t value, Pr(|t|) and significance stars? How I can calculate coefficient's p-value in ridge regression? Thanks! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Building 'R' from source for Windows.
rkevinbur...@charter.net wrote: Thank you for looking into this. It turns out the problem was You are misinterpreting R_HOME. . . I thought R_HOME was were I installed R not the directory where I was trying to compile the source. Once I moved the extra stuff that RTools.exe installed in what I thought was the R installation directory to where I was trying to cimpile the R source it became apparent what I had done wrong. Thanks again. But unfortunately this brings up two more questions. One the function or project that I would like to start debugging is in appl (I would like to step into the L-LBFGSB lbfgsb.c code). The documentation that was with the RTools code mentioned that if I built a package like 'make DEBUG=T package' it would insert -gdwarf-2 in the compiler swtiches and that would allow be to set a breakpoint. Well I am not sure if the fact that this is not a package if that is why it didn't work but if I go to the appl directory and enter 'make DEBUG=T', I don't see gcc called with -gdwarf-2. If I go to the gnuwin32 directory and try to build all of 'R' like 'make DEBUG=T all recommended' I see the -gdwarf=2 flag added to compilation of each file. But I would rather not add debugging information to all the source in R. Any suggestions? Build R without debugging, touch the files you want to debug, and rebuild it. But make DEBUG=T package will never work: package is unlikely to be a make target. You need Rcmd INSTALL package, with DEBUG=T defined in the environment. The second question is kind of like 'Where do I go from here?'. From the instructions I get that I probably need to use 'Inno' to build an installation. Hopefully once the first problem is solved this installation will have debugging symbols where I need them. If I run the resultant self-extracting installer will that just overwrite my R installation and now I debug with that? Don't bother installing. Just debug what gets built in the bin directory. Again, thanks for the additional tips. It has been a long time since I last debugged with anything other than Windows Visual Studio and this will take some getting used to. Debugging gcc programs in Windows is rather painful. The problems are: - MinGW doesn't provide a graphical front end. You need to go back to the 70s and debug using gdb. - Cygwin does provide Insight, but it's like living in the early 90s, and it doesn't completely work. - We (blame me!) don't provide an easy way to build R with different optimization levels than the one we use for distribution builds. Building with -O0 might make debugging easier, if it doesn't change the meaning of the program. (If it does change the meaning, it will waste so much time that I've decided not to do it.) - Microsoft and other makers of good debuggers won't support gcc debug info. It would take one of their programmers a couple of weeks to do so, but they choose not to. One more comment below... Kevin Peter Dalgaard p.dalga...@biostat.ku.dk wrote: rkevinbur...@charter.net wrote: I know I am going to catch alot of comments for this question but I am really stuck. If there is some written documentation that I have missed please redirect me. I want to build 'R' from source on a Windows Platform. The main reasons are that I want to check out a debugging some existing packages so I need to build with debug symbols and I want to check out a 64-bit version of 'R'. So I read the instuructions and downloaded and installed 'rtools' and extracted the source. Then I ran into this statement in R-admin.pdf: Open a command window at ‘R_HOME/src/gnuwin32’. Edit ‘MkRules’ to set the appropriate paths as needed and to set the type(s) of help that you want built. Beware: ‘MkRules’ contains tabs and some editors (e.g., WinEdt) silently remove them. Then run make all recommended and sit back and wait while the basic compile takes place. But when I go to this directory I don't see MkRules. In fact I don't see any files, just folders (bitmap and unicode). Are the instructions wrong ? Have I missed a step? Or is there somewhere I can retrieve the missing file (MkRules)? Thank you. Kevin It should be there. Three possibilities: - Your editor is not showing it because of extension issues (look for All files) - You are misinterpreting R_HOME as something other than the source directory. (Could this be a typo? R_HOME is usually the destination dir, but source is what makes sense here. Or are the instructions assuming builddir=srcdir=destdir?) On Windows, builddir=srcdir=destdir. Duncan Murdoch - You unpacked it incorrectly or got the wrong source file. I checked http://cran.r-project.org/src/base/R-2/R-2.9.1.tar.gz and it does have the file in the right place. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) --
Re: [R] Estimate Discrete Choice Models with R
glm can do probit regression, and glmer (lme4 package) and do mixed effect logit model. Ronggui 2009/8/16 Hongwei Dong pdxd...@gmail.com: Thanks for the replies. What I'm really interest in are the functions that can do GEV, probit, and mixed logit. I searched R, and I did find the function that can do the regular multinomial logit model, but I did not see the function that can do GEV, probit, and mixed logit. Any further advices? Thanks. Harry On Fri, Aug 14, 2009 at 3:49 PM, Hongwei Dong pdxd...@gmail.com wrote: Hi, R users, Does anyone know whether there are any Discrete Choice Modeling modules for R? Any books or websites discussing this? Thanks Harry [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting text from wordnet using synonym()
Thank you both! It works now. (Need to check out the parsing ) Gabor Grothendieck wrote: Or a variation: unlist(lapply(parse(text = Str), eval)) [1] aidassist assistance help aid [6] assistance help On Sat, Aug 15, 2009 at 5:55 PM, Henrique Dallazuannawww...@gmail.com wrote: Try this: Str - c(c(\aid\, \assist\, \assistance\, \help\), c(\aid\, \assistance\, \help\)) unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE)) On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam lamk...@gmail.com wrote: Dear group, There are postings on extracting partial string using sub()/gsub()/gsubfn() but I still couldn't figure this one out. Supposed I am pulling the synonyms of help using synonyms(help) from wordnet and get the followings: synonyms(help) [1] c(\aid\, \assist\, \assistance\, \help\) [2] c(\aid\, \assistance\, \help\) How can I get a one character string at the end that looks like this: [1] aid assist assistance help aid assist help Thanks for the help! Kelvin -- View this message in context: http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24989814.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] why summary() does not work here???
Hi, R users, I'm using the function vglm to estimate a multinomial logit model. Every time I use summary() to ask for the coefficients and std error, I got this: Length Class Mode 1 vglm S4 Anyone know what's wrong here? Thanks. Harry [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] why summary() does not work here???
I cannot reproduce what you mentioned. One possible is that you use summary() without loading VGAM package. 2009/8/16 Hongwei Dong pdxd...@gmail.com: Hi, R users, I'm using the function vglm to estimate a multinomial logit model. Every time I use summary() to ask for the coefficients and std error, I got this: Length Class Mode 1 vglm S4 Anyone know what's wrong here? Thanks. Harry [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- HUANG Ronggui, Wincent PhD Candidate Dept of Public and Social Administration City University of Hong Kong Home page: http://asrr.r-forge.r-project.org/rghuang.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.