Re: How to weight cases in R
- From: John Kane <jrkrideau@xxxxxxxxx>
- Date: Thu, 21 Jun 2007 10:37:55 -0700
On Jun 21, 7:59 am, raquelrgu...@xxxxxxxxx wrote:
On 20 jun, 13:26, John Kane <jrkrid...@xxxxxxxxx> wrote:
You would be better off asking this question on the R-help mailing
list. Seehttps://stat.ethz.ch/mailman/listinfo/r-help
Have a look at ?tranform again. transform is intended to work on a
data.frame and you are feeding it two elements of a data.frame or so
it appears.
The term 'mulheres$pesop' implies that mulheres is a data.frame or
list not a "object" (i.e. vector) within a data.frame.
If mulheres is a data.frame this might work:
logsalhpm <-transform(mulheres,
logsalhp=(mulheres$logsalh)*(mulheres$pesop)/sum(mulheres$pesop))
John Kane, Kingston ON Canada- Ocultar texto entre aspas -
Thanks for your help, John, but unfortunately, it doesn't work...
Here's the message error:
mulheres <-read.table("base81_2_m_r.dat")
logsalhpm <-transform(mulheres, logsalhp=(mulheres$logsalh)*(mulheres$pesop)/sum(mulheres$pesop))
Erro em data.frame(`_data`, e[!matched]) :
argumentos implicam em número de linhas conflitantes: 52012,
0
If the number of lines is conflicting (52012 is the number of
observations), and there's no missing values, what should be the
problem?
Also I have subscribed on the R-list you recommended me. :)
Thanks again, Raquel
I saw the post over in R.
I think you need to construct a small example of the data that you
have and post it. You'll get a couple of comments like this on the R
list (possibly a bit acerbic. :)
To diagnose what is happening is difficult when we don't have any idea
of the structure of the data. As I mentioned earlier it looks like
you have two data.frames (mulares & homens) or maybe a two element
list. If so we need to know what the elements are (matrix, data.frame
etc. You almost certainly don't have a data.frame with two
data.frames inside it.
I'd suggest creating a very small data.frame (perhaps 4 variables and
5 6 subjects and try working with it. It may show you where the error
is, and if you still get the error it will give the people on the R-
help list a lot more to work with.
I had hoped that just using mulheres would work but since it doesn't I
still cannot tell if it is a data.frame or not.
Something I forgot : do a
class(mulheres) and see if you get 'data.frame' as a response.
Also just do a head(mulheres$logsalh) and see what happens.
.
- References:
- How to weight cases in R
- From: raquelrguima
- Re: How to weight cases in R
- From: John Kane
- Re: How to weight cases in R
- From: raquelrguima
- How to weight cases in R
- Prev by Date: Re: Approximate solution to linear regression
- Next by Date: Re: Approximate solution to linear regression
- Previous by thread: Re: How to weight cases in R
- Next by thread: Multiple comparaison of proportions
- Index(es):