Re: [R] extracting non-NA entries from a two-way frequency table

2013-12-16 Thread rmailbox
Sorry about omitting library(plyr). It's really thanks to Hadley, of course. His contributions make us all (capable of being) better. Eric - Original message - From: Michael Friendly To: rmail...@justemail.net, r-help@r-project.org Subject: Re: extracting non-NA entries from a two-way f

Re: [R] extracting non-NA entries from a two-way frequency table

2013-12-13 Thread rmailbox
Perhaps this? library(reshape2) library(stringr) GeisslerLong <- melt (Geissler, id.vars = c("boys")) GeisslerLong <- transform ( GeisslerLong, girls = as.numeric ( str_replace( variable, "g", '' )) ) GeisslerLong <- rename ( GeisslerLong, c( value = "Freq")) GeisslerLong <- arrange ( GeisslerLo

Re: [R] Merging data in R compared to SAS

2012-08-22 Thread rmailbox
Untested code below - Original message - From: ramoss To: r-help@r-project.org Subject: [R] Merging data in R compared to SAS Date: Wed, 22 Aug 2012 07:59:04 -0700 (PDT) Hello, I am a SAS user new to R. What is the R equivalent to following SAS statements: 1) data all; merge test

Re: [R] Getting codebook data into R

2012-02-13 Thread rmailbox
This is how I get a whole SPSS data files into R. You specifically asked about the codebook, so this may not be exactly what you are after. spssFileInfo <- spss.system.file ( file = "path to my SPSS file" ) spssDataSet <- as.data.set ( spssFileInfo) spssDataFrame <- as.data.frame ( spssDataSet

Re: [R] Getting codebook data into R

2012-02-09 Thread rmailbox
Or, you can do it the lazy way... Download spss errr... pspp at http://www.gnu.org/software/pspp/ and run the spss code in which somebody else already figured all that out, to create an spss file. Then use one of the spss importing libraries. Lately I've become partial to memisc, but there are s

Re: [R] Referring to an object by a variable containing its name: 6 failures

2011-09-15 Thread rmailbox
What am I missing about your inquiry: It seems like x[ , colName ] should work: testDFcols <- function(x = data.df, select=c(1:ncol(x)), bar=TRUE) { if(bar) cat("##\n"); for (column in select) { colName <-names(x)[column] cat("Column Name(", c

Re: [R] issue with odfWeave running on Windows XP; question about installing packages under Linux

2011-05-17 Thread rmailbox
I also have a problem using odfWeave on Windows XP with R > R2.11.1. odfWeave fails, giving mysterious error messages. (Not quite the same as yours, but similar. I sent the info to Max Kuhn privately, but did not get a response after two tries.) My odfWeave reporting system worked fine prior to

Re: [R] plyr workaround to converting by() to a data frame

2011-04-07 Thread rmailbox
Is this what you are looking for? ddply ( .variables = c("grp1", "grp2", "grp3" ), .data = df, .fun = plyr::summarize, abmin = min(c(a, b, c) ), abmax = max ( c ( a, b, c) ) ) - Original message - From: "Liviu Andronic" To: "r-help@r-project.org Help" Date: Thu, 7 Apr 2011 18:39:30 +

Re: [R] odfWeave Error unzipping file in Win 7

2011-03-21 Thread rmailbox
I tried with no spaces in either file name and got the same error. - Original message - From: "Max Kuhn" To: rmail...@justemail.net Cc: r-help@r-project.org Date: Mon, 21 Mar 2011 17:04:40 -0400 Subject: Re: [R] odfWeave Error unzipping file in Win 7 I don't think that this is the issu

Re: [R] odfWeave Error unzipping file in Win 7

2011-03-21 Thread rmailbox
I have a very similar error that cropped up when I upgraded to R 2.12 and persists at R 2.12.1. I am running R on Windows XP and OO is at version 3.2. I did not make any changes to my R code or ODF code or configuration to produce this error. Only upgraded R. Many Thanks, Eric R session: >

Re: [R] Question on implementing Random Forests scoring

2010-04-09 Thread rmailbox
You may also wish to check out the PMML approach. Check out the PMML package. eRic - Original message - From: "Liaw, Andy" To: "Larry D'Agostino" , "r-help" Date: Fri, 9 Apr 2010 15:15:11 -0400 Subject: Re: [R] Question on implementing Random Forests scoring From: Larry D'Agostino >

Re: [R] DROP and KEEP statements in R

2009-12-21 Thread rmailbox
My preferred solution would be to use the select option of the subset function. > data ( iris ) > names ( iris ) [1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width" "Species" # KEEP-like way > iris_subset_by_keep <- subset ( iris, select = c( "Sepal.Length", "Species" ) > ) #

Re: [R] cleanse columns and unwanted rows

2009-11-13 Thread rmailbox
?subset - Original message - From: "frenchcr" To: r-help@r-project.org Date: Fri, 13 Nov 2009 11:32:35 -0800 (PST) Subject: [R] cleanse columns and unwanted rows hello folks, Im trying to clean out a large file with data i dont need. The column im manipulating in the file is called

Re: [R] R process gets killed spontaneously

2009-11-10 Thread rmailbox
Cedrick is correct. I was referring to the command invoked by entering the string "screen" at the shell prompt. - Original message - From: "Cedrick W. Johnson" To: "Peng Yu" Cc: r-help@r-project.org Date: Tue, 10 Nov 2009 16:38:09 -0500 Subject: Re: [R] R process gets killed spontaneo

Re: [R] R process gets killed spontaneously

2009-11-10 Thread rmailbox
This was happening to me on Red Hat Linux when I was running huge jobs within a screen session. By any chance are your R processes running within a screen session? (screen is a very nice program that will keep your sessions alive after you log out, but it was killing off my big memory jobs for u

Re: [R] crosstabulation and unlist function

2009-10-12 Thread rmailbox
What you're really saying is that you don't care about the distinction between "aa", "bb" and "cc". In that case, a different arrangement of the data will be more useful: library (reshape ) df.melt <- melt ( df, id.var = "dd") with ( df.melt, table ( dd, value ) ) Eric - Original messag

Re: [R] Help with reshaping data.frame

2009-08-03 Thread rmailbox
How about: tst.long <- melt ( tst, id.vars = c("K1", "K2", "K3"), variable_name = "V" ) tst2 <- transform ( tst.long, K23Vx = paste ( K2, K3, V, sep = ".") ) tst.wide <- cast ( tst2 , K1 ~ K23Vx ) tst.wide > tst.wide K1 D.a.V1 D.a.V2 D.a.V3 D.b.V1 D.b.V2 D.b.V3 E.a.V1 E.a.V2 E.a.V3 E.b.V1

Re: [R] What is cast telling me?

2009-07-08 Thread rmailbox
That you have non-unique rows in your data (as identified by the identifying variables). - Original message - From: "Mark Knecht" To: "r-help" Date: Wed, 8 Jul 2009 12:41:28 -0700 Subject: [R] What is cast telling me? Hi, What is cast telling me when it says the following? Aggre

Re: [R] Equivalent to Stata egen

2009-04-16 Thread rmailbox
Now that we know what egen is, the answers are one-liners in R: # Make up some data vasdat <- matrix ( sample ( 1:100, 3000, replace = TRUE ), ncol = 3 ) # Use apply for each ( MARGIN = 1 means rows, 2 means columns ) anycountresult <- apply ( vasdat, MARGIN = 1, FUN = function ( x ) sum ( x %in%

Re: [R] group by-like statement for 2-row matrix

2009-04-07 Thread rmailbox
Another possibility is to transpose and use functions that assume the grouping is by rows, such as summaryBy in the doBy library. If you can easily work with your data this way, the code might be more clear. > library ( doBy ) > databyrows <- rbind ( c ( 2, 2, 3, 4, 4, 4, 5, 5, 6), c(1, 1, 2

Re: [R] adding rows as arithmatic calculation on original rows

2008-12-05 Thread rmailbox
Here is a solution using doBy and Gabor's DF2 created below: library( doBy ) newrows <- summaryBy ( myNum1 + myNum2 + myNum3 ~ myType , DF2, keep.names = TRUE ) newrows[,"myID"] <- "+" rbind ( DF2, newrows) - Original message - From: "Gabor Grothendieck" <[EMAIL PROTECTED]> To: "F

Re: [R] ggplot2; dot plot, jitter, and error bars

2008-11-19 Thread rmailbox
Do ?position_jitter You will see why the error message "unused arguments" is happening in your example. - Original message - From: "Juliet Hannah" <[EMAIL PROTECTED]> To: r-help@r-project.org Date: Wed, 19 Nov 2008 18:34:36 -0500 Subject: [R] ggplot2; dot plot, jitter, and error bars W

[R] Revised source to my own package; how to update?

2008-11-14 Thread rmailbox
I have written some functions that I have now collected into a package. Of course, there are revisions and additions. I started by creating a skeleton with package.skeleton. I read and deleted the read and delete me file. I edited the DESCRIPTION file appropriately. I can use the package once

[R] ggplot scale limit and stat_smooth

2008-10-21 Thread rmailbox
In the change log of ggplot2, version 0.7, I find this: "* scales: any point outside of limits is dropped (this was previously the behaviour for discrete scales, but not continuous scales)" and that makes sense for some applications. But what about if I want to summarize the data with a smooth

Re: [R] Simple question about extracting a subset of data

2008-09-29 Thread rmailbox
It's hard to read your table, but I think this could be your problem: daylength = "long.day" is always TRUE Testing for equality uses "==" so daylength == "long.day" may or may not always be TRUE - Original message - From: "Josh B" <[EMAIL PROTECTED]> To: "R Help" Date: Mon, 29 Sep 20

Re: [R] ggplot 2 - editing in the "panel_1_1" viewport

2008-09-29 Thread rmailbox
Not an answer, but, I hope, more of an almost-the-same question... I want to divide up the text grobs for the key labels into two different (text) grobs (each) and put them back into the space occupied by the original text grob. I've worked with grobs enough to think this should be easy, but I

[R] ggplot: adding layer using different data, groups and also controlling appearance

2008-09-24 Thread rmailbox
I have a more complicated function I am trying to write, but I run in to a problem when I want to add something to the plot from more than one data set while simultaneously controlling the appearance of the additional layer. # Toy data: foo <- data.frame ( x = 1:4, y = 4:1 , membership = c(