Re: [R] Drop values of one dataframe based on the value of another

2012-06-01 Thread Ethan Brown
Before using ddply, try adding an id variable to uniquely identify each record (this is a good data integrity practice anyway). Then you can simply create the new data frame by using all the ids that aren't in your 'To_remove' subset. Here's the code for your example: library(plyr) library(outlie

Re: [R] write data using xlsReadWrite

2012-05-14 Thread Ethan Brown
You're trying to write an object that you've never created. If you want to write `varHL2y`, which it appears you do, you would replace that for `mydata` in your command. Best, Ethan On Sun, May 13, 2012 at 1:33 AM, diyanah wrote: > Hai, I'm trying to write these var output data from these codes

Re: [R] determine size (width and height) of a graphics file via R - how?

2012-05-14 Thread Ethan Brown
Hi Mark, You can do this easily with the "identify" command in ImageMagick . Install it, and then from within an R session: system2("identify", "yourimagename.jpg") ...and it should give you something like this: yourimagename.jpg JPEG 800x533 800x533+0+0 8-bit Direct

Re: [R] Strange "Error: subscript out of bounds"

2012-05-11 Thread Ethan Brown
Hi, this looks like a typo to me. The name of the argument to your function is 'pre.mat', but you're trying to print an object called 'pred.mat' (with an extra 'd') that never appears before. It's easier to help when you give a reproducible example that we can execute on our own computers, as reco

Re: [R] (no subject)

2011-06-20 Thread Ethan Brown
300,                                # image resolution (dpi) > > #         units="in", width=8.3, height=5.8,      # image dimensions > > (inches) > > #         compression="none"                      # image compression > > #                                                 #  (

Re: [R] (no subject)

2011-06-20 Thread Ethan Brown
Hi Ungku, it's really difficult for us to take a huge block of code and understand where an error happened. There's several things that can help us help you: 1) First and foremost, what is the error message or undesired behavior you're experiencing? 2) Second, please pare down the code to the plac

Re: [R] Help with Median test and Coxon-Mann-Whittney test

2011-06-11 Thread Ethan Brown
Hi Rob, This list is primarily intended for questions about how to do things in R, so you're more likely to get a helpful response elsewhere. You might want to try some place like the Cross-Validated web site ( http://stats.stackexchange.com/) for general statistics and data analysis questions. B

Re: [R] Problem loading packages in R 2.13.0 on Mac

2011-06-10 Thread Ethan Brown
Hi Adrienne, I'm not familiar with your interface, but it sounds like R thinks the package "mvtnorm" is not installed. You can see the packages you've installed with: row.names(installed.packages()) Is "mvtnorm" in the output of that command? You could test with the command, "mvtnorm" %in% row.

Re: [R] giving factor names

2011-06-10 Thread Ethan Brown
Hi Kieran, I'm not very familiar with lattice, but here's a workaround that works for me. Basically, I just created a new data.frame column that was a factor (combo$zf), and forced its levels to be what you're looking for here. require(lattice) x<-c(1,2,3) y<-c(2,4,6) z<-c(0.1,0.5,2) combo<-expa

Re: [R] Sorting DataFrames

2011-06-07 Thread Ethan Brown
Hello Samantha, I'm having some trouble understanding your question in terms of what's happening in R. Are these "bins" columns of a data.frame? Rows? It's helpful for us to have a small example to look at--for instance, you could create a small subset of your data called x, then type the command

Re: [R] Merge two columns of a data frame

2011-06-06 Thread Ethan Brown
Another possibility: dfs <- list(df1, df2, df3) df.1.2.3 <- as.data.frame(unlist(sapply(dfs, function(x) do.call(paste, x On Mon, Jun 6, 2011 at 2:37 PM, Ista Zahn wrote: > Hi Abraham, > Just take it step by step. Paste the values together, combine them, > and assign them to a data.frame col

Re: [R] Question with RExcel

2011-06-06 Thread Ethan Brown
It's hard to see where the problem is from this information. I would suggest subscribing to and asking this question of the RExcel mailing list (accessible from http://rcom.univie.ac.at/) and providing more detail of what you're trying to do, what is going wrong, error messages (is it R or Excel g

Re: [R] Question about example function

2011-06-05 Thread Ethan Brown
Hi Abhilash, >From ?example, under "arguments": local: logical: if ‘TRUE’ evaluate locally, if ‘FALSE’ evaluate in the workspace. So all you need to do is: > x <- 0 > example(mean, local=TRUE) mean> x <- c(0:10, 50) mean> xm <- mean(x) mean> c(xm, mean(x, trim = 0.10)) [1] 8.75 5.50 mean> m

Re: [R] VLOOKUP in R - tried everything.

2011-06-03 Thread Ethan Brown
Even after I discovered match(), it took me a little while to figure out how to use it for this task, so to add on to Peter's comment--to add a column for total for each value of "coll.minus.release", try the following: data$ParasitoidMatch <- data$ParasitoidTotal[match(data$coll.minus.release, da

Re: [R] Writing R code for "moments"

2010-10-08 Thread Ethan Brown
Hi July, You might want to check out the "moments" package. It has a couple functions, "all.moments()" and "moment()" that will compute these for you. By the way, "RSeek.org" is a great place to find packages like this; I searched for "sample moments" and clicked on the "functions" tab to find th

Re: [R] using a package function inside another function

2010-10-07 Thread Ethan Brown
t; x [,1] [,2] [,3] 147 258 369 test000 See http://cran.r-project.org/doc/manuals/R-intro.html#Writing-your-own-functions for more on this topic. HTH, Ethan Brown On Thu, Oct 7, 2010 at 9:47 AM, Alison Callahan wrote: > Hello

Re: [R] Converting scraped data

2010-10-06 Thread Ethan Brown
{ # Convert columns to factors result[,i] <- as.numeric(unfactor(result[,i])) } result >From here you should be able to plot or do whatever else you want. Hope this helps, Ethan Brown On Wed, Oct 6, 2010 at 9:52 AM, Simon Kiss wrote: > Dear Colleagues, > I used this code to scrap