Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Marc Schwartz
On Nov 19, 2009, at 4:31 PM, Peng Yu wrote: On Thu, Nov 19, 2009 at 4:27 PM, Marc Schwartz wrote: On Nov 20, 2009, at 10:21 AM, Peng Yu wrote: There are a few version of apply() (e.g., lapply(), sapply()). I'm wondering if there is one that does not return anything but just silently

Re: [R] How to extract the variable names from a formula

2009-11-19 Thread Marc Schwartz
On Nov 19, 2009, at 9:28 PM, Yihui Xie wrote: Hi all, Suppose I have a formula: a = log(y) ~ x1 + I(x2^2) How can I extract the original variable names 'y', 'x1', 'x2' from this formula? Thanks a lot! Regards, Yihui > all.vars(a) [1] "y" &q

Re: [R] find data (date) gaps in time series

2009-11-20 Thread Marc Schwartz
31" "2002-04-01" "2002-04-02" "2002-04-03" [36] "2002-04-04" "2002-04-05" "2002-04-06" "2002-04-07" "2002-04-08" [41] "2002-04-09" "2002-04-10" "2002-04-11" "2002-04-12&qu

Re: [R] how do i persuade IT to install R on PCs ?? ...and should I ??

2009-11-22 Thread Marc Schwartz
ng IT's support, presuming that your managers are in a position of influence with IT. It would be difficult to provide detailed guidance to you without more information on your specific environment, but hopefully the above provides food for thought, at least in the abstract. Ch

Re: [R] Do you keep an archive of "useful" R code? and if so - how?

2009-11-22 Thread Marc Schwartz
there are a plethora of GUI based clients for Subversion available depending upon the operating systems you are using. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Do you keep an archive of "useful" R code? and if so - how?

2009-11-22 Thread Marc Schwartz
gt; system or a new package. > > I hope my question was made more clear, and your answer will be much > appreciated. > > Best, > Tal > On Sun, Nov 22, 2009 at 7:13 PM, Marc Schwartz > wrote: > On Nov 22, 2009, at 10:53 AM, Tal Galili wrote: > > Hello all,

Re: [R] mac os X: mprobit fails to install

2009-11-22 Thread Marc Schwartz
Xcode is available for download here: http://developer.apple.com/technology/xcode.html As David noted, you do need to register, but it is free. Note also that it is a 750 Mb download. HTH, Marc Schwartz On Nov 22, 2009, at 3:11 PM, David Winsemius wrote: On Nov 22, 2009, at 4:00 PM

Re: [R] how do i persuade IT to install R on PCs ?? ...and should I ??

2009-11-23 Thread Marc Schwartz
the same errors as MS and OO.org, at least in this narrow example. Also, here are two additional Excel resources: David Heiser's page: http://www.daheiser.info/excel/frontpage.html Patrick Burns' Spreadsheet Addition: http://www.burns-stat.com/pa

Re: [R] Excel-Export

2009-11-23 Thread Marc Schwartz
://www.omegahat.org/RDCOMClient/ See examples in the Introduction for that package. 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

Re: [R] How do I specify a partially completed survival analysis model?

2009-11-23 Thread Marc Schwartz
inging. Would that be SAS1N1 and is there a vaccine that one can distribute to universities and corporations to prevent the spread of the infection? ;-) Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listin

Re: [R] Configuring R-2.10 help html server on Linux?

2009-11-23 Thread Marc Schwartz
ception for 127.0.0.1. ..." The Firefox configuration/preference dialogs are similar across OSs, albeit on OSX they are at the top of the display rather than on the Firefox application window frame as on other OSs. Here is link to the Mozilla support site: http://suppor

Re: [R] Configuring R-2.10 help html server on Linux?

2009-11-23 Thread Marc Schwartz
On Nov 23, 2009, at 7:13 PM, Tom Wainwright wrote: On 11/23/2009 04:39 PM, Marc Schwartz wrote: ... The proxy issue is referenced in ?tools::startDynamicHelp, which is linked from ?help.start: "Details ... The browser in use does need to be able to connect to the loopback inte

Re: [R] Barplot with confidence intervals

2009-11-27 Thread Marc Schwartz
plot.ci = TRUE, ci.l = ci.l, ci.u = ci.u, beside = TRUE, legend = legend, ylim = c(0, 200), main = "Experiment X", ylab = "Total size", font.main = 4, cex.axis = 1.2, cex.lab = 1.5, cex.names = 1.5, plot.grid = TRUE) BTW, once you get the plot

Re: [R] Referencing variable names rather than column numbers

2009-12-05 Thread Marc Schwartz
series of contiguous and non-contiguous column names. See ?subset HTH, Marc Schwartz On Dec 5, 2009, at 10:43 AM, Ista Zahn wrote: As baptiste noted, you can do cor(pollute[ ,c("Pollution","Temp","Industry")]). But cor(pollute[,"Pollution":

Re: [R] three plots as one JEPG?

2009-12-05 Thread Marc Schwartz
tance. 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.

Re: [R] three plots as one JEPG?

2009-12-05 Thread Marc Schwartz
On Dec 5, 2009, at 11:34 AM, Marc Schwartz wrote: On Dec 5, 2009, at 11:21 AM, Walther, Alexander wrote: Dear List, i have a question concerning these device-related function (i.e. pdf(),jpeg(), etc.). Currently, I plot three graphs, one below the other into a /single/ window by using par

Re: [R] Regular expression help

2009-12-07 Thread Marc Schwartz
to extract the value within the parens in the regex using a back reference. Any characters from the beginning of the line to the '#' are dropped, as are any characters after the numeric sequence to the end of the line. See ?gsub for more information. HTH, Marc Schwartz

Re: [R] Changing border width in barplot ?

2009-12-08 Thread Marc Schwartz
way that I can see to pass a vector of line widths as the code is presently implemented. You might want to look at the barchart() function in lattice to see if there is more functionality there. HTH, Marc Schwartz __ R-help@r-project.org mai

Re: [R] formula () problems

2009-12-09 Thread Marc Schwartz
;.' to refer to all columns not otherwise already in the formula. 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-gui

Re: [R] What is the function to test if a vector is ordered or not?

2009-12-09 Thread Marc Schwartz
(1, 4, 2, 6, 7)) [1] TRUE > is.unsorted(sort(c(1, 4, 2, 6, 7))) [1] FALSE If you mean to test a factor to see if it is an ordered factor, then ? is.ordered > is.ordered(factor(letters)) [1] FALSE > is.ordered(factor(letters, ordered = TRUE)) [1] TRUE HT

Re: [R] How to get rid of NULL in the result of apply()?

2009-12-10 Thread Marc Schwartz
AQ/R-FAQ.html#How-can-I-set-components-of-a-list-to-NULL_003f 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 comment

Re: [R] memory problem on Suse

2009-12-11 Thread Marc Schwartz
running a 64 bit version of R. What does: .Machine$sizeof.pointer show? If it returns 4, then you are running a 32 bit version of R, which cannot take advantage of your 64 bit platform. You should install a 64 bit version of R. HTH, Marc Schwartz __

Re: [R] cube root on array

2009-12-12 Thread Marc Schwartz
the first value in the vector. c(-27,27)^(1/3) [1] NaN 3 i'm using sign( c(-27,27) ) * abs( c(-27,27)) ^(1/3) , thanks That seems to be a reasonable approach and if memory serves, has been posted to the list previously. HTH, Marc Schwartz _

Re: [R] Diagonal Labels on "Beside" Bars in Barplot

2009-12-15 Thread Marc Schwartz
dimnames")$Hair, xaxt = "n", xlab = "") text(colMeans(barplot_reference), par("usr")[3] - 0.09, srt = 45, adj = 1, labels = as.character(colnames(a)), xpd = TRUE, offset = 1, col = "black") HTH, Marc Schwartz ___

Re: [R] A Date related problem

2009-12-15 Thread Marc Schwartz
;2009-01-01" "2008-12-01" # Prior two years > seq(as.Date("2009-02-01"), by = "-1 year", length = 3)[-1] [1] "2008-02-01" "2007-02-01" 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.

Re: [R] A Date related problem

2009-12-15 Thread Marc Schwartz
On Dec 15, 2009, at 2:19 PM, Marc Schwartz wrote: On Dec 15, 2009, at 1:39 PM, Megh wrote: Dear all, Please consider following date "as.Date("2009-02-01")". If I subtract "1" then it will give last day, similarly if I subtract "2" it will give 2

Re: [R] Baseline survival estimate

2009-12-16 Thread Marc Schwartz
) ... You might also be interested in John Fox' web appendix on Cox models: http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-cox-regression.pdf HTH, Marc Schwartz On Dec 16, 2009, at 11:34 AM, tlum...@u.washington.edu wrote: survival = exp(-hazard) -thomas On Wed

Re: [R] cross-product

2009-12-17 Thread Marc Schwartz
ame of an object, as C() is a function in R. R will typically know the difference, but it is a good defensive programming habit to avoid assigning objects to pre-existing function names. HTH, Marc Schwartz __ R-help@r-project.org mailing list ht

Re: [R] SPLUS Seqtrial vs. R Packages for sequential clinical trials designs

2009-12-17 Thread Marc Schwartz
internally). As a SAS user, on a more general level, you may find the following book to be helpful in moving to R: R for SAS and SPSS Users Robert A. Muenchen http://www.amazon.com/SAS-SPSS-Users-Statistics-Computing/dp/0387094172/ HTH, Marc Schwartz ___

Re: [R] Run time error when executing sqlQuery using the 64-bit version of R with 64-bit RODBC package in a Solaris 10 Sparc machine.

2009-12-20 Thread Marc Schwartz
ration issue to resolve. BTW, we won't see the 'red highlighted text' here, as the list is plain text only, not HTML or RTF. Last, but not least, R version 2.10.1 is the currently supported stable release of R. HTH, Marc Schwartz ___

Re: [R] insert a dot to the numbers

2009-12-20 Thread Marc Schwartz
t; s / (10 ^ (nchar(s) - 3)) [1] 110. 112.3210 See ?nchar > nchar(s) [1] 7 6 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-

Re: [R] Plot odds ratios on log scale

2009-12-21 Thread Marc Schwartz
functions in Thomas Lumley's 'rmeta' package on CRAN. 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.

Re: [R] Plot odds ratios on log scale

2009-12-21 Thread Marc Schwartz
On Dec 21, 2009, at 4:13 PM, Ted Harding wrote: On 21-Dec-09 21:19:27, Marc Schwartz wrote: On Dec 21, 2009, at 2:54 PM, Rice, Terri wrote: Hi, I have the following table of odds ratios (or), lower limits(ll) and upper limits(ul), which I would like to plot as horizontal lines beginning at

Re: [R] extracting residuals from glm object

2009-05-12 Thread Marc Schwartz
e the references in ?residuals.glm for more information as per the Details section therein. 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-proje

Re: [R] access to the current element of lapply

2009-05-13 Thread Marc Schwartz
X1, df$X2), drop = TRUE) > L $A.1 X1 X2 1 A 1 $A.2 X1 X2 2 A 2 $B.3 X1 X2 3 B 3 $B.4 X1 X2 4 B 4 Is that what you want? HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Function to read a string as the variables as opposed to taking the string name as the variable

2009-05-14 Thread Marc Schwartz
vars <- unlist(strsplit(third, split = ", ")) > vars [1] "first" "second" > sapply(vars, get) first second 4 6 > max(sapply(vars, get)) [1] 6 > sum(sapply(vars, get)) [1] 10 So, see ?as.formula and ?get. Also see ?paste and ?strsplit f

Re: [R] help with as.numeric

2009-05-15 Thread Marc Schwartz
each column in your data frame. Review each column and take note of any columns that should be numeric, but are factors. See ?str, ?grep and ?regex for more information. You might also want to look at ?type.convert, which is the function used by the read.table() family of functions to dete

Re: [R] warning message while installing a package

2009-05-15 Thread Marc Schwartz
definitely use a different mirror in the mean time. 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 commente

Re: [R] replace "%" with "\%"

2009-05-15 Thread Marc Schwartz
%" Thank you, Liviu Presuming that you might want to output the results to a TeX file for subsequent processing, where the '%' would otherwise be a comment character, the key is not to get a single '\', but a double '\\', so that you then get a single '\

Re: [R] Printing to screen a matrix or data.frame in one chunk (not splitting columns)

2009-05-15 Thread Marc Schwartz
14113 0.4668012 0.04420137 So there is a way to resize the space for printing so that everything in printed in one chunk. Thanks in advance, Adrian See ?options and take note of 'width' which defaults to 80. Increase that value to a number that suits your requirements. HTH,

Re: [R] error writing to connection

2009-05-15 Thread Marc Schwartz
hat drive 'D' exists and that you have permission to write to it, it is possible that there is insufficient room on that drive to save 'data'. Check on the above. HTH, Marc Schwartz __ R-help@r-project.org mailing list http

Re: [R] Rotating x-axis categorical labels

2009-05-15 Thread Marc Schwartz
egree rotation, see: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f 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:

Re: [R] Read.table problems

2009-05-18 Thread Marc Schwartz
NA NA NA NA NA NA NA NA NA NA NA NA NA NA 10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 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.

Re: [R] drc results differ for different versions

2009-05-20 Thread Marc Schwartz
rc would be available from: http://cran.r-project.org/src/contrib/Archive/drc/ I also found a Windows binary of the old package here: http://cran.r-project.org/bin/windows/contrib/2.6/drc_1.4-2.zip I have also copied Christian Ritz, the drc package author/m

Re: [R] help with gsub and date pattern

2009-05-21 Thread Marc Schwartz
d within the parens # See ?regex > gsub("^.* (.*)$", "\\1", x) [1] "12:34:00" "1:14:00" # Replace the characters up to the space with an empty vector > gsub("^.* ", "", x) [1] "12:34:00" "1:14:00" HTH, Marc Schw

Re: [R] postscript problems (landscape orientation)

2009-05-22 Thread Marc Schwartz
27; Preview works quite well in place of Adobe Reader, save for certain animations in PDF files. Also, for those still reading this thread and are on OSX, if you are not aware, there are additional plugins for QuickLook for EPS files and other such things:

Re: [R] long format - find age when another variable is first 'high'

2009-05-25 Thread Marc Schwartz
imum age for each of the remaining subjects: > aggregate(d.new$age, list(id = d.new$id), min) id x 1 1 5 2 2 7 3 3 12 Try that to see what sort of time reduction you observe. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz

[R] [R-pkgs] WriteXLS - New Version 1.7.1

2009-05-29 Thread Marc Schwartz
based R function to create Excel (XLS) files from one or more data frames. Each data frame will be written to a separate named worksheet in the Excel spreadsheet. The worksheet name will be the name of the data frame it contains or can be specified by the user. Author(s): Marc Schwartz

Re: [R] Bug in gmodels CrossTable()?

2009-05-31 Thread Marc Schwartz
;Value' section: Non-integral numeric values are truncated towards zero (i.e., as.integer(x) equals trunc(x) there) The output is correct, if confusing, but you are really using the function in a fashion that is not intended. HTH, Marc Schwartz _

Re: [R] Excel Export in a beauty way

2009-06-03 Thread Marc Schwartz
hing that I can look into adding in a future version, perhaps with some appropriate 'padding' in the column width setting that would result in minimal wasted space. HTH, Marc Schwartz On Jun 3, 2009, at 7:54 AM, Erich Neuwirth wrote: If you are working on Windows and Excel instal

Re: [R] Getting a column of values from a list - think I'm doing it the hard way

2009-06-03 Thread Marc Schwartz
fashion. Essentially, iterate an operation over the entire object with a single function call. If you are coming from a different programming language, this is perhaps one of the more challenging perspectives to achieve. But once you make that leap, you will look back

Re: [R] Cochran’s Q statistic

2009-06-04 Thread Marc Schwartz
On Jun 4, 2009, at 7:48 AM, jlfmssm wrote: Does anyone know which package include the computation of Cochran’s Q statistic in R? jlfmssm See this thread: https://stat.ethz.ch/pipermail/r-help/2006-September/113139.html HTH, Marc Schwartz __ R

Re: [R] Error Catching?

2009-06-04 Thread Marc Schwartz
On Jun 4, 2009, at 12:56 PM, Brigid Mooney wrote: Hi, Is there an easy way to "catch" errors, in order to arrange for r-scripts to exit gracefully? I'm thinking of something along the lines of using is.na with an if/else statement, but for errors. Thanks! See ?try and ?tryCa

Re: [R] how to tell if as.numeric succeeds?

2009-06-04 Thread Marc Schwartz
gs(as.numeric(x)) if (any(!is.na(Result))) TRUE else FALSE } > NumCheck(c("a", "1", "c", "2")) [1] TRUE > NumCheck(letters[1:4]) [1] FALSE > NumCheck(c("1", "2", "3", "4")) [1] TRUE Alter the in

Re: [R] from 3 numeric variables to a string

2009-06-05 Thread Marc Schwartz
, month, year), format = "%d/%m/ %Y") [1] "2009-06-05" Note that the above is now of Class 'Date': > str(as.Date(sprintf("%02d/%02d/%4d", day, month, year), format = "%d/%m/%Y")) Class 'Date' num 14400 which then enables you to per

Re: [R] graphically representing frequency of words in a speech?

2009-06-07 Thread Marc Schwartz
or Gorjanc, but the information seems to be dated: http://www.bfro.uni-lj.si/MR/ggorjan/software/R/index.html#tagCloud I have cc'd him here for any updates. Otherwise, there are some links on the Wikipedia page and some other applications such as Wordle: http://www.wordle.net/ HTH,

Re: [R] using regular expressions to retrieve a digit-digit-dot structure from a string

2009-06-08 Thread Marc Schwartz
period, only at the beginning of the line". The caret '^' defines the beginning of the line, so that a sequence of numbers followed by a period in the middle of the line will not match. HTH, Marc Schwartz __ R-help@r-project.org

Re: [R] using regular expressions to retrieve a digit-digit-dot structure from a string

2009-06-08 Thread Marc Schwartz
On Jun 8, 2009, at 12:34 PM, Marc Schwartz wrote: On Jun 8, 2009, at 9:15 AM, Mark Heckmann wrote: Hi, i need to recognize itemization structures in strings which follow the format: "digit-digit-dot" like e.g. 1. 2. 19. 211. Given the string " This happened in

Re: [R] Regex question to find a string that contains 5-9 alpha-numeric characters, at least one of which is a number

2009-06-08 Thread Marc Schwartz
s trying to think of a way to do this with only a single grep(), but it has been too long of a day. So here is a bit of a simplification on the two stage approach: > vec [1] "SHRT""5HRT""M1TCH" "M1TCH5" "LONG3RS"

Re: [R] using regular expressions to retrieve a digit-digit-dot structure from a string

2009-06-09 Thread Marc Schwartz
"One January 1. I saw Rick.* He was born in the 19. century.*" which then makes the strsplit() parsing a bit easier. Since both strsplit() and grep() use .Internal()s, hopefully this would still be reasonably fast. Note that I have strsplit() split on the "*" possibly follow

Re: [R] Merge data frame and keep unmatched

2009-06-10 Thread Marc Schwartz
b3 NA 7 c1 NA 8 c 2 4 9 c3 NA Note the 'all', 'all.x' and 'all.y' arguments... HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Using yum to install R-2.9

2009-06-10 Thread Marc Schwartz
, there is a Fedora specific R e-mail list: https://stat.ethz.ch/mailman/listinfo/r-sig-fedora which you might want to subscribe to and then post future Fedora/RH specific queries there. HTH, Marc Schwartz __ R-help@r-project.org mailing list

Re: [R] Vista + R = *!!?@

2009-06-10 Thread Marc Schwartz
tical theory issue. See the following R FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-p_002dvalues-not-displayed-when-using-lmer_0028_0029_003f HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] Difficulties with the simpest table

2009-06-10 Thread Marc Schwartz
ontains the two columns, which can then be addressed as DF$x and DF$y. Further information is available in the R manual An Introduction to R. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] How to extract from a matrix based on indices in a vector?

2009-06-10 Thread Marc Schwartz
,14] [,15] [,16] [,17] [,18] [,19] [,20] [1,] "G" "A" "W" "M" "M" "V" "U" "S" [2,] "K" "J" "I" "P" "E" "R" "C" "K&q

Re: [R] How to extract from a matrix based on indices in a vector?

2009-06-10 Thread Marc Schwartz
On Jun 10, 2009, at 6:26 PM, Marc Schwartz wrote: On Jun 10, 2009, at 12:36 PM, Logickle wrote: Sorry, there may be some lingo for describing the extraction problem I have, but I don't know it. I have a matrix of 2 rows and N columns, and a vector of N 1s and 2s. Matrix M:

Re: [R] How to extract from a matrix based on indices in a vector?

2009-06-10 Thread Marc Schwartz
On Jun 10, 2009, at 7:05 PM, William Dunlap wrote: Subscripting by a 2-column matrix M[cbind(v, seq_len(ncol(M)))] uses much less space (hence time) than making the ncol(M) by ncol(M) intermediate matrix just to extract its diagonal. E.g. test <- function(n, seed) { if (!missing(seed))

Re: [R] need help with strsplit function

2009-06-11 Thread Marc Schwartz
es the first '.' with a '*' allowing you to split on the unique character. You can modify the replacement character as your data may actually require. 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.

Re: [R] Expand a contingency table based on the value in one column

2009-06-11 Thread Marc Schwartz
12 TRUCK A 1412 TRUCK A 1512 TRUCK A 1612 TRUCK A 1712 TRUCK A 1812 TRUCK A 19 1 2 BUS F HTH, Marc Schwartz __ R-help@r-project.org mailing

Re: [R] Installing the Rstem package

2009-06-11 Thread Marc Schwartz
e and the 2.9.0 version is available from: http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.9/ HTH, Marc Schwartz On Jun 11, 2009, at 12:57 PM, Henrik Bengtsson wrote: Google "Rstem package" - first hit. It is hosted by the Omegahat project. /H On Thu, Jun 11, 2

Re: [R] gfortran command not found?

2009-06-11 Thread Marc Schwartz
ave not worked on SUSE, but check to see where gfortran is located: $ which gfortran and be sure that it returns the path to the executable and that the path to it is in your $PATH. You might also want to review: http://cran.r-project.org/doc/manuals/R-admin

Re: [R] How to force R to print 2 decimal places in column of a data.frame?

2009-06-11 Thread Marc Schwartz
ion. Note that the presumption here is that you want to output the numeric values to a formatted character vector for display purposes, perhaps in a table, etc. So if your actual data frame is called 'INP' and the column is called 'Size', you would use: sprintf("

Re: [R] Snap axes to origin rather than around it

2009-06-12 Thread Marc Schwartz
s gratefully accepted. Perhaps I've been looking at it so long I'm now missing the obvious! :) Paul Any ideas? See ?par and take note of 'xaxs' and 'yaxs': x <- 0:10 y <- 0:10 plot(x, y, xaxs = "i", yaxs = "i") HTH, Marc

Re: [R] Centering graphics by default in Sweave

2009-06-14 Thread Marc Schwartz
\begin{centerfig} ... \end{centerfig} instead of: \begin{figure} \begin{center} ... \end{center} \end{figure} HTH, Marc Schwartz \documentclass[10pt]{article} \usepackage{graphicx} \begin{document} \setlength{\parindent}{0pt} \setlength{\parskip}{0pt} %% Here is the

Re: [R] NA as a result of using GLM

2009-06-15 Thread Marc Schwartz
o 20 'events' for each covariate degree of freedom in a logistic regression model. With only 6 diseased (events) you really don't even have enough data to support one covariate. The study, presuming an 'a priori' design, is way underpowered for what you are attem

Re: [R] NA as a result of using GLM

2009-06-15 Thread Marc Schwartz
On Jun 15, 2009, at 10:13 AM, Paul Christoph Schröder wrote: > Thanks Marc, as you said, this is a priori design. I'm trying to get > more events. > But for now, I'll have to try to get rid of the collinear genes. Is > there any other method than using cor? Any method to state which > genes

Re: [R] glm binomial logit

2009-06-17 Thread Marc Schwartz
value to you. So there are tradeoffs... I have not compared Frank's lrm() function in the Design package relative to any time savings in comparison to using glm() on large datasets, but that may also be something to look into. HTH, Marc Schwartz

[R] [R-pkgs] WriteXLS - New Version 1.8.0

2009-06-17 Thread Marc Schwartz
based R function to create Excel (XLS) files from one or more data frames. Each data frame will be written to a separate named worksheet in the Excel spreadsheet. The worksheet name will be the name of the data frame it contains or can be specified by the user. Author(s): Marc Schwartz

Re: [R] sapply() related query

2009-06-17 Thread Marc Schwartz
this is a step in any approach to variable selection for subsequent model development... 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

Re: [R] Any method to speed up this problem?

2009-06-18 Thread Marc Schwartz
ops to do the job... But it's really taking too long... Any suggestions would be greatly appreciated. Thank you! Is this what you want? > Vec [1] "STAT1" "STAT1" "STAT1" "STAT1" "GAPDH" "G

Re: [R] Print column headers of summary

2009-06-18 Thread Marc Schwartz
1089 0.6915 2.4020 " > write(capture.output(summary(x)), file = "") Min. 1st Qu. MedianMean 3rd Qu.Max. -2.2150 -0.4942 0.1139 0.1089 0.6915 2.4020 Note also that write() is a wrapper for cat(), thus you can get the same by: > cat(capture.output(summa

Re: [R] Random number datasets help

2009-06-18 Thread Marc Schwartz
Alexandre did say 28 datasets, not 784 (28 * 28) Thus, either: mapply(rnorm, n = 500, mean = a1, sd = a2) or apply(cbind(a1, a2), 1, function(x) rnorm(500, x[1], x[2])) HTH, Marc Schwartz On Jun 18, 2009, at 12:51 PM, Henrique Dallazuanna wrote: Try this also: a <- expand.g

Re: [R] Random number datasets help

2009-06-18 Thread Marc Schwartz
'for' loops are doing. He is iterating through all combinations and would have created 784. So his problem statement did not match the code that he sent. On Thu, Jun 18, 2009 at 2:12 PM, Marc Schwartz wrote: Alexandre did say 28 datasets, not 784 (28 * 28) Thus, either: ma

Re: [R] simple question on glm

2009-06-18 Thread Marc Schwartz
indicates that all variables not already in the formula should be used. See ?formula for more information. 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:/

Re: [R] Random number datasets help

2009-06-19 Thread Marc Schwartz
On Jun 19, 2009, at 10:25 AM, Alexandre Lockhart wrote: My other question involved formatting my output. Normally, my text file has 8 columns, each column with 500 values before the next 8 below are generated, and so on until 28 are reached. I have examined formatting issues with each f

Re: [R] correlation between categorical data

2009-06-20 Thread Marc Schwartz
t/~lthompson221/Splusdiscrete2.pdf 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.

Re: [R] barplot2 x-axis

2009-03-22 Thread Marc Schwartz
es, then a barplot is not the best approach for the display of summarized continuous data. I would use a point plot with error bars/confidence intervals. See the errbar() function in the Hmisc package or the plotCI() or plotmeans() functions in gplots. You could also create somethin

Re: [R] barplot2 x-axis

2009-03-22 Thread Marc Schwartz
a funny scale (0, 13, 28...) and what I would like to do is to make that scale from 0 and then increasing by 25 km for a better interpretation (0, 25, 50...). Hopefully my problem is more clear now, meanwhile I will have a look to your suggestions. Thank you very much Mafalda 2009/3/22

[R] [R-pkgs] New CRAN Package: WriteXLS

2009-03-26 Thread Marc Schwartz
stance with the testing of this package prior to release. Thanks, Marc Schwartz ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@r-project.org

Re: [R] use of "@" character in variable name

2009-03-26 Thread Marc Schwartz
as a variable name. See ?make.names for more information, which is noted in the description of the 'check.names' argument in the read.table() family of functions. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.et

[R] [R-pkgs] WriteXLS: New version 1.6.0 - Binary CRAN packages available and other changes

2009-03-31 Thread Marc Schwartz
d for Windows, OSX and Linux relative to options for installing Perl and any missing modules. The WriteXLS package is being maintained on R-Forge at: https://r-forge.r-project.org/projects/writexls/ Regards, Marc Schwartz ___ R-packages mailing l

Re: [R] Convert bits to numbers in base 10

2009-04-09 Thread Marc Schwartz
I suspect that Gang was looking for something along the lines of: > sum(2 ^ (which(as.logical(rev(nn))) - 1)) [1] 74 You might also want to look at the digitsBase() function in Martin's sfsmisc package on CRAN. HTH, Marc Schwartz On Apr 9, 2009, at 4:34 PM, Jorge Ivan Velez wrote

Re: [R] Determine the Length of the Longest Word in a String

2009-04-10 Thread Marc Schwartz
Longest", which results in an empty element in the resultant vector. If you wanted to split on one or more spaces, you could use a 'regular expression' in strsplit() such as: > strsplit(shadstr, " +")[[1]] [1] "My"

Re: [R] Protocol question: formatting of posts

2009-04-11 Thread Marc Schwartz
.org/ffaq.html and the formal spec is here: http://www.ietf.org/rfc/rfc2646.txt 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-gui

Re: [R] Modular Arithmetic Error?

2009-04-17 Thread Marc Schwartz
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f and call us in the morning.... :-) HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] real numeric variable transforms into factor:

2009-04-17 Thread Marc Schwartz
4.5 1/1 6 6 5.1 0/0 7 7 6.3 1/1 8 8 NA 1/2 > str(DF) 'data.frame': 8 obs. of 3 variables: $ ob: int 1 2 3 4 5 6 7 8 $ x1: num 1.1 2.1 3.2 NA 4.5 5.1 6.3 NA $ y1: Factor w/ 4 levels "0/0","1/1","1/2",..: 2 3 4 1 2 1 2 3 This is now because:

Re: [R] covariance

2009-04-19 Thread Marc Schwartz
06834326 0.78344182 -0.02085422 1.05896045 1.37631451 HTH, Marc Schwartz On Apr 19, 2009, at 12:22 PM, Jorge Ivan Velez wrote: Dear Benny, Here is something that could get you a hint: # Some data set.seed(123) X <- matrix(rnorm(100),ncol=10) Y <- matrix(rnorm(100,2,4),ncol=10) # Number of

Re: [R] bladder1 dataset in survival library

2009-04-20 Thread Marc Schwartz
at: http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/survival/man/bladder.Rd?root=survival&rev=11221&r1=11166&r2=11221 it was added in the last two months. Petra, try either running update.packages() or installing R 2.9.0. HTH, Marc Schwartz __

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Marc Schwartz
1.369721e-16" So it would appear that in the first R example above, the print() function has changed in a material fashion. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do r

Re: [R] Package or packages for randomization in a clinical trial

2009-04-21 Thread Marc Schwartz
including stratified randomization, blocked randomization, and adaptive randomization. Thanks, John John, Take a look at the 'blockrand' and 'crossdes' packages on CRAN. If you need something beyond those, it is not overly difficult to write functions in R to do this.

<    1   2   3   4   5   6   7   8   9   10   >