[R] Reading data file with both fixed and tab-delimited fields

2010-03-02 Thread Marshall Feldman
Hello R wizards, What is the best way to read a data file containing both fixed-width and tab-delimited files? (More detail follows.) _*Details:*_ The U.S. Bureau of Labor Statistics provides local area unemployment statistics at ftp://ftp.bls.gov/pub/time.series/la/, and the data are document

Re: [R] Reading data file with both fixed and tab-delimited fields

2010-03-02 Thread Marshall Feldman
\8,\9/' | less > > and see if the output is alright and use the resulting .csv file > directly in R using read.csv > > If that does not satisfy you maybe the R Wizards on the list might be > able to point you to a > native R way of doing this possibly using scan?

[R] Do colClasses in readHTMLTable (XML Package) work?

2010-03-17 Thread Marshall Feldman
Hi, I can't get the colClasses option to work in the readHTMLTable function of the XML package. Here's a code fragment: require("XML") doc <- "http://www.nber.org/cycles/cyclesmain.html"; table <- getNodeSet(htmlParse(doc),"//table") [[2]]# The main table is the second on

[R] Substitute NAs in a data frame

2010-03-18 Thread Marshall Feldman
Excuse me for what I'm sure is a stupid beginner's question, but I've given up trying to find the answer to this question from the help, RSiteSearch, or any of the usual places. I have a list that looks like this: >myList $first [1] "--" "18" "8" "32" $second [1] "--" "--" "40" "54" I want a

[R] How to handle missing value as first item in yearmon (zoo package)

2010-03-19 Thread Marshall Feldman
Hi, Some time series have missing values in the time index. For example historical data on business cycles will typically date them from peak to trough, but some information may be missing. In most cases, this does not cause trouble, but if the first date is missing (e.g., we know the date of

[R] Preserving both yearmon and numeric data in an xls object

2010-03-28 Thread Marshall Feldman
Hi R gourmets, I am trying to convert an HTML table into an xts object. The table has six columns, with the data of interest in a single row with each cell containing a long, \n-delimited character string. Initially, I work with these strings as elements in a list. This is necessary because the

[R] Plots don't update with xlab, etc. What am I doing wrong.

2010-04-02 Thread Marshall Feldman
Hi, I've been struggling with this problem the last few days and finally discovered it's happening at a very fundamental level. Going through Stephen Turner's tutorial on ggplot2, I entered these base graphics commands: > with(diamonds, plot(carat,price)) > with(diamonds, plot(carat,

[R] ggplot2 geom_rect(): What am I missing here

2010-04-04 Thread Marshall Feldman
Hi R fans, As a newbie following the five-hour rule (after hitting my head against the wall for five hours, post to this list), I am appealing for some help understanding geom_rect() in ggplot2. What I want to do is very simple. I want to generate a plot of rectangles. Each one represents a bu

[R] ggplot2 geom_rect(): What am I missing here

2010-04-05 Thread Marshall Feldman
Thanks to David Winsemius, Peter Ehlers, and Paul Murrell who pointed out my careless error working with ggplot2's geom_rect(). Not to make excuses, but when you've done something successfully dozens of times and suddenly it doesn't work, you're more likely to look for careless errors on your p

[R] Combining ggplot2 objects and/or extracting layers

2010-04-09 Thread Marshall Feldman
Hi, Other then rebuilding the plots, is there any way either (1) to combine existing ggplot2 plots or (2) to extract a layer from an existing plot so that it can be added to another? Thanks. -- Dr. Marshall Feldman, PhD Director of Research and Academic Affairs Center for Urban Studies

[R] Beyond reshape: automatically streamlining data

2010-04-09 Thread Marshall Feldman
Hello, I've been very impressed by the reshape package and how easy it makes reorganizing statistical data structures. This makes me wonder if there's another package out there that addresses another set of tasks that one often does when preparing data for analysis. For any particular set of

Re: [R] Combining ggplot2 objects and/or extracting layers

2010-04-09 Thread Marshall Feldman
Hi Hadley, Thanks for the terrific package! If you'd like I could give you my code, but conceptually what I'm trying to do is pretty simple. The chart on this page

[R] Identifying names of matrix columns shared by many matrices

2010-04-19 Thread Marshall Feldman
Greetings R-Geniuses, What is the most efficient way to handle the problem described below? Thanks Marsh Feldman Problem description: Each U.S. state has its own matrix. The rows are dates, the columns are industries, and each cell contains total statewide employment at the given time a

Re: [R] Upgrading R using the "global library folder" strategy -, what do you think about it?

2010-04-26 Thread Marshall Feldman
On 4/25/2010 19:39:52, Tal Galili wrote: *c) R core implementation ?!* I hope I am not being rude (or jumping into any open doors) in asking this but... What do you think about implementing this strategy into the R basic installation? Tal, As a general rule, I think R should make upgradi

Re: [R] R-help Digest, Vol 86, Issue 28

2010-04-27 Thread Marshall Feldman
On 4/26/10 21:45:55 R P Herrold wrote: Date: Mon, 26 Apr 2010 21:45:55 -0400 (EDT) From: R P Herrold To: Marshall Feldman Cc:r-help@r-project.org Subject: [R] Upgrading R using the "global library folder" strategy -, what do you think about it? Message-ID: Content-Type:

[R] Multiple methods in models

2010-05-03 Thread Marshall Feldman
Hi, The model specification formula language introduced in Chambers and Hastie potentially handles rather complex models. Typically the user specifies the model and in a separate argument specifies the method. For example, one specifies a general linear model with glm(formula,family). But wit

[R] Hierarchical factors

2010-05-03 Thread Marshall Feldman
Hello, Hierarchical factors are a very common data structure. For instance, one might have municipalities within states within countries within continents. Other examples include occupational codes, biological species, software types (R within statistical software within analytical software),

Re: [R] Hierarchical factors

2010-05-03 Thread Marshall Feldman
arshell, > What exactly do you mean by "handles this kind of data structure"? > What do you want R to do? > > Best, > Ista > > On Mon, May 3, 2010 at 9:44 AM, Marshall Feldman wrote: > >> Hello, >> >> Hierarchical factors are a very common

[R] Accessing remote data (ftp) over the net

2009-11-24 Thread Marshall Feldman
Hi, Is there any way to access data remotely over the Internet? In particular, I'm starting a project that will use data from the U.S. Bureau of Labor Statistics. The Bureau regularly updates various data series and publishes them as a series of flat files that can be downloaded via ftp (e.g.

Re: [R] SAS "datalines" or "cards" statement equivalent in R?

2009-12-07 Thread Marshall Feldman
Regarding the various methods people have suggested, what if a typical tab-delimited data line looks like: SMS11001 1990 M01 688.0 and the SAS INPUT statement is INPUT survey $ 1-2 seasonal $ 3 state $ 4-5 area $ 6-10 supersector $ 11-12 @13 industry $8. datatype $ 21-22

Re: [R] SAS "datalines" or "cards" statement equivalent in R?

2009-12-07 Thread Marshall Feldman
Barry Rowlingson wrote: > On Mon, Dec 7, 2009 at 3:53 PM, Marshall Feldman wrote: > >> Regarding the various methods people have suggested, what if a typical >> tab-delimited data line looks like: >> >> SMS11001 1990 M01 688.0 >> >> and the SA

Re: [R] SAS "datalines" or "cards" statement equivalent in R?

2009-12-07 Thread Marshall Feldman
Barry Rowlingson wrote: I'd love to duplicate this functionality of SAS, however, I fear: http://www.sas.com/news/preleases/SASsuit.html Amazing, since input statements in SAS bear an uncanny resemblance to how PL/I handles input from text files. _

Re: [R] Access web content from within R

2010-07-16 Thread Marshall Feldman
On 7/16/2010 6:00 AM, r-help-requ...@r-project.org wrote: Message: 5 Date: Thu, 15 Jul 2010 03:36:21 -0700 (PDT) From: Bart Joosen To:r-help@r-project.org Subject: [R] Access web content from within R Message-ID:<1279190181074-2289953.p...@n4.nabble.com> Content-Type: text/plain; charset=us-ascii

Re: [R] Historical Libor Rates

2010-07-20 Thread Marshall Feldman
a website that holds all this data...I only need up to > january of 2000. > > Also, how can we make the row names the index of a plot (the names of the x > values)? > > [[alternative HTML version deleted]] > -- Dr. Marshall Feldman, PhD Director of Research an

Re: [R] Historical Libor Rates

2010-07-20 Thread Marshall Feldman
w to download historical LIBOR rates of different > currencies into R? > > Or if anyone knows of a website that holds all this data...I only need up to > january of 2000. > > Also, how can we make the row names the index of a plot (the names of th

Re: [R] how to generate a random data from a empirical, distribition

2010-07-27 Thread Marshall Feldman
esponds to one of the mathematically studied distributions, why not fit a curve to a plot of your data points and see if it looks familiar? Then do some kind of goodness-of-fit test to see if the theoretical distribution is a reasonable approximation. -- Dr. Marshall Feldman, PhD Director of Res

[R] read.table: skipping trailing delimiters

2010-05-04 Thread Marshall Feldman
Hi, I am trying to read a tab-delimited file that has trailing tab delimiters. It's a simple file with two legitimate fields. I'm using the first as row.names, and the second should be the only column in the resulting data frame. Initially, R was filling the last column with NA's, but I was

[R] Flushing print buffer

2010-05-04 Thread Marshall Feldman
Hello, I have a function with these lines: test <- function(object,...){ cat("object: has ",nrow(object),"labels\n") cat("Head:\n") head(object,...) cat("\nTail:\n") tail(object,...) } If I feed it a data frame object, it only prints ou

Re: [R] concatenate values of two columns

2010-05-05 Thread Marshall Feldman
On 5/5/2010 6:00 AM, n.via...@libero.it wrote: Dear list, I'm trying to concatenate the values of two columns but im not able to do it: i have a dataframe with the following two columns: X VAR1 VAR2 1 2 2 1 3

Re: [R] Hierarchical factors

2010-05-05 Thread Marshall Feldman
hereas conceptually the On 5/4/2010 6:00 AM, > Message: 49 Date: Mon, 3 May 2010 13:22:59 -0400 From: Ista Zahn > To: Marshall Feldman Cc: > r-help@r-project.org Subject: Re: [R] Hierarchical factors Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 Hi Marshall, I&

Re: [R] Hierarchical factors

2010-05-06 Thread Marshall Feldman
On 5/5/10 [May 5, 10] 11:29 PM, David Winsemius wrote: I think you are perhaps unintentionally obscuring two issues. One is whether R might have the statistical functions to deal with such an arrangement, and here "mixed models" would be the phrase you ought to be watching for, while the other

Re: [R] How to re-arrange data in R

2010-05-07 Thread Marshall Feldman
gt; Nanjing University of Information, Science and Technology > Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China > Tel: +86-25-58731402 > Fax: +86-25-58731456 > Mob. 15077895632 > Website:www.nuist.edu.cn > -- Dr. Marshall Feldman, PhD Director of Research and

Re: [R] Data Frame as Hash Table

2010-05-30 Thread Marshall Feldman
Besides data.table, there's the hash package. It does not use data.frame type structures but is a bit more flexible. Marsh Feldman On 5/30/10 [May 30, 10] 6:00 AM, r-help-requ...@r-project.org wrote: Message: 40 Date: Sun, 30 May 2010 09:24:22 +0100 From: Patrick Burns To:r-help@r-project.org,