Re: [R] legend not appearing in Word document

2010-12-12 Thread Schalk Heunis
Tim Works in Word 2002 on Windows XP with PDF-xchange 3.0 to convert to pdf. Saw reponse from Duncan - agree might be problem with Word 2007 PDF converter. HTH Schalk On Sun, Dec 12, 2010 at 3:59 PM, Tim Clark wrote: > I need help with using graphics in Word 2007 that will later be converted

Re: [R] legend not appearing in Word document

2010-12-12 Thread Schalk Heunis
On Sun, Dec 12, 2010 at 3:59 PM, Tim Clark wrote: > I need help with using graphics in Word 2007 that will later be converted > into a > pdf document. I have tried several formats and found that I get the best > quality of graphics using .wmf, .eps format, but when I convert it to .pdf > I get >

Re: [R] Replacing elements of list

2010-03-22 Thread Schalk Heunis
lapply will do the trick, try something like lapply(1:length(dat1), function(x,dat1,dat2) cbind(dat1[[x]][,1:2], dat2[[x]]),dat1,dat2) HTH Schalk On Mon, Mar 22, 2010 at 10:18 AM, Ron_M wrote: > > Dear all, > > I have following two list object, both are basically collection of matrices > : > >

Re: [R] Tranpose and Aggregate Data

2010-01-04 Thread Schalk Heunis
Hi You can use the reshape package to achieve this. If you don't have it installed, install.packages('reshape'). Then look at ?cast and (possibly) ?melt HTH! Schalk On Tue, Jan 5, 2010 at 7:59 AM, Noli Sicad wrote: > Hi, > > I need to transpose and aggregate the 4th and 5th column of this d

Re: [R] Checking for normality and homogeneity of variance

2010-01-04 Thread Schalk Heunis
For normality check out: ?shapiro.test HTH! Schalk On Tue, Jan 5, 2010 at 5:32 AM, Haiyang AI wrote: > Dear all, > > I'm a beginner of R and I need to carry out some three-way mixed ANOVAs. > Following examples at http://personality-project.org/r/r.anova.html, I > managed to get the ANOVA part,

Re: [R] test for causality

2009-11-16 Thread Schalk Heunis
Tobias The grangertest function in the lmtest package might be simpler for your application. Regards Schalk Heunis On Mon, Nov 16, 2009 at 5:31 PM, tobiasfa wrote: > > Hi useRs.. > > I cant figure out how to test for causality using causality() in vars > package > > I ha

Re: [R] Help Error

2009-10-12 Thread Schalk Heunis
This may be of some help:?try On Mon, Oct 12, 2009 at 9:42 AM, Arif Chandra wrote: > > Hi R-users, > > I would like to ask question related to error output. > If an error comments come out, then the program will automatically stop. > I want to ask , how I can still continue the program even thoug

Re: [R] field index given name.

2009-10-12 Thread Schalk Heunis
Hi Phil Try the following > which(names(iris)=='Species') [1] 5 HTH Schalk Heunis On Mon, Oct 12, 2009 at 8:53 AM, tdm wrote: > > Hi, > > How do I access the index number of a field given I only know the field > name? > > eg - I want to set the probability

Re: [R] Loading data to Trellis barchart plot.

2009-10-11 Thread Schalk Heunis
Hi I think the following will help: #Load some packages library(lattice) library(reshape) #Sample data dataset.frame <- data.frame(id=c("a","b","c","a","c","b","a"),colour=c("blue","green","red","red","red","green","green")) # calculate the counts dataset.table <- table(dataset.frame) #and res

Re: [R] RODBC problem

2009-09-24 Thread Schalk Heunis
Walt I get the same message using R2.9.2 on Vista. Using sqlFetch(con,'Sheet1') seems to however. HTH Schalk Heunis On Thu, Sep 24, 2009 at 6:23 PM, Data Analytics Corp. wrote: > Hi, > > I'm attempting to use the RODBC package on Windows Vista to import an e

Re: [R] set choose.files directory?

2009-09-24 Thread Schalk Heunis
See http://finzi.psych.upenn.edu/Rhelp08/2009-March/192978.html You can do something like: default.search = paste(getwd(),"/*.txt",sep="") infile2 = choose.files(default.search,filters = Filters[c("txt","All"),], caption = "Choose ECD datafile"

Re: [R] Basic function output/scope question

2009-09-21 Thread Schalk Heunis
Don't know SAS, but you can use y<<-10 to make the answer available in the global environement. See ?'<<-' To define the output see ?return Schalk Heunis On Mon, Sep 21, 2009 at 5:29 PM, David Young wrote: > Hello Group, > > I'm trying to learn R and

Re: [R] Three dimensional view of the profiles using 'rgl' package (example of 3 dimensional graphics using rgl package).

2009-09-21 Thread Schalk Heunis
Ana Not sure if I understood your problem, but on my side, the lines and points are both on the same 3-d picture. However, the lines are just very small: by setting data = data/100, the lines and points are both visible. HTH Schalk Heunis On Mon, Sep 21, 2009 at 4:38 PM, Ana Kolar wrote

Re: [R] Specific criteria for color palette using heatmap.2

2009-09-21 Thread Schalk Heunis
you can set the breaks property. > breaks <- c(seq(0, 1-1e-10, length=16) ,1) > heatmap.2(volcano / max(volcano), col=c(heat.colors(16)[1:15],"black"), > breaks = breaks) HTH Schalk Heunis On Mon, Sep 21, 2009 at 1:43 PM, bioinformatics_guy wrote: > > I'm tryi

Re: [R] running many different regressions

2009-09-20 Thread Schalk Heunis
Georg for example: >data(swiss) >data=swiss >lapply(2:length(data),function(x) lm(data[,1]~data[,x])) HTH Schalk Heunis On Sun, Sep 20, 2009 at 2:05 PM, Georg Ehret wrote: > Dear R community, > I have a dataframe with say 100 different variables. I wish to regress > var

Re: [R] Regarding KS Test for Goodness-of-Fit

2009-09-20 Thread Schalk Heunis
be able to handle a vector of inputs. Look at sapply if this is an issue. HTH Schalk Heunis On Sun, Sep 20, 2009 at 4:21 AM, Manuj Sharma wrote: > > I have fitted Hyperexponential distribution (HED) and Hypoexponential > distribution (HoED) to two different data sets (of size 1000 numer

Re: [R] plotting least-squares residuals against x-axis

2009-09-20 Thread Schalk Heunis
Jason Try this > Residuals = residuals(lm(y~x)) > plot(x,Residuals) Schalk Heunis On Sun, Sep 20, 2009 at 1:36 AM, Jason Priem wrote: > Hi, > I want to plot the residuals of a least-squares regression. > > plot(lm(y~x), which=1) > > does this, but it plots the y-axis

Re: [R] random selection from dataset and creating and graphing multiple means

2009-09-20 Thread Schalk Heunis
199.9544 202.2562 197.8169 199.3558 C. Draw the histogram Drawing a histogram of means500 is achieved using the hist function > hist(means500) HTH Schalk Heunis On Sat, Sep 19, 2009 at 11:24 PM, MikeH78 wrote: > > I was wondering if anyone could help me with a problem. I need to

Re: [R] Creating histograms from factors using a for loop

2009-09-19 Thread Schalk Heunis
You could plot both histograms into the same file using this: library(lattice) jpeg(filename="combined.jpeg") histogram(~d|f, data = df) dev.off() Schalk Heunis On Sat, Sep 19, 2009 at 11:37 AM, Sam Player wrote: > # I have a dataframe with data and factors similar to the fol

Re: [R] Replacing values in dataframes

2009-09-19 Thread Schalk Heunis
I think this is what you want NAD$Sample.Id <- t(Prot.amount[NAD$Sample.Id]) HTH Schalk Heunis On Sat, Sep 19, 2009 at 12:18 PM, Monna Nygård wrote: > > Hi, > > > > This is a question of a newbie getting into the exciting world of R. > > > > I have several

Re: [R] Incorrect Dimension

2009-09-17 Thread Schalk Heunis
On Fri, Sep 18, 2009 at 8:12 AM, Schalk Heunis wrote: > Marcio > Looking at the script (not much explanation re your intention), I think > there is a couple of problems: > 1. Not sure if the attached was supposed to be working code, but the > assignment operator is <- not <

Re: [R] Incorrect Dimension

2009-09-17 Thread Schalk Heunis
if(1) >= (1 - r2)) g1 else g2 g[j, i] <- xx(gen, j, i) } } ###### HTH Schalk Heunis On Fri, Sep 18, 2009 at 4:50 AM, Marcio Resende wrote: > > I am new in R and i am having trouble here. I´ve alread

Re: [R] referring to a row number and to a row condition, and to columns simultaneously

2009-09-17 Thread Schalk Heunis
Try this x[(row(x[1]) %in% 2:5) & x$a==1,4:5] <- c(8,9) x[(row(x[1]) %in% 2:5) & x$a!=1,4:5] <- c(101,102) HTH Schalk Heunis On Thu, Sep 17, 2009 at 11:17 PM, Dimitri Liakhovitski wrote: > Hello, dear R-ers! > > I have a data frame: > > x<-data.frame(a=c(4,2,

Re: [R] Help with date specification

2009-09-17 Thread Schalk Heunis
Subodh Assuming the data is ordered by date then you can define fin.years = (0:(10*12-1)) %/% 12 then use aggregate: aggregate(x, list(fin.years),sum) HTH Schalk Heunis On Thu, Sep 17, 2009 at 6:11 PM, Subodh Acharya wrote: > Hi everyone,I have a data daily data (x) for 10 years start

Re: [R] How to separate a function by 2 probabilities

2009-09-17 Thread Schalk Heunis
Marcio Define two functions, e.g. f1<-function(i,j) i+j f2<-function(i,j) i-j then call them based on the probability e.g. 0.7 f <- if(runif(1)>0.7) f1 else f2 f(1,1) or more compact (if(runif(1)>0.7) f1 else f2)(1,1) HTH Schalk Heunis On Thu, Sep 17, 2009 at 5:10 PM, Marci

Re: [R] heatmap.2() problems with re-ordering of rows and columns

2009-09-17 Thread Schalk Heunis
Try placing the column names into labCol and the rownames into labRow e.g.heatmap.2(mat,dendrogram=c("none"), Rowv=F, Colv=F, labRow = seq(-7.5,7.5,by=5), labCol=seq(-3,3,by=2)) Schalk Heunis On Thu, Sep 17, 2009 at 3:53 PM, bioinformatics_guy wrote: > > Schalk, > > Thats

Re: [R] heatmap.2() problems with re-ordering of rows and columns

2009-09-17 Thread Schalk Heunis
Hi bioinformatics_guy I think you are looking for the "image" function: image(mat) The heatmap.2 function does hierarchical clustering on rows and columns and then orders the rows and columns according to the results of the clustering. Image simply plots the matrix. HTH Schalk Heuni

Re: [R] How to extract data.frame columns using regex?

2009-09-17 Thread Schalk Heunis
t; or >df[,grep('^x',names(df))] x1 x2 x3 1 1 2 3 2 2 3 4 3 3 4 5 4 4 5 6 5 5 6 7 6 6 7 8 7 7 8 9 8 8 9 10 9 9 10 11 10 10 11 12 11 11 12 13 HTH Schalk Heunis On Thu, Sep 17, 2009 at 5:03 AM, Peng Yu wrote: > Hi, > > data.frame(x1=1:11

Re: [R] list of symbols to substitution

2009-09-15 Thread Schalk Heunis
Instead of eval(expr), use lapply(expr,eval) HTH Schalk Heunis On Wed, Sep 16, 2009 at 5:50 AM, Michael Spiegel < michael.m.spie...@gmail.com> wrote: > Hi, > > I'm trying to use a list of symbols as one of the values to be > substituted in a substitute expression, but I

Re: [R] comma as decimal separator in xtable

2009-09-15 Thread Schalk Heunis
This might be of help, first applies the formatting:print(xtable(prettyNum(d, decimal.mark=","))) Schalk Heunis On Tue, Sep 15, 2009 at 5:06 PM, Jakson A. Aquino wrote: > Hello, > > How can I make xtable print a comma as decimal separator? Setting > the option OutDec i

Re: [R] problems with reshape

2009-09-14 Thread Schalk Heunis
3 56849XX QPWOER52E2XX 2000-07-07 4 54982XX FJKLSD67P4XX 2000-12-12 5 56849XX QWERTG50T0XX 2000-03-30 6 12345XX POIQWE74H0XX1999-12-31 HTH Schalk Heunis On Mon, Sep 14, 2009 at 4:41 PM, Luca Braglia wrote: > H

Re: [R] (no subject)

2009-09-13 Thread Schalk Heunis
Karen You can copy and paste data directly into R from Excel: 1. Mark the data including the headings in Excel 2. Ctrl-C 3. In R: myDF <- read.delim("clipboard") Following from Milton: hist(myDF$VARNAME) or hist(myD[,1]) #to plot 1st collumn hist(myD[,2]) #to plot 2nd collumn Schal

Re: [R] Question about Factors

2009-09-13 Thread Schalk Heunis
On Mon, Sep 14, 2009 at 5:19 AM, Schalk Heunis wrote: > Chris > try this (assume your dataset is in a dataframe called ms): > library(lattice) > xyplot(Value~Time|Name,data = ms) > > HTH > Schalk > > > > On Mon, Sep 14, 2009 at 2:19 AM, Chris Li wrote: > >

Re: [R] Accumulating results from "for" loop in a list/array

2009-09-10 Thread Schalk Heunis
Steven I think list() can help you ## indlist = list() for (i in 1:(dim(x)[2])) { indlist[[paste("ind", i, sep = "")]] <- which(x[ , i] == "y") } accum = unlist(indlist) print(indlist$ind1) ##

Re: [R] Combining simulated data

2009-09-09 Thread Schalk Heunis
e("Spazashop",1:35))) Hope this helps. Schalk Heunis On Wed, Sep 9, 2009 at 2:26 AM, KABELI MEFANE wrote: > R helpers > > Please help me combine the simulated data to a form of table where: > Hypermarket have 10 rows, supermarket have 15 rows,..., spazashops with > 35 ro

Re: [R] vector of Vectors

2009-09-08 Thread Schalk Heunis
You want to use list: a = list() a[[1]] = c(1,2,3) a[[2]] = c(1,2,3) Note the [[..]] operator - check the "An Introduction to R" manual for more details Schalk Heunis On Wed, Sep 9, 2009 at 6:00 AM, wrote: > I just learned that vectors can't contain vectors, which frankly

Re: [R] Data in Array

2009-09-08 Thread Schalk Heunis
have you tried rbind? On Tue, Sep 8, 2009 at 11:16 AM, FMH wrote: > Dear All, > > I have some data which were stored in few  matrices with different orders. > Let have three different matrices a, b and c, which have the same number of > column but different number of row. > > > a <- matrix(1, n

Re: [R] Color index in image function

2009-09-06 Thread Schalk Heunis
bout which colors match which range, consider specifying the ranges in "breaks". Schalk Heunis On Sun, Sep 6, 2009 at 4:50 PM, FMH wrote: > Hi, > > Thank you for your response. I'm looking for the names of the colors denoted > by these  codes and what do these colors

Re: [R] Anova over a list of models

2009-09-06 Thread Schalk Heunis
rce(myModels[[",x,"]])",sep = "")}) myParStr = toString(paste( myParameters )) eval(parse(text = paste("anova(",myParStr,")"))) I would have expected do.call(anova, myModels) to work Hope this helps Schalk Heunis On Sat, Sep 5, 2009 at 10:43 PM, Je

Re: [R] Two way joining vs heatmap

2009-08-31 Thread Schalk Heunis
Levi Thanks for the reply, do you know of any function or package that does contain an implementation of two-way joining? I looked at the biclust package which implements several other (more modern?) bi-clustering techniques, but could not find two-way joining. Schalk Heunis On Mon, Aug 31

[R] Two way joining vs heatmap

2009-08-30 Thread Schalk Heunis
hat is the relationship (if any) between the "heatmap" function in R and this technique? Is there an alternative function to use? Thanks for the help! Schalk Heunis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel