Re: [R] What does class "call" mean? How do I make class "formula" into a "call"?

2011-06-28 Thread Rita Carreira
will attempt a short explanation > > in reply. But I am not (s)he. > > > > Cheers, > > Bert > > > > Oh -- as for specific suggestions, I think you need to do what the > > posting guide asks and provide a minimal reproducible example to give > > peo

[R] What does class "call" mean? How do I make class "formula" into a "call"?

2011-06-24 Thread Rita Carreira
I have a list called "tabs" that I would like to have the same structure as my list "eqSystem." The two look like they have the same format but they are different because when I look at their attributes, class(eqSystem[[1]]) is "call" but class(tabs[[1]]) is "formula". I want to have class(tabs

[R] Loops, Paste, Apply? What is the best way to set up a list of many equations?

2011-06-23 Thread Rita Carreira
Is there a way to apply paste to list(form1 = EQ1, form2 = EQ2, form3 = EQ3, form4 = EQ4) such that I don't have to write form1=EQ1 for all my models (I might have a list of 20 or more)? I also need the EQs to read the formulas associated with them. For example, below, I was able to automate

Re: [R] Help Needed on Merging Columns by Summation

2011-06-22 Thread Rita Carreira
I assume that you are working in package MatrixCalc. Let’s say you have a matrix X. You can call the columns of X this way: X[,1] for the first column X[,2] for the second column X[,3] for the third column Etc. So let’s say that you want to add the first and third column, then you would just

Re: [R] Setting up list of many equations for systemfit

2011-06-22 Thread Rita Carreira
Q4" Fourth attempt:> eqSystem2 <-paste(paste("form", 1:4, sep=""),paste("EQ", 1:4,sep=""), sep="=") eqSystem2 <-as.formula(eqSystem2) eqSystem2 <-as.list(eqSystem2) eqSystem2 RESULT: [[1]] `~` [[2]] Y1 [[3]] X1 + X2 + X4 >

[R] Setting up list of many equations for systemfit

2011-06-21 Thread Rita Carreira
Dear List Members,I am trying to set up a large system of equations and I am trying to find a simple way to set up the list command under the package system fit. Here is the example from system fit and what I am trying to do: EQ1 <- Y1 ~ X1 + X2 + X4EQ2 <- Y2 ~ X2 + X3EQ3 <- Y3 ~ X2 + X3 + X4EQ

[R] Subsetting a data frame by dropping correlated variables

2011-04-19 Thread Rita Carreira
Hello R Users! I have a data frame that has many variables, some with missing observations, and some that are correlated with each other. I would like to subset the data by dropping one of the variables that is correlated with another variable that I will keep int he data frame. Alternatively,

Re: [R] Function for deleting variables with >=50% missing obs from a data frame

2011-04-18 Thread Rita Carreira
with >=50% missing obs from > a data frame > > you could simply modify > > !all(is.na(x)) > > to > > mean(is.na(x))> .6 > > or some such, or invert the logic if I have it backwards. > > .6 was the fraction greater than which we omit the data. >

[R] Function for deleting variables with >=50% missing obs from a data frame

2011-04-15 Thread Rita Carreira
Hello R users! I have several data frames where some of the variables have many missing observations. For example, Q1 in one of my data frames has over 66% of its observations missing. I have tried imputation with mice but it does not work for all the data frames and I get the following message

[R] Overcoming warning in package zoo

2011-04-13 Thread Rita Carreira
Dear R users,I have a long program that I am trying to run--I am using RStudio as my interface with R. The pieces of the program run well individually but when I try to run everything in sequence it bogs down because of a warning after using rollmax from package zoo. Here is the warning: "In ro

[R] Package mice: Error in if (meth[j] != "") { : argument is of length zero

2011-04-08 Thread Rita Carreira
Dear R users, I am using package mice and I am getting the error " Error in if (meth[j] != "") { : argument is of length zero." I have tried using several different versions of R (even the one that will be coming out this month) to no avail. I am using RStudio as my interface with R. Also note t

Re: [R] df with max function applied to 6 lags of a variable?!?

2011-04-07 Thread Rita Carreira
education is expensive, try ignorance"--Derek Bok > From: ggrothendi...@gmail.com > Date: Thu, 7 Apr 2011 15:41:30 -0400 > Subject: Re: [R] df with max function applied to 6 lags of a variable?!? > To: ritacarre...@hotmail.com > CC: r-help@r-project.org > >

Re: [R] df with max function applied to 6 lags of a variable?!?

2011-04-07 Thread Rita Carreira
df with max function applied to 6 lags of a variable?!? > To: ritacarre...@hotmail.com > CC: r-help@r-project.org > > On Thu, Apr 7, 2011 at 2:29 PM, Rita Carreira > wrote: > > > > Hello everyone! > > I have a data frame of 136 variables with 270 observations. I would li

[R] df with max function applied to 6 lags of a variable?!?

2011-04-07 Thread Rita Carreira
Hello everyone! I have a data frame of 136 variables with 270 observations. I would like to create a new data frame such that each element of that data frame contains the maximum value of the 6 prior lags of the initial data frame. So for example, if my original data frame, A, were A1=c(7.72, 7

[R] package MICE, squeeze function, calling several variables at once

2011-04-01 Thread Rita Carreira
Hello everyone!I have a data set with missing observations that I am trying to impute. I am using MICE and I would like the imputed values to all be positive. I have two types of variables: prices (P1 to P136) and quantities (Q1 to Q136) and I also want the range of these two types to be differ

Re: [R] How do I delete multiple blank variables from a data frame?

2011-03-21 Thread Rita Carreira
se. The result is a logical vector the same length as the > > number of columns in d that is used to subset only the d columns with > > at least some non-missing values. For documentation see: > > > > ?apply > > ?is.na > > ?all > > ?"[" > > ?Logic

[R] How do I delete multiple blank variables from a data frame?

2011-03-18 Thread Rita Carreira
Dear List Members,I have 55 data frames, each of which with 272 variables and 267 observations. Some of these variables are blanks but the blanks are not the same for every data frame. I would like to write a procedure in which I import a data frame, see which variables are blank, and delete th

[R] R not working after loading lattice

2011-02-14 Thread Rita Carreira
Hello! Happy Valentine's Day... After I loaded the package lattice in R, it did not work. Then when I closed R and restarted it, R started with an error message and here is the feedback that I got from the R Console: Loading required package: Hmisc Loading required package: survival Loading re

[R] Loop in variable names

2011-02-09 Thread Rita Carreira
Hello! I would like to do some tables for several variables and I would like to write a loop that does the table for each variable. I should also point out that my data set has several missing observations and sometimes the observations that are missing are not the same for all my variables.