Re: [R] Can not find lme

2012-08-07 Thread Simon Blomberg
You loaded package lme4. The function lme is in package nlme. Try doing library(nlme) first. Simon. On 08/08/12 16:22, Santini Silvana wrote: Dear all, Can anyone help me, my R software can not run a nested linear regression by using the lme funcion. The message that appears is Error: could

[R] Can not find lme

2012-08-07 Thread Santini Silvana
Dear all, Can anyone help me, my R software can not run a nested linear regression by using the lme funcion. The message that appears is  Error: could not find function "lme" I already downloaded and loaded the package, please see below. Thank you in advance for any help! Nadia. > data<-read.cs

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread Petr Savicky
On Wed, Aug 08, 2012 at 06:03:19AM +, Ingo Reinhold wrote: > Hi Jeff, David, > > what I'm trying to do is speed the currently used nest for loop > > a<-matrix(c(1:6),ncol=3) > b<-c(1,2,3,4) > > result<-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)[1]) > for(ii in 1:dim(a)[1]){ > fo

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread Ingo Reinhold
Hi Jeff, David, what I'm trying to do is speed the currently used nest for loop a<-matrix(c(1:6),ncol=3) b<-c(1,2,3,4) result<-matrix(rep(0, times=dim(a)[1]*length(b)),nrow=dim(a)[1]) for(ii in 1:dim(a)[1]){ for(jj in 1:length(b)){ result[ii,jj]<-a[ii,1]+a[ii,3]/b[jj] } } giving th

Re: [R] add leading zeros

2012-08-07 Thread Liviu Andronic
On Tue, Aug 7, 2012 at 10:48 PM, David Winsemius wrote: > On Aug 7, 2012, at 3:55 AM, Liviu Andronic wrote: >> For anyone interested, I came up with a small wrapper for the above: >> add.lead <- function(x, width=max(nchar(x))){ >>sprintf(paste('%0', width, 'i', sep=''), x) >> } > > Thanks, Li

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Liviu Andronic
On Tue, Aug 7, 2012 at 10:18 PM, Marc Schwartz wrote: > That will get you values where punctuation characters are used, but there may > be other non-alphanumeric characters in the vector. There may be ASCII > control codes, tabs, newlines, CR, LF, spaces, etc. which would not be found > by usin

Re: [R] Accents and special character using hwriter (on Windows)

2012-08-07 Thread David Scott
The safest way to include special characters is to use a character code. You are at the mercy of the browser otherwise and browsers behave very differently when confronted with unusual things. You don't mention which browser you are using on Windows, which is a severe gap in the information you

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread Jeff Newmiller
Can you post what you want your answer to be for the a and b you have given already? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] Repeated Aggregation with data.table

2012-08-07 Thread arun
HI, Try this: fun1<-function(x,.expr){   .expr<-expression(list(mean.z=mean(z),sd.z=sd(z)))  z1<-eval(.expr)  } #or fun1<-function(x,.expr){   .expr<-expression(list(mean.z=mean(z),sd.z=sd(z)))  z1<-.expr  }  dat[,eval(z1),list(x)] dat[,eval(z1),list(y)] dat[,eval(z1),list(x,y)] A.K. -

Re: [R] Decimal number

2012-08-07 Thread arun
Hi, You are right, R doesn't allow white space within variable.   beta0 = 64.90614   beta1 = 17.7025  her beta<-c(beta0,beta1) #Error: unexpected symbol in "her beta"  "her beta"<-c(beta0,beta1)  "her beta" #[1] "her beta" #But, this will get the results:  `her beta`<-c(beta0,beta1)  `her bet

Re: [R] reshape2's dcast() Adds NAs to Data Frame

2012-08-07 Thread arun
HI, It is hard to tell without the data.  But, a wild guess is that your data might have more levels per each variable and so the missing combinations end up as NA. For example, Try these two example datasets. #This will end up with NAs md2  <-  structure(list(group = structure(c(1L, 1L, 1L,

Re: [R] Outer product from matrix by row and a vector

2012-08-07 Thread David Winsemius
On Aug 7, 2012, at 9:02 PM, Ingo Reinhold wrote: Dear all, I am facing a challenge when applying the outer product with a matrix by rows. What I have is a rather big matrix, which I would like to convert into a different matrix by doing something like outer(matrix_row, vector, function

[R] Outer product from matrix by row and a vector

2012-08-07 Thread Ingo Reinhold
Dear all, I am facing a challenge when applying the outer product with a matrix by rows. What I have is a rather big matrix, which I would like to convert into a different matrix by doing something like outer(matrix_row, vector, function(x,y) x[1]+5*x[4]/y) In order to get there, I tried to ge

Re: [R] Repeated Aggregation with data.table

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 4:36 PM, Elliot Joel Bernstein wrote: > I have been using ddply to do aggregation, and I frequently define a > single aggregation function that I use to aggregate over different > groups. For example, > > require(plyr) > > dat <- data.frame(x = sample(3, 100, replace=TRUE),

[R] R versus SAS

2012-08-07 Thread Kjetil Halvorsen
I found this on CrossValidated: "A medical statistician once told me, that they use SAS because if they make mistakes due to software bugs and it comes to lawsuits, SAS will recompensate them. R comes without warranty." Kjetil __ R-help@r-project.org m

[R] Confidence bands around LOESS

2012-08-07 Thread David Doyle
Hi Folks, I'm looking to do Confidence bands around LOESS smoothing curve. If found the older post about using the Standard error to approximate it https://stat.ethz.ch/pipermail/r-help/2008-August/170011.html Also found this one http://www.r-bloggers.com/sab-r-metrics-basics-of-loess-regression

[R] random number generator with SNOW/ Parallel/ foreach

2012-08-07 Thread Jie
Dear All, I have three classes of questions about generating random numbers with different packages (windows xp 32bit R). . 1. Suppose I would like to use package *foreach*, can I use current Sys.time as a seed? Although I can get the time up to1e-6 second precesion, the code below dose not work w

Re: [R] reshape2's dcast() Adds NAs to Data Frame

2012-08-07 Thread Jeff Newmiller
Need sample data, and code that demos the problem. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live:

Re: [R] Setting Number of Displayed Digits

2012-08-07 Thread David Winsemius
On Aug 7, 2012, at 2:30 PM, Rich Shepard wrote: Some chemicals have concentrations at or below the method detection limit (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how the concentration is displayed. But, when I ask for a summary() of that data frame column

Re: [R] reshape2's dcast() Adds NAs to Data Frame

2012-08-07 Thread R. Michael Weylandt
Can you provide a reproducible example? See, e.g., http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for information on how to do so. My entirely unjustified guess is that the NAs appear for combinations of factor levels that don't exist. Michael On Tue, Aug

Re: [R] Setting Number of Displayed Digits

2012-08-07 Thread R. Michael Weylandt
Can you provide a reproducible example: see, e.g., this site for how to do so: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Incidentally, I don't believe I can replicate your problem: > x <- data.frame(conc = sample(c(100, 1,2,3, 0.005, 0.0005, 0.2),

Re: [R] Setting Number of Displayed Digits

2012-08-07 Thread arun
HI, formatC() may work for you.  summary(x,digits=5) #may not work here. I tried this within a list.  For some of the list members, this is not working. summary(list12[[5]],digits=max(7))   # Min. 1st Qu.  Median    Mean 3rd Qu.    Max.   #  1.0 1.0 2.5 3.2 5.0 7.0  formatC(

Re: [R] r-forge down?

2012-08-07 Thread R. Michael Weylandt
Entirely different project. (confusingly similar name though) M On Aug 7, 2012, at 5:29 PM, Roy Mendelssohn wrote: > http://www.rforge.net > > -Roy > > On Aug 7, 2012, at 3:25 PM, Alexander Shenkin wrote: > >> Hi Folks, >> >> I've looked around, haven't found anything, and I'm not sure wher

Re: [R] Re-grouping data in R

2012-08-07 Thread Rui Barradas
Hello, Inline. Em 07-08-2012 19:56, Abraham Mathew escreveu: I have a data frame with a column of values that I want to bucket (group) into specific levels. str(dat)'data.frame': 3678 obs. of 39 variables: $ id : int 23 76 129 156 166 180 200 214 296 344 ...

Re: [R] Setting Number of Displayed Digits

2012-08-07 Thread Rui Barradas
Hello, function summary.data.frame does have a 'digits' argument with a default set to max(3, getOption("digits")-3) If you need more digits in your summary, call summary(object, digits = getOption("digits")) Hope this helps, Rui Barradas Em 07-08-2012 22:30, Rich Shepard escreveu: Some

Re: [R] summing and combining rows

2012-08-07 Thread arun
Hi, Not sure why you mentioned "+" doesn't work. dat1<-read.table(text=" Plot    Elevation    Area    SizeClass    Stems 12    1200    132.4    Class3    0 12    1200    132.4    Class4    1 17    2320    209.1   

Re: [R] Setting Number of Displayed Digits

2012-08-07 Thread Duncan Murdoch
On 12-08-07 5:30 PM, Rich Shepard wrote: Some chemicals have concentrations at or below the method detection limit (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how the concentration is displayed. But, when I ask for a summary() of that data frame column only 0 is d

[R] [R-pkgs] new package MPDiR version 0.1-11

2012-08-07 Thread Ken Knoblauch
We announce the release of package MPDiR version 0.1-11 which contains data sets and functions to support the forthcoming book "Modeling Psychophysical Data in R" by K. Knoblauch and L. T. Maloney, Use R! Vol 32, Springer (expected publication date: September 2012). The package includes several d

Re: [R] Execution of a function

2012-08-07 Thread hafida
HI Arun and all >my function is: >aj.fun <- function(j, i, X, z, E, beta0, beta1){ + n <- length(X) + iX <- order(X) + iz <- order(z) + e1 <- -(beta)*z[ iz[1:(i - 1)] ] + numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) ) + e2 <- -(beta)*z[ iz[i:n] ] + denom <- sum( exp(e2) ) + numer/denom + } >

Re: [R] r-forge down?

2012-08-07 Thread Duncan Murdoch
On 12-08-07 6:25 PM, Alexander Shenkin wrote: Hi Folks, I've looked around, haven't found anything, and I'm not sure where else to check. I haven't visited R-forge (http://r-forge.r-project.org) in a long time. Now that I'm trying, it seems to be down. Anyone know if this is a temporary condi

[R] Repeated Aggregation with data.table

2012-08-07 Thread Elliot Joel Bernstein
I have been using ddply to do aggregation, and I frequently define a single aggregation function that I use to aggregate over different groups. For example, require(plyr) dat <- data.frame(x = sample(3, 100, replace=TRUE), y = sample(3, 100, replace = TRUE), z = rnorm(100)) f <- function(x) { da

Re: [R] Error using ddply inside user-defined function

2012-08-07 Thread Brian Diggs
A few comments in-line below On 8/7/2012 1:53 PM, Jennifer Sabatier wrote: PROV.PM.FBCTS <- c(0.00 ,0.00, 33205.19, 25994.56, 23351.37, 26959.56 ,27632.58, 26076.24, 0.00, 0.00 , 6741.42, 18665.09 ,18129.59 ,21468.39 ,21294.60 ,22764.82, 26076.73) FBCTS.INV.TOT <- c(0 , 0, 958612, 487

Re: [R] Decimal number

2012-08-07 Thread hafida
HI >THANK YOU ALL OF YOU >THIS PROBLEM IS SOLVED >THANK YOU >hafida -- View this message in context: http://r.789695.n4.nabble.com/Decimal-number-tp4639428p4639467.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.o

Re: [R] Problem with global variable building a package

2012-08-07 Thread Greg Snow
Probably the best thing to do is create an environment within the package that you can assign to and read from. Somewhere in the source code for the package include a line like: my.env <- new.env() then within any functions defined after that line you can set variables within the environment wit

Re: [R] Execution of a function

2012-08-07 Thread R. Michael Weylandt
Please do keep your replies on the R help list. On Tue, Aug 7, 2012 at 4:17 PM, hafida goual wrote: > > HI >> >>I know my questions are debile, but please I'm debutante. > >>> source("functionaj") > Error in file(filename, "r", encoding = encoding) : > cannot open the connection > In addition:

Re: [R] What is this called? lapply(datum,"[[","ColumnName")

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 2:06 PM, Kevin Chang wrote: > Hello R users > > > > I recently learned how to use this command: > > > lapply(datum,"[[","ColumnName") > > > > Unfortunately, I don't know how exactly it works, what it's called (in > particular the "[[" part], and what other things you can do

[R] [R-pkgs] QCA version 1.0-4 released

2012-08-07 Thread Adrian Duşa
Dear All, QCA package version 1.0-4 has been released today, the sources are now visible on CRAN and the binaries for Windows and MacOS should appear in a couple of more days. We highly recommend upgrading to this version. Apart from a number of small bug fixes, the most notable reason to upgrade

Re: [R] Decimal number

2012-08-07 Thread arun
Hello,   beta0<-64.90614  beta1<-17.7025  herbeta<-c(beta0,beta1)  herbeta [1] 64.90614 17.70250 So, here you have "herbeta" (or is it simply "beta") assigned to the vector containing values of beta0 and beta1.  Your statement "I want to get the number of beta and beta with the full part after

Re: [R] multiple comparisons for GAMs

2012-08-07 Thread peter dalgaard
On Aug 7, 2012, at 18:48 , Bird_Girl wrote: > I have looked into using glht (‘multcomp’ package) to do multiple comparisons > for a model fit with GAM {mgcv} but after reading the description of the > ‘multcomp’ package, I believe this method only applies to parametric models > and linear hypothe

Re: [R] Decimal number

2012-08-07 Thread R. Michael Weylandt
Are you simply looking for c() then? I'm afraid I simply don't understand your question: R> b1 <- 64.90614 R> b2 <- 17.7025 R> c(b1, b2) [1] 64.90614 17.70250 Perhaps you need to adjust options()$digits For me (and I believe by default) it is 7, but you can change it with a command such as

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Marc Schwartz
On Aug 7, 2012, at 3:18 PM, Marc Schwartz wrote: > > On Aug 7, 2012, at 3:02 PM, Liviu Andronic wrote: > >> On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: >>> is.letter <- function(x) grepl("[[:alpha:]]", x) >>> is.number <- function(x) grepl("[[:digit:]]", x) >>> >> >> Another follo

Re: [R] summing and combining rows

2012-08-07 Thread arun
HI, I tried two ways in aggregate.  The results are the same. dat1<-read.table(text="    Data   Plot  Lat LatCat Elevation ElevCat    Type SizeClass Stems Area   Density    VTM  39C16 39.76282   Lat6  1500   Elev1 Conifer    Class3 0 751.5347   0.0    VTM 

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Marc Schwartz
On Aug 7, 2012, at 3:02 PM, Liviu Andronic wrote: > On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: >> is.letter <- function(x) grepl("[[:alpha:]]", x) >> is.number <- function(x) grepl("[[:digit:]]", x) >> > > Another follow-up. To test for (non-)alphanumeric one would do the following:

Re: [R] Decimal number

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:47 AM, hafida wrote: > HI > >>i have a little problem please help me to solve it > >>this is the code in R: > >>> beta0 > [1] 64.90614 >> beta1 > [1] 17.7025 >> beta > [1] 17 64 > >>her beta<- c(beta0, beta1) > > thank you in advance > hafida Are you looking for the roun

Re: [R] shading line plot

2012-08-07 Thread David Winsemius
On Aug 6, 2012, at 10:46 PM, Akhil dua wrote: Hi everyone, I have a time series data set and I want to fill my line plot of this time series with different colors e.g I want to fill portion related to 1995-1996 with blue , portion related to 1996-1997 with orange and then portion relate

Re: [R] Force evaluation of a symbol when a function is created

2012-08-07 Thread Bert Gunter
Thanks Duncan. That clarifies it! -- Bert On Tue, Aug 7, 2012 at 12:28 PM, Duncan Murdoch wrote: > On 12-08-07 10:46 AM, Bert Gunter wrote: >> >> Duncan, et.al: >> >> Many thanks: let the closure do the work automatically rather than >> manually manipulating it. >> >> However, in the spirit of t

Re: [R] Force evaluation of a symbol when a function is created

2012-08-07 Thread Duncan Murdoch
On 12-08-07 10:46 AM, Bert Gunter wrote: Duncan, et.al: Many thanks: let the closure do the work automatically rather than manually manipulating it. However, in the spirit of the OP's original request, I believe the call would be: Y <- 3 ## That is, Y gets a value at some prior point, perhap

[R] lm with a single X and step with several Xi-s, beta coef. quite different:

2012-08-07 Thread Aldi Kraja
Hi, (R version 2.15.0) I am running a pgm with 1 response (earlier standardized Y) and 44 independent vars (Xi) from the same data =a2: When I run the 'lm' function on single Xi at a time, the beta coefficient for let's say X1 is = -0.08 (se=0.03256) But when I run the same Y with 44 Xi-s with t

[R] Ad Hoc comparison non parametric ANCOVA

2012-08-07 Thread Luis Fernando García Hernández
Dear R Users, Recently I began to use R. I`m interested about comparing several regression curves. I found the package sm and the function sm.ancova which I understand allows me to do this. I applied this function to my data (seven regression curves) and I found that there are significant differe

Re: [R] r-forge down?

2012-08-07 Thread Marc Schwartz
That's not the same site, as is noted at the bottom of that site's main page. It does appear that R-Forge is down, albeit the domain is resolving and the server IP is responding quickly to pings with no packet loss. Regards, Marc Schwartz On Aug 7, 2012, at 5:29 PM, Roy Mendelssohn wrote: >

[R] Setting Number of Displayed Digits

2012-08-07 Thread Rich Shepard
Some chemicals have concentrations at or below the method detection limit (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how the concentration is displayed. But, when I ask for a summary() of that data frame column only 0 is displayed. How can I adjust the number of

Re: [R] r-forge down?

2012-08-07 Thread Alexander Shenkin
Thanks Roy, That's one "R-forge" site, but my impression is that the r-forge.r-project.org site is a different one (and it's the one that hosts the package I'm interested in). Please correct me if those two sites are somehow related. thanks, allie On 8/7/2012 5:29 PM, Roy Mendelssohn wrote: > h

Re: [R] r-forge down?

2012-08-07 Thread Roy Mendelssohn
http://www.rforge.net -Roy On Aug 7, 2012, at 3:25 PM, Alexander Shenkin wrote: > Hi Folks, > > I've looked around, haven't found anything, and I'm not sure where else > to check. I haven't visited R-forge (http://r-forge.r-project.org) in a > long time. Now that I'm trying, it seems to be do

Re: [R] Re-grouping data in R

2012-08-07 Thread David L Carlson
Your first command erases all the data in that column: dat$final_purchase_amount<- NA so when you refer to it later, it consists of only NAs. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 >

[R] r-forge down?

2012-08-07 Thread Alexander Shenkin
Hi Folks, I've looked around, haven't found anything, and I'm not sure where else to check. I haven't visited R-forge (http://r-forge.r-project.org) in a long time. Now that I'm trying, it seems to be down. Anyone know if this is a temporary condition, and if so, when it's expected to rise agai

Re: [R] Which R function for GLMM with binary response, nested random factors with temporal correlation?

2012-08-07 Thread Bert Gunter
Have you posted on R-sig-mixed-models? That would be more likely to yield useful responses than here. -- Bert On Tue, Aug 7, 2012 at 3:02 PM, Andrew Digby wrote: > > Despite lots of investigation, I haven't found any R packages might be > suitable for the following problem. I'd be very grateful

[R] Setting Number of Displayed Digits

2012-08-07 Thread Rich Shepard
Some chemicals have concentrations at or below the method detection limit (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how the concentration is displayed. But, when I ask for a summary() of that data frame column only 0 is displayed. How can I adjust the number of

[R] Which R function for GLMM with binary response, nested random factors with temporal correlation?

2012-08-07 Thread Andrew Digby
Despite lots of investigation, I haven't found any R packages might be suitable for the following problem. I'd be very grateful for suggestions. I have three-way nested data, with a series of measures (obs) taken in quick succession (equal time spacing) from each subject on different days. The

Re: [R] help to program my function

2012-08-07 Thread Rui Barradas
Hello, Your problem is something else, before returning a vector of only the same values there are warning messages. Inline. Em 07-08-2012 18:14, hafida escreveu: HI i have a problem please help me to solve it: http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf i want to calculate

[R] Setting Number of Displayed Digits

2012-08-07 Thread Rich Shepard
Some chemicals have concentrations at or below the method detection limit (MDL; 'less-thans') of 0.005 mg/L. When I look at the data frame that is how the concentration is displayed. But, when I ask for a summary() of that data frame column only 0 is displayed. How can I adjust the number of

[R] reshape2's dcast() Adds NAs to Data Frame

2012-08-07 Thread Rich Shepard
I need to understand how and why dcast() adds NAs to a data frame that contained no missing values. The database table of chemical concentrations has all missing values removed because they cannot contribute to data analyses. The structure of the R data frame of these data have no NA values,

Re: [R] Execution of a function

2012-08-07 Thread arun
HI, Suppose, I have a function like this: fun1<-function(x){  ifelse(x[1]<0,  sum(x[min(which(x<0)):(which.max(x>0)-1)]), sum(x[min(which(x<0)):max(which(x<0))]) )  } #And I save it as "aj.fun" (-- filename) #Then, >source("aj.fun") > fun1 function(x){  ifelse(x[1]<0,  sum(x[min(which(x<0)):(whic

Re: [R] Decimal number

2012-08-07 Thread arun
Hello Hafida, So, I guess the decimal number problem is solved. I'll check on it. A.K. From: hafida goual To: smartpink...@yahoo.com Sent: Tuesday, August 7, 2012 4:58 PM Subject: RE: [R] Decimal number thank you  a lot please can you visite my post t

Re: [R] What is this called? lapply(datum,"[[","ColumnName")

2012-08-07 Thread Bert Gunter
"I... cannot look it up in a book." Baloney! Read the R Language Definition manual section on indexing in the "Evaluation of Expressions" Chapter. Then ?lapply and ?"[[" -- and the relevant sections in "The Introduction to R" manual. However, I will admit that it's tricky. The point to grasp -- d

Re: [R] process evaluation packages (slightly off topic)

2012-08-07 Thread Rui Barradas
Hello, There's also, apparently for simple needs, plotrix::gantt.chart See an example in http://addictedtor.free.fr/graphiques/sources/source_74.R To transfer graphs to timelines, etc, (or anything graph related) package igraph. Hope this helps, Rui Barradas Em 07-08-2012 14:46, Bert Gunter

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-07 Thread David Winsemius
On Aug 7, 2012, at 11:31 AM, R. Michael Weylandt wrote: On Tue, Aug 7, 2012 at 11:26 AM, Rich Shepard > wrote: The sample data sets that come with the NADA package are limited to one or two variables and a censored measurement indicator column. I try to mimic examples using my data but kee

Re: [R] Decimal number

2012-08-07 Thread Eloi Mercier
Hi hafida, I fail to understand the question. Could you elaborate please ? Is this what you want ? > beta0 = 64.90614 > beta1 = 17.7025 > beta<-c(beta0, beta1) beta [1] 64.90614 17.70250 As a side note, please keep in mind that R doesn't allow white space within variable name (name it her_bet

[R] What is this called? lapply(datum,"[[","ColumnName")

2012-08-07 Thread Kevin Chang
Hello R users I recently learned how to use this command: lapply(datum,"[[","ColumnName") Unfortunately, I don't know how exactly it works, what it's called (in particular the "[[" part], and what other things you can do with it (retrieve multiple columns?). Given datum is a list of data

[R] Re-grouping data in R

2012-08-07 Thread Abraham Mathew
I have a data frame with a column of values that I want to bucket (group) into specific levels. > str(dat)'data.frame': 3678 obs. of 39 variables: $ id : int 23 76 129 156 166 180 200 214 296 344 ... $ final_purchase_amount : Factor w/ 32 levels "\\N","1082","110

Re: [R] Execution of a function

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:26 AM, hafida wrote: > Hi > >>i have aproblem withe execution of my function > >>first, i wrote my function in the script of R >>nom_fonction <- function(arg1[=expr1], arg2[=expr2], ...){ > bloc d'instructions > } > >> when i want to have the result i mean the laste inst

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 4:28 AM, Liviu Andronic wrote: > On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: >> is.letter <- function(x) grepl("[[:alpha:]]", x) >> is.number <- function(x) grepl("[[:digit:]]", x) >> > Quick follow-up question. > > I'm always reluctant to create functions that wou

Re: [R] summing and combining rows

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 12:47 PM, Christopher R. Dolanc wrote: > Hello, > > I have a data set that needs to be combined so that rows are summed by a > group based on a certain variable. I'm pretty sure rowsum() or rowsums() can > do this but it's difficult for me to figure out how it will work for

[R] help to program my function

2012-08-07 Thread hafida
HI >i have a problem please help me to solve it: http://r.789695.n4.nabble.com/file/n4639434/aj.pdf aj.pdf >i want to calculate the vecteur a[j] where j: 1...8 >this is the code in R: >aj.fun <- function(j, i, X, z, E, beta0, beta1){ + n <- length(X) + iX <- order(X) + iz <- order(z) + e1

[R] Execution of a function

2012-08-07 Thread hafida
Hi >i have aproblem withe execution of my function >first, i wrote my function in the script of R >nom_fonction <- function(arg1[=expr1], arg2[=expr2], ...){ bloc d'instructions } > when i want to have the result i mean the laste instruction in the bloc of > instruction , i try to >wrote th

[R] Error using ddply inside user-defined function

2012-08-07 Thread Jennifer Sabatier
Hi All, I *think* it's ddply because the function recognizes vr1, etc, in other parts of the function. Here's some code: # create dataset PROV.PM.FBCTS <- c(0.00 ,0.00, 33205.19, 25994.56, 23351.37, 26959.56 ,27632.58, 26076.24, 0.00, 0.00 , 6741.42, 18665.09 ,18129.59 ,21468.39 ,21294.60 ,

[R] summing and combining rows

2012-08-07 Thread Christopher R. Dolanc
Hello, I have a data set that needs to be combined so that rows are summed by a group based on a certain variable. I'm pretty sure rowsum() or rowsums() can do this but it's difficult for me to figure out how it will work for my data based on the examples I've read. My data are structured li

[R] looking for accessibility help (blind student)

2012-08-07 Thread Peter Petto
I will have a blind student in my AP Statistics class this year. I'm thinking about using R as his calculator. It seems like it's core text-in text-out nature may match screen reading software well. And I'd like to explore directing visualizations to tactile graphics output. I'm wondering if an

Re: [R] add leading zeros

2012-08-07 Thread David Winsemius
On Aug 7, 2012, at 3:55 AM, Liviu Andronic wrote: Hello On Fri, Jul 27, 2012 at 6:54 AM, R. Michael Weylandt wrote: Much easier than you think: x <- c(1L, 9000L) sprintf("%05i",x) For anyone interested, I came up with a small wrapper for the above: add.lead <- function(x, width=max(ncha

[R] Trying to build up a user interface with the R tcltk package

2012-08-07 Thread Julio Sergio Santana
I'm trying to build up a user inteface using the R tcltk component. Since the documentation for this R library is scarce and poor, I have decided to use only the .Tcl function to pass commands to the tcl interpreter. So I wrote my first very simple tcltk program, hoping to run it from inside R a

Re: [R] Decimal number

2012-08-07 Thread hafida
hello arun >her beta can be considered simply as an object. > when i wrote beta >I want to get the number of beta and beta with the full part after the comma hafida -- View this message in context: http://r.789695.n4.nabble.com/Decimal-number-tp4639428p4639452.html Sent from the R help mai

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: > is.letter <- function(x) grepl("[[:alpha:]]", x) > is.number <- function(x) grepl("[[:digit:]]", x) > Another follow-up. To test for (non-)alphanumeric one would do the following: > x <- c(letters, 1:26, '+', '-', '%^&') > x[1:10] <- paste(x[

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-07 Thread Rich Shepard
On Tue, 7 Aug 2012, R. Michael Weylandt wrote: Take a look at with() Michael, Works like a charm! Thanks again for the pointer. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gui

Re: [R] Styling gridExtra's title and left labels

2012-08-07 Thread baptiste auguie
Hi, You can use a grob instead of a text string, e.g main = textGrob("Title goes here", gp=gpar(fontsize=24)) HTH, b. On 7 August 2012 03:49, Alastair wrote: > Hi, > > I'm using the gridExtra package to combine some graphs like in the > arrangeGrob example. Each of the graphs has a title but

[R] Decimal number

2012-08-07 Thread hafida
HI >i have a little problem please help me to solve it >this is the code in R: >> beta0 [1] 64.90614 > beta1 [1] 17.7025 > beta [1] 17 64 >her beta<- c(beta0, beta1) thank you in advance hafida -- View this message in context: http://r.789695.n4.nabble.com/Decimal-number-tp4639428.html Se

[R] Bayesian estimates for the 1st-order Spatial Autoregressive model

2012-08-07 Thread CARTIER, ADRIAN AW (AG/1000)
Greetings: I am a relatively new user to R. I was wondering if anyone is familiar with MATLAB's far_g() function. If yes, is there an R equivalent to this? I would like to have the ability to input as my observation vector continuous values. I noticed that there was something close in R

Re: [R] issue with nzchar() ?

2012-08-07 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 5:27 PM, R. Michael Weylandt wrote: > On Mon, Aug 6, 2012 at 9:53 AM, Liviu Andronic wrote: >> On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic >> wrote: >>> string, something that I find strange. At best NA is the equivalent of >>> an empty string. > > Certainly not to my

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-07 Thread Rich Shepard
On Tue, 7 Aug 2012, David Winsemius wrote: cenboxplot(chem&Vdis, chem$ceneq1, chem$era) ___^ Incorrect use of '&' when '$' was intended. Mea culpa, David! Thanks for catching my typo. Rich __ R-help@r-project.org mailing list https://

Re: [R] Package to remove collinear variables

2012-08-07 Thread John C Frain
For background have a look at http://en.wikipedia.org/wiki/Multicollinearity. I have also used Regression Diagnostics: Identifying Influential Data and Sources of Collinearity (Wiley Series in Probability and Statistics) by David A. Belsley, Edwin Kuh and Roy E. Welsch Sections 1.9 to 1.12 of Ha

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-07 Thread Rich Shepard
On Tue, 7 Aug 2012, R. Michael Weylandt wrote: Take a look at with() Michael, Thank you. I will. Rich -- Richard B. Shepard, Ph.D. | Integrity - Credibility - Innovation Applied Ecosystem Services, Inc. |Helping Ensure Our Clients' Futures

Re: [R] multiple comparisons for GAMs

2012-08-07 Thread Bird_Girl
I have looked into using glht (‘multcomp’ package) to do multiple comparisons for a model fit with GAM {mgcv} but after reading the description of the ‘multcomp’ package, I believe this method only applies to parametric models and linear hypotheses. When I ran the code glht(model,linfct….) I got a

Re: [R] How to convert data to 'normal' if they are in the form of standard scientific notations?

2012-08-07 Thread arun
Hi, Try these also:  a<-c(2.0e+9,2.1e+9)  is.numeric(a) [1] TRUE formatC(a,format="fg") #[1] "20" "21"  formatC(a,format="f") #[1] "20." "21."  formatC(a,format="f",digits=0) #[1] "20" "21" A.K. - Original Message - From: HJ Y

Re: [R] Hist function

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 8:05 AM, Dominic Roye wrote: > Hello everyone, > > > First i explain my aim. I would like to calculate the frecuency of > temperature (datos.mx1, columns 3-6) for each month with the thresholds of > table lf.med and lc.med. > > numero1 <- hist(subset(datos.mx1[,3], > datos.

Re: [R] Error with convUL (PBSmapping)

2012-08-07 Thread R. Michael Weylandt
This looks like a fairly low level problem that you might need the maintainer to look at. To get contact information, type maintainer("PBSmapping") at the R prompt. Best, Michael On Tue, Aug 7, 2012 at 7:21 AM, niandra wrote: > Hi all, > > I'm trying to use the function "convUL" from the Packa

Re: [R] Problem with global variable building a package

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 2:09 AM, Eva Prieto Castro wrote: > > > Hi, > > > > My name is > Eva and this is my first message here. My English is not very good, but I hope > you can understand my question, in the context of an academic project. > > > > I have > developed several functions in R and the

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:26 AM, Rich Shepard wrote: > The sample data sets that come with the NADA package are limited to one or > two variables and a censored measurement indicator column. I try to mimic > examples using my data but keep missing the target. > > My water chemistry data is ava

Re: [R] Sum of vector elements

2012-08-07 Thread William Dunlap
I'll add my suggestion, which first extracts from x the elements up to but not including the first positive one and then sums them: f3 <- function(x) { sum(x[cumsum(x>0) == 0]) } Michaels suggestion was sum(x[seq_len(which.max(x > 0)]) but that includes the first positive element so I think i

Re: [R] Rcolorbrewer Package

2012-08-07 Thread John Kane
install.packages("RColorBrewer") seems to work for me. John Kane Kingston ON Canada > -Original Message- > From: hannah@gmail.com > Sent: Tue, 7 Aug 2012 13:08:11 -0400 > To: r-help@r-project.org > Subject: [R] Rcolorbrewer Package > > Hi all, >I am trying to download the Rcol

Re: [R] Sum of vector elements

2012-08-07 Thread Jeff Newmiller
Another approach... not exactly more direct, but perhaps more robust and more general: tmp <- aggregate(x,list(lvl=cumsum(abs(diff(c(FALSE,x>0), FUN=sum) ans <- tmp[0==tmp$lvl,"x"] abs(diff()) finds transitions, FALSE forces level zero to represent negative numbers cumsum marks levels (grou

Re: [R] Rcolorbrewer Package

2012-08-07 Thread R. Michael Weylandt
The link works just fine for me and I can download the package if I take out one of the repeated slashes. Best, Michael On Tue, Aug 7, 2012 at 12:08 PM, li li wrote: > Hi all, >I am trying to download the Rcolorbrewer package from Cran > http://cran.r-project.org/web/packages/RColorBrewer//i

[R] Rcolorbrewer Package

2012-08-07 Thread li li
Hi all, I am trying to download the Rcolorbrewer package from Cran http://cran.r-project.org/web/packages/RColorBrewer//index.html It seems the files have been removed. Does anyone know where can I download the package? Thanks. Hannah [[alternative HTML version deleted]] _

  1   2   >