Re: [R] on "do.call" function

2011-08-08 Thread peter dalgaard
On Aug 9, 2011, at 02:38 , Kathie wrote: > Thanks a lot all of you > > Yes, you're right. > > However, as i know, "do.call" calls its function once, but "apply(or sapply > etc)" not. So, I think do.call is faster than apply. That's why i am trying > to use do.call. > > Am I right?? You're not

Re: [R] Sweave : allowing errors in R code?

2011-08-08 Thread Duncan Mackay
Hi Remko After thinking about try and tryCatch the problem was catching the error what about ?captureOutput Regards Duncan At 14:28 09/08/2011, you wrote: > Hi Remko, > > How about ?try > > Hope it helps, > > Tsjerk > Not quite, because then the code chunk in the final doc. will have this tr

[R] Transparent color ramp problem

2011-08-08 Thread James Sturman
Hello, I can't seem to add transparency to any color ramp I create using colorRampPalette(). Can someone tell me if it is possible to create transparent colour ramps? I am attempting to map shaded relief under elevation data. I know I can use the terrain.colors() with the alpha option, but I

[R] Matlab to R

2011-08-08 Thread Annabel
I am trying to convert a matlab code to R. Most of the conversion statements are simple, but problem is with return. Since it's a recursive function it's a bit complicated. Anyway in matlab we can have return statment like [price, notional] = functionname() and also for the same function... not

Re: [R] Sweave : allowing errors in R code?

2011-08-08 Thread Remko Duursma
> Hi Remko, > > How about ?try > > Hope it helps, > > Tsjerk > Not quite, because then the code chunk in the final doc. will have this try() around it as well - not too pretty for a user manual. remko > On Aug 9, 2011 5:30 AM, "Remko Duursma" wrote: > > Dear R-helpers, > > > sorry if this i

Re: [R] How to pass different arguments to a function within lapply()?

2011-08-08 Thread Richard Ma
Hi David, Thank you very much. Problem solved. sapply() and lapply() are so powerful that even I have read their documents several times, still lots of tricky stuff to learn and try. Thank you again! Richard David Winsemius wrote: > > > > sapply(c("hsp", "dal"), function(x) locpoly(x=ts, y=

Re: [R] Aggregating data

2011-08-08 Thread Dennis Murphy
Hi: David evidently left the ddply() part to me :) Here's one way to summarize the data and get a plot in ggplot2. Firstly, thank you for the dput(); you score extra points for that :) I put that output in an object named results. ## Step 1: Summarize the data in plyr library('ggplot2') # als

[R] testing goodness of fit for t copula

2011-08-08 Thread poulomi ganguli
Hi, I'm a new user of R. I'm using package copula implemented in R. I want to know how to test goodness of fit of student's t copula for 3 dimensional cases using real world data. In manual gof test has been performed on the copula families generated from rcopula function that i understood as rand

Re: [R] Sweave : allowing errors in R code?

2011-08-08 Thread Duncan Mackay
Hi Remko ?try ?tryCatch Below are some posts that may give you an idea http://finzi.psych.upenn.edu/R/Rhelp02/archive/35608.html http://finzi.psych.upenn.edu/Rhelp10/2010-June/243576.html http://finzi.psych.upenn.edu/R/Rhelp02/archive/35604.html http://finzi.psych.upenn.edu/Rhelp10/2008-Septemb

Re: [R] How to pass different arguments to a function within lapply()?

2011-08-08 Thread David Winsemius
On Aug 8, 2011, at 11:01 PM, Richard Ma wrote: Hi all, I have a data frame called "rst", see below: -- # This is a paste able example # In case you don't have "KernSmooth" package installed, please uncom

[R] keeping output in memory

2011-08-08 Thread Joseph Sorell
In regard to my question Prof. Warren (Victoria University of Wellington, NZ) suggested the line: assign(paste("freq.list",i,sep="."),freq.list) instead of the lines: filename<-paste("freq.list", i, "txt", sep=".") write(freq.list, file=filename[[1]], sep="", append=FALSE)

[R] How to pass different arguments to a function within lapply()?

2011-08-08 Thread Richard Ma
Hi all, I have a data frame called "rst", see below: -- # This is a paste able example # In case you don't have "KernSmooth" package installed, please uncomment below line. # install.packages("KernSmooth") li

[R] nls, how to determine function?

2011-08-08 Thread Katrina Bennett
Hi R help, I am trying to determine how nls() generates a function based on the self-starting SSlogis and what the formula for the function would be. I've scoured the help site, and other literature to try and figure this out but I still am unsure if I am correct in what I am coming up with. ***

Re: [R] on "do.call" function

2011-08-08 Thread Kathie
Thanks a lot all of you Yes, you're right. However, as i know, "do.call" calls its function once, but "apply(or sapply etc)" not. So, I think do.call is faster than apply. That's why i am trying to use do.call. Am I right?? -- View this message in context: http://r.789695.n4.nabble.com/on-do-c

[R] Sweave : allowing errors in R code?

2011-08-08 Thread Remko Duursma
Dear R-helpers, sorry if this is obvious, but I can't find this in the documentation. I am using Sweave, and have some code that does not actually work - but I want to include it anyway, including the error message that R produces. But on running Sweave() on my .Rnw file, it simply halts when i

Re: [R] enclosing with() in a function

2011-08-08 Thread Duncan Murdoch
On 11-08-08 9:58 PM, thmsfuller...@gmail.com wrote: On Mon, Aug 8, 2011 at 6:08 PM, peter dalgaard wrote: On Aug 9, 2011, at 00:29 , Dennis Murphy wrote: Hi: Here are a couple of ways; there may well be better ones. # (1) Use the get() function: mean_on_element=function(data, elem_name) {

Re: [R] Creating a simple 1-row heatmap

2011-08-08 Thread Justin Fincher
Thank you for that. I had to do some tweaking, but I managed to get it working. In case anyone wants to do something similar, here's my solution. n = sample(1:50,25) g = gray(1-(n/max(n))) # the subtraction from 1 reverses the colors. rev() just reverses the order of the colors. image(as.matrix

Re: [R] S4 classes, some help with the basics

2011-08-08 Thread Martin Morgan
On 08/08/2011 05:04 PM, Mike Williamson wrote: Hi All, I have tried to find an answer within documentation, but I cannot: o How can call a class "slot" without knowing the name a priori? E.g., let's say I use the "pcaMethods" library to create a "pcaRes" object. How can I call parts

Re: [R] enclosing with() in a function

2011-08-08 Thread thmsfuller...@gmail.com
On Mon, Aug 8, 2011 at 6:08 PM, peter dalgaard wrote: > > On Aug 9, 2011, at 00:29 , Dennis Murphy wrote: > >> Hi: >> >> Here are a couple of ways; there may well be better ones. >> >> # (1)  Use the get() function: >> mean_on_element=function(data, elem_name) { >>   with(data, mean(get(elem_name)

Re: [R] enclosing with() in a function

2011-08-08 Thread thmsfuller...@gmail.com
On Mon, Aug 8, 2011 at 6:08 PM, peter dalgaard wrote: > > On Aug 9, 2011, at 00:29 , Dennis Murphy wrote: > >> Hi: >> >> Here are a couple of ways; there may well be better ones. >> >> # (1)  Use the get() function: >> mean_on_element=function(data, elem_name) { >>   with(data, mean(get(elem_name)

Re: [R] Aggregating data

2011-08-08 Thread David Winsemius
On Aug 8, 2011, at 7:51 PM, Jeffrey Joh wrote: Here is a sample of what I'm trying to do: structure(list(C_lo = c(0.00392581816943354, 0.00901222644518829, 0.00484396253385175, 0.00822377400482716, 0.00780070460187192, 0.00952688235337435), C_hi = c(0.00697755827622381, 0.0123301031600017,

Re: [R] msProcess, creating msSet file(s)

2011-08-08 Thread Duncan Mackay
Hi ? list.files There have been recent posts of a similar thread of working with multiple files. I do not know anything about msSet and msProcess Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email: home mac...@northnet.com

Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread Michael Sumner
Is it this? https://stat.ethz.ch/pipermail/r-devel/2011-July/061540.html Try a recent version of R 2.13.1 patched On Tue, Aug 9, 2011 at 1:53 AM, Colin Ford wrote: > Hi Pete, > > I thought it might be something to do with NA's when I first started but its > not. I've attached both the image ou

Re: [R] S4 classes, some help with the basics

2011-08-08 Thread Duncan Murdoch
On 08/08/2011 8:04 PM, Mike Williamson wrote: Hi All, I have tried to find an answer within documentation, but I cannot: o How can call a class "slot" without knowing the name a priori? See ?slot. E.g., let's say I use the "pcaMethods" library to create a "pcaRes" object. How ca

[R] S4 classes, some help with the basics

2011-08-08 Thread Mike Williamson
Hi All, I have tried to find an answer within documentation, but I cannot: o How can call a class "slot" without knowing the name a priori? E.g., let's say I use the "pcaMethods" library to create a "pcaRes" object. How can I call parts of that object without using the specific names of

Re: [R] Question

2011-08-08 Thread Martin Morgan
Hi Tyler -- On 08/08/2011 12:54 PM, Tyler Gruhn wrote: I just signed up for R Help, so please let me know if I'm doing this incorrectly. Better to provide an informative subject line -- "microarray heatmap memory use" ? I've been working with R for a couple of weeks, attempting to process

Re: [R] Aggregating data

2011-08-08 Thread Jeffrey Joh
Here is a sample of what I'm trying to do: structure(list(C_lo = c(0.00392581816943354, 0.00901222644518829, 0.00484396253385175, 0.00822377400482716, 0.00780070460187192, 0.00952688235337435), C_hi = c(0.00697755827622381, 0.0123301031600017, 0.0113207627868435, 0.0112887993422598, 0.01856724

Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread David Winsemius
On Aug 8, 2011, at 11:53 AM, Colin Ford wrote: Hi Pete, I thought it might be something to do with NA's when I first started but its not. I've attached both the image output and the data. No, you haven't. Probably was an unacceptable file type. Its almost as if the blocks in the heatmap a

Re: [R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread Colin Ford
Hi Pete, I thought it might be something to do with NA's when I first started but its not. I've attached both the image output and the data. Its almost as if the blocks in the heatmap are not quite meshing together? I've tried heatmap.2 as well and that gave the same result. I also just tried t

[R] keeping output in memory

2011-08-08 Thread Joseph Sorell
Dear R afficianados! I'm writing a script to create a frequency list for multiple files. I've written a "for" loop to iterate through the selected folder and creating lists for each file. In the line "write(freq.list, file=filename[[1]], sep="", append=FALSE)" I've written the individual lists to

Re: [R] enclosing with() in a function

2011-08-08 Thread peter dalgaard
On Aug 9, 2011, at 00:29 , Dennis Murphy wrote: > Hi: > > Here are a couple of ways; there may well be better ones. > > # (1) Use the get() function: > mean_on_element=function(data, elem_name) { > with(data, mean(get(elem_name))) > } > mean_on_element(data, 'x') I suspect this goes belly-u

Re: [R] Classification trees problem.

2011-08-08 Thread Weidong Gu
?predict.rpart Weidong Gu On Mon, Aug 8, 2011 at 6:08 PM, Jose Bustos Melo wrote: > Hello Everyone, > > I'm doing a Classification trees with categorical explanatory variables using > library rpart and I would like to do a prediction for some data imputs. I > don't know where's a function or h

Re: [R] R.oo error upon construction

2011-08-08 Thread Ben qant
Hey that helps! Wish we could also throw an error if both were missing... Thanks again! Ben On Mon, Aug 8, 2011 at 4:37 PM, Henrik Bengtsson wrote: > Hi, > > you can do something like: > > setConstructorS3("Person", function(name, age) { > # Check for missing arguments, but allow for empty >

Re: [R] mixed model fitting between R and SAS

2011-08-08 Thread array chip
Dear Thierry, Thanks a lot for pointing me to the right direction! I still have some questions, really appreciate if you could provide any help: Is there a relationship between the nested mixed model that I used vs. the model that you gave (using biop location as random slope of pid), i.e.

Re: [R] R.oo error upon construction

2011-08-08 Thread Henrik Bengtsson
Hi, you can do something like: setConstructorS3("Person", function(name, age) { # Check for missing arguments, but allow for empty # constructor calls, i.e. Person(). if (missing(name) && missing(age)) { name <- NA; age <- NA; } else if (missing(name)) { throw("Argument 'name'

Re: [R] enclosing with() in a function

2011-08-08 Thread Dennis Murphy
Hi: Here are a couple of ways; there may well be better ones. # (1) Use the get() function: mean_on_element=function(data, elem_name) { with(data, mean(get(elem_name))) } mean_on_element(data, 'x') # (2) Lose 'with' and use subscripting instead: mean_on_element=function(data, elem_name) {

Re: [R] enclosing with() in a function

2011-08-08 Thread R. Michael Weylandt
Hi Tom, What exactly is this function supposed to do? Your immediate problem is that you are passing it a string "x" and asking for a mean of the string "x" (hence complaints that it's not numeric) but I'm a little confused as to what this is supposed to do when it works. If you just want the mea

[R] R.oo error upon construction

2011-08-08 Thread Ben qant
Hello, Using the R.oo package, how do I throw an error if a field is not present when the user of the class creates the object? Using the example in the R.oo package: setConstructorS3("Person", function(name, age) { if (missing(name)) name <- NA; if (missing(age)) age <- NA; extend(Objec

[R] enclosing with() in a function

2011-08-08 Thread thmsfuller...@gmail.com
Hi All, I want to enclose with() in a function mean_on_element. Obviously, it is not working. The problem is how to specify the element name with a function body. Does anybody have any suggestion? Thanks! > data=list(x=1:10) > with(data, mean(x)) [1] 5.5 > > mean_on_element=function(data, elem_na

Re: [R] Reshape2 sytax

2011-08-08 Thread Dennis Murphy
Hi: Here are two ways you could do this, one using dcast() and one using xtabs(): batdat <- structure(list(Time = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L), .Label = c("0:00", "0:15", "0:30", "0:45", "1:00", "1:15" ), class = "fact

[R] Classification trees problem.

2011-08-08 Thread Jose Bustos Melo
Hello Everyone, I'm doing a Classification trees with categorical explanatory variables using library rpart and I would like to do a prediction for some data imputs. I don't know where's a function or how can I do it?. Is there someone can help ?? ¿. Here's the code that I'm using. library(rp

Re: [R] Creating a simple 1-row heatmap

2011-08-08 Thread R. Michael Weylandt
Would the image() function do what you need? n = sample(1:50,25); g = gray(n/max(n)) # set up color palate g = rev(g) # reverse so max is black instead of white image(as.matrix(n),col=g) # Requires a matrix input I think you should be able to handle axes/ labels/ etc as normal: image(as.matrix(n

[R] Question

2011-08-08 Thread Tyler Gruhn
I just signed up for R Help, so please let me know if I'm doing this incorrectly. I've been working with R for a couple of weeks, attempting to process microarray data. This means 20,000+ rows of data to work with x 24 columns. I am trying to produce heatmaps and found that the best computer

[R] Sample size AUC for ROC curves

2011-08-08 Thread Karl Knoblick
Hallo! Does anybody know a way to calculate the sample size for comparing AUC of ROC curves against 'by chance' with AUC=0.5 (and/or against anothe AUC)? Thanks! Karl __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PL

Re: [R] Differences between ROC curves

2011-08-08 Thread Karl Knoblick
Package pROC does the job - roc.test with parameter paired=F Karl   - Ursprüngliche Mail Von: Karl Knoblick An: r-h...@stat.math.ethz.ch Gesendet: Montag, den 27. Juni 2011, 12:19:48 Uhr Betreff: Differences between ROC curves Hallo! Can anybody help with the comparison of ROC curve

Re: [R] Compare AUC of uncorrelated ROC curves

2011-08-08 Thread Karl Knoblick
Package pROC does the job - roc.test withparameter paired=F Karl - Ursprüngliche Mail Von: Karl Knoblick An: r-h...@stat.math.ethz.ch Gesendet: Dienstag, den 21. Juni 2011, 23:19:17 Uhr Betreff: Compare AUC of uncorrelated ROC curves Hallo! I want to compare two uncorrelated ROC curv

[R] Creating a simple 1-row heatmap

2011-08-08 Thread Justin Fincher
Howdy, I am trying to make a simple monochrome heatmap from 1 row of data. Essentially, I just want a long bar where black represents the max value in the data, white is the minimum, and all values in between are interpolated appropriately. I have tried using heatmap and heatmap.2, but both ha

[R] msProcess, creating msSet file(s)

2011-08-08 Thread 1Rnwb
I have 120 MS chromatograms containing two columns'Time' and 'Peak height'. how do in create a msSet file which is required by all the functions of 'msProcess' to process these files. I would appreciate help very much. Thanks Sharad -- View this message in context: http://r.789695.n4.nabble.com/m

[R] Reshape2 sytax

2011-08-08 Thread Bruce Miller
Hi Hadley et all, I am struggling with reshape2 and melt works and melt_check (filtered151) seems fine My cast command was acast (filtered151, Time ~ Species ~ Number) > melt_check (filtered151) Using time, Species as id variables $id [1] "time""Species" $measure [1] "Number" When I exec

Re: [R] a question on list manipulation

2011-08-08 Thread Brian Diggs
On 8/6/2011 9:21 AM, zhenjiang xu wrote: Unfortunately the list names of my real data are irregular with mixed digit and letters at the end. This is good idea though. It inspired me to give another solution based on that: x<- list(A=c("d", "e", "f"), B=c("d", "e"), C=c("d","g")) tmp<- unlist(x,

Re: [R] confidence interval as shaded band (lme)

2011-08-08 Thread Bert Gunter
Would someone tell me how they propose to go from "standard errors" to confidence intervals*. I suspect Doug Bates would probably like to know, also, as he has expended a lot of effort on this over the years, I believe. :-) -- Bert * Note +/- 2 std errors is almost certainly not the right answ

Re: [R] confidence interval as shaded band (lme)

2011-08-08 Thread Dennis Murphy
Hi: On Mon, Aug 8, 2011 at 10:07 AM, bjmjarrett wrote: > Hi all, > > I’m trying to plot confidence intervals for the fitted values I get with my > lme model in R. Which fitted values? The ones conditional on the random effects or the ones averaged over the random effects? The standard errors of

Re: [R] Need help with xyplot

2011-08-08 Thread Dennis Murphy
Hi: Try this: # Obtained from 'dput(dd)' dd <- structure(list(AgeRange = structure(c(1L, 1L, 2L, 2L, 3L, 3L), .Label = c("10-12", "15-18", "30-40"), class = "factor"), AgeOfPerson = c(11L, 12L, 13L, 14L, 33L, 36L), PersonNo = 1:6, Year0 = c(0L, 0L, 1L, 1L, 3L, 4L), Year1 = c(1L, 1L, 2L, 3L, 5L, 4

Re: [R] histogram not equal to Kolmogorov-Smirnov test; 3-way-nested Anova (2)

2011-08-08 Thread Dennis Murphy
Hi: What is the connection between genot and cage? What is the purpose of the levels fifteen, nine and fortyfive in eggs? Are these the numbers of eggs per some type of batch whose total is 45? Dennis On Mon, Aug 8, 2011 at 7:00 AM, Jörg Stephan wrote: > Hello R-Help-Team, > > I am doing a 3-wa

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
I think the problem may be there are multiple subjects with the same subject number. I'll have to index by subject & date. I put together a zip file with the original data set, the cleaned data set, and the code (with your code integrated). It's called "clean.zip" netfiles.umn.edu/users/patze003

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Joshua Wiley
Possiblyif any(grepl(4, x)) somehow returned true for a subject that only had 1 & 2, the effect would be to return all 1s. dummy <- factor(c("2", "1", "NA", "4")) foo(dummy) > foo(dummy) [1] 1 1 NA 2 Levels: 1 2 NA note the internal representation of the dummy factor: > as.numeric(dummy)

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
Here's a thought, when I execute it on a data frame with only the subject and resp variables I have the same problem. But not on the subset of data we've been working with. The difference between the full vector and the subset vector is that the full vector contains NA's. Only 35 out of 17,000 t

Re: [R] aggregate.zoo on bivariate data

2011-08-08 Thread Gabor Grothendieck
On Mon, Aug 8, 2011 at 9:16 AM, Johannes Egner wrote: > Hi, > > I'm removing non-unique time indices in a zoo time series by means of > aggregate. The time series is bivariate, and the row to be kept only depends > on the maximum of one of the two columns. Here's an example: > > x <- zoo(rbind( c(

Re: [R] confidence interval as shaded band (lme)

2011-08-08 Thread R. Michael Weylandt
I don't know lme models very well, but if you have standard errors for your values, this shouldn't be too hard (as a last resort) using polygon() For example x = 1:10 y = x^2 y.Err = 2*x y.Up = y + y.Err; y.Dn =y-y.Err # This graph is actually quite ugly so don't copy the formatting plot(x,y

[R] GOF of Student's t copula

2011-08-08 Thread POULOMI GANGULI
Hi all, I need to test gof of 3-dimensional t copula for my trivariate observed data set. So I used the command t.cop <- tCopula(c(0.785,0.283,0.613),dim=3,dispstr="un",df=6,df.fixed = TRUE) where c(0.785,0.283,0.613) is the correlation pattern of my data with 0.785 pearson correlation between

[R] confidence interval as shaded band (lme)

2011-08-08 Thread bjmjarrett
Hi all, I’m trying to plot confidence intervals for the fitted values I get with my lme model in R. Is there any way I can plot this in the form of a shaded band, like the output of geom_smooth() in ggplot2 package. ggplot2 seems to use only lm, glm, gam, loess and rlm as smoothing methods. Any

[R] Thanks for the help with displaying a data frame.

2011-08-08 Thread Ed Heaton
Thanks to Michael Weylandt and Josh Wiley for pointing me to the View() function. It worked like a charm - once I learned that R is case-sensitive. I told you I am new to R! Ed Ed Heaton 10318 Yearling Drive Rockville, MD 20850-3517 Voice: (301) 424-8186 Mobile: (301) 520-7414 Fax: (301) 4

Re: [R] Var-Cov matrix from LMER function

2011-08-08 Thread Joshua Wiley
Hi Cheryl, Here is an example of how to get the fixed and random effects covariance matrices. require(lme4) (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)) ## fixed effects vcov(fm1) ## random effects VarCorr(fm1) ## for documentation, see method?vcov("mer") Hope this helps, Josh

Re: [R] on "do.call" function

2011-08-08 Thread Zhang,Yanwei
Hi, Your use of "do.call" is essentially equal to "dpois(lt$y0, exp(rowSums(t(X[lt$i,])*B[,1])))". You do not need to use "do.call", "sapply" or "apply" will do, e.g., > sapply(1:nrow(lt), function(x) fc(lt[x,2],lt[x,1])) [1] 0.1891356 0.1859965 0.3149658 0.3128512 0.2622549 0.2631122 Way

[R] Fwd: Need help with xyplot

2011-08-08 Thread aziz4
Original message >Date: Wed, 3 Aug 2011 16:06:33 -0500 (CDT) >From: >Subject: Need help with xyplot >To: r-help@r-project.org > > >Consider I have the following data: > >AgeRange AgeOfPerson PersonNoFriendsAtYear0 FriendsAtYear1 >FriendsAtYear2 FriendsAtYear3

Re: [R] on "do.call" function

2011-08-08 Thread David Winsemius
On Aug 8, 2011, at 11:16 AM, Kathie wrote: Dear all, Even though one of R users answered my question, I cannot understand, so I re-ask this question. I am trying to use "do.call", but I don't think I totally understand this function. Why are you trying to use do.call? It operates on a

Re: [R] on "do.call" function

2011-08-08 Thread peter dalgaard
On Aug 8, 2011, at 17:16 , Kathie wrote: > Dear all, > > Even though one of R users answered my question, I cannot understand, so I > re-ask this question. > > I am trying to use "do.call", but I don't think I totally understand this > function. It has nothing to do with do.call, the problem i

Re: [R] Display a DataFrame in a data grid

2011-08-08 Thread Joshua Wiley
Hi Ed, In addition to Michael's suggestion (which is probably what you want), consider something like: head(mtcars) tail(mtcars) or for just the corners, you could try a little function like this: corner <- function(x, n = 3L, ...) { stopifnot(length(n) == 1L) if (n < 0L || n * 2 > min(dim(

Re: [R] Display a DataFrame in a data grid

2011-08-08 Thread R. Michael Weylandt
Welcome to the dark-side! I think the View() command will do what you want. This brings up a new window that displays the data spreadsheet style and you can scroll wherever you wish. If you want to do work in your command window, the head() and tail() commands will be of help to you. If you are j

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Joshua Wiley
These are shots in the dark, but you could try: running it in a clean R session with only the necessary packages and data loaded; testing on subsets of your data; examing the classes of all your variables and make sure they are what is expexted; upgrading your version of R. I just retested this on

[R] Display a DataFrame in a data grid

2011-08-08 Thread Ed Heaton
Hi, all; I'm new to R. Have been a SAS developer for over 20 years. Whenever I create a new table - you call them dataFrame objects - or modify an existing one, I like to open the table in a grid with horizontal and vertical sliders so that I can scan across the table and (especially) look

Re: [R] merging lists within lists via time stamp

2011-08-08 Thread Joshua Wiley
Hi Thomas, I suspect part of the reason you did not get a response the first time is that your example is not very easy to use. You say you have lists of data frames, but we only have two data frames (which you said worked fine). dput() is a nice way to provide example data if you cannot/do not

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
H, I pulled out a portion of the data set to create the code for posting. When I execute this on the data frame I get the following for subject 8 which is clearly incorrect. I get this for all subjects who originally had "1 & 2". dat$respalt <- with(dat, ave(Slide1_RESP, factor(grid), FUN =

[R] on "do.call" function

2011-08-08 Thread Kathie
Dear all, Even though one of R users answered my question, I cannot understand, so I re-ask this question. I am trying to use "do.call", but I don't think I totally understand this function. Here is an simple example. > B <- matrix(c(.5,.1,.2,.3),2,

Re: [R] merging lists within lists via time stamp

2011-08-08 Thread tomtomme
still no answer? I´ll try to be more precise and will ask on stack-overflow too... I´ve got multiple data.frames of gps- and temperature-data within a list. One data.frame looks like: GPS: date time x.lat x.lon 1 22.05.11 13:50:37 53.57908 10.034599 2

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Joshua Wiley
Hmm, well I suppose it technically does "touch" in some sense still if there are 1 & 2s, but it should just return it as is, not changed. Thanks for the data, very easy! Here is what I get: dat <- structure(list(subject = c(8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 42L, 42L, 42L, 42L, 42L, 42L, 42L

Re: [R] FW: Help on reshape2 data frame rearrangement

2011-08-08 Thread Joshua Wiley
Hi BJ, Is this what you want? Data1 <- structure(list(Site = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L), .Label = c("Site1", "Site2"), class = "factor"), Fish_no = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), .Label = c("Fish1", "Fish2", "Fish3", "Fish4"), class = "factor"), Length = c(10L, 13L,

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
Here's the code. I don't want it to even touch the vector if there are already "1's & 2's" structure(list(subject = c(8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), resp = c(2, 1, 1, 2, 1, 2, 1, 1, 1, 1, 4, 4, 2,

[R] FW: Help on reshape2 data frame rearrangement

2011-08-08 Thread B Jessop
Help-list, Sorry about the formatting problem, Josh. The following example data set(minor difference from original) in plain text should make the problem clear. Original data format: Site Fish_no Length Site1Fish110 Site1Fish213 Site1Fish314 Site1

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Joshua Wiley
On Mon, Aug 8, 2011 at 8:23 AM, Edward Patzelt wrote: > Thanks Josh for the code to post I have been trying to figure out how to do > that.  Your code works except that it changes subjects that responded with > "1 & 2" to all 1's.  What does the "ave" argument mean in the execution of Not in the

Re: [R] histogram not equal to Kolmogorov-Smirnov test; 3-way-nested Anova (2)

2011-08-08 Thread David Winsemius
On Aug 8, 2011, at 10:00 AM, Jörg Stephan wrote: Hello R-Help-Team, I am doing a 3-way-nestedAnova and a very strange thing occurred. My "Two-sample Kolmogorov-Smirnov test" (p=0.957) meet the requirement of normal distribution, BUT if I have a look at the histogram it is definitely not

Re: [R] If find x, then y, else do nothing

2011-08-08 Thread Edward Patzelt
Thanks Josh for the code to post I have been trying to figure out how to do that. Your code works except that it changes subjects that responded with "1 & 2" to all 1's. What does the "ave" argument mean in the execution of the function? library(car) foo <- function(x) { if (any(grepl(4, x))) {

Re: [R] SSOAP & chemspider

2011-08-08 Thread Duncan Temple Lang
Hi Paul I've been gradually filling in the XMLSchema packages for different cases that arise. My development versions of SSOAP and XMLSchema get a long way further and I have been trying to find time to finish them off. Fortunately, it is on my todo list for the next few weeks. I have releas

[R] fa (psych) output oblique.scores=TRUE vs. FALSE

2011-08-08 Thread Alain D.
Dear R-List, I have carried out a factor analysis using fa (psych) with nfactors=2, rotation="oblimin" and fm="pa". Now I have to report both pattern AND structure matrix. As I have understood R-Documentation, this can be obtained by setting the "oblique.scores" argument TRUE (structure matrix) o

[R] histogram not equal to Kolmogorov-Smirnov test; 3-way-nested Anova (2)

2011-08-08 Thread Jörg Stephan
Hello R-Help-Team, I am doing a 3-way-nestedAnova and a very strange thing occurred. My "Two-sample Kolmogorov-Smirnov test" (p=0.957) meet the requirement of normal distribution, BUT if I have a look at the histogram it is definitely not normally distributed. I never had something like that a

[R] aggregate.zoo on bivariate data

2011-08-08 Thread Johannes Egner
Hi, I'm removing non-unique time indices in a zoo time series by means of aggregate. The time series is bivariate, and the row to be kept only depends on the maximum of one of the two columns. Here's an example: x <- zoo(rbind( c(1,1), c(1.1, 0.9), c(1.1, 1.1), c(1,1) ), order.by=c(1,1,2,

[R] Var-Cov matrix from LMER function

2011-08-08 Thread Cheryl Johnson
Hello, Is there a way to get the Var-Cov matrix from the LMER function? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] histogram not equal to Kolmogorov-Smirnov test; 3-way-nested Anova

2011-08-08 Thread David Winsemius
On Aug 8, 2011, at 8:04 AM, Jörg Stephan wrote: Hello R-Help-Team, I am doing a 3-way-nestedAnova and a very strange thing occurred. My "Two-sample Kolmogorov-Smirnov test" (p=0.957) meet the requirement of normal distribution, BUT if I have a look at the histogram it is definitely not n

[R] histogram not equal to Kolmogorov-Smirnov test; 3-way-nested Anova

2011-08-08 Thread Jörg Stephan
Hello R-Help-Team, I am doing a 3-way-nestedAnova and a very strange thing occurred. My "Two-sample Kolmogorov-Smirnov test" (p=0.957) meet the requirement of normal distribution, BUT if I have a look at the histogram it is definitely not normally distributed. I never had something like that a

Re: [R] read in cel file by ReadAffy and read.celfile

2011-08-08 Thread Martin Morgan
On 08/08/2011 02:04 AM, You Na wrote: Hi there, I got a problem when trying to read in a .cel file using ReadAffy(). R codes: require(affy) Please ask questions about Bioconductor packages on the Bioconductor mailing list http://bioconductor.org/help/mailing-list/ Make sure your packages

Re: [R] problem in do.call function

2011-08-08 Thread Duncan Murdoch
On 08/08/2011 8:21 AM, Duncan Murdoch wrote: On 08/08/2011 4:34 AM, Kathie wrote: > Dear all, > > I am trying to use "do.call", but I don't think I totally understand this > function. > > Here is an simple example. > > > > > B<- matrix(c(.5,.1,

Re: [R] problem in do.call function

2011-08-08 Thread Duncan Murdoch
On 08/08/2011 4:34 AM, Kathie wrote: Dear all, I am trying to use "do.call", but I don't think I totally understand this function. Here is an simple example. > B<- matrix(c(.5,.1,.2,.3),2,2) > B [,1] [,2] [1,] 0.5 0.2 [2,] 0.1 0.3 > x<

[R] Print-quality output from R: some questions about R2wd

2011-08-08 Thread Frans Marcelissen
Hi,My major problem with R was always the quality of the output. Recently I found R2wd, which solved this problem. R2wd makes it possible to write output directly to a word file, end to produce high-quality tables.I have two problems with R2wd, however.1. The documentation says it is possible t

[R] heatmap is producing unwanted horizontal and vertical lines?

2011-08-08 Thread Colin Ford
Hello, I must start by saying that I am an R novice and am sorry if this is a no-brainer... I have an csv file that contains a grid of 300x300 data points. Each point represents a 1Km square on a map. Each point is either a floating point number or NA. I load the data in with:   data <- read.

Re: [R] R-help Digest, Vol 102, Issue 8

2011-08-08 Thread fraenzi . korner
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten. Bei dringenden Fällen melden Sie sich bei Stefanie von Felten steffi.vonfel...@oikostat.ch We are on vacation until 20. August. In urgent cases, please contact Stefanie von Felten steffi.vonfel...@oikostat.ch __

[R] read in cel file by ReadAffy and read.celfile

2011-08-08 Thread You Na
Hi there, I got a problem when trying to read in a .cel file using ReadAffy(). R codes: require(affy) ReadAffy(filenames="CH1.CEL") It failed and I got the error, Error in read.celfile.header(as.character(filenames[[1]])) : Is CH1.CEL really a CEL file? tried reading as text, gzipped text, b

Re: [R] Bruno's Panel LSDVC

2011-08-08 Thread George Matysiak
I'm repeating the post. Has anyone written a routine for this R? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Re-Bruno-s-Panel-LSDVC-tp3680824p3726719.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-p

Re: [R] Distance between a vector and matrix rows

2011-08-08 Thread vioravis
Thank you both for your reply. I went with the cosine function for similarity and used it with apply to get a measure of distance. Ravi -- View this message in context: http://r.789695.n4.nabble.com/Distance-between-a-vector-and-matrix-rows-tp3726268p3726610.html Sent from the R help mailing lis

[R] problem in do.call function

2011-08-08 Thread Kathie
Dear all, I am trying to use "do.call", but I don't think I totally understand this function. Here is an simple example. > B <- matrix(c(.5,.1,.2,.3),2,2) > B [,1] [,2] [1,] 0.5 0.2 [2,] 0.1 0.3 > x <- c(.1,.2) > X <- cbind(1,x) > X

Re: [R] glmm for ordinal repeated measurement

2011-08-08 Thread Duncan Mackay
Hi If you go to the list of contributed packages have a look at the ones that have ordinal in their description. You have not told us what your data is or what you need Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England ARMIDALE NSW 2351 Email: ho

  1   2   >