psidR icon indicating copy to clipboard operation
psidR copied to clipboard

Question about using psidR

Open chanyuecon opened this issue 4 years ago • 9 comments

Hi

I am trying the psid R package via R studio. I ran into an error message " Error in get.psid(family[i, "file"], name = paste0(datadir, "FAM", family[i, : no longer logged in "

I tried several times with different tests provided on the website. I still got the same error. It did ask me to log in the PSID using my account , however, it just stopped working afterwards.

Here is the code I wrote:

myvars=data.frame(year=c(2001,2003), house.value=c("ER17044", "ER21043"), education=c("ER20457", "ER24148")) indvars=data.frame(year=c(2001,2003), longitud.wgt=c("ER33637", "ER33740")) d=build.panel(datadir=NULL, fam.vars=myvars, ind.var=indvars)

Do you know why is that?

Thank you very much!

chanyuecon avatar Jul 13 '21 08:07 chanyuecon

just pushed a new readme. can you try what's here: https://github.com/floswald/psidR#quick-start

your example seems to be running fine for me. maybe there is an issue with the temp file on your system.

> library(psidR)
> myvars=data.frame(year=c(2001,2003), house.value=c("ER17044", "ER21043"), education=c("ER20457", "ER24148"))
> indvars=data.frame(year=c(2001,2003), longitud.wgt=c("ER33637", "ER33740"))
> 
> myvars
  year house.value education
1 2001     ER17044   ER20457
2 2003     ER21043   ER24148
> indvars
  year longitud.wgt
1 2001      ER33637
2 2003      ER33740
> d=build.panel(datadir=NULL, fam.vars=myvars, ind.var=indvars)
INFO [2021-07-13 11:08:08] Will download missing datasets now
INFO [2021-07-13 11:08:08] will download family files: 2001, 2003
INFO [2021-07-13 11:08:08] will download latest individual index: IND2019ER
This can take several hours/days to download.
 want to go ahead? give me 'yes' or 'no'.yes
please enter your PSID username: *******
please enter your PSID password: *******
INFO [2021-07-13 11:23:53] downloading file /var/folders/ry/d__dq69j6w31gmbnhz7ybj013sn99p/T//Rtmpg8hppO/FAM2001ER
INFO [2021-07-13 11:24:03] now reading and processing SAS file /var/folders/ry/d__dq69j6w31gmbnhz7ybj013sn99p/T//Rtmpg8hppO/FAM2001ER into R
  current progress: read.fwf has read in 7,406 records    

floswald avatar Jul 13 '21 09:07 floswald

Hi Floswald

Thanks for the reply. I tried the example you posted. However, still got the same error. Do you think there might be an connection issue with the PSID data base?

Thanks Chan

On Tue, Jul 13, 2021 at 5:27 PM Florian Oswald @.***> wrote:

just pushed a new readme. can you try what's here: https://github.com/floswald/psidR#quick-start

your example seems to be running fine for me. maybe there is an issue with the temp file on your system.

library(psidR) myvars=data.frame(year=c(2001,2003), house.value=c("ER17044", "ER21043"), education=c("ER20457", "ER24148")) indvars=data.frame(year=c(2001,2003), longitud.wgt=c("ER33637", "ER33740"))

myvars year house.value education 1 2001 ER17044 ER20457 2 2003 ER21043 ER24148 indvars year longitud.wgt 1 2001 ER33637 2 2003 ER33740 d=build.panel(datadir=NULL, fam.vars=myvars, ind.var=indvars) INFO [2021-07-13 11:08:08] Will download missing datasets now INFO [2021-07-13 11:08:08] will download family files: 2001, 2003 INFO [2021-07-13 11:08:08] will download latest individual index: IND2019ER This can take several hours/days to download. want to go ahead? give me 'yes' or 'no'.yes please enter your PSID username: ******* please enter your PSID password: ******* INFO [2021-07-13 11:23:53] downloading file /var/folders/ry/d__dq69j6w31gmbnhz7ybj013sn99p/T//Rtmpg8hppO/FAM2001ER INFO [2021-07-13 11:24:03] now reading and processing SAS file /var/folders/ry/d__dq69j6w31gmbnhz7ybj013sn99p/T//Rtmpg8hppO/FAM2001ER into R current progress: read.fwf has read in 7,406 records

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878929063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU2Q6WCO7OV4GO3KC7AIRATTXQBHTANCNFSM5AISRDWA .

--


Chan Yu Assistant Professor The University of International Business and Economics https://sites.google.com/view/yu-chan

chanyuecon avatar Jul 13 '21 09:07 chanyuecon

Could be. Are you behind the Chinese firewall maybe?

floswald avatar Jul 13 '21 10:07 floswald

Yes. I am in China and I use the VPN to browse the international websites. I could download data from the PSID.

On Tue, Jul 13, 2021 at 6:06 PM Florian Oswald @.***> wrote:

Could be. Are you behind the Chinese firewall maybe?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878955714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU2Q6WHAP2GJFE3ZI6WOWBDTXQFYVANCNFSM5AISRDWA .

--


Chan Yu Assistant Professor The University of International Business and Economics https://sites.google.com/view/yu-chan

chanyuecon avatar Jul 13 '21 10:07 chanyuecon

I see . At that point this is my best guess given that in my side your example works. Sorry can't help more this as I'm not an expert here. You could look at the source code for function getPSID and see if you can feed it a proxy?

floswald avatar Jul 13 '21 10:07 floswald

Or you download manually the data in ASCII format into your datadir and avoid having to download with the package!

floswald avatar Jul 13 '21 10:07 floswald

But then I have to also manually merge the individual and family datasets if I do not use your package. Or you refer to something different?

On Tue, Jul 13, 2021 at 6:53 PM Florian Oswald @.***> wrote:

Or you download manually the data in ASCII format into your datadir and avoid having to download with the package!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878985918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU2Q6WH5L3NAX6CTDLS6MEDTXQLIXANCNFSM5AISRDWA .

--


Chan Yu Assistant Professor The University of International Business and Economics https://sites.google.com/view/yu-chan

chanyuecon avatar Jul 13 '21 10:07 chanyuecon

Oh no, for sure the merge will be done by the package ! You do everything as before, but instead of NULL you give the datadir argument the location of the data. Must download full family files for each year interested in plus the individual index file

On Tue 13 Jul 2021 at 12:56, chanyuecon @.***> wrote:

But then I have to also manually merge the individual and family datasets if I do not use your package. Or you refer to something different?

On Tue, Jul 13, 2021 at 6:53 PM Florian Oswald @.***> wrote:

Or you download manually the data in ASCII format into your datadir and avoid having to download with the package!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878985918, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AU2Q6WH5L3NAX6CTDLS6MEDTXQLIXANCNFSM5AISRDWA

.

--


Chan Yu Assistant Professor The University of International Business and Economics https://sites.google.com/view/yu-chan

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878987923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZM5SJSHI5Y64XWQQNQB3TXQLWFANCNFSM5AISRDWA .

floswald avatar Jul 13 '21 10:07 floswald

Hi Florian

Thank you very much for your reply. This is really helpful and I will try it!

Best Chan

On Tue, Jul 13, 2021 at 6:59 PM Florian Oswald @.***> wrote:

Oh no, for sure the merge will be done by the package ! You do everything as before, but instead of NULL you give the datadir argument the location of the data. Must download full family files for each year interested in plus the individual index file

On Tue 13 Jul 2021 at 12:56, chanyuecon @.***> wrote:

But then I have to also manually merge the individual and family datasets if I do not use your package. Or you refer to something different?

On Tue, Jul 13, 2021 at 6:53 PM Florian Oswald @.***> wrote:

Or you download manually the data in ASCII format into your datadir and avoid having to download with the package!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878985918, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AU2Q6WH5L3NAX6CTDLS6MEDTXQLIXANCNFSM5AISRDWA

.

--


Chan Yu Assistant Professor The University of International Business and Economics https://sites.google.com/view/yu-chan

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878987923, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAHZM5SJSHI5Y64XWQQNQB3TXQLWFANCNFSM5AISRDWA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floswald/psidR/issues/48#issuecomment-878989326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU2Q6WHPYWUJ2MWYHAC52Y3TXQL7VANCNFSM5AISRDWA .

--


Chan Yu Assistant Professor The University of International Business and Economics https://sites.google.com/view/yu-chan

chanyuecon avatar Jul 13 '21 11:07 chanyuecon