Re: [R] "Matrix' with Functions

2011-02-03 Thread Alaios
lp Best Regards Alex __ 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 c

Re: [R] Where does R look for library packages - there is no package called 'BRugs'

2011-02-03 Thread Prof Brian Ripley
For the record, this is not a good answer to the question (and the real answer is 'explained fully' on the help page for .libPaths, and also in the rw-FAQ, Q4.2). If you move your personal library directory, you need to set the environment variable R_LIBS_USER . And personal (not site) envir

Re: [R] Where does R look for library packages - there is no package called 'BRugs'

2011-02-03 Thread conor1725
David Winsemius wrote: > > > On Jan 30, 2011, at 5:42 PM, conor1725 wrote: > >> >> I am have installed R on Windows 7 machine. R got installed in the >> directory >> C:\Program Files\R\R-2.12.0. Then I installed the package BRugs >> using the >> install.packages command. I did not get an o

[R] how to learn more from R

2011-02-03 Thread Jie TANG
hi ,R USERS: I am a new R user. I have study some basic R syntax and get some interesting results. Now I want to know how much R can do .where can i get some examples or demo resource to study advanced function of R ? -- thank your TANG Jie Email: totang...@gmail.com Shanghai Typhoon Institu

[R] Can an xyplot() plus legend be saved as an Enhanced Windows Metafile (EMF)?

2011-02-03 Thread david . luckett
I am trying to save some graphical output including a legend in the Windows Enhanced Metafile (EMF) format. This fails when xyplot() is used rather than plot(). Here is a simple example: require(lattice) a <- c(1:10) b <- c(2,4,5,2,3,5,7,8,9,5) # Output can be saved (or copied to the clipboard)

[R] Finding non-normal distributions per row of data frame?

2011-02-03 Thread DB1984
This is my first attempt at this, so hopefully a few kind pointers can get me going in the right direction... I have a large data frame of 20+ columns and 20,000 rows. I'd like to evaluate the distribution of values in each row, to determine whether they meet the criteria of a normal distribution

Re: [R] TM Package - installation

2011-02-03 Thread bpn
Hi Sujatha, if you haven't still resolved this issue, here is a tip: Update your Java with the latest version. I faced with similar problem and resolved it with new java version. Hope this would help. -- View this message in context: http://r.789695.n4.nabble.com/TM-Package-installation-tp2

[R] Please stop all e-mail

2011-02-03 Thread cahyo kristiono
Dear "r-help" I don't want to receive again every e-mail about [R] in my address e-mail (cahyo_kristi...@yahoo.com), because it is cause my inbox so full quickly. So I need your help to stop every e-mail about [R] in my address. Thank you so much Regards CK [[alternative HTML version

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Gabor Grothendieck
On Thu, Feb 3, 2011 at 10:05 PM, Peter Ehlers wrote: > On 2011-02-03 14:09, Dennis Murphy wrote: >> >> Hi: >> >> This also works, except that the result is of class 'table': >> >> xtabs(COUNTS ~ USER_ID + SITE, data = RAW) >>        SITE >> USER_ID SITE1 SITE2 SITE3 >>       1    10    13    22 >>

Re: [R] coxph fails to survfit

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 3:27 PM, Bond, Stephen wrote: Responding to the suggestion by D Winsemius : s1 <- survfit(mod1,newdata=inc[50050:50100,c("strt","stp","incpost", "amt","rate", "termfac")], + se.fit=F,individual=T,type="aa") Error in Surv(time = strt, time2 = stp, event = (

Re: [R] problem subsetting a data frame

2011-02-03 Thread Steve Lianoglou
Hi, On Thu, Feb 3, 2011 at 8:54 PM, Pete Brecknock wrote: > > try > > subset(D, D$x < 5|D$y < 5) Or even better: R> subset(D, x < 5 | y < 5) (The column names of D are "in scope" as variables within the call to subset(D, ...) -steve -- Steve Lianoglou Graduate Student: Computational Systems

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Peter Ehlers
On 2011-02-03 14:09, Dennis Murphy wrote: Hi: This also works, except that the result is of class 'table': xtabs(COUNTS ~ USER_ID + SITE, data = RAW) SITE USER_ID SITE1 SITE2 SITE3 1101322 2101212 31344 0 4 0 09

Re: [R] Easy help with plots, font size

2011-02-03 Thread Thomas Levine
There's also pointsize, depending on your device. On Thu, Feb 3, 2011 at 9:31 PM, gigi1234 wrote: > > Ok thanks. I did have some success using the cex options. Figured out that > I > was putting some of the arguments in the wrong place. > > Thanks again! > > On Thu, Feb 3, 2011 at 8:24 PM, David

Re: [R] Easy help with plots, font size

2011-02-03 Thread gigi1234
Ok thanks. I did have some success using the cex options. Figured out that I was putting some of the arguments in the wrong place. Thanks again! On Thu, Feb 3, 2011 at 8:24 PM, David Winsemius [via R] < ml-node+3259390-1216185916-210...@n4.nabble.com > wrote: > > On Feb 3, 2011, at 7:12 PM, gig

Re: [R] Easy help with plots, font size

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 7:12 PM, gigi1234 wrote: I am trying to make some plots for a poster. Each one needs to be 6 inches by inches. Right now the fonts are too small and the plots don't read well on my poster. I am pretty much an R newbie and I can't figure out how to change the fonts. It

Re: [R] R-help

2011-02-03 Thread sudhir cr
Very neat...Thank you Dennis..that's what I was looking for.. :) On Thu, Feb 3, 2011 at 12:05 PM, Dennis Murphy wrote: > Hi: > > u <- matrix(sample(LETTERS[1:24]), nrow = 8) > u > [,1] [,2] [,3] > [1,] "W" "J" "M" > [2,] "K" "V" "P" > [3,] "X" "E" "U" > [4,] "T" "B" "N" > [5,] "I"

Re: [R] Changing the direction of axis labels on a plot

2011-02-03 Thread Longe
On 02/03/2011 01:57 PM, Peter Alspach wrote: Tena koe ?par and check the las argument. HTH Peter Alspach Thank you, Peter, and also David and William. The las argument indeed helps in setting the tick labels horizontally. Beautiful! But how do I rotate also the axis label, which i

Re: [R] any similiar R fuction for matlab function 'fprintf'?

2011-02-03 Thread Jude Ryan
There does not seem to be a function exactly similar to MATLAB's "fprintf" in R, but you can achieve pretty much the same results using something like the code below: a <- 1:10 b <- 11:20 ab <- cbind(a,b) sink("C:\\R\\test.txt") # open file to write data to - file will be deleted if it exists

[R] Easy help with plots, font size

2011-02-03 Thread gigi1234
I am trying to make some plots for a poster. Each one needs to be 6 inches by inches. Right now the fonts are too small and the plots don't read well on my poster. I am pretty much an R newbie and I can't figure out how to change the fonts. It would also be nice to know how to specify the size of

Re: [R] problem subsetting a data frame

2011-02-03 Thread Pete Brecknock
try subset(D, D$x < 5|D$y < 5) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/problem-subsetting-a-data-frame-tp3258981p3259360.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] any similiar R fuction for matlab function 'fprintf'?

2011-02-03 Thread Zunqiu Chen
Thanks a lot! It really helps. Zunqiu From: Jude Ryan [mailto:jr...@marketshare.com] Sent: Thursday, February 03, 2011 3:28 PM To: Zunqiu Chen Cc: R-help@r-project.org Subject: Re: [R] any similiar R fuction for matlab function 'fprintf'? There does not seem to be a function exactly similar to MA

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Dennis Murphy
Hi: This also works, except that the result is of class 'table': xtabs(COUNTS ~ USER_ID + SITE, data = RAW) SITE USER_ID SITE1 SITE2 SITE3 1101322 2101212 31344 0 4 0 099 If you need a data frame, then the earlier res

[R] Generalized Estimating Equations and a Reviewer Question I can’t answer

2011-02-03 Thread James Ewing
I am using the R statistical package in a pretty straightforward manner, just interested in getting summary statistics and reliable estimates of means, variances, confidence intervals, p-values using standard tests, etc. I've been using the generalized estimating equation package because I ofte

Re: [R] rgenoud for multiple chips: does a more recent special version of "snow" exist?

2011-02-03 Thread Dimitri Liakhovitski
Just a small correction: the package "snow" does install. But once I try to load it: library(snow), I get an error: Error: package 'snow' was built before R 2.10.0: please re-install it Dimitri On Thu, Feb 3, 2011 at 3:57 PM, Dimitri Liakhovitski wrote: > Dear everyone, > > I am trying to run rge

[R] rgenoud for multiple chips: does a more recent special version of "snow" exist?

2011-02-03 Thread Dimitri Liakhovitski
Dear everyone, I am trying to run rgenoud on several chips simultaneusly. I used the instructions provided on Jasjeet Sekhon's Homepage (http://sekhon.berkeley.edu/rgenoud/multiple_cpus.html). However, I have the newer version of R (R 2.12) installed - for a 64-bit machine. So, when I tried to in

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Steve Lianoglou
Hi, On Thu, Feb 3, 2011 at 2:41 PM, Mike Schumacher wrote: > Hello, > > I'd like to transpose data to create an analysis-friendly dataframe.  See > below for an example, I was unable to use t(x) and I couldn't find a > function with options like PROC TRANSPOSE in SAS. > > The ideal solution handl

Re: [R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Eik Vettorazzi
Hi Mike reshape will be your friend. reshape(RAW,direction="wide",timevar="SITE",idvar="USER_ID") there is also the 'reshape'-package, which can do some more sophisticated transformations. hth. Am 03.02.2011 20:41, schrieb Mike Schumacher: > Hello, > > I'd like to transpose data to create an

[R] "hubers" function in R MASS library : problem and solution

2011-02-03 Thread Feiming Chen
Hello: I found the "hubers" function in MASS library is NOT working on the following data: > a <- >c(7.19,7.19,7.19,9.41,6.79,9.41,7.19,9.41,1.64,7.19,7.19,7.19,7.19,1.422,7.19,6.79,7.19,6.79,7.19,7.19,4.44,6.55,6.79,7.19,9.41,9.41,7.19,7.19,7.19,7.19,1.64,1.597,1.64,7.19,1.422,7.19,6.79,9.38,7

Re: [R] coxph fails to survfit

2011-02-03 Thread Bond, Stephen
Responding to the suggestion by D Winsemius : > s1 <- survfit(mod1,newdata=inc[50050:50100,c("strt","stp","incpost", > "amt","rate", "termfac")], + se.fit=F,individual=T,type="aa") Error in Surv(time = strt, time2 = stp, event = (resp == 1)) : object 'resp' not found it appears

[R] R Data Manipulation - Transposing Data by a Given Column, Like User_ID

2011-02-03 Thread Mike Schumacher
Hello, I'd like to transpose data to create an analysis-friendly dataframe. See below for an example, I was unable to use t(x) and I couldn't find a function with options like PROC TRANSPOSE in SAS. The ideal solution handles variable quantities of SITE - but beggars can't be choosers. :-) Tha

Re: [R] exact logistic regression

2011-02-03 Thread Łukasz Ręcławowicz
2011/2/3 Den > > Thank you again > It is funny how stupid I was Elrm, clogit {survival} or exactLoglinTest are only "exact-like", the truth is, R don't have it... and glm is poor. http://sas-and-r.blogspot.com/2010/12/example-818-monte-carlo-experiment.html http://sas-and-r.blogspot.com/2010/1

Re: [R] coxph fails to survfit

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 2:14 PM, Bond, Stephen wrote: I have a model with quant vars only and the error message does not make sense: (mod1 <- coxph(Surv(time=strt,time2=stp,event=(resp==1))~ +incpost +I(amt/1e5)+rate+strata(termfac), subset=dt<"2010-08-30", data=inc,method="efron"

[R] use "summary"

2011-02-03 Thread Hongwei Dong
Hi, dear R users, I'm running a Tobit regression and using "summary" to display model results. It used to work. But this time, I kept getting this: > summary(RES_TOBIT) Length Class Mode 1 vglm S4 Could anyone tell me how to solve this problem, and why I got this problem? Thanks.

Re: [R] Changing the direction of axis labels on a plot

2011-02-03 Thread Peter Alspach
Tena koe ?par and check the las argument. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Longe > Sent: Friday, 4 February 2011 7:16 a.m. > To: r-help@r-project.org > Subject: [R] Changing the direct

Re: [R] error in density plot

2011-02-03 Thread Ben Bolker
> My concern was that it was "outside" the density function and I thought > the density function would throw an error before it passed anything to > na.omit(). > > plot(na.omit(density(c(1,1,1,1,1,NA,4,4,4,4))) ) > Error in density.default(c(1, 1, 1, 1, 1, NA, 4, 4, 4, 4)) : > 'x' contains mis

Re: [R] error in density plot

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 2:14 PM, Ben Bolker wrote: On 02/02/2011 09:29 AM, David Winsemius wrote: On Feb 2, 2011, at 8:22 AM, Ben Bolker wrote: Ramya gmail.com> writes: I have the code for the density plot j <- 8 plot(density(diff_in_sample[,1]), main = list.files()[j]) for(i in 1:25){ lines(

Re: [R] Changing the direction of axis labels on a plot

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 1:16 PM, Longe wrote: Dear list, Plots generated with the plot command have labels on the vertical y axis rotated counterclockwise. How do I specify that they should be positioned horizontally (I mean each label should read from left to right)? ?par The las argumen

[R] Changing the direction of axis labels on a plot

2011-02-03 Thread Longe
Dear list, Plots generated with the plot command have labels on the vertical y axis rotated counterclockwise. How do I specify that they should be positioned horizontally (I mean each label should read from left to right)? Thank you. L. __ R-help@

[R] My own distribution in survreg function

2011-02-03 Thread spooky
Hello, I´m trying to do some analysis using survreg function. I need to implement there my own distribution with density: lambda*exp(-lambda*y), where y = a1/(1+exp(-a2*x)). a1, a2 are unknown parameters and x >0. I need to get estimates of a1 and a2 (and lambda of course) I’m really

[R] replacement bootstrapping

2011-02-03 Thread Mhairi
Hi there I am looking at the functional response (the consumption of single predators of prey over a range of prey densities) and Im having issues with the following script when trying to obtain mutliple replicates of coefficients (a and h) from the following nls model based on Hollings disc equ

Re: [R] tapply output as a dataframe

2011-02-03 Thread Graves, Gregory
This works. Thanks. Gregory A. Graves, Lead Scientist Everglades REstoration COoordination and VERification (RECOVER) Wetland Watershed Sciences / Restoration Sciences Department South Florida Water Management District Phones:  DESK: 561 / 682 - 2429       CELL:  561 / 719 - 8157

[R] coxph fails to survfit

2011-02-03 Thread Bond, Stephen
I have a model with quant vars only and the error message does not make sense: (mod1 <- coxph(Surv(time=strt,time2=stp,event=(resp==1))~ +incpost+I(amt/1e5)+rate+strata(termfac), subset=dt<"2010-08-30", data=inc,method="efron")) Call: coxph(formula = Surv(time = strt, time2 = stp,

Re: [R] error in density plot

2011-02-03 Thread Ben Bolker
On 02/02/2011 09:29 AM, David Winsemius wrote: > > On Feb 2, 2011, at 8:22 AM, Ben Bolker wrote: > >> Ramya gmail.com> writes: >> >>> I have the code for the density plot >>> j <- 8 >>> plot(density(diff_in_sample[,1]), main = list.files()[j]) >>> for(i in 1:25){ >>> lines(density(diff_in_sample

[R] Need advises on mixed-effect model ( a concrete example)

2011-02-03 Thread wphantomfr
Dear R-help members, I'm trying to run LME model on some behavioral data and need confirmations about what I'm doing... Here's the story... I have some behavioral reaction time (RT) data (participants have to detect dome kind of auditory stimuli). the dependant variable is RT measured in mi

[R] I want to ask user to create a typical matrix, otherwise there should be some error displaying...

2011-02-03 Thread Maithula Chandrashekhar
Dear all, I am into some bigger project and in implementing that, I have come across a problem, wherein I have to ask user to create a Matrix with all elements either NA value or some "Date" object, preferably in mm/dd/yy format. Therefore I would like to force user to create following sort of matr

Re: [R] "Matrix' with Functions

2011-02-03 Thread Bert Gunter
ad 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. > > > __ Information from ESET NOD32 Antivirus, version of virus > signature datab

Re: [R] tapply output as a dataframe

2011-02-03 Thread Gabor Grothendieck
On Thu, Feb 3, 2011 at 1:11 PM, David Winsemius wrote: > > On Feb 3, 2011, at 1:05 PM, Graves, Gregory wrote: > >> Yes, as far as I can tell, "sampling.date" is a character vector of the >> format "1/15/2008".  It resides in the leftmost column of the tapply output. >> >> "station.code" are the A,

Re: [R] tapply output as a dataframe

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 1:05 PM, Graves, Gregory wrote: Yes, as far as I can tell, "sampling.date" is a character vector of the format "1/15/2008". It resides in the leftmost column of the tapply output. "station.code" are the A, B, C column headers which refer actual water quality station l

Re: [R] tapply output as a dataframe

2011-02-03 Thread Graves, Gregory
Yes, as far as I can tell, "sampling.date" is a character vector of the format "1/15/2008". It resides in the leftmost column of the tapply output. "station.code" are the A, B, C column headers which refer actual water quality station locations, and the values below those headers correspond to

Re: [R] tapply output as a dataframe

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 11:29 AM, Graves, Gregory wrote: On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube wrote: That is pushing two years ago, so I doubt very many people still have that posting on their mail-clients. (When I did go to the archives Dan Dube's problem was posed as how to bind "a":

Re: [R] "Matrix' with Functions

2011-02-03 Thread RICHARD M. HEIBERGER
__ > 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<http://www.r-project.org/posting-guide.html> > and provide

Re: [R] tapply output as a dataframe

2011-02-03 Thread Phil Spector
Try as.data.frame(as.table(a)) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley

Re: [R] exact logistic regression

2011-02-03 Thread Den
Dear Dennis Thank you again It is funny how stupid I was. I was afraid of the word "inference" in elrm package description while performing my first search. elrm package looks like what I need. They have very good intro with examples Zamar D, McNeney B and Graham J. elrm: Software Implementing

Re: [R] Average of several line plots

2011-02-03 Thread mattnixon
Yes - that is exactly what was needed. Applying approx to each data set then allowed for straight forward averaging afterwards. Many thanks. -- View this message in context: http://r.789695.n4.nabble.com/Average-of-several-line-plots-tp3254850p3258494.html Sent from the R help mailing list arc

[R] Mixed Model Logistic Weighting

2011-02-03 Thread Cody Likavec
I am trying to run a mixed model logistic regression with participants nested within state with a certain amount of covariates. Here is what my model looks like: m1 <- lmer(Overweight ~ age + factor(A_RACE_G) + Prevalance + HH_Income_Dicot + Unemployment_Rate + Intensity_effect + (1 | state2)

Re: [R] get caller's name

2011-02-03 Thread Ernest Adrogué
3/02/11 @ 14:30 (-0200), Henrique Dallazuanna escriu: > Try this: > > g <- function(.x) tryCatch(stop.if.dims(.x), error=function(e)sprintf("Error > in %s: %s", deparse(sys.call(1)), e$message)) > g(rbind(2, 3)) This is it. Thanks! Cheers. -- Ernest __

Re: [R] get caller's name

2011-02-03 Thread Ernest Adrogué
3/02/11 @ 11:25 (-0500), David Winsemius escriu: > On Feb 3, 2011, at 10:27 AM, Ernest Adrogué wrote: > > >Hi, > >Suppose a function that checks an object: > > > >stop.if.dims <- function(x) { > > if (! is.null(dim(x))) { > > stop("cannot handle dimensional data") > > } > >} > > > > > mtx <- m

Re: [R] looping variable names

2011-02-03 Thread Greg Snow
It is not clear what you are trying to do, but you can have lists (or vectors) of functions and that should simplify what you are trying to do: > trigfuns <- list( s=sin, c=cos, t=tan ) > trigfuns $s function (x) .Primitive("sin") $c function (x) .Primitive("cos") $t function (x) .Primitive(

Re: [R] looping variable names

2011-02-03 Thread Greg Snow
It depends on what you are assigning. A simple example of assigning the values 1 through 100: mylist <- lapply(1:100, I) names(mylist) <- paste('var',1:100, sep='') Or if you have 100 files named dat1.txt, dat2.txt, ..., dat100.txt and you want to read them in: mylist <- lapply( paste('dat',

Re: [R] "Matrix' with Functions

2011-02-03 Thread Samuel Le
_ 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. __ Information from ESET NOD32 Antivirus,

Re: [R] R-help

2011-02-03 Thread Dennis Murphy
Hi: u <- matrix(sample(LETTERS[1:24]), nrow = 8) u [,1] [,2] [,3] [1,] "W" "J" "M" [2,] "K" "V" "P" [3,] "X" "E" "U" [4,] "T" "B" "N" [5,] "I" "Q" "F" [6,] "G" "R" "S" [7,] "A" "C" "O" [8,] "D" "H" "L" t(apply(u, 1, function(x) sort(x))) [,1] [,2] [,3] [1,] "J" "M" "W"

Re: [R] substring and paste character with a for loop

2011-02-03 Thread Chris82
Oh, that's of course a better solution. I've never red or heard about "gsub". Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/substring-and-paste-character-with-a-for-loop-tp3258449p3258485.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] "Matrix' with Functions

2011-02-03 Thread Claudia Beleites
Seems funny to me: > f <- list (mean, sd, median, sum) > dim (f) <- c (2, 2) or in one line: > f <- structure (.Data=list (mean, sd, median, sum), dim = c(2,2)) > f [,1] [,2] [1,] ?? [2,] ?? > f [1,1] [[1]] function (x, ...) UseMethod("mean") > f [[1,1]] (1:3) [1] 2 > f [[2,1]] (1

Re: [R] substring and paste character with a for loop

2011-02-03 Thread Eik Vettorazzi
Hi Chris, 'gsub' does exactly what you want: gsub(",","",text) so there is no need for a loop. Btw. your loop assigns a new value to m in each step and you see only the last assignment. you could do something like m <- paste(m,substring(text,i,i+2),sep = "") hth Am 03.02.2011 17:35, schrieb C

Re: [R] R-help

2011-02-03 Thread Henrique Dallazuanna
Try this: x[2:3] <- t(apply(x[-1], 1, sort)) On Thu, Feb 3, 2011 at 1:57 PM, sudhir cr wrote: > Hi, > > > > I have data like this > > > > print(x) > > > > ID VAL1VAL2 > > 1 B A > > 2 P Q > > 3 T S > > > > What I would like is data like this... > >

Re: [R] substring and paste character with a for loop

2011-02-03 Thread Ben Bolker
Chris82 gmx.de> writes: > > > Hello R users, > > I have a little problem with a for loop. > Below there is an simple example of my problem. > > I want to delet the commas in the character string. Fore this reason I > create a for loop to unpick the string and rebuild him without the commas. >

[R] substring and paste character with a for loop

2011-02-03 Thread Chris82
Hello R users, I have a little problem with a for loop. Below there is an simple example of my problem. I want to delet the commas in the character string. Fore this reason I create a for loop to unpick the string and rebuild him without the commas. The problem is, that "paste" does not work in

[R] "Matrix' with Functions

2011-02-03 Thread Alaios
Dear R members, I have a quite large of function that are named like that f11,f12,...f15 f21,f22,...f25 .. f51,f52,...f52 These are static (hard-coded) functions that the only common they have is that they take the same number and type of input fij(a,b,c,d). As you might understand this is reall

Re: [R] get caller's name

2011-02-03 Thread Henrique Dallazuanna
Try this: g <- function(.x) tryCatch(stop.if.dims(.x), error=function(e)sprintf("Error in %s: %s", deparse(sys.call(1)), e$message)) g(rbind(2, 3)) 2011/2/3 Ernest Adrogué > Hi, > Suppose a function that checks an object: > > stop.if.dims <- function(x) { > if (! is.null(dim(x))) { >stop(

Re: [R] tapply output as a dataframe

2011-02-03 Thread Graves, Gregory
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube wrote: > i use tapply and by often, but i always end up banging my head against > the wall with the output. The proposed solution of Dan's problem posted on R-help was: > do.call(rbind,a) When I use this 'solution' I get 'ERROR: second argument must

[R] R-help

2011-02-03 Thread sudhir cr
Hi, I have data like this print(x) ID VAL1VAL2 1 B A 2 P Q 3 T S What I would like is data like this... ID VAL1VAL2 1 A B 2 P Q 3 S T So that VAL1 and VAL2 are alphabetically ordere

Re: [R] get caller's name

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 10:27 AM, Ernest Adrogué wrote: Hi, Suppose a function that checks an object: stop.if.dims <- function(x) { if (! is.null(dim(x))) { stop("cannot handle dimensional data") } } > mtx <- matrix(c(1,0,0,1), 2) > stop.if.dims <- function(x) { objname <- deparse(substitut

Re: [R] sqlsave and mysql database with autoincremental column

2011-02-03 Thread PtitBleu
I found a solution (certainly not the best one but it works). I add a 45th column full of 0 to the 44-columns data.frame. When I copy the data.frame to the database with sqlsave, the last column of the table is not full of 0, but it autoincrements. Another small question: what is the command to c

Re: [R] Sorting a Data Frame by hybrid string / number key

2011-02-03 Thread William Dunlap
To sort a character vector in a desired order you can convert it to a factor with the levels in the desired order. To sort strings like "2" and "11" in numerical order, use convert them to numbers with as.numeric. To sort by two variables, using the second to break ties in the first, use data[ord

[R] get caller's name

2011-02-03 Thread Ernest Adrogué
Hi, Suppose a function that checks an object: stop.if.dims <- function(x) { if (! is.null(dim(x))) { stop("cannot handle dimensional data") } } This would be used by other functions that can only work with dimensionless objects. The problem is the error message would need to include the n

Re: [R] Sorting a Data Frame by hybrid string / number key

2011-02-03 Thread David Winsemius
On Feb 3, 2011, at 10:12 AM, Alastair wrote: Hi, I'm trying to present a table of some experimental data, and I want to order the rows by the instance names. The issue I've got is that there are a variety of conventions for the instance names (e.g. competition01, competition13, small_1, bi

[R] Sorting a Data Frame by hybrid string / number key

2011-02-03 Thread Alastair
Hi, I'm trying to present a table of some experimental data, and I want to order the rows by the instance names. The issue I've got is that there are a variety of conventions for the instance names (e.g. competition01, competition13, small_1, big_20, med_9). What I want to be able to sort them fi

Re: [R] Why my package is not being generated?

2011-02-03 Thread Bart Joosen
a typo in r-projeCt.org? install.packages("tests",repos="http://r-forge.r-project.org";) -- View this message in context: http://r.789695.n4.nabble.com/Why-my-package-is-not-being-generated-tp3255111p3258202.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] interpret significance from the contr.poly() function

2011-02-03 Thread RICHARD M. HEIBERGER
You can use the summary with the split argument. See ?summary.aov for an example. This gives similar results to the regression coefficients approach that Ista Zahn suggested. I usually prefer the ANOVA table approach for factors. On Thu, Feb 3, 2011 at 3:36 AM, Asan Ramzan wrote: > Hello R-he

Re: [R] interpret significance from the contr.poly() function

2011-02-03 Thread Ista Zahn
By fitting some kind of model. contr.poly doesn't fit a model or test significance, it just sets contrasts. Here is an example data(mtcars) > mtcars$carb <- factor(mtcars$carb) > contrasts(mtcars$carb) <- contr.poly(n=levels(mtcars$carb)) > contrasts(mtcars$carb) .L .Q .C

[R] coxme, colon2 dataframe

2011-02-03 Thread John Sorkin
I am exploring the coxme function. The help page uses two examples that use the colon2 dataframe. The data frame is not included in the material that is installed when one loads the coxme package. The web site that contains the colon2 data, does not have the file in an immediately usable fashio

[R] mpirun .C and R

2011-02-03 Thread Allan Clark
hello all For those interested! i figured out the problem! I needed to put the dyn.load and dyn.unload lines inside the loop! library(doMPI) cl <- startMPIcluster(count=2)#this will b

[R] minimum steiner tree

2011-02-03 Thread amir
Dear All, Is there any function in R that find the minimum steiner tree not minimum spanning tree? Regards, Amir __ 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

Re: [R] Odp: Loop to mapply. Error

2011-02-03 Thread Alaios
I would like to thank you very much both. Your replies helped me understand. I will bookmark you replies for future reference :) Best Regards Alex --- On Thu, 2/3/11, Kenn Konstabel wrote: From: Kenn Konstabel Subject: Re: [R] Odp: Loop to mapply. Error To: "Alaios" Cc: "Petr PIKAL" , R-help

Re: [R] random sequences for rnorm and runif

2011-02-03 Thread Prof Brian Ripley
On Thu, 3 Feb 2011, Matthias Gondan wrote: Dear R experts, For a fixed seed, the first random number produced by rnorm and runif has the same rank within the distribution, which I find useful. The following ranks differ, however. set.seed(123) runif(4) [1] *0.2875775* 0.7883051 *0.4089769* 0

Re: [R] how to read the "Sum Sq" - column from summary.aov()

2011-02-03 Thread Bertolt Meyer
Dear Peter, thank you so much for the quick and helpful reply - it was exactly what I was looking for. Regards, Bertolt Am 03.02.2011 um 13:49 schrieb Peter Ehlers: > On 2011-02-03 04:30, Bertolt Meyer wrote: >> Dear R-Users, >> >> I have a trivial problem, but extensive googling and ??'ing d

[R] random sequences for rnorm and runif

2011-02-03 Thread Matthias Gondan
Dear R experts, For a fixed seed, the first random number produced by rnorm and runif has the same rank within the distribution, which I find useful. The following ranks differ, however. > set.seed(123) > runif(4) [1] *0.2875775* 0.7883051 *0.4089769* 0.8830174 > set.seed(123) > pnorm(rnorm(4)

Re: [R] Why my package is not being generated?

2011-02-03 Thread Ben Bolker
Cristiano Strieder gmail.com> writes: > > Hi all, > > I have commited a new release of my package and waited for more than > one day. After that > "install.packages("tests",repos="http://r-forge.r-projet.org";)" still > returns "package 'tests' is not available". I have done the local > build &

Re: [R] how to read the "Sum Sq" - column from summary.aov()

2011-02-03 Thread Ivan Calandra
Hi, If you do test <- summary(aov(DV ~ IV1 * IV2)) str(test) you will see that test[[1]][2] gives you what you want. Reading more on indexing will also probably help you. str() is a very useful function, to use without moderation! HTH, Ivan Le 2/3/2011 13:30, Bertolt Meyer a écrit : summary

Re: [R] how to read the "Sum Sq" - column from summary.aov()

2011-02-03 Thread Peter Ehlers
On 2011-02-03 04:30, Bertolt Meyer wrote: Dear R-Users, I have a trivial problem, but extensive googling and ??'ing did not solve it: I want to obtain the sums of squares from a summary.aov() object for later use. Example: DV<- rnorm(100) IV1<- as.factor(rep(c("male", "female"), times = 50))

Re: [R] Odp: Loop to mapply. Error

2011-02-03 Thread Kenn Konstabel
On Thu, Feb 3, 2011 at 1:16 PM, Alaios wrote: > I am sorry that I did not provide all the required data (for me is not very > straight-forward to understand what I have to provide and what not) > > > findCell<-function(x,sr){ # It is just for me understand how mapply works > sr[x[1],x[2]

[R] interpret significance from the contr.poly() function

2011-02-03 Thread Asan Ramzan
Hello R-help (sorry if this message gets posted twice, i think I may have accidently postponed it) I don’t know how to interpret significance from the contr.poly() function . From the example below : how can I tell if data has a significant Linear/quadratic/cubic trend? > contr.poly(4, c(1,2,4

[R] boostrap an nls regression

2011-02-03 Thread m234
Hello there I have the following model based on the hollings disc equation for the type II functional response for 2 data sets: nls(eaten~(a*suppl)/(1+a*h*suppl) where eaten is the number of prey eaten by a predator and suppl is the number of prey initially supplied to the same predator. I ha

[R] how to read the "Sum Sq" - column from summary.aov()

2011-02-03 Thread Bertolt Meyer
Dear R-Users, I have a trivial problem, but extensive googling and ??'ing did not solve it: I want to obtain the sums of squares from a summary.aov() object for later use. Example: > DV <- rnorm(100) > IV1 <- as.factor(rep(c("male", "female"), times = 50)) > IV2 <- as.factor(rep(c("young", "old

Re: [R] testing randomness of random number generators with student t-test?

2011-02-03 Thread Petr Savicky
On Wed, Feb 02, 2011 at 06:01:36PM -0500, Carl Witthoft wrote: > Hi, subject more or less says it all. > > I freely admit to not having bothered to find some of the online papers > about method of testing the quality of random number generators -- but > in an idle moment I wondered what to expec

Re: [R] Odp: Loop to mapply. Error

2011-02-03 Thread Petr PIKAL
Hi Alaios napsal dne 03.02.2011 12:16:45: > Hello Petr, > I am sorry that I did not provide all the required data (for me is not very > straight-forward to understand what I have to provide and what not) > > > findCell<-function(x,sr){ # It is just for me understand how mapply works >

Re: [R] mapply question (?)

2011-02-03 Thread Kenn Konstabel
On Thu, Feb 3, 2011 at 1:26 PM, Albert-Jan Roskam wrote: > Hi, > > I have a function myFun which I want to call multiple times, using > different > argument lists. > myFun("v1", "2009", 1) > myFun("v2", "2008", 1) > myFun("q", "2001") > Notice that the third call is different, you have 3 args in

[R] Error message: number of items to replace is not a multiple of replacement length

2011-02-03 Thread Karen Moore
*Warning messages: *appear after dredging global model in MMI and requesting model selection table dd(global model)<-dredge(global model) - runs OK dd(global model) * 1: In x[i] <- value[[j]] : number of items to replace is not a multiple of replacement length* Also at model averaging stage

[R] mapply question (?)

2011-02-03 Thread Albert-Jan Roskam
Hi, I have a function myFun which I want to call multiple times, using different argument lists. myFun("v1", "2009", 1) myFun("v2", "2008", 1) myFun("q", "2001") How can I easily do this in R? Should I use mapply? I unsuccessfully tried something like: x <- list(c("v1", "2009", 1), c("v2", "200

Re: [R] Average of several line plots

2011-02-03 Thread Philipp Pagel
On Thu, Feb 03, 2011 at 01:36:57AM -0800, mattnixon wrote: > > The data doesn't represent functions. Basically the X values represent the > distance across a sample and the Y values are a measure of the colour > intensity at that point across the sample (i.e. a line plot across the > sample). Each

  1   2   >