Displaying 20 results from an estimated 2000 matches similar to: ""Types" of missingness"
2010 Jul 19
3
Indexing by logical vectors
Dear R-Listers,
My question concerns indexing vectors by logical vectors that are based
on the original vector. Consider the following simple example to
hopefully make clear what I mean:
a <- rnorm(10)
a[a<0] <- NA
However, I am now working with multiple data frames that I received,
where each of them has nicely descriptive, yet long names(). In my
scripts there are many instances
2010 Apr 16
3
VERY SIMPLE QUESTION
Dear R users,
I am looking for more efficient way to compute the followings
--------------------------------------------------------------------------
a <- matrix(c(1,1,1,1,2,2,2,2),4,2)
b <- matrix(c(1,2,3,4),4,1)
Eventually, I want to get this matrix, `c`.
c <- matrix(c(1/1,1/2,1/3,1/4,2/1,2/2,2/3,2/4),4,2)
--------------------------------------------------------------------------
2010 Feb 22
3
gsub patterns from vector elements w/out loop?
Dear list,
I have two vectors:
x <- c("one","two")
y <- paste(rep(x,2),"blah")
I want to replace all occurrences of each element of x in y with
something else, so that y looks like this:
y
[1] "something else blah" "something else blah" "something else blah"
[4] "something else blah"
I can do this using a loop:
for (
2011 Feb 02
1
set digits in xtable by row
Hello R-listers,
I am using xtable to create some LaTeX tables for me to Sweave into my
document. I am now trying to set the number of digits that will be
reported in several _rows_ in my table.
The 'digits' option in xtable() sets the number of digits to display for
specified columns. Am I missing another obvious option to do the same
thing for rows? A quick RSiteSearch didn't turn
2009 Oct 31
1
Help me improving my code
Hi,
I am new to R. My problem is with the ordered logistic model. Here is my
question:
Generate an order discrete variable using the variable
wrwage1 = wages in first full calendar quarter after benefit application
in the following way:
*
wage*1*Ordered *=
1 *if*0 *· wrwage*1 *< *1000
2 *if*1000 *· wrwage*1 *< *2000
3 *if*2000 *· wrwage*1 *< *3000
4 *if*3000 *· wrwage*1 *<
2010 Sep 14
2
Multiple CPU HowTo in Linux?
Hello all,
I upgraded my R workstation, and to my dismay, only one core appears to
be used during intensive computation of a bioconductor function.
What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I
fully load it, top reports about 25% user, 75% idle and 0.98 short-term
load.
The archives gave nothing helpful besides mention of snow. I thought of
posting to HPC, but this system
2005 Aug 13
1
How to make a lagged variable in panel data?
Suppose we observe N individuals, for each of which we have a
time-series. How do we correctly create a lagged value of the
time-series variable?
As an example, suppose I create:
A <- data.frame(year=rep(c(1980:1984),3),
person= factor(sort(rep(1:3,5))),
wage=c(rnorm(15)))
> A
year person wage
1 1980 1 0.17923212
2 1981
2010 Sep 01
5
[semi-OT] Using fortune() in an email signature
Hello, As you can see from my signature in this message, I use the R
fortune function to generate a fortune, which is then fed to the
signature program, which constructs a named pipe containing the
fortune-bearing sig, which is then included in mail messages. The
problem is that it's got extraneous junk in it and I can't figure out
how to get rid of it. This is the command that generates
2012 Dec 01
1
reading json tables
I'm trying to read two data sets in json format from a single .js file.
I've tried fromJSON()
in both RJSONIOIO and RJSON packages, but they require that the lines be
pre-parsed somehow in ways I don't understand. Can someone help?
> wheat <- readLines("http://mbostock.github.com/protovis/ex/wheat.js")
> str(wheat)
chr [1:70] "var wheat = [" "
2009 Sep 03
2
How can I appoint a small part of the whole data
Dear all,
I have 1980~1990 eleven datas,
every year have three variables,
wage
gender(1=female, 2=male)
race(1=black, 2=white)
My original commands is:
fig2b<-reldist(y=mu1990$wage,yo=mu1980$wage,.......)
I have three questions:
1. If I want to appoint y=women's wage in 1990
yo=women's wage in 1980
2. If I want to appoint y=women's wage in
2010 May 03
2
Hierarchical factors
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), etc.
Such data structures commonly use hierarchical coding systems. For
example, the 2007 North
2004 Oct 03
1
How might one write this better?
I am trying to simulate the trajectory of the pension assets of one
person. In C-like syntax, it looks like this:
daily.wage.growth = 1.001 # deterministic
contribution.rate = 0.08 # deterministic 8%
Wage = 10 # initial
Asset = 0 # initial
for (10,000 days) {
Asset += contribution.rate * Wage
2009 Nov 27
1
problem with "dynformula" from "plm" package [RE-POST]
Hello list,
I'm following the paper (http://www.jstatsoft.org/v27/i02/paper) on
how to use "plm" to run panel regressions, and am having trouble with
what I believe should be something very basic.
When I run the command (p.9 in the paper):
R>
dynformula(emp~wage+capital,log=list(capital=FALSE,TRUE),lag=list(emp=2,c(2,3)),diff=list(FALSE,capital=TRUE))
I see:
emp ~ wage +
2012 Nov 15
2
Optimizing
Hello,
I am fairly new with R and am having trouble finding an optimal group. I
checked the help functions for the various optimize commands and it was a
little over my head.
I have a dataset with 4 columns, name, type, value, and cost. The set
consists of a list of people, which have 3 types. I want to choose 6
people, two of each type, and maximize the sum of their values. However,
I'm
2024 Jan 28
1
2SLS with Fixed Effects and Control Variables
Dear John Fox, Christian Kleiber, and Achim Zeileis,
I am attempting to run various independent variable parameters to assess
their suitability. Unfortunately, I hit a snag and couldn't get the tests
to run properly. When I used ivreg, I got an error message saying: "Error
in eval(predvars, data, env) : object 'WageInequality' not found."
Can you please help?
Model:
2005 Feb 16
1
Setting log(0) to 0
Hi,
I'm trying to do a regression like this:
wage.r = lm( log(WAGE) ~ log(EXPER)
where EXPER is an integer that goes from 0 to about 50. EXPER contains
some zeros, so you can't take its log, and the above regression
therefore fails. I would like to make R accept log(0) as 0, is that
possible? Or do I have first have to turn the 0's into 1's to be able to
do the above
2012 Apr 25
4
"Conditional" average
Hello, I have a set of data including age, wage and education level each
called age76, wage76 and grade76 I want to know how i can calculate the
average wage of people age 15 to 65 (each year separetly) , only for those
who have an education level of 10 12 and 16...
--
View this message in context: http://r.789695.n4.nabble.com/Conditional-average-tp4585313p4585313.html
Sent from the R help
2009 Jan 21
0
trouble switching to 'plm' from 'xtabond' and Stata
Hello,
I am switching to R from Stata and I am having particular trouble with
the transition from Stata's 'xtabond' and 'ivreg' commands to the
"plm" package. I am trying to replicate some of the dynamic panel data
work using the UK Employment data in Arellano and Bond (1991) and
available as 'EmplUK' under the 'plm' package.
I have been
2012 Nov 29
1
instrumental variables regression using ivreg (AER) or tsls (sem)
Dear friends,
I am trying to understand and implement instrumental variables
regression using R.
I found a small (simple) example here which purportedly illustrates the
mechanics (using 2-stage least-squares):
http://www.r-bloggers.com/a-simple-instrumental-variables-problem/
Basically, here are the R commands (reproducible example) from that
site:
# ------ begin R
library(AER)
2011 May 07
4
how to calculate the mean of a group in a table
Hi its me again
I don't mean to get on your nerves, but the use of R proofs to be a bit more
complicated than envisaged.
I would like to calculate the mean of a group of values, here
"wage_accepted". The group is determined by the stage and period, so in the
end there should be a column with the values of the wages in period 1
stage1, period 1 stage 2, period 2 stage1...