Re: [R] Dot plot similar to StatKey

2013-07-29 Thread Jim Lemon
On 07/30/2013 04:21 PM, David Arnold wrote: Hi, I'd like to use R to produce the following plot: dotplot.jpeg This was constructed using StatKey at: http://www.lock5stat.com/statkey/bootstrap_1_quant/bootstrap_1_quant.html

[R] Dot plot similar to StatKey

2013-07-29 Thread David Arnold
Hi, I'd like to use R to produce the following plot: dotplot.jpeg This was constructed using StatKey at: http://www.lock5stat.com/statkey/bootstrap_1_quant/bootstrap_1_quant.html

Re: [R] triangular color plot of array

2013-07-29 Thread Jim Lemon
On 07/30/2013 04:54 AM, White, William Patrick wrote: Hello, I've encountered an interesting situation and can't seem to find an applicable solution. I've got a multivariate synthetic dataset I generated in order to explore various statistical techniques. In my dataset I vary three things, sam

Re: [R] tm (text mining) package persistent storage

2013-07-29 Thread David Winsemius
On Jul 29, 2013, at 4:47 PM, Ashwani Rao wrote: > Hi, > > My Corpus is bunch of xml files in a single directory. > Each xml files have bunch of documents. > I can create a persitent storage using PCorpus constructor by specifying a > DIrectorySource. > PCorpus writes this as key-value data base

Re: [R] Declare BASH Array Using R System Function

2013-07-29 Thread Dario Strbenac
Thank you. This answers my question. I am using Linux, too. From: arun [smartpink...@yahoo.com] Sent: Monday, 29 July 2013 11:11 PM To: Dario Strbenac Cc: R help Subject: Re: [R] Declare BASH Array Using R System Function Hi, system("names=(X Y); echo ${n

Re: [R] Intersecting two matrices

2013-07-29 Thread William Dunlap
I haven't looked at the size-time relationship, but im2 (below) is faster than your function on at least one example: intersectMat <- function(mat1, mat2) { #mat1 and mat2 are both deduplicated nr1 <- nrow(mat1) nr2 <- nrow(mat2) mat2[duplicated(rbind(mat1, mat2))[(nr1 + 1):(nr1 +

[R] tm (text mining) package persistent storage

2013-07-29 Thread Ashwani Rao
Hi, My Corpus is bunch of xml files in a single directory. Each xml files have bunch of documents. I can create a persitent storage using PCorpus constructor by specifying a DIrectorySource. PCorpus writes this as key-value data base. My problem is that next time when I want to start R then I wan

[R] Intersecting two matrices

2013-07-29 Thread c char
Dear all, I am interested to know a faster matrix intersection package for R handles intersection of two integer matrices with ncol=2. Currently I am using my homemade code adapted from a previous thread: intersectMat <- function(mat1, mat2){#mat1 and mat2 are both deduplicated nr1 <- nrow(mat1

Re: [R] Aggregate

2013-07-29 Thread farnoosh sheikhi
Thanks a lot Arun.  I like the do.call command a lot. So easy to use and fast:-)   Best,Farnoosh Sheikhi Cc: R help Sent: Monday, July 29, 2013 1:58 PM Subject: Re: Aggregate Hi, You could try: dat1<- read.table(text=" ID     Group1 1     1 1     0 1     1

Re: [R] about R stat.table function

2013-07-29 Thread arun
Hi, Try: library(Epi)  stat.table(tension,list(count(),mean(breaks)),data=warpbreaks) # --- # tension   count() mean(breaks)   #---  #L  18    36.39   #M  18    26.39   #H  18    21.67   #-

Re: [R] Aggregate

2013-07-29 Thread arun
To add: library(reshape2)  dcast(dat1,ID~Group1,length,value.var="Group1") # ID would be a column # ID No Yes #1  1  2   2 #2  2  1   3 #3  5  1   3 A.K. - Original Message - From: David Carlson To: 'arun' ; 'farnoosh sheikhi' Cc: 'R help' Sent: Monday, July 29, 2013 5:28 PM Subject

Re: [R] Aggregate

2013-07-29 Thread David Carlson
Or just table(dat1$ID, dat1$Group1) # 0 1 # 1 2 2 # 2 1 3 # 5 1 3 Or xtabs(~ID+Group1, dat1) #Group1 # ID 0 1 # 1 2 2 # 2 1 3 # 5 1 3 Or with labeling dat1$Group1 <- factor(dat1$Group1, labels=c("No", "Yes")) xtabs(~ID+Group1, dat1) #Group1 # ID No Yes # 1 2 2 #

Re: [R] cross-correlation with R

2013-07-29 Thread Jeff Newmiller
Homework help is off-topic on this list (see the Posting Guide). You should use the assistance provided by your educational institution. In addition, even if this is not homework, in most cases discussions of theoretical background (interpretation) are off-topic here as well. See stats.stack ex

Re: [R] about R stat.table function

2013-07-29 Thread David Carlson
Where did you find out about stat.table()? There is one in package Epi, but who knows if it is the one you are looking for? If you don't know about packages and the library() function, you need to work through a basic tutorial on R. You can't really expect to download a script file and run it witho

Re: [R] about R stat.table function

2013-07-29 Thread Rui Barradas
Hello, Where did you get that script from? You should ask the person that gave it to you for that missing function, of which we know nothing about. Hope this helps, Rui Barradas Em 29-07-2013 20:23, Gu, LanYing escreveu: Hi R Help group, I try to use stat.table function in my R script, whe

Re: [R] Aggregate

2013-07-29 Thread arun
Hi, You could try: dat1<- read.table(text=" ID     Group1 1     1 1     0 1     1 1     0 2     1 2     1 2     0 2     1 5     1 5     1 5     1 5     0 ",sep="",header=TRUE) library(plyr) res<- ddply(dat1,.(ID),summarize,yes=sum(Group1),no=length(Group1)-sum(Group1)) res #  ID yes no #1  1   2

Re: [R] Jul 26, 2013; 12:34am

2013-07-29 Thread Eik Vettorazzi
Dear Frank, you can use grconvertY and grconvertX to convert from user coordinates to inches etc and vice versa. E.g. lines(rep(.25*1500,2),grconvertY(grconvertY(par("usr")[3],"user","inches")+c(0,.1),from="inches",to="user")) should produce a tick of 0.1 inches height, regardless of the actual p

[R] cross-correlation with R

2013-07-29 Thread weigelti
Dear R-User, I'm Student at the TU Bergakademie Freiberg and have R used for the first time. I have created cross-correlations of air pressure, outside temperature, temperature laboratory and X-ray radiation intensity. However, I do not know how I interpret the graphs. Can someone help me?

Re: [R] triangular color plot of array

2013-07-29 Thread David Carlson
A triangular plot can represent three dimensions in a two dimensional plane because the three dimensions are constrained by the fact that they sum to 100% (e.g. sand/silt/clay composition of a soil). That does not seem to apply to your example. It sounds like you might need a 3d contour plot. You m

[R] split beanplot in ggplot2 - adjusting bandwidth

2013-07-29 Thread Andrew Cooper
Dear R Users, I'm attempting to create a split beanplot in ggplot2 and have figured most of it out except how to adjust the bandwidth for the density statistic. I read online that geom_violin will not plot 2 separate sets of data and that geom_ribbon should be used to create a split beanplot.

[R] about R stat.table function

2013-07-29 Thread Gu, LanYing
Hi R Help group, I try to use stat.table function in my R script, when I run stat.table in R. it shows that "No stat.function found", and I try to get help using "?stat.table" it shows that "No documentation for 'stat.table' in specified packages and libraries: you could try '??stat.table'". i

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread David Winsemius
On Jul 29, 2013, at 9:39 AM, iza.ch1 wrote: > Hi everyone > > I have a problem with replacing the NA values with the mean of the column > which contains them. If I replace Na with the means of the rest values in the > column, the mean of the whole column will be still the same as if I would >

[R] triangular color plot of array

2013-07-29 Thread White, William Patrick
Hello, I've encountered an interesting situation and can't seem to find an applicable solution. I've got a multivariate synthetic dataset I generated in order to explore various statistical techniques. In my dataset I vary three things, sample size, effect size, and the number of variables that

[R] Greek symbols in study labels and custom summary lines in forest plot (meta)

2013-07-29 Thread Rapsomaniki, Eleni
Dear R helpers, Is there a way to display mathematical notations (e.g. greek characters, subscripts) properly in study (studlab) and group (byvar) labels in a forest plot created using the meta package? #Example: library(meta) logHR <- log(runif(10,0.5,2)) selogHR <- log(runif(10,0.05,0.2)) stu

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread William Dunlap
Replacements are a case where I think an explicit for-loop is better than sapply or any other *apply function. The for-loop will make the output resemble the output: while sapply and friends will mangle the class, dimnames, and other attributes of the input. Also, if you want to replace the NA'

[R] Customized interpolating spline?

2013-07-29 Thread Szumiloski, John
Dear useRs, I have a univariate spline application where I have a fixed set of independent variable values. I would like to be able to generate an interpolating spline, given a set of dependent variables, which can easily return the value of the interpolant over its entire range, for use in an

Re: [R] add different regression lines for groups on ggplot

2013-07-29 Thread Ye Lin
Thanks John, yes you are right I have add different smooth statements, here is the code from Dennis for my case: library(ggplot2) ggplot(data = df, aes(x=Var1, y=log(Var2), color=SiteID, group=SiteID)) + geom_point() + geom_smooth(data = subset(df, SiteID != "AL3"), method='lm', formula= y

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread arun
Hi, de<- structure(c(NA, NA, NA, NA, NA, NA, NA, NA, 0.27500571, -3.07568579, -0.42240954, -0.26901731, 0.01766284, -0.8099958, 0.20805934, 0.03036708, -0.26928087, 1.20925752, 0.38012008, -0.41778861, -0.49677462, -0.13248754, -0.54179054, 0.35788624, -0.41467591, -0.59234248, 0.73642396, -0.

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread Berend Hasselman
On 29-07-2013, at 18:39, "iza.ch1" wrote: > Hi everyone > > I have a problem with replacing the NA values with the mean of the column > which contains them. If I replace Na with the means of the rest values in the > column, the mean of the whole column will be still the same as if I would >

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread Jorge I Velez
Consider the following: f <- function(x){ m <- mean(x, na.rm = TRUE) x[is.na(x)] <- m x } apply(de, 2, f) HTH, Jorge.- On Tue, Jul 30, 2013 at 2:39 AM, iza.ch1 wrote: > Hi everyone > > I have a problem with replacing the NA values with the mean of the column > which contains them. If I repla

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread John Fox
Dear iza.ch1, I hesitate to say this, because mean imputation is such a bad idea, but it's easy to do what you want with a loop, rather than puzzling over a "cleverer" way to accomplish the task. Here's an example using the Freedman data set in the car package: > colSums(is.na(Freedman)) popul

Re: [R] replace Na values with the mean of the column which contains them

2013-07-29 Thread Berend Hasselman
On 29-07-2013, at 18:39, "iza.ch1" wrote: > Hi everyone > > I have a problem with replacing the NA values with the mean of the column > which contains them. If I replace Na with the means of the rest values in the > column, the mean of the whole column will be still the same as if I would >

[R] Course R for Beginners, September 3-6, Barcelona, Spain

2013-07-29 Thread Soledad De Esteban Trivigno
Dear colleagues: This post is for informing you about some slots available in the course below, which may be of interest of some people in the list. 2 % of each fee will be donated to the R project. Course: R FOR BEGINNERS - Second edition. INSTRUCTORS: Dr. Klaus Langohr (Universitat Politécnic

[R] discontinous ssa forecast

2013-07-29 Thread Ingo Wardinski
Hello, I compute a singular spectrum ananlysis of a time series using ssa of the Rssa package. Then I compute the forecast based on the results of the singular spectrum ananlysis (ssa). Here I observe that the original time series and the forecast are discontinous. How can I force the forecast

[R] replace Na values with the mean of the column which contains them

2013-07-29 Thread iza.ch1
Hi everyone I have a problem with replacing the NA values with the mean of the column which contains them. If I replace Na with the means of the rest values in the column, the mean of the whole column will be still the same as if I would have omitted NA values. I have the following data de

[R] package "ridge"-how to obtain R squared

2013-07-29 Thread ZhouYuepeng
Dear all, I'm using package "ridge" to deal with multicollinearity. It's been convenient to automatically choose lambda. However, how do I tell whether the OLS results have been improved after applying ridge regression? I only notice that more variables become statistically significant and some

Re: [R] Multiple interaction terms in GAMM-model

2013-07-29 Thread Jeroen
Thanks for your extended reply. Application of the splines seems to be very plausible. I have now added random effects to the GAMM-model: random= list( objectID= ~1|doy ) (is that defined correct?) But I am wondering how to include both time and space in one te()-function? Or would it be bette

Re: [R] Chinese characters in html source captured by download.file() are garbled code , how to convert it readable

2013-07-29 Thread Henrik Bengtsson
Try with adding mode="wb" to download.file(), or just use downloadFile() of R.utils. /Henrik On Sun, Jul 28, 2013 at 8:32 PM, Yong Wang wrote: > Dear list, > I am working with R to download numerous html source code from which the > data extracted will be further processed. > The problem is the

Re: [R] Error: Line starting ' ...' is malformed!

2013-07-29 Thread MacQueen, Don
A recent version of the R extension manual says, "For maximal portability, the ‘DESCRIPTION’ file should be written entirely in ASCII — if this is not possible it must contain an ‘Encoding’ field (see below)." It also says, regarding the DESCRIPTION file, "Fields start with an ASCII name immedia

Re: [R] R function

2013-07-29 Thread David Carlson
Rui has shown you a much more efficient way to code your function in R. To fix the code you posted, you need to add brackets around the loop, test x[i] instead of i (which is always >= 1), and get the length of the loop from x not pah1$P. Without the brackets only the first if() is included in the

[R] legend in ggmap

2013-07-29 Thread Edoardo Baldoni
Hello, how can I visualize the legend in the following ggmap plot ? In the legend I just want to show the size ranges of the data: ggmap(map) + geom_point(aes(x=Longitude,y=Latitude), size = dataRd[,2]/12, col=2, data=dataRd, alpha=0.7, lwd=2) Thanks Edoardo [[alternative HTML version

Re: [R] Alternative method for range-matching within 2 nested loops in R?

2013-07-29 Thread William Dunlap
Look into the findInterval function. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of John Helly > Sent: Saturday, July 27, 2013 3:29 PM > To: r-help@r-project.org > Su

[R] How to double integrate a function in R

2013-07-29 Thread Tiago V. Pereira
I would like to express my gratitude for the great help given by David and Hans regarding my last query. Thank you very much for your time, people. All the best, Tiago --- Hello, R users! I am trying to double integrate the following expression: # expression (1/(2*pi))*exp(-y2/2)*sqrt((y1/(y2

Re: [R] How to split two levels several times?

2013-07-29 Thread dennis1991
Hi Arun, thanks. Great help. I tested the code for several tables and your function works well. Dennis > Gesendet: Freitag, 26. Juli 2013 um 15:43 Uhr > Von: arun > An: "dennis1...@gmx.net" > Cc: "R help" , "Rui Barradas" > Betreff: Re: [R] How to split two levels several times? > > It would

Re: [R] Declare BASH Array Using R System Function

2013-07-29 Thread arun
Hi,  system("names=(X Y); echo ${names[0]}") #sh: 1: Syntax error: "(" unexpected #this worked for me:  system("bash -c 'names=(X Y); echo ${names[0]}'") #X A.K. - Original Message - From: Dario Strbenac To: "r-help@r-project.org" Cc: Sent: Sunday, July 28, 2013 10:00 PM Subject: [

Re: [R] MCMClogit: Cannot calculate marginal likelihood with improper prior

2013-07-29 Thread Simon Zehnder
Hi, what I see so far is that you have specified your user.prior.density correctly. The error comes from the prior precision matrix "B0" in combination with the marginal.likelihood set to "Laplace". B0, if not explicitly specified, defaults to zero, which results in eigenvalues of zero. If "La

Re: [R] Declare BASH Array Using R System Function

2013-07-29 Thread Prof Brian Ripley
On 29/07/2013 08:49, peter dalgaard wrote: On Jul 29, 2013, at 08:27 , Jeff Newmiller wrote: You seem confused. Not particularly, but he needs to be aware of _which_ shell R is executing in system() calls. These things work for me: system("foo=(bar baz); echo ${foo[1]}") baz Dario's iss

Re: [R] Help R

2013-07-29 Thread Jose Iparraguirre
Hola Maria Teresa, For multiple imputation, I would suggest the Amelia package by Gary King, James Honaker, and Matthew Blackwell, which uses the expectation-maximisation (EM) algorithm with bootstrap. Its excellent vignette has examples which should be more than enough for your needs. Do read

Re: [R] surface plot

2013-07-29 Thread Jim Lemon
On 07/29/2013 03:31 PM, javad bayat wrote: Dear R users; I have a question about surface plot that show me spatial variability of parameter. I have a data frame with 6 variables and X and Y for coordinate system. X Y pH ..... ... so I want to create a surface plot for my

Re: [R] R function

2013-07-29 Thread Rui Barradas
Hello, Sorry, that should be T <- function(x){ ifelse(x > = 1, "Combustion", "Petroleum") } Rui Barradas Em 29-07-2013 09:32, Rui Barradas escreveu: Hello, Try the following. T <- function(x){ ifelse(pah1$P > = 1, "Combustion", "Petroleum") } T(pah1$P[1:83]) Hope this hel

Re: [R] R function

2013-07-29 Thread Rui Barradas
Hello, Try the following. T <- function(x){ ifelse(pah1$P > = 1, "Combustion", "Petroleum") } T(pah1$P[1:83]) Hope this helps, Rui Barradas Em 29-07-2013 06:35, javad bayat escreveu: Dear R users; I am MSc student and I want to write my own function, but it cant be completed. pleas

Re: [R] Declare BASH Array Using R System Function

2013-07-29 Thread peter dalgaard
On Jul 29, 2013, at 08:27 , Jeff Newmiller wrote: > You seem confused. Not particularly, but he needs to be aware of _which_ shell R is executing in system() calls. These things work for me: > system("foo=(bar baz); echo ${foo[1]}") baz Dario's issue is suggested by his error message >>> sys