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 reshape the table dataset.melt -

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 ph...@philbrierley.com 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 of the field 'species

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 arif.chan...@hotmail.comwrote: 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

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 tobias.farnly...@gmail.comwrote: Hi useRs.. I cant figure out how to test for causality using causality() in vars package I have

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 aihaiy...@gmail.com 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

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 nsi...@gmail.com wrote: Hi, I need to transpose and aggregate the 4th and 5th

[R] Two way joining vs heatmap

2009-08-31 Thread Schalk Heunis
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-help PLEASE do read the posting

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

Re: [R] Anova over a list of models

2009-09-06 Thread Schalk Heunis
)) 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, Jeroen Oomsj.c.l.o...@uu.nl wrote: 2009/9/5 Henrique Dallazuanna www...@gmail.com Try this: anova(myModels[[1]],myModels

Re: [R] Color index in image function

2009-09-06 Thread Schalk Heunis
colors match which range, consider specifying the ranges in breaks. Schalk Heunis On Sun, Sep 6, 2009 at 4:50 PM, FMHkagba2...@yahoo.com 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 represent

Re: [R] Data in Array

2009-09-08 Thread Schalk Heunis
have you tried rbind? On Tue, Sep 8, 2009 at 11:16 AM, FMHkagba2...@yahoo.com 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 -

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, sclar...@illinois.edu wrote: I just learned that vectors can't contain vectors, which frankly

Re: [R] Combining simulated data

2009-09-09 Thread Schalk Heunis
this helps. Schalk Heunis On Wed, Sep 9, 2009 at 2:26 AM, KABELI MEFANEkabelimef...@yahoo.co.uk 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 rows. Hypermarket - rnorm(10

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

2009-09-11 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) ### Schalk Heunis

Re: [R] Question about Factors

2009-09-13 Thread Schalk Heunis
On Mon, Sep 14, 2009 at 5:19 AM, Schalk Heunis schalk.heu...@enerweb.co.zawrote: 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 chri...@austwaterenv.com.auwrote

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 Schalk Heunis On Mon

Re: [R] problems with reshape

2009-09-15 Thread Schalk Heunis
2000-12-12 5 56849XX QWERTG50T0XX NA2000-03-30 6 12345XX POIQWE74H0XX1999-12-31 NA HTH Schalk Heunis On Mon, Sep 14, 2009 at 4:41 PM, Luca Braglia brag...@poleis.eu wrote: Hello * I would like to reshape wide the following dataset: rl

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 jaksonaqu...@gmail.comwrote: Hello, How can I make xtable print a comma as decimal separator? Setting the option OutDec isn't

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 can't figure out how

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

2009-09-17 Thread Schalk Heunis
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 pengyu...@gmail.com wrote: Hi, data.frame(x1=1:11,x2=2:12,x3=3:13,y=4:14) I want to extract all the columns that with the name 'x

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 Heunis On Thu

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 wwwhite...@gmail.comwrote: Schalk, Thats a great

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, Marcio Resende mresende

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 shoeb...@gmail.com wrote: Hi everyone,I have a data daily data (x) for 10

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 ld7...@gmail.comwrote: Hello, dear R-ers! I have a data frame: x-data.frame(a=c(4,2,4,1,3,4),b=c(1,3,4,1,5,0),c

Re: [R] Incorrect Dimension

2009-09-18 Thread Schalk Heunis
, j, i) } } ## HTH Schalk Heunis On Fri, Sep 18, 2009 at 4:50 AM, Marcio Resende mresende...@yahoo.com.brwrote: I am new in R and i am having trouble here. I´ve already searched in the list but hasn´t helped

Re: [R] Incorrect Dimension

2009-09-18 Thread Schalk Heunis
On Fri, Sep 18, 2009 at 8:12 AM, Schalk Heunis schalk.heu...@enerweb.co.zawrote: 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

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 monn...@hotmail.com wrote: Hi, This is a question of a newbie getting into the exciting world of R. I have several dataframes in the same

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 samtpla...@gmail.com wrote: # I have a dataframe with data and factors similar

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

2009-09-20 Thread Schalk Heunis
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 holli...@crimson.ua.edu wrote: I was wondering if anyone could help me with a problem. I need to randomly select

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 ja...@jasonpriem.com 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 of my data

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

2009-09-20 Thread Schalk Heunis
to 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 smanuj1...@yahoo.in wrote: I have fitted Hyperexponential distribution (HED) and Hypoexponential distribution (HoED) to two different data sets (of size

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 georgeh...@gmail.com wrote: Dear R community, I have a dataframe with say 100 different variables. I wish to regress variable

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

2009-09-21 Thread Schalk Heunis
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 wwwhite...@gmail.com wrote: I'm trying to display the probability space

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 annako

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 dyo...@telefonica.net wrote: Hello Group, I'm trying to learn R and am having a problem getting

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) Schalk Heunis On Wed, Sep 23, 2009 at 8:57 PM, mdusa

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. dataanalyt...@earthlink.net wrote: Hi, I'm attempting to use the RODBC package on Windows Vista to import an excel

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 ron_michae...@yahoo.com wrote: Dear all, I have following two list object, both are basically collection

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 mudiver1...@yahoo.com 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

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 mudiver1...@yahoo.com wrote: I need help with using graphics in Word 2007 that