Re: [R] stripping #s in a text file prior to reading into table or dataframe

2010-10-27 Thread Donald Braman
read.delim2 did the trick -- many thanks!!! On Wed, Oct 27, 2010 at 10:01 AM, Jorge Ivan Velez wrote: > ?read.delim2 > > HTH, > Jorge > > > On Wed, Oct 27, 2010 at 9:51 AM, Donald Braman wrote: > >> Thanks for your advice! I still get the same er

Re: [R] stripping #s in a text file prior to reading into table or dataframe

2010-10-27 Thread Donald Braman
more columns than column names Any other thoughts? -- Donald Braman http://ssrn.com/author=286206 http://www.culturalcognition.net/braman/ http://www.law.gwu.edu/Faculty/profile.aspx?id=10123 Henrique Dallazuanna Tue, 26 Oct 2010 09:11:33 -0700 Try this: read.table('don.5.clusters.txt'

Re: [R] stripping #s in a text file prior to reading into table or dataframe

2010-10-26 Thread Donald Braman
x27;t get that error. On Tue, Oct 26, 2010 at 10:49 AM, Duncan Murdoch wrote: > On 26/10/2010 10:33 AM, Donald Braman wrote: > >> I'm importing a lot of text tables of data (from Latent Gold) that >> includes >> hashes in some of the column names ("Cluster#1&

[R] stripping #s in a text file prior to reading into table or dataframe

2010-10-26 Thread Donald Braman
I'm importing a lot of text tables of data (from Latent Gold) that includes hashes in some of the column names ("Cluster#1", "Cluster#2", etc.). Is there an easy way to strip the offending hashes out before pushing the text into a table or data frame? I thought I'd use gsub, e.g., but can't figur

[R] dirichlet models

2010-09-05 Thread Donald Braman
Does anyone know of a package (or workaround) for fitting a dirichlet distribution by maximum likelihood? (I'm looking for something like this: http://repec.org/bocode/d/dirifit.html, that allows for both dependent variables summing to 1 & predictive variables of any sort.) Don -

[R] latent class analysis with mixed variable types

2010-07-23 Thread Donald Braman
As an alternative to Latent GOLD, I'm wondering if anyone knows of and R package that can manage Latent Class Analysis with mixed variable types (continuous, ordinal, and nominal/binary). [[alternative HTML version deleted]] __ R-help@r-project.

Re: [R] repeating values in levels()

2009-10-19 Thread Donald Braman
Thanks! I've figured out how to fix it, but how I got here is still a puzzle. :-) Cheers, Don On Sat, Oct 17, 2009 at 5:36 PM, Peter Ehlers wrote: > > Donald Braman wrote: > >> Can someone help me understand this results? >> >> levels(as.factor(miset1$facts

[R] repeating values in levels()

2009-10-17 Thread Donald Braman
Can someone help me understand this results? > levels(as.factor(miset1$facts_convict)) [1] "1" "1" "2" "3" "4" "5" "6" converting to numeric and back doesn't seem to help: > levels(as.factor(as.numeric(miset1$facts_convict))) [1] "1" "1" "2" "3" "4" "5" "6" It's messing up my ologits.  Any way

[R] standard error associated with correlation coefficient

2009-08-27 Thread Donald Braman
I want the standard error associated with a correlation. I can calculate using cor & var, but am wondering if there are libraries that already provide this function. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list http

[R] simple graph question: manipulating variable names

2009-08-25 Thread Donald Braman
;anotherdv", "yetanotherdv") for (iv in ivs) { for (dv in dvs) { graphname <- paste(iv, dv, ".png", sep = "") png(file=graphname, width=300, height=300) plot(dv ~ iv, pch=".") lines(loess.smooth(iv, dv), lty=1) dev.off() } } Clearly that doesn't wor

Re: [R] lowess puzzle

2009-08-06 Thread Donald Braman
Resolved. It works if I set iter=0. On Thu, Aug 6, 2009 at 9:03 PM, Donald Braman wrote: > I was trying to fit a curve to the number of people who identify as liberal > by age. I got some puzzling results which suggested to me that I don't > really understand how local poly

[R] lowess puzzle

2009-08-06 Thread Donald Braman
I am trying to fit a curve to the number of people who identify as liberal by age. I got some puzzling results which suggested to me that I don't really understand how local polynomial fitting works. Why, I am wondering, is lowess producing a local fit of zero for every age? > liberal [1] 0 0 0

[R] lowess puzzle

2009-08-06 Thread Donald Braman
I was trying to fit a curve to the number of people who identify as liberal by age. I got some puzzling results which suggested to me that I don't really understand how local polynomial fitting works. Why, I am wondering, is lowess producing a local fit of zero for every age? > liberal.bin [1]

[R] recoding strings containing colons

2009-07-08 Thread Donald Braman
Curious to know if recode can work with strings containing colons. I haven't gotten it to work yet, but perhaps there is a way? Donald Braman http://www.culturalcognition.com/braman/ __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

[R] mapping states with colors

2009-07-02 Thread Donald Braman
#x27;, 'florida', 'georgia', 'idaho' , 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana', 'maine' , 'michigan', 'mississippi', 'montana', 'nevada

Re: [R] newbie query: simple crosstabs

2009-04-07 Thread Donald Braman
Thanks for the help everyone! I'm new to vectors, and don't quite get it. This works for me: binary.vars <- c("q1", "q2", "q3", ...) apply(mydata[binary.vars], 2, tapply, mydata["male"], mean) but this doesn't: other.vars <- c("male", "race", "religion") apply(mydata[other.binary.vars], 2, ta

[R] newbie query: simple crosstabs

2009-04-07 Thread Donald Braman
I've been playing around with various table tools, trying to construct a fairly simple cross-tab. It shouldn't be hard, but for some reason it turning out to be (for me). If I want to see how many men and how many women agree with a agree/disagree question (coded 1,0), I can do this: >attach(myd

[R] inverting a table

2009-04-05 Thread Donald Braman
Is there an easy way to invert a table? (not to solve for the inverted matrix, just swap rows for columns & vice versa). I've gone through my data manipulation bible (Phil Spector's book), but to no avail. [[alternative HTML version deleted]]

Re: [R] quantile / centile

2008-09-27 Thread Donald Braman
rique Dallazuanna <[EMAIL PROTECTED]>wrote: > Try this: > > my.df$my.newvar <- quantile(my.df$my.var, probs = seq(0.01,1, 0.01)) > > > On Sat, Sep 27, 2008 at 3:50 AM, Donald Braman <[EMAIL PROTECTED]> > wrote: > > I'm wondering if there is a simple way to assig

[R] quantile / centile

2008-09-26 Thread Donald Braman
I'm wondering if there is a simple way to assign a quantile to a vector in a data frame, much like one could in Stata using centile. Let's say I want 100 slices in my assignation. I can easily see what the limits of each slice by using quantile: quantile(my.df$my.var, probs=seq(0, 1, 0.01)) But ho

[R] sem & testing multiple hypotheses with BIC

2008-07-15 Thread Donald Braman
I'm coming from the AMOS world and am wondering if there is a simple way to do multiple hypothesis testing in the manner of BIC analyses in AMOS using the sem package in R. I've read the documentation, but don't see anything in there except for basic BIC scores. Perhaps someone has devised a simp

Re: [R] two newbie questions

2008-06-22 Thread Donald Braman
ons > invisible(apply(xpnd, 1, function(.row) { > jpeg(paste(paste(.row, collapse="_"),".jpg", sep='')) > > my.fit <- lm( my.df[[.row[1]]] ~ my.df[[.row[2]]] + my.df[[.row[3]]] + >my.df[[.row[2]]]:my.df[[.row[3]]]) > colors <- ifel

[R] two newbie questions

2008-06-22 Thread Donald Braman
ot;.") curve (cbind (1, 1, x, 1*x) %*% coef(my.fit), add=TRUE, col="black") curve (cbind (1, 0, x, 0*x) %*% coef(my.fit), add=TRUE, col="gray") }) dev.off() } } } # Clearly that's wrong -- why it's wrong is obsc

[R] imputationlist, update, and recode

2008-05-29 Thread Donald Braman
I'm stumbling my way through manipulating data in multiply imputed datasets, and have run into a problem translating code I used to run on my pre-imputed dataset to multiple datasets. The imputation runs just fine, as does the reading of the mi data sets into an imputationList. I run into trouble

Re: [R] manipulating multiply imputed data sets

2008-05-28 Thread Donald Braman
--- snip --- > > I hope this helps, > John > > ------ > John Fox, Professor > Department of Sociology > McMaster University > Hamilton, Ontario, Canada > web: socserv.mcmaster.ca/jfox > >> -Original Message- &g

[R] manipulating multiply imputed data sets

2008-05-28 Thread Donald Braman
)) I've also tried some basic loops. I guess I'm also a bit confused as to when R references the original object and when it creates a new one. I suppose I could do this in Python and the use PyR, but I'd really like to learn a bit more about how R syntax. Any help on this specif

Re: [R] recoding data with loops

2008-05-19 Thread Donald Braman
code x, in a > similar way to what you tried before. This function of x we define will get > called three times in the above example, once for each of > reverse_me_varnames. It will then assign those three new columns to the > left-hand side of the <- operator, which are three n

Re: [R] recoding data with loops

2008-05-19 Thread Donald Braman
7;, as.factor.result=FALSE) While I don't get an error message, the data don't change. Any advice on reverse coding non-continguous variables? On Mon, May 19, 2008 at 4:12 PM, Donald Braman <[EMAIL PROTECTED]> wrote: > Many thanks -- > > You are right; I had

Re: [R] recoding data with loops

2008-05-19 Thread Donald Braman
Many thanks -- You are right; I had rnorm() and sample() mixed up in my code. I'll work on generating a normal ordinal sample next. Cheers, Don On Mon, May 19, 2008 at 4:07 PM, Erik Iverson <[EMAIL PROTECTED]> wrote: > Hello - > > Donald Braman wrote: > >> # I&#x

Re: [R] recoding data with loops

2008-05-19 Thread Donald Braman
esources listed on CRAN. > > -- Bert gunter > Genentech > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On > Behalf Of Donald Braman > Sent: Monday, May 19, 2008 12:42 PM > To: r-help@r-project.org > Subject: [R] recoding data with

[R] recoding data with loops

2008-05-19 Thread Donald Braman
# I'm new to R and am trying to get the hang of how it handles # dataframes & loops. If anyone can help me with some simple tasks, # I'd be much obliged. # First, i'd like to generate some random data in a dataframe # to efficiently illustrate what I'm up to. # let's say I have six variables as li