Re: [R] Problem getting loess tricubic weights

2013-01-08 Thread Bert Gunter
As this does not seem to have been answered... I believe you may misunderstand how loess works. The tricube weights are part of the smoothing algorithm and change with each local fit, not fixed weights for observations, which is what the "weights" argument provides (and initially multiplies the tr

Re: [R] Applying a user-defined function

2013-01-08 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello List, Last time, Arun's following solution worked to create 3 new columns (1,3,5). Now how would I tweak this function to create corresponding (additional) columns (7,8,9) of mode factor (levels = 1,2,3,4,5)? Thanks for your continued support. Pradip ### cut and paste from the rep

Re: [R] R2html and Blackboard LMS : solved

2013-01-08 Thread Erin Hodgess
Use the echo = TRUE in the HTMLStart function. Sorry. On Tue, Jan 8, 2013 at 8:21 PM, Erin Hodgess wrote: > Everything is ok on Firefox, IE, and iPad. > > Thanks, > Erin > > > On Tue, Jan 8, 2013 at 7:58 PM, Erin Hodgess wrote: >> Dear R People: >> >> Has anyone used R2HTML in web files that we

[R] another R2HTML question

2013-01-08 Thread Erin Hodgess
Hello again. I just started with the R2HTML and it's REALLY slick! I do have one question, please: It shows the output, but not the command which generated the output. How do I get the command, please? For instance, when I do: summary(etch.aov) it shows the nice output but no summary comman

Re: [R] random effects model

2013-01-08 Thread arun
HI, In your dataset, the "exchangeable" or "compound symmetry" may work as there are only two levels for time.  In experimental data analysis involving a factor time with more than 2 levels, randomization of combination of levels of factors applied to the subject/plot etc. gets affected as time

Re: [R] R2html and Blackboard LMS : solved

2013-01-08 Thread Erin Hodgess
Everything is ok on Firefox, IE, and iPad. Thanks, Erin On Tue, Jan 8, 2013 at 7:58 PM, Erin Hodgess wrote: > Dear R People: > > Has anyone used R2HTML in web files that were on the Blackboard LMS, please? > > I'm starting to do these but wanted to know if there were any > potential pitfalls. >

[R] R2html and Blackboard LMS

2013-01-08 Thread Erin Hodgess
Dear R People: Has anyone used R2HTML in web files that were on the Blackboard LMS, please? I'm starting to do these but wanted to know if there were any potential pitfalls. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston

Re: [R] [twitteR-users] Not getting enough tweets in twitteR

2013-01-08 Thread Sachinthaka Abeywardana
Is there a way to limit the tweets by date so that I can do multiple calls to get the required number of tweets? For example, something in the lines of: police<-userTimeline('@**nswpolice',n=1000,since="01/12/2012", to="01/01/2013") #first call police<-userTimeline('@**nswpolice',n=1000,since="01

[R] Not getting enough tweets in twitteR

2013-01-08 Thread Sachinthaka Abeywardana
Hi all, I am trying to download as many tweets as possible (say 1000). The documentation states that the limit is 3200. However when I run police<-userTimeline('@nswpolice',n=1000) it returns random amounts. When I ran it today I got 144, yesterday it was around 300. Any thoughts? Thanks, Sachi

Re: [R] MA process in panels

2013-01-08 Thread Philipp Grueber
Dear R users, after some time I have picked up working on this dataset again. I have found a way which produces reasonable results but I am not sure whether it is truly the correct way to go. I am still looking for a way to estimate a panel ARMA(1,1) with cross-sectional fixed effects (later I

Re: [R] random effects model

2013-01-08 Thread rex2013
Hi Thanks a lot, the corstr "exchangeable"does work. Didn't strike to me for so long. Does the AIC value come out with the gee output? By reference, I meant reference to a easy-read paper or web address that can give me knowledge about implications of missing data. Ta. On 1/8/13, arun kirshna [

Re: [R] try()-function does not catch error in BATCH-job if Matrix is loaded

2013-01-08 Thread luke-tierney
The work-around was actually put in plae prior to the release of R 2.15.2, so updating your R to the current released version will resolve this. Best, luke On Mon, 7 Jan 2013, luke-tier...@uiowa.edu wrote: This is due to long-staning issue in methods internals, which are involved because load

[R] Correct use of the cluster::daisy function

2013-01-08 Thread Stefan Petersson
Hi, I have two groups, and I want to find the dissimiarity between the members of the two groups. Since I have mixed level variables on the members, I opt for the daisy function in the cluster package. Let's pretend that the following represent my groups: x <- data.frame(sex=factor(c(1,0,0,1,0,1

Re: [R] tm: custom reader for readPlain

2013-01-08 Thread Simon Kiss
Hmm...Thanks a lot! that seems like really useful stuff. It might be a bit over my head, but I'll look into it. The articles are all contained in one text file, but they are clearly delimited (either by a series of ) or the regular expression ^Document.[0-9]. Simon On 2013-01-08, at 4

Re: [R] tm: custom reader for readPlain

2013-01-08 Thread Milan Bouchet-Valat
Le mardi 08 janvier 2013 à 15:56 -0500, Simon Kiss a écrit : > Hello: > I have a series of newspaper articles from a Canadian newspaper > database (Canadian Newsstand) that look just like below. > > I've read through this vignette > (http://cran.r-project.org/web/packages/tm/vignettes/extensions.p

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 1:31 PM, David Winsemius wrote: On Jan 8, 2013, at 1:07 PM, Berend Hasselman wrote: On 08-01-2013, at 22:00, Berend Hasselman wrote: …... David implemented the condition by multiplying by x[1]in a numeric context is 0 when x[1]=x[2]. OOPS!! Reverse the 0 and the 1 in

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 1:07 PM, Berend Hasselman wrote: On 08-01-2013, at 22:00, Berend Hasselman wrote: …... David implemented the condition by multiplying by x[1]in a numeric context is 0 when x[1]=x[2]. OOPS!! Reverse the 0 and the 1 in that sentence (TRUE becomes 1 and FALSE becomes 0)

Re: [R] Integration in R

2013-01-08 Thread Berend Hasselman
On 08-01-2013, at 22:00, Berend Hasselman wrote: > …... > David implemented the condition by multiplying by x[1] numeric context is 0 when x[1]=x[2]. OOPS!! Reverse the 0 and the 1 in that sentence (TRUE becomes 1 and FALSE becomes 0) Berend __ R-h

Re: [R] Integration in R

2013-01-08 Thread Berend Hasselman
On 08-01-2013, at 19:51, Naser Jamil wrote: > Thanks. But then how to implement condition like 0 happy to know that. > David implemented the condition by multiplying by x[1]=x[2]. That is what your requirement does. The condition 0x2 which is what your inequality implies. Berend > On 8 Jan

[R] tm: custom reader for readPlain

2013-01-08 Thread Simon Kiss
Hello: I have a series of newspaper articles from a Canadian newspaper database (Canadian Newsstand) that look just like below. I've read through this vignette (http://cran.r-project.org/web/packages/tm/vignettes/extensions.pdf) about creating a custom reader to extract meta-data, but I can't u

Re: [R] Manhattan Plot

2013-01-08 Thread Tengfei Yin
Hi Einat As Mehmet suggested, you can try plotGrandlinear in ggbio. an example codes in the manual are here http://tengfei.github.com/ggbio/docs/man/plotGrandLinear.html how to install http://www.bioconductor.org/packages/2.11/bioc/html/ggbio.html But one thing is confusing(Maybe I don't get it r

Re: [R] plot residuals per factor

2013-01-08 Thread arun
HI, Not sure whether ggplot() works with lists. If you want to plot residuals.vs.fitted for multiple groups, this could help you.  Assuming that you want separate plots for each group: #You didn't provide any example. dat1<-read.csv("skin_color.csv",sep="\t") #You can replace this with your dat

Re: [R] Integration in R

2013-01-08 Thread Naser Jamil
Thanks. But then how to implement condition like 0 wrote: > Please reply on list. > > > On Jan 8, 2013, at 10:27 AM, Naser Jamil wrote: > > Hi David, >> x[2] is the second variable, x2. It comes from the condition 0> > > No, it doesn't come from those conditions. It is being grabbed from some > "

Re: [R] Logical operator and lists

2013-01-08 Thread arun
Hi, If you don't return(x) or x at the end,  set.seed(5)  list1<-lapply(1:3,function(i) data.frame(col1=sample(c(1:5,""),10,replace=TRUE), value=rnorm(10),stringsAsFactors=FALSE))  lapply(list1,function(x) x[x==""]) #[[1]] #[1] "" "" #[[2]] #character(0) #[[3]] #[1] "" "" "" "" "" ""  lapply

[R] incrementation within ifelse

2013-01-08 Thread Damien Pilloud
Dear R-helper, I am working on a very large data frame and I am trying to add a new column and write in it with certain conditions. I have try to use this code with the data frame p : ID = 0 p[,"newColumn"]<- ifelse (p$flagFoehn3_durr == 1, ifelse(p$Guetsch == 0, ID <<- I

[R] Levels in new data fed to SVM

2013-01-08 Thread Claus O'Rourke
Hi all, I've encountered an issue using svm (e1071) in the specific case of supplying new data which may not have the full range of levels that were present in the training data. I've constructed this really primitive example to illustrate the point: > library(e1071) > training.data <- data.frame

Re: [R] Manhattan Plot

2013-01-08 Thread Suzen, Mehmet
Hello Einat, Have you tried ggbio package's plotGrandLinear from bioconductor? Best, -m On 8 January 2013 20:03, Einat Granot wrote: > Hello, > I am trying to create a simple Manhattan plot for a small list of 200 SNPs > spread out in the genome in different genes. > I have tried different fun

[R] Manhattan Plot

2013-01-08 Thread Einat Granot
Hello, I am trying to create a simple Manhattan plot for a small list of 200 SNPs spread out in the genome in different genes. I have tried different functions (using ggplot2 and a function created by Stephen Turner, mhtplot etc.)-none of them work smoothly. Does anyone have a simple way to create

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 10:51 AM, Naser Jamil wrote: Thanks. But then how to implement condition like 0be happy to know that. Multiply the function by the conditional expression: > f<-function(x) { 2/3 * (x[1] + x[2] )*(x[1] < x[2]) } > adaptIntegrate(f, lowerLimit = c(0, 0), upperLimit = c(7,7))

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
Please reply on list. On Jan 8, 2013, at 10:27 AM, Naser Jamil wrote: Hi David, x[2] is the second variable, x2. It comes from the condition 0 No, it doesn't come from those conditions. It is being grabbed from some "x"-named object that exists in your workspace. If your limits were 7 in

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 9:43 AM, Naser Jamil wrote: Hi R-users. I'm having difficulty with an integration in R via the package "cubature". I'm putting it with a simple example here. I wish to integrate a function like: f(x1,x2)=2/3*(x1+x2) in the interval 0by hand and got 114.33, but the follow

[R] Integration in R

2013-01-08 Thread Naser Jamil
Hi R-users. I'm having difficulty with an integration in R via the package "cubature". I'm putting it with a simple example here. I wish to integrate a function like: f(x1,x2)=2/3*(x1+x2) in the interval 0https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-p

Re: [R] Applying a user-defined function

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 9:11 AM, Muhuri, Pradip (SAMHSA/CBHSQ) wrote: Hello List, My goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message. #now Write a new function using the above

[R] Applying a user-defined function

2013-01-08 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello List, My goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message. > #now Write a new function using the above cut ()/quantile function to apply > on different columns of the data

Re: [R] how to label two figures in the same chunk independently with knitr

2013-01-08 Thread Yihui Xie
All you mentioned are possible; knitr has very comprehensive support to figures in LaTeX, and what you want in this case is subfigures (\usepackage{subfig}); here is an example: https://github.com/yihui/knitr-examples/blob/master/067-graphics-options.Rnw (search for 'fig.subcap' for the relevant ch

Re: [R] Logical operator and lists

2013-01-08 Thread arun
Hi, Try this:  set.seed(5)  list1<-lapply(1:3,function(i) data.frame(col1=sample(c(1:5,""),10,replace=TRUE), value=rnorm(10),stringsAsFactors=FALSE))  res<-lapply(list1,function(x) {x[apply(x,2,function(y) y=="")]<-NA;x}) res[[1]] #   col1  value #1 2 -0.6029080 #2 5 -0.4721664 #3 

Re: [R] Logical operator and lists

2013-01-08 Thread arun
HI, This should also work:  set.seed(5)  list1<-lapply(1:3,function(i) data.frame(col1=sample(c(1:5,""),10,replace=TRUE), value=rnorm(10),stringsAsFactors=FALSE))  lapply(list1,function(x) {x[x==""]<-NA;x}) A.K. - Original Message - From: Dominic Roye To: R help Cc: Sent: Tuesday, J

Re: [R] plot xaxp issue

2013-01-08 Thread David Winsemius
On Jan 7, 2013, at 5:02 PM, Elaine Kuo wrote: Hello, I figured out that the code should be boyline<-lm(body_weight ~ body_length, data=subset (together,,sex=="boy")) However, the "" could be omitted if the field name happened to be numeric, such as 1, 2, or 3. Please kindly explain why th

Re: [R] multiple versions of function

2013-01-08 Thread David Winsemius
On Jan 7, 2013, at 6:58 PM, ivo welch wrote: hi david---can you give just a little more of an example? the function should work with call by order, call by name, and data frame whose columns are the names. /iaw It is I who should be expecting you to provide an example. -- David.

Re: [R] problems when loading package GenABEL

2013-01-08 Thread Prof Brian Ripley
On 08/01/2013 11:42, Filippo Biscarini wrote: Dear all, since yesterday, I have been experiencing problems with the package GenABEL. When I try to load the package (library(GenABEL)) I get the following error message: Loading required package: MASS Error : .onLoad failed in loadNamespace() for

Re: [R] how to label two figures in the same chunk independently with knitr

2013-01-08 Thread Ulises M. Alvarez
On 01/08/2013 04:17 AM, Francesco Sarracino wrote: Dear R helpers, I am using knitr to run analysis with R and edit my document with Latex. I am wondering whether there is a way to include 2 or more pictures per chunk and being able to refer them in the text independently and eventually whether

Re: [R] Logical operator and lists

2013-01-08 Thread Gerrit Eichner
Hello, Dominic, untested: data <- lapply( data, function( x) x[ x == ""] <- NA Hth -- Gerrit On Tue, 8 Jan 2013, Dominic Roye wrote: Hello R-Helpers, I have a slight problem with the expresion data[data==""] <- NA which works well for a data.frame. But now i must use the same for a list

[R] GLMM post- hoc comparisons

2013-01-08 Thread Silvina Velez
Hi All, I have data about seed predation (SP) in fruits of three differents colors (yellow, motted, dark) and in two fruiting seasons (2007, 2008). I performed a GLMM (lmer function, lme4 package) and the outcome showed that the interaction term (color:season) was significant, and some combinati

[R] problems when loading package GenABEL

2013-01-08 Thread Filippo Biscarini
Dear all, since yesterday, I have been experiencing problems with the package GenABEL. When I try to load the package (library(GenABEL)) I get the following error message: Loading required package: MASS Error : .onLoad failed in loadNamespace() for 'GenABEL', details: call: stringSplit[[1]] e

[R] stats-as.dendrogram

2013-01-08 Thread Sahar A Alkhairy
Dear Sir/Madam, I am using the 'as.dendrogram' function to convert from an hclust object (using 'fastcluster') to a dendrogram with a dataset of size ~3 (an example code is below). I need the dendrogram structure to use the "dendrapply" and "attributes" functions and to access the child no

Re: [R] error in a abline loop

2013-01-08 Thread arun
HI Elaine, In the data you sent to me, it had 5 levels for skin_color. data1<-read.csv("skin_color.csv",sep="\t") data1$skin_color<-factor(data1$skin_color) levels(data1$skin_color) #[1] "1" "2" "3" "4" "5"  mypath<-file.path("/home/arun/Trial1",paste("Elaine_",1:5,".jpg",sep=""))  #change the

[R] Logical operator and lists

2013-01-08 Thread Dominic Roye
Hello R-Helpers, I have a slight problem with the expresion data[data==""] <- NA which works well for a data.frame. But now i must use the same for a list of data.frames. My idea is data[[]][data==""] but it don´t work. Thanks!! Dominic [[alternative HTML version deleted]] ___

Re: [R] Conditional Statistics

2013-01-08 Thread S Ellison
> ...if I had the closing prices of the > S&P from 01/01/1990-12/31/1990, how could I get the average price of > the S&P from 02/01/1990-03/15/1990? Or the average price of the S&P on > Mondays (assuming a dummy var is created for 1 = Monday, 0 = else). tapply has already been referred to. You m

Re: [R] list of lists to matrix

2013-01-08 Thread John Kane
Please supply some sample data. The easiest way to supply data is to use the dput() function. Example with your file named "testfile": dput(testfile) Then copy the output and paste into your email. For large data sets, you can just supply a representative sample. Usually, dput(head(test

Re: [R] Conditional Statistics

2013-01-08 Thread John Kane
I think Simon has provided a good answer to the actual question but as a refugee from SAS I'd suggest having a look at www.et.bs.ehu.es/~etptupaf/pub/R/RforSAS&SPSSusers.pdf or getting the book Muenchen, R. A. (2008). R for SAS and SPSS Users (1st ed.). Springer. R ans SAS approach things very

[R] New book: Beginner's Guide to GAM with R

2013-01-08 Thread Highland Statistics Ltd
Readers of this mailing list may be interested to know that the book "A Beginner's Guide to Generalized Additive Models with R' is now available from: http://www.highstat.com/BGGAM.htm Upcoming books in 2013: A Beginner's Guide to GLM with R and JAGS. AF Zuur, J Hilbe, EN Ieno A Beginner's G

Re: [R] (no subject)

2013-01-08 Thread S Ellison
>I am using the nls function and it stops because the number of iterations >exceeded 50, but i used the nls.control argument to allow for 500 >iterations. Do you have any idea why it's not working? Not entirely. But I do see in the code for SSgompertz that SSgompertz calls nls _without_ specifyin

[R] Oaxaca-Blinder decomposition in R

2013-01-08 Thread Francesco Sarracino
Dear R-listers, does anybody know of any package developed to implement the Oaxaca-Blinder decomposition in R? I've been googling around and my reserch has been unfruitful. The latest news I've found were 1 year old. Does anybody know of any recent development? Has R ever been employed to run a Oa

Re: [R] posting a question in the R-help forum

2013-01-08 Thread Michael Dewey
At 14:14 07/01/2013, Violet Swakman wrote: Hello, I wanted to post this question below, on the R-help forum, but I'm not sure I succeeded because it said that I wasn't subscribed to the mailing list yet. Now I am subscribed, but will my question be accepted now automatically, or should I submit i

[R] how to label two figures in the same chunk independently with knitr

2013-01-08 Thread Francesco Sarracino
Dear R helpers, I am using knitr to run analysis with R and edit my document with Latex. I am wondering whether there is a way to include 2 or more pictures per chunk and being able to refer them in the text independently and eventually whether it is possible to give them different captions. Let m

Re: [R] ggplot not showing all the years on the x-axis

2013-01-08 Thread Francesco Sarracino
Indeed, it works. I've been mumbling around with scale_x_discrete(), but without any success. Thanks a lot, Yao. You helped me a lot! f. On 8 January 2013 10:06, Yao He wrote: > Hi,this is a question about how to set the scale,try this > add a scale_x_discrete() like that: > > plot <- tmpplot +

[R] plot residuals per factor

2013-01-08 Thread catalin roibu
Dear R-users, I want to plot residuals vs fitted for multiple groups with ggplot2. I try this code, but unsuccessful. library("plyr") models<-dlply(dat1,"d",function(df) mod<-lm(y~x,data=df) ggplot(models,aes(.fitted,.resid), color=factor(d))+ geom_hline(yintercept=0,col="white",size=2)+ geo

[R] Problem getting loess tricubic weights

2013-01-08 Thread Joyce Lin
Hi I am trying to get the tricube weights from the loess outputs as I need to calculate an error function which requires the weight. So I have used the following example from the R: cars.lo <- loess(dist ~ speed, cars, span=0.5, degree=1, family="symmetric") Then i try to get the weights: cars

Re: [R] ggplot not showing all the years on the x-axis

2013-01-08 Thread Yao He
Hi,this is a question about how to set the scale,try this add a scale_x_discrete() like that: plot <- tmpplot + geom_line()+scale_x_continuous(breaks=ii) Yao He 2013/1/8 Francesco Sarracino : > Dear R helpers, > > I am currently having hard time fixing the values on the x-axis of a plot > with

[R] ggplot not showing all the years on the x-axis

2013-01-08 Thread Francesco Sarracino
Dear R helpers, I am currently having hard time fixing the values on the x-axis of a plot with ggplot: even though I have 12 years, ggplot plots only 3 of them. Here is my example: library(ggplot2) ii <- 2000:2011 ss <- rnorm(12,0,1) pm <- data.frame(ii,ss) tmpplot <- ggplot(pm, aes(x = ii, y = s