[R] Importing data using Foreign

Eric Berger er|cjberger @end|ng |rom gm@||@com
Wed Aug 26 15:31:22 CEST 2020


Hi Elham,
You are not giving us much to go on here.
Show us the commands that (a) confirm there are no NA's in the first column
of z
and (b) output a row of z that has an NA in the first column.
Here's how one might do this:
(a) sum(is.na(z[,1]))
(b) z[ match(TRUE, z[,8] %in% c("11","12","14")), ]

Eric


On Wed, Aug 26, 2020 at 3:56 PM Elham Daadmehr <e.daadmehr using gmail.com> wrote:

> Hi all,
>
> I have a simple problem. I get stuck in using the imported spss data (.sav)
> using "read.spss".
> I imported data (z) without any problem. After importing, the first column
> doesn't contain any "NA". but when I choose a subset of it (like:
> z[z[,8]=="11"|z[,8]=="12"|z[,8]=="14",]), lots of NA appears (even in the
> first column).
>
> The (.sav) file is the output of Compustat (WRDS).
>
> It is terrible, I can't find the mistake.
>
> Thank you in advance for your help,
> Elham
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list