[R] Histogram with uneven bins

2007-04-19 Thread mtb954
Hi R-helpers I would like to produce a histogram with uneven bins (e.g., 0, 1-2, 3-5, 6-10, 10-20, 20) but I would like the resulting bars to be the same width ( i.e., a bar's width would not be proportional to its corresponding bin size). Also, the x and y axes of my histograms frequently

[R] Histograms of lots of variables

2007-04-16 Thread mtb954
Hi R-helpers, I wish to produce frequency histograms of all of the variables in my dataframe (except some identifying variables). I have tried hist(dataframe[,3:20]) to produce histograms of the 3rd through 20th variables in my dataframe, but R doesn't like that. Could anyone provide a

Re: [R] Histograms of lots of variables

2007-04-16 Thread mtb954
Hi Jim, thanks for your help. That looks like it might work, but a couple of things... 1) The resulting 73 (in my case) histograms will be named by their variable number, not by the variable name contained in the first row. Any way to include the variable name in the resulting histogram? 2) How

Re: [R] Histograms of lots of variables

2007-04-16 Thread mtb954
Thanks again Jim, I appreciate your time. I've been trying to debug the code, but am running into a wall. I'm getting a syntax error after the line containing the hist function. Here's the R session, any ideas? Also, I'd like to be able to have each histogram use the same x-axis breaks (0, 1,

[R] How to drop variables using a wildcard and logic...

2007-03-26 Thread mtb954
Dear R users I would like to make a new dataframe from an existing dataframe, retaining ONLY those variables that end in the letter t I have searched the help archives and consulted several reference books but cannot seem to find an example. Any ideas...? Thanks! Mark [[alternative

Re: [R] How to drop variables using a wildcard and logic...

2007-03-26 Thread mtb954
Thanks Phil and Benilton! Mark On 3/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R users I would like to make a new dataframe from an existing dataframe, retaining ONLY those variables that end in the letter t I have searched the help archives and consulted several reference

[R] Sorting a dataframe by one column?

2006-02-24 Thread mtb954 mtb954
Given the following dataframe: A=1:10 B=(a-5)^2 DATAFRAME=data.frame(A,B) How can I sort DATAFRAME increasing (or decreasing, for that matter) by B without making reference to A, or any other column? I've read ?order and ?sort but cannot seem to figure this out. Thank you. Mark

[R] Sorting alphanumerically

2006-02-24 Thread mtb954 mtb954
I'm trying to sort a DATAFRAME by a column ID that contains alphanumeric data. Specifically,ID contains integers all preceeded by the character g as in: g1, g6, g3, g19, g100, g2, g39 I am using the following code: DATAFRAME=DATAFRAME[order(DATAFRAME1$ID),] and was hoping it would sort the

[R] Read SAS .sd2 file into R?

2006-02-24 Thread mtb954 mtb954
Does anyone know how to import a SAS .sd2 file into R? I can't see anything in library(foreign). Thank you. Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

[R] Merge dataframes with no shared rows, some shared and some unshared columns

2006-02-22 Thread mtb954
Dear R-users, I have two dataframes FIRST and SECOND that do not share any rows (i.e., there is no unique identifier linking the rows in the two dataframes, the rows are independent). The dataframes have three variables (in columns) in common, but each dataframe also has some variables not

[R] How to select only certain rows when making a new dataframe?

2006-02-21 Thread mtb954
Dear R-users, I have two data frames. The FIRST data frame has 100 rows, the SECOND data frame has only 50 rows. The data frames have different variables in columns (VAR1, VAR2, etc) but they share a column called ID that contains a unique identifer linking the two data frames. I would like to

[R] glob2rx function not working

2006-02-20 Thread mtb954
Dear R users, Inspired by previous list discussion of the glob2rxc function, I am attempting to create a new vector called TOTAL by summing all vectors whose names begin with ABC: TOTAL = sum(list = ls(pattern = glob2rx(ABC*))) I'm running R 2.2.1 on Windows XP. Can anyone say what I'm missing?

[R] How to sum values across multiple variables using a wildcard?

2006-02-20 Thread mtb954
I have a dataframe called data with 5 records (in rows) each of which has been scored on each of many variables (in columns). Five of the variables are named var1, var2, var3, var4, var5 using headers. The other variables are named using other conventions. I can create a new variable called var6

Re: [R] How to sum values across multiple variables using a wildcard?

2006-02-20 Thread mtb954
Thanks Gabor, Simon and Marc...I got this to work with the grep() and rowSums examples you provided. Mark On 2/20/06, Marc Schwartz [EMAIL PROTECTED] wrote: On Mon, 2006-02-20 at 18:41 -0600, [EMAIL PROTECTED] wrote: I have a dataframe called data with 5 records (in rows) each of which

[R] Graphics window always overlaps console window!

2005-10-25 Thread mtb954
Does anyone know how I can set up R so that when I make a graphic, the graphics window remains behind the console window? It's annoying to have to reach for the mouse every time I want to type another line of code (e.g., to add another line to the plot). Thanks.

Re: [R] Graphics window always overlaps console window!

2005-10-25 Thread mtb954
Thanks for your replies, I was unaware of these solutions. On 10/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Does anyone know how I can set up R so that when I make a graphic, the graphics window remains behind the console window? It's annoying to have to reach for the mouse every time I

[R] Plotting more than one series on the same graph

2005-10-19 Thread mtb954
I'm new to R and have searched for help and consulted the the pdf manuals, but I can't seem to figure out how to plot more than one series on the same graph. I've tried using multiple par(new=TRUE) statements such as plot(series1, ci.type=line, col=red, lwd=2, ci.lty=0, ci.col=red) par(new=TRUE)