Displaying 20 results from an estimated 10000 matches similar to: "creating files using for loop"
2006 Apr 07
4
saving estimates from a for loop for later use
Thanks to the help of many on this list, I am now an R user and have
been able to write some functioning code to do matching estimation.
I have two for loops (i in 1:3, and j in 0:2). Within the loops, I
had been creating matrices of relevant estimation coefficents in order
to make lots of LaTeX tables.
Well, now I want to be able to combine the results of many different
estimations from within
2006 Apr 05
2
using latex() in R for Unix
I am using R for Unix and want to make some LaTeX tables. I have
already played around in R for Windows and have succeeded in making
tables that I want using the following code:
latex(Estimates, file='out.tex', rowlabel='',digits=3)
However, when I use this code in Unix, I can never find the file
"out.tex". I assumed that R would send the file to whatever directory
I
2006 Apr 14
2
another very simple loop question
I have a dataset with 4 years of students, and normally I want to
estimate things using each individual year, so I have a for loop as
follows
for (i in 1:4){}
However, the only way I know how to calculate estimates using all four
years of data is to put the estimations outside of the loop. Is there
anyway to make a for loop that uses all four years at once, then uses
each individual year?
2006 Apr 11
3
problems with rounding in output
Perhaps someone will have a solution to my more general problem, but
here is the specific one:
I used the round() function to round some estimates to 3 decimal
places. I then sent put the rounded estimates in a matrix and used
latex() to make a LaTeX table from them. However, in my table, there
are estimtes which only have 2 decimal places. I assume that the third
decimal place in these numbers
2006 Apr 02
1
New R user looking from help
Dear R users,
I am trying to become a convert to R (from Stata), and I'm having some
growing pains. Is there anyone would be willing to answer a few basic
questions I have? Of course I am using the relevant help guides...
Thanks,
Brian Quinif
ps. If there is anyone at UGA on this list, I'd love to hear from someone local.
2006 May 01
2
problem installing Econometrics view
When I try to install hte Econometrics view I get the following error:
CRAN task view Econometrics not available in: install.views("Econometrics")
I have already install the ctv package and loaded it before trying to
install the above...
Any ideas as to what's going on?
2010 Feb 26
3
Preserving lists in a function
Dear R users,
A co-worker and I are writing a function to facilitate graph plotting in R. The function makes use of a lot of lists in its defaults.
However, we discovered that R does not necessarily preserve the defaults if we were to input them in the form of list() when initializing the function. For example, if you feed the function codes below into R:
myfunction=function(
list1=list
2006 Apr 04
1
generating LaTeX tables from Match output
Dear R users,
I am using the Match function to generate nearest neighbor matching
estimators. On that front I am ok, but where I am having problems is
getting my output into nice LaTeX tables.
Here is some basic code imitating the estimation I'm doing. No problem there.
library(Matching)
#make up some data
X1 <- matrix(rnorm(1000*5), ncol=5)
Y1 <- as.vector(rnorm(1000))
Tr1 <-
2006 Apr 07
3
strange matrix behaviour: is there a matrix with one row?
Consider this:
> y <- matrix(1:8, ncol=2)
> is.matrix(y[-c(1,2),])
[1] TRUE
> is.matrix(y[-c(1,2,3),])
[1] FALSE
> is.matrix(y[-c(1,2,3,4),])
[1] TRUE
It seems like an inconsistent behaviour:
- with 2 or more rows we have a matrix
- with 1 row we do not have a matrix and
- with 0 rows we have a matrix again
I just stumbled on this behaviour, because I had a problem
with my
2009 Jul 30
3
What is the best method to produce means by categorical factors?
I am attempting to replicate some of my experience from SAS in R and assume
there are best methods for using a combination of summary(), subset, and
which() to produce a subset of mean values by categorical or ordinal
factors.
within sas I would write
proc means mean data=dataset;
class factor1 factor2
var variable1 variable2;
RUN;
producing an output with means for each variable by factor
2010 Jan 30
2
drawing a line that shifts from solid to broken
I am graphing longitudinal data from three time points. I'd like to draw a
solid line from point 1 to point 2, and then a dashed line from point 2 to
point 3. It works if I do it in two steps:
> first.vector <- c(mean(year1$variable1), mean(year2$variable1))
> second.vector <- c(NA, mean(year2$variable1), mean(year3$variable1))
> plot(first.vector, type="b",
2012 Jan 02
4
Create variable with AND IF statement
Hello,
I'm using SPSS at work but really would like to switch to R. Right now I'm
trying to learn R in reproducing calculations I did with SPSS but am stuck
with something that is quite simple and comprehensible in SPSS-Syntax:
IF (variable1.fac = 0 AND variable2.num = 0) variable3=1.
IF (variable1.fac = 0 AND variable2.num >= 1) variable3=2.
IF (variable1.fac = 1 AND variable2.num =
2006 Jul 03
1
analogue of group option of SAS MIXED/random in R
Dear list,
I am trying to use lme to build the analogue of the following SAS MIXED
random specification:
random int+Variable1+Variable2 /subject = Subject group=Condition type=vc;
which gives a Condition-blocked heterogeneity in the random effects
variance-covariance matrix.
Needless to say, I have a hard time in specifying Condition-specific
heterogeneities in the variance-covariance
2009 Mar 24
2
Calculating percentage Missing value for variables using one object
Hi,
I have a dataset in which there are in all 250 variables and for each
variable the data is entered over the months.
I need to calculate the percentage of missing values for each variable over
each month and then plot a graph for that.
I am running the following code for doing the same
*ds <- read.csv(file="filepath", header=TRUE)
attach(ds)
may <-
2006 Apr 07
1
Referencing variables in a dataframe.
I have a question about how to reference variables in a dataframe.
Normally, after I have read in some Stata data using the following command
all <- read.dta('all.dta')
Whenever I want to use the variable "sat.vr1" in the "all" data frame,
I do so using
all$sat.vr1
However, I'd like to be able to use the sat.vr1 variable without the
"all$" (as well
2011 Apr 18
4
altering identity column
Hi there,
I have a huge dataframe containing 70,000 observations.
I have filtered this dataframe (let it's name be "transformed_dataframe") as I wanted to select only those observations which are greater than or equal to 60,001 regarding the very first identity column.
So I have a transformed dataframe now including 10,000 obeservations (from 60,001 - to 70,000) and if you send
2009 Dec 04
2
Multiple Channel Variables with AMI Originate
Hi guys I seem to be having a problem, I don't know if it's a bug or whether
I'm just doing it incorrectly.
I want to set about 3 channel variables when I originate a call via AMI.
All the documentation I have found says to do it like this:
Variable: variable1=value|variable2=value|variable3=value
However when I do this it runs them all together and I end up with:
2012 Jul 05
4
Exclude missing values on only 1 variable
Hello,
I have many hundred variables in my longitudinal dataset and lots of
missings. In order to plot data I need to remove missings.
If I do
> data <- na.omit(data)
that will reduce my dataset to 2% of its original size ;)
So I only need to listwise delete missings on 3 variables (the ones I am
plotting).
data$variable1 <-na.omit(data$variable1)
does not work.
Thank you
2009 Jan 29
1
Multiple tables
Dear list,
I have a set of 100+ variables. I would like to have one by one crosstables for each variable. I started with
table(variable1, variable2)
table(variable1, variable3)
table(variable1, variable4)
...
table(variable2, variable3)
table(variable2, variable4)
...
It seems rather tedious.
Any better ideas around?
Thanks for any help!
Gerit
--
NUR NOCH BIS 31.01.! GMX FreeDSL -
2008 Aug 04
1
subset inside a lattice plot using panel.lines
Hi R people
Pulling my hair out here trying to get something very simple to work.
Have a data frame of 774 rows and want to plot first and second half
on same axes with different colours. A variable is present call 'row'
created like this and checked to be OK:
row <- seq( len=length( variable1 ) )
...so I just want to plot the two subsets where row <= 387 and where
row