[R] cut with floating point, a bug?

2009-06-18 Thread Shawn Rutledge
With floating point numbers I'm seeing 'cut' putting values in the wrong bands. An example below places 0.3 in (0.3,0.6] i.e. 0.3 > 0.3. > x = 1:5*.1 > x [1] 0.1 0.2 0.3 0.4 0.5 > cut(x, br=c(0,.3,.6)) [1] (0,0.3] (0,0.3] (0.3,0.6] (0.3,0.6] (0.3,0.6] Levels: (0,0.3] (0.3,0.6] I'm sure this i

[R] namespace? environment? how to manage functions?

2009-06-18 Thread whizvast
Hi, useRs- I have been building a set of functions over time and now my R_GlobalEnv becomes too crowded. I would like to put all my functions under the same namespace/environment. Ideally, I would like to call them using "env::func" as in C++. The following code almost do the jobs I want - e

[R] Help on Heteroskedastic diagram

2009-06-18 Thread Al Leong
Hi, I am trying to create a diagram similar to Figures 4.4 (page 125) and 5.2 (page 159) in Stock and Watson2009) Introduction to Econometrics Brief Edition. The diagrams display the conditional probability distributions of y at different values of x along the regression line. I would be gra

Re: [R] R on Mobile Devices (Android)

2009-06-18 Thread Ishwor
Hi Alain, 2009/6/19 Alain Forget [...] > Hi Ishwor, > > Ugh, lots of roadblocks. Do you think there's any chance that I could just > install the Windows version of R onto a Windows Mobile device? I'm currently > trying to set up a Windows Mobile 6.1 emulator, so I may actually find out > soon.

Re: [R] R on Mobile Devices (Android)

2009-06-18 Thread Alain Forget
2009/6/19 Alain Forget > > > Hell R-list, > > > > > > At the cost of sounding far-fetched and almost incredulous, I would > > > like to know if any R user is remotely considering the use of R on > > > Mobile devices, and Android in particular. > > > > First, rewrite R in Java. Good luck with tha

Re: [R] R on Mobile Devices (Android)

2009-06-18 Thread Ishwor
Hi Alain, 2009/6/19 Alain Forget > > > Hell R-list, > > > > > > At the cost of sounding far-fetched and almost incredulous, I would > > > like to know if any R user is remotely considering the use of R on > > > Mobile devices, and Android in particular. > > > > First, rewrite R in Java. Good lu

[R] R on Mobile Devices (Android)

2009-06-18 Thread Alain Forget
> > Hell R-list, > > > > At the cost of sounding far-fetched and almost incredulous, I would > > like to know if any R user is remotely considering the use of R on > > Mobile devices, and Android in particular. > > First, rewrite R in Java. Good luck with that! > > http://code.google.com/android/k

Re: [R] Reading from Google Docs

2009-06-18 Thread Gabor Grothendieck
I have haven't neen following this thread but: 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as opposed to built source) then the first line renames it so that its not the same name as the built file about to be created. The second line detars it into the RGoogleDocs directory. The thi

Re: [R] How to change ONLY the first character of each variable name

2009-06-18 Thread Henrique Dallazuanna
Try this: gsub("^M{1}", "MOLE", names(data)) On Thu, Jun 18, 2009 at 8:24 PM, Mark Na wrote: > Dear R-helpers, > > I would like to adapt the following code > > > names(data)<-sub("M","MOLE",names(data)) > > which changes any occurrence of "M" (in my variable names) to "MOLE" > > such that it ON

Re: [R] Reading from Google Docs

2009-06-18 Thread Farrel Buchinsky
What do you mean by "cd the.directory.containing.RGoogleDocs" Do you mean the directory where I downloaded the RGoogleDocs_0.2-2.tar.gz to? Or do you mean that I must create a directory called RGoogleDocs under Library and then change to that directory? Farrel Buchinsky Google Voice Tel: (412) 567-

Re: [R] How to change ONLY the first character of each variable

2009-06-18 Thread Ted Harding
On 18-Jun-09 23:24:39, Mark Na wrote: > Dear R-helpers, > I would like to adapt the following code > >> names(data)<-sub("M","MOLE",names(data)) > > which changes any occurrence of "M" (in my variable names) to "MOLE" > such that it ONLY operates on the first character of each variable > name, i.

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread Michael
Thanks so much for the invaluable pointers folks! I just also wanted to note that my definition of statistics also includes data-mining, generic data-analysis, etc. , i.e. the statistics in the broad sense. Any more thoughts? Thanks a lot! On Thu, Jun 18, 2009 at 4:05 PM, Richard M. Heiberger w

[R] How to change ONLY the first character of each variable name

2009-06-18 Thread Mark Na
Dear R-helpers, I would like to adapt the following code > names(data)<-sub("M","MOLE",names(data)) which changes any occurrence of "M" (in my variable names) to "MOLE" such that it ONLY operates on the first character of each variable name, i.e. M will only be changed to MOLE if it's the first

Re: [R] Stratified random sampling?

2009-06-18 Thread Dylan Beaudette
On Thursday 18 June 2009, Jonathan Greenberg wrote: > Rers: > > What is the preferred library/function for doing stratified random > sampling from a dataset, given I want to control the number of samples > (rather than the proportion of samples) per strata? Thanks! > > --j Hi Jonathan! Check

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread Richard M. Heiberger
Alan Izenman suggests: I have lots of places worth checking out for him. It means a lot of reading. Probably the first (and best) place to start is the set of Springer books entitled "Breakthroughs in Statistics," which was edited by Kotz & Johnson. There' are three (3) volume

Re: [R] Reading from Google Docs

2009-06-18 Thread Farrel Buchinsky
The first time I did it I had no idea how I did it. Yesterday I struggled and tried every combination to get it to work and eventually it worked. Once again I do not know what I did to get it to work. Now today I am trying to install a version that I downloaded today. And once again I am banging my

[R] Stratified random sampling?

2009-06-18 Thread Jonathan Greenberg
Rers: What is the preferred library/function for doing stratified random sampling from a dataset, given I want to control the number of samples (rather than the proportion of samples) per strata? Thanks! --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technolog

Re: [R] Random number datasets help

2009-06-18 Thread Alexandre Lockhart
You're absolutely right, Marc. Thanks > From: marc_schwa...@me.com > To: jholt...@gmail.com > Date: Thu, 18 Jun 2009 15:23:06 -0500 > CC: r-help@r-project.org; alexandre_geor...@hotmail.com > Subject: Re: [R] Random number datasets help > > Quite true Jim, however I focused on his request a

Re: [R] append to list

2009-06-18 Thread David Winsemius
On Jun 18, 2009, at 6:09 PM, bram wrote: Hi all, how can I effectively add new objects to a list of which the eventual length is unknown? I have been using something like mylist[[length(mylist)+1]] = newobject but I wonder if there is something better. this question might look familiar.

Re: [R] simple question on glm

2009-06-18 Thread David Winsemius
On Jun 18, 2009, at 5:50 PM, Marc Schwartz wrote: On Jun 18, 2009, at 4:36 PM, Jack Luo wrote: Hi, I am trying to use glm to fit my data, wondering if there is a easy way to fit a glm without typing all the explanatory variable names. For example, if I have 100 explanatory variables x1,

Re: [R] append to list

2009-06-18 Thread Gabor Grothendieck
Perhaps it was this: https://stat.ethz.ch/pipermail/r-help/2005-January/063530.html On Thu, Jun 18, 2009 at 6:09 PM, bram wrote: > Hi all, > > how can I effectively add new objects to a list of which the eventual length > is unknown? > > I have been using something like > > mylist[[length(mylist)

Re: [R] How to parse and eval a collection of items

2009-06-18 Thread Gabor Grothendieck
This does not use an apply: unlist(mget(thels, .GlobalEnv)) On Thu, Jun 18, 2009 at 5:25 PM, Carl Witthoft wrote: > Let's say I have, for some reason, a bunch of scalars (i.e. single-valued > variables) and I want to merge them all into a single vector of values.  Can > someone recommend a bette

[R] append to list

2009-06-18 Thread bram
Hi all, how can I effectively add new objects to a list of which the eventual length is unknown? I have been using something like mylist[[length(mylist)+1]] = newobject but I wonder if there is something better. this question might look familiar. It is the same question as has been asked h

Re: [R] Problem in 'Apply' function: does anybody have other solution

2009-06-18 Thread Carl Witthoft
Several folks pointed out the problem is most likely that a column of data is being read in as a factor. I prefer to solve this by setting as.is=TRUE as one of the arguments to read.table() (unless I am mis-remembering and it needs to be set to FALSE :-) ). The point is to tell the read funct

Re: [R] How to parse and eval a collection of items

2009-06-18 Thread Carl Witthoft
Hi, do.call doesn't help, but the solution provided by Henrique D. is much cleaner than my hack: > sapply(ls(patt='foo'),get) Thanks to all. Carl Rolf Turner wrote: On 19/06/2009, at 9:25 AM, Carl Witthoft wrote: Let's say I have, for some reason, a bunch of scalars (i.e. single-valu

Re: [R] Dataset suggestion sought

2009-06-18 Thread hadley wickham
> In revising my book Regression Modeling Strategies for a second edition, I > am seeking a dataset for exemplifying multiple regression using least > squares.  Ideally the dataset would have 5-40 variables and 40-1 > independent observations, and would generate significant interest for a wide

Re: [R] simple question on glm

2009-06-18 Thread Marc Schwartz
On Jun 18, 2009, at 4:36 PM, Jack Luo wrote: Hi, I am trying to use glm to fit my data, wondering if there is a easy way to fit a glm without typing all the explanatory variable names. For example, if I have 100 explanatory variables x1, x2, ..., x100 and response variable is y, I don't

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread David Scott
Michael wrote: Hi all, I apologize for this off-topic question but I need your help -- I know there are lots of experts here. As a lover and student of statistics, I am thinking of building a tree of various branches of statistics and keeping track of the greatest historical inventions/discover

[R] simple question on glm

2009-06-18 Thread Jack Luo
Hi, I am trying to use glm to fit my data, wondering if there is a easy way to fit a glm without typing all the explanatory variable names. For example, if I have 100 explanatory variables x1, x2, ..., x100 and response variable is y, I don't want to do something like glm1 <- glm(y ~ x1 + x2 + ...

Re: [R] How to parse and eval a collection of items

2009-06-18 Thread Rolf Turner
On 19/06/2009, at 9:25 AM, Carl Witthoft wrote: Let's say I have, for some reason, a bunch of scalars (i.e. single-valued variables) and I want to merge them all into a single vector of values. Can someone recommend a better function, or simpler way, to do so than the following? Suppose my sc

Re: [R] How to parse and eval a collection of items

2009-06-18 Thread Henrique Dallazuanna
You can get the values using get: sapply(ls(patt = "foo"), get) On Thu, Jun 18, 2009 at 6:25 PM, Carl Witthoft wrote: > Let's say I have, for some reason, a bunch of scalars (i.e. single-valued > variables) and I want to merge them all into a single vector of values. Can > someone recommend a

Re: [R] Print column headers of summary

2009-06-18 Thread nmset
Thank you very much, it's what I was looking for. -- View this message in context: http://www.nabble.com/Print-column-headers-of-summary-tp24094930p24099660.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] How to parse and eval a collection of items

2009-06-18 Thread Carl Witthoft
Let's say I have, for some reason, a bunch of scalars (i.e. single-valued variables) and I want to merge them all into a single vector of values. Can someone recommend a better function, or simpler way, to do so than the following? Suppose my scalars' names are foo1, foo2, foo3, foo1high, foo

Re: [R] Hatched symbols

2009-06-18 Thread David Winsemius
On Jun 18, 2009, at 3:10 PM, Guilhem Faure wrote: Hello, I would like to build rectangles in a plot and use color and different type of hatching for filling rectangles. I don't find the way to draw hatchings. I'm thinking to build segment by segment inside each rectangle but I'm sure tha

Re: [R] Altering columns

2009-06-18 Thread Jim Nemesh
A simple way to do it would be: mat<-mat[,c(2,1)] Slightly more fancy (for any number of columns): mat<-mat[,dim(mat)[2]:1] I'm sure there are prettier ways to do it. -Jim On Jun 18, 2009, at 4:14 PM, RON70 wrote: Hi, Suppose I have following dataset : mat <- matrix(rnorm(100), 50) Now

[R] Dataset suggestion sought

2009-06-18 Thread Frank E Harrell Jr
Dear Group: In revising my book Regression Modeling Strategies for a second edition, I am seeking a dataset for exemplifying multiple regression using least squares. Ideally the dataset would have 5-40 variables and 40-1 independent observations, and would generate significant interest fo

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread Steve_Friedman
Chapter 10 "A Twentieth-Century Tour of Categorical Data Analysis" in Agresti's smaller book with this title "An Introduction to Categorical Data Analysis includes this history. Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor)

Re: [R] Altering columns

2009-06-18 Thread David Winsemius
mat[ , 2:1] On Jun 18, 2009, at 4:14 PM, RON70 wrote: Hi, Suppose I have following dataset : mat <- matrix(rnorm(100), 50) Now I want to put 2nd column in the place of 1st and 1st column in the place of 2nd. Is there any "quick" way to do that? Thanks and regards, -- View this message

Re: [R] Random number datasets help

2009-06-18 Thread Marc Schwartz
Quite true Jim, however I focused on his request and not his code, presuming that he did not realize what he was doing as a consequence of the nested loops. Perhaps Alexandre can provide clarification? Regards, Marc On Jun 18, 2009, at 2:46 PM, jim holtman wrote: That is not what his 'for

Re: [R] Hatched symbols

2009-06-18 Thread Peter Alspach
Tena koe Guilhem Perhaps ?rect would help ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Guilhem Faure > Sent: Friday, 19 June 2009 7:11 a.m. > To: r-help@r-project.org > Subject: [R] Hatched symbols

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread Graham Smith
> Could anybody give me some pointers about existing books/articles > about the greatest inventions/discoveries in statistics? And topic > list? You could have a look at http://www.amazon.com/Lady-Tasting-Tea-Statistics-Revolutionized/dp/0805071342/ref=sr_1_1?ie=UTF8&s=books&qid=1245356064&sr=8-1

[R] Altering columns

2009-06-18 Thread RON70
Hi, Suppose I have following dataset : mat <- matrix(rnorm(100), 50) Now I want to put 2nd column in the place of 1st and 1st column in the place of 2nd. Is there any "quick" way to do that? Thanks and regards, -- View this message in context: http://www.nabble.com/Altering-columns-tp2409959

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread markleeds
agresti's book ( forget which one. there are two ) has an appendix about the history of categorical data that i remember being quite interesting. that's the only one i know of. On Jun 18, 2009, Michael wrote: Hi all, I apologize for this off-topic question but I need your

Re: [R] r scripting

2009-06-18 Thread Don MacQueen
For the mean() example, I believe this should work (untested) for (var in names(Dataset)) print( mean( Dataset[[var]] , na.rm=TRUE ) ) or for (var in names(Dataset)) print( mean( Dataset[,var] , na.rm=TRUE ) ) But it's harder with lm, glm, and friends. For them I think maybe you can do i

Re: [R] overshoot of formula line in summary output of Sweave

2009-06-18 Thread Ken Knoblauch
Ben Bolker ufl.edu> writes: > > In the Sweave output for summary for several types > > of model objects and also for the comparison of models > > with anova, I find that that the display of the call(s) > > or formula does not obey the width option, even with > > keep.source=TRUE set, so that a lon

Re: [R] Random number datasets help

2009-06-18 Thread jim holtman
That is not what his '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,

Re: [R] predict.glm and predict.gam output

2009-06-18 Thread David Winsemius
On Jun 18, 2009, at 3:23 PM, Anke Konrad wrote: Hi all, I am currently trying to compare different plant occurrence prediction maps generated in R and exported into GRASS. One of these maps was generated from a glm fitted to some data, and subsequently applying this glm model to a wider

[R] predict.glm and predict.gam output

2009-06-18 Thread Anke Konrad
Hi all, I am currently trying to compare different plant occurrence prediction maps generated in R and exported into GRASS. One of these maps was generated from a glm fitted to some data, and subsequently applying this glm model to a wider region using predict.glm. The outcome here was a prob

[R] Hatched symbols

2009-06-18 Thread Guilhem Faure
Hello, I would like to build rectangles in a plot and use color and different type of hatching for filling rectangles. I don't find the way to draw hatchings. I'm thinking to build segment by segment inside each rectangle but I'm sure that exists a better way to do that. I didn't find any document

Re: [R] biOps load failed after being used for one week

2009-06-18 Thread Michelle2009
With help from my colleague, I found the problem. After I put another library dll, zlib1.dll, at the folder, biOps is working again now. Though it's still amazing to me why biOps worked for about one week before I had zlib1.dll. I hope message could also help people who have the same problem. Th

[R] Constant value in an interval

2009-06-18 Thread Katschke, Adrian R
I am calling on the R-help crew once again. The CD4Per for each subject should be the same for each subject based on a 90 day window either side of the known value. For example, ID 2931 should have a CD4Per of 36 at 0, 34, and 62 DaysEnrolled. Any ideas how to do this without a loop? ID

[R] off topic but need your pointers about statistics

2009-06-18 Thread Michael
Hi all, I apologize for this off-topic question but I need your help -- I know there are lots of experts here. As a lover and student of statistics, I am thinking of building a tree of various branches of statistics and keeping track of the greatest historical inventions/discoveries in statistics

Re: [R] Calling library functions from outside R

2009-06-18 Thread Dirk Eddelbuettel
On 18 June 2009 at 14:02, Jim Nemesh wrote: | Actually, I'm going to take by my comments. | | You can use Rscript with multiple -e arguments to do what I was | looking for: | | Rscript -e 'library(broadgap.hapmaptools)' -e 'processAllFiles(dir="/ | humgen/cnp04/sandbox/steve/1m/hapmap3/genot

Re: [R] Random number datasets help

2009-06-18 Thread David Winsemius
On Jun 18, 2009, at 1:10 PM, Alexandre Lockhart wrote: Hello: My problem is that I have a data frame of means, and a data frame of standard deviations which match up to each mean. I have been trying to create 500 random numbers in a given dataset for each mean/sd combination, but I am

[R] Fractional Polynomials (mfp) for Weibull Model

2009-06-18 Thread Lam, Kelvin
Dear R-users, I am trying to modify the mfp() function in the mfp package to model Weibull survival using fractional polynomials approach. However, I keep getting into trouble when mfp.fit and other "hidden" functions can't be found. I did find some of them in Splus but it's getting nowhere.

Re: [R] regression with covariate

2009-06-18 Thread Dylan Beaudette
Hi, take a look at the following manual pages: ?lm ?longley In general, you would use Wilkinson-Rogers notation for linear models: y ~ x + z, etc. Some nice examples here: http://data.princeton.edu/R/linearmodels.html Cheers, Dylan On Thu, Jun 18, 2009 at 11:04 AM, Martin Batholdy wrote: >

Re: [R] Random number datasets help

2009-06-18 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Henrique Dallazuanna > Sent: Thursday, June 18, 2009 10:52 AM > To: Alexandre Lockhart > Cc: r-help@r-project.org > Subject: Re: [R] Random number datasets help > > Try this also:

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.grid(a

[R] regression with covariate

2009-06-18 Thread Martin Batholdy
hi, How can I compute a regression between x and y adding a covariate z? __ 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] Calling library functions from outside R

2009-06-18 Thread Jim Nemesh
Actually, I'm going to take by my comments. You can use Rscript with multiple -e arguments to do what I was looking for: Rscript -e 'library(broadgap.hapmaptools)' -e 'processAllFiles(dir="/ humgen/cnp04/sandbox/steve/1m/hapmap3/genotypes/ftp.hapmap.org/genotypes/2008-07_phaseIII/hapmap_form

Re: [R] Calling library functions from outside R

2009-06-18 Thread Gabor Grothendieck
On Thu, Jun 18, 2009 at 1:54 PM, Jim Nemesh wrote: > I did look at ?Rscript.  My question there was: >>> >>> Unfortunately, it looks like each expression is evaluated separately. >>> Is there a way to evaluate multiple expressions in the same >>> environment to make the above work? > > I could writ

Re: [R] Calling library functions from outside R

2009-06-18 Thread Jim Nemesh
I did look at ?Rscript. My question there was: Unfortunately, it looks like each expression is evaluated separately. Is there a way to evaluate multiple expressions in the same environment to make the above work? I could write an Rscript client file, but it's still poor CLI support compared

Re: [R] Random number datasets help

2009-06-18 Thread Henrique Dallazuanna
Try this also: a <- expand.grid(a1, a2) x <- mapply(rnorm, n = 500, mean = a[,1], sd = a[,2]) On Thu, Jun 18, 2009 at 2:10 PM, Alexandre Lockhart < alexandre_geor...@hotmail.com> wrote: > > Hello: > > My problem is that I have a data frame of means, and a data frame of > standard deviations whic

Re: [R] Calling library functions from outside R

2009-06-18 Thread Gabor Grothendieck
See the getopt R package and have a look at ?Rscript Also on Windows see Rscript.bat and #Rscript.bat in http://batchfiles.googlecode.com and on Linux see: http://dirk.eddelbuettel.com/code/littler.html On Thu, Jun 18, 2009 at 1:25 PM, Jim Nemesh wrote: > I develop quite a bit of R code that I t

Re: [R] Random number datasets help

2009-06-18 Thread jim holtman
try this: > a1<-c(178.07,178.28,178.08,177.74,177.04,178.17,177.58,57.71,59.6,60.92,59.48,59.32,61.59,59.94,28.9,29.82,30.73,25.68,27.93,28.98,29.76,123.48,127.27,127.8,127.2,127.13,126.71,125.5) > a2<-c(1.69,1.3,1,.18,1.53,1.31,1.35,1.83,1.56,1.12,.74,1.48,1.67,1.53,.95,.87,0.03,1.12,1.95,1.22,1.

Re: [R] Replace zeroes in vector with nearest non-zero value

2009-06-18 Thread William Dunlap
approx() almost does what you want, but you have to patch up its output to account for a possible initial run of 0's in the input: > x <- c(0, -1, -1, -1, 0, 0, 1, -1, 1, 0) > y <- approx(seq_along(x)[x!=0], x[x!=0], xout=seq_along(x), method="const", f=0, rule=2)$y > y [1] -1 -1 -1 -1 -1 -1 1 -1

[R] Calling library functions from outside R

2009-06-18 Thread Jim Nemesh
I develop quite a bit of R code that I tend to distribute, or let other people embed in their software. One of the things I'd really like to do is find a way to load an R library I've developed, and call one function with arguments. Currently, I achieve that by building a separate R client

Re: [R] Replace zeroes in vector with nearest non-zero value

2009-06-18 Thread Gabor Grothendieck
The zoo package has na.locf which replaces NAs with the last non-NA. So, first replace 0's with NA's, apply na.locf and then replace NAs with 0's. > library(zoo) > x.na <- replace(x, x == 0, NA) > x0 <- na.locf(x.na, na.rm = FALSE) > replace(x0, is.na(x0), 0) [1] 0 -1 -1 -1 -1 -1 1 1 1 1 On

[R] biOps load failed after being used for one week

2009-06-18 Thread Michelle2009
Hi, I installed biOps on my XP, and installed the required dll packages, jpeg62.dll, libfftw3-3.dll, and libtiff3.dll, as suggested by this forum. Then it worked perfectly for about one week till this afternoon. When I tried to load biOps again, I got the following error message again Error in i

Re: [R] Replace zeroes in vector with nearest non-zero value

2009-06-18 Thread jim holtman
use na.locf in zoo: > x [1] 0 -1 -1 -1 0 0 1 -1 1 0 > # replace 0 with NA so na.locf works > is.na(x) <- x == 0 > x [1] NA -1 -1 -1 NA NA 1 -1 1 NA > na.locf(x, na.rm=FALSE) [1] NA -1 -1 -1 -1 -1 1 -1 1 1 > You can then go back and replace NAs with 0 On Thu, Jun 18, 2009 at 12:47

[R] Random number datasets help

2009-06-18 Thread Alexandre Lockhart
Hello: My problem is that I have a data frame of means, and a data frame of standard deviations which match up to each mean. I have been trying to create 500 random numbers in a given dataset for each mean/sd combination, but I am only able to generate the last value in each data set to creat

Re: [R] Learning S3

2009-06-18 Thread Dirk Eddelbuettel
On 18 June 2009 at 09:36, Bert Gunter wrote: | -- or Chapter 4 in S PROGRAMMING? (you'll need to determine if it's "reader | friendly") +1 It helped me a lot too back in the day. But I am wondering if there are good current alternatives. Hadley: if you could, please send a summary back to the

Re: [R] Learning S3

2009-06-18 Thread Hadley Wickham
I think I remember reading that some time back and finding it confusing because it described the ideal implementation in S, rather than the actual implementation in R. I'll look at it again. Hadley On Thu, Jun 18, 2009 at 11:36 AM, Bert Gunter wrote: > -- or Chapter 4 in S PROGRAMMING? (you'll n

Re: [R] merging data.frames of different length

2009-06-18 Thread Henrique Dallazuanna
This code works for me, subset(merge(x1, x2, by = c("category", "id"), all = T), select=-id) category rnorm.10..5..2. rnorm.10..8..2. 1 1 NA7.810377 2 16.4932819.002411 3 16.4932818.397378 4 12.757321

[R] Replace zeroes in vector with nearest non-zero value

2009-06-18 Thread Murali.MENON
Folks, If I have a vector such as the following: x <- c(0, -1, -1, -1, 0, 0, 1, -1, 1, 0) and I want to replace the zeroes by the nearest non-zero number to the left, is there a more elegant way to do this than the following loop? y <- x for (i in 2 : length(x)) { if (y[i] == 0) {

Re: [R] "Normal" plot and xyplot side by side in one figure?

2009-06-18 Thread Bert Gunter
Greg is absolutely right: Generally base and grid graphics(which is what lattice plots are based on) don't play well together, and gridBase is meant to address this. However... The problem here is specifically that the print.trellis (or synonymous plot.trellis) function that is silently invoked to

Re: [R] Learning S3

2009-06-18 Thread Bert Gunter
-- or Chapter 4 in S PROGRAMMING? (you'll need to determine if it's "reader friendly") Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck Sent: Thursday, June 18, 2009

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-18 Thread Ravi Varadhan
Of course, closed form hessian is great, but I would still check it using deriv3 or hessian() from numDeriv. It should be noted that hessian() is so accurate that it can be a surrogate for the exact hessian. It is computationally demanding, but it is tolerable when you are computing it only

Re: [R] Learning S3

2009-06-18 Thread Henrik Bengtsson
Not a suggestion on documentation, but to ease S3 coding and hiding some of the details, you might want to consider the R.methodsS3 package. It basically provides some S3 code generators and makes it clear what class of objects a method is dispatched on. From the example code: setMethodS3("foo",

Re: [R] Learning S3

2009-06-18 Thread Gabor Grothendieck
There is a section on Object Orientation in MASS (I have 2nd ed). On Thu, Jun 18, 2009 at 12:06 PM, Hadley Wickham wrote: > Hi all, > > Do you know of any good resources for learning how S3 works?  I've > some how become familiar with it by reading many small pieces, but now > that I'm teaching it

[R] R networking group on LinkedIn

2009-06-18 Thread agdesilva
Greetings: I created an R group on Linkedin. It has a discussion board but a bit less about programming and more about networking including jobs but also relevant web sites. Please join us. Regards, Ajit http://www.linkedin.com/groups?about=&gid=77616&trk=anet_ug_grppro http://www.linkedin.c

Re: [R] Significance asterisk in a bar plot

2009-06-18 Thread Frank E Harrell Jr
Gilad wrote: Hi all, How do I add an asterisk representing a significant difference to a barplot? Cheers, Gil Bar plots are dreadful ways to present information (see http://biostat.mc.vanderbilt.edu/DynamitePlots). Don't make them worse by adding arbitrary declarations of 'significance.

[R] Learning S3

2009-06-18 Thread Hadley Wickham
Hi all, Do you know of any good resources for learning how S3 works? I've some how become familiar with it by reading many small pieces, but now that I'm teaching it to students I'm wondering if there are any good resources that describe it completely, especially in a reader-friendly way. So far

Re: [R] Print column headers of summary

2009-06-18 Thread Marc Schwartz
On Jun 18, 2009, at 10:05 AM, nmset wrote: Hello, This is a newbee question. I would simply like to write in a text file the headers of the summary function along with the computed data. write(summary(x), file="out.txt") gives only the data. I have not found a solution on the forum. Tha

Re: [R] r scripting

2009-06-18 Thread Christian Schulz
Hi, perhaps that is what you want? > df <- as.data.frame(matrix(runif(100),ncol=10)) > form <- as.formula(paste(names(df)[length(df)], "~ .")) > lm(form,data=df) Call: lm(formula = form, data = df) Coefficients: (Intercept) V1 V2 V3 V4 -1.367 -

Re: [R] merging data.frames of different length

2009-06-18 Thread Don MacQueen
The word "merge" in the context of R suggests the use of the merge() function, but I don't think that's the right tool for what you want. The merge() function is for relational database type merges, which for your data would have a many to many merge. Not good. In terms of the R language, you'

Re: [R] Problem in 'Apply' function: does anybody have other solution

2009-06-18 Thread jude.ryan
Thanks! I did not look at the output of str(df) closely. Since y is defined as a character variable when df is created (but stored as a factor), it looks like str(df) is sorting the factors, at least when it is displayed to the screen. Jude -Original Message- From: David Winsemius [mailto

Re: [R] "Normal" plot and xyplot side by side in one figure?

2009-06-18 Thread Greg Snow
Look at the gridBase package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Titus v. d. Malsburg > Sent: Thu

Re: [R] Problem in 'Apply' function: does anybody have other solution

2009-06-18 Thread David Winsemius
It's not a solution. Unfortunately data.matrix is no different with respect to factors than other functions. Note what str(df) produced for df$y. -- David. On Jun 18, 2009, at 10:59 AM, wrote: David Winsemius' solution: > apply(data.matrix(df), 1, I) [,1] [,2] [,3] [,4] [,5] [,6]

[R] Print column headers of summary

2009-06-18 Thread nmset
Hello, This is a newbee question. I would simply like to write in a text file the headers of the summary function along with the computed data. write(summary(x), file="out.txt") gives only the data. I have not found a solution on the forum. Thank you for any help. -- View this message in con

[R] Can I estimate strength and correlation of Random Forest in R package " randomForest"?

2009-06-18 Thread Li GUO
Hello! I want to estimate strength and correlation of RandomForest, but in package "randomForest" there is not an interface to get it. I think I must to change the source code. Is there any advise? Thanks, Li [[alternative HTML version deleted]]

Re: [R] Significance asterisk in a bar plot

2009-06-18 Thread Henrique Dallazuanna
If I understand correctly, you can try something about like this: x <- c(1, 4, 5, 10) bp <- barplot(x, ylim = c(0, max(x) + 2)) text(bp, x, labels = symnum(x, cutpoints = c(1, 5, 10), symbols = c("*", "**")), pos = 3) On Thu, Jun 18, 2009 at 12:40 PM, Gilad wrote: > Hi all, > > How

Re: [R] Problem in 'Apply' function: does anybody have other solution

2009-06-18 Thread jude.ryan
David Winsemius' solution: > apply(data.matrix(df), 1, I) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] x12345678910 y13456789 10 2 For y and [,2] above the value is 3. Why is the value not 2? It look

[R] r scripting

2009-06-18 Thread Jon Erik Ween
Hi! I have a dataset with some 300+ variables and 2000+ records. I'd like to grind through a bunch of analyses on the variables by using a script, but can't figure out how to refer to variable names properly. For some of the simpler stuff I use various "apply" functions, but for others (like t-tes

Re: [R] Matrix inversion-different answers from LAPACK and LINPACK

2009-06-18 Thread Avraham . Adler
Thank you. One question, though. In the case where I have closed form formulæ for the Hessian, or the functions are parseable by "deriv3", would it be better to use that than the approximation? --Avraham "

Re: [R] win.metafile() and family

2009-06-18 Thread Prof Brian Ripley
Where did you get the idea that Helvetica was a Windows font family name? (It is a Linotype trademark font name.) It is rarely seen on Windows, so attempts to use it almost always end up with a font substitution, often to Arial which is already the default family in win.metafile(). That will

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

2009-06-18 Thread jim holtman
Here is a way of determining where the dups are: > vec <- scan(textConnection(' "STAT1" "STAT1" "STAT1" "STAT1" "GAPDH" "GAPDH" "GAPDH" + + "ACTB" "ACTB" "ACTB" "DDR1" "RFC2" "HSPA6" "PAX8" + "GUCA1A" "UBE1L" "THRA" "PTPN21" "CCL5" "CYP2E1" "STAT1" + "THRA" "PAX8"'), what=

Re: [R] quantile fixed effects with weights

2009-06-18 Thread roger
On Jun 18, 2009, at 5:01 AM, alessia matano wrote: Dear all, I 'm implementing the koenker procedure for quantile fixed effects. Who he? Wuz 'dat? I would like also to apply weights to the procedure, so that to give more weight to the observation that better represent my original sample (

[R] Significance asterisk in a bar plot

2009-06-18 Thread Gilad
Hi all, How do I add an asterisk representing a significant difference to a barplot? Cheers, Gil [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

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

2009-06-18 Thread Marc Schwartz
On Jun 18, 2009, at 9:28 AM, njhuang86 wrote: Hi all, Suppose I have a vector like this: [1] "STAT1" "STAT1" "STAT1" "STAT1" "GAPDH" "GAPDH" "GAPDH" "ACTB" "ACTB" [10] "ACTB" "DDR1" "RFC2" "HSPA6" "PAX8" "GUCA1A" "UBE1L" "THRA" "PTPN21" [19] "CCL5" "CYP2E1" "STAT1"

  1   2   >