首页 \ 问答 \ 如何直接将“.da”文件读入R?(How can I read a “.da” file directly into R?)

如何直接将“.da”文件读入R?(How can I read a “.da” file directly into R?)

我想与R的健康与退休研究合作 。他们的网站提供“.da”文件和SAS提取程序。 SAS程序读取“.da”文件,如固定宽度文件:

libname EXTRACT 'c:\hrs1994\sas\' ; 

DATA EXTRACT.W2H;
INFILE 'c:\hrs1994\data\W2H.DA'  LRECL=358; 

INPUT 
  HHID $ 1-6
  PN $ 7-9
  CSUBHH $ 10-10
  ETC ETC    
;

LABEL
  HHID ="HOUSEHOLD IDENTIFIER"
  PN ="PERSON NUMBER"
  CSUBHH ="1994 SUB-HOUSEHOLD IDENTIFIER"
  ASUBHH ="1992 SUB-HOUSEHOLD IDENTIFIER"
  ETC ETC
;

1)这是什么类型的文件? 我找不到有关此文件类型的任何信息。

2)是否有一种简单的方法可以将其读入R而无需从SAS导出.csv的中间步骤? read.fwf()有没有办法在没有明确说明数百个变量名的情况下工作?

谢谢!


I want to work with the Health and Retirement Study in R. Their website provides ".da" files and a SAS extract program. The SAS program reads the ".da" files like a fixed width file:

libname EXTRACT 'c:\hrs1994\sas\' ; 

DATA EXTRACT.W2H;
INFILE 'c:\hrs1994\data\W2H.DA'  LRECL=358; 

INPUT 
  HHID $ 1-6
  PN $ 7-9
  CSUBHH $ 10-10
  ETC ETC    
;

LABEL
  HHID ="HOUSEHOLD IDENTIFIER"
  PN ="PERSON NUMBER"
  CSUBHH ="1994 SUB-HOUSEHOLD IDENTIFIER"
  ASUBHH ="1992 SUB-HOUSEHOLD IDENTIFIER"
  ETC ETC
;

1) What type of file is this? I can't find anything about this file type.

2) Is there an easy way to read this into R without the intermediate step of exporting a .csv from SAS? Is there a way for read.fwf() to work without explicitly stating hundreds of variable names?

Thank you!


原文:https://stackoverflow.com/questions/45109400
更新时间:2023-02-10 11:02

最满意答案

作为一个wordpress插件,我认为你应该制作wordpress画廊,然后通过名称来调用那些画廊,例如

我引用你提供的链接:

设置画廊

默认情况下,Nivo Lightbox仅显示单个项目。 要使用上一个/下一个导航创建项目库,您需要在链接中添加data-lightbox-gallery属性。 例如:

<a href="image1_large.jpg" data-lightbox-gallery="gallery1">
    <img src="image1_thumb.jpg" alt="" /> </a> <a href="image2_large.jpg" data-lightbox-gallery="gallery1">
    <img src="image2_thumb.jpg" alt="" /> </a> <a href="image3_large.jpg" data-lightbox-gallery="gallery1">
    <img src="image3_thumb.jpg" alt="" /> </a>

Being a wordpress plugin I think you are supposed to make wordpress galleries and then call those galleries by there name, eg

And I quote from the link you provided:

Setting up Galleries

By default Nivo Lightbox will only show individual items. To create a gallery of items with prev/next navigation you need to add a data-lightbox-gallery attribute to your links. For example:

<a href="image1_large.jpg" data-lightbox-gallery="gallery1">
    <img src="image1_thumb.jpg" alt="" /> </a> <a href="image2_large.jpg" data-lightbox-gallery="gallery1">
    <img src="image2_thumb.jpg" alt="" /> </a> <a href="image3_large.jpg" data-lightbox-gallery="gallery1">
    <img src="image3_thumb.jpg" alt="" /> </a>

相关问答

更多
  • 作为一个wordpress插件,我认为你应该制作wordpress画廊,然后通过名称来调用那些画廊,例如 我引用你提供的链接: 设置画廊 默认情况下,Nivo Lightbox仅显示单个项目。 要使用上一个/下一个导航创建项目库,您需要在链接中添加data-lightbox-gallery属性。 例如: ...
  • 在JS和CSS扩展之后使用php rand函数修复了Firefox中的问题,但由于从Nivo JS文件中调用了slider.xml文件,问题仍然存在于IE中。 在Nivo JS文件中添加了以下代码,以解决IE中的问题 var randomNumber=Math.floor(Math.random()*1000000); var xml = 'slider.xml' + "?" + randomNumber; 再次感谢 Fixed the Issue in Firefox with the php rand ...
  • 您可以使用jQuery.noConflict()让jQuery放弃对$变量的控制。 包含jQuery后,调用jQuery.noConflict(); 然后任何时候你想使用jQuery,使用jQuery代替$ so: $("div p").hide(); 变成: jQuery("div p").hide(); 我上面链接的页面有更多示例。 You can use jQuery.noConflict() to have jQuery relinquish control of the $ variable. ...
  • event.stopPropagation();只需在图像上添加即可
    
    
    应该管用。 您可以通过添加来更改光标 style='cursor:default' 看到这里。 event.stopPropagation();Just add on the image
    
                                
  • 好吧,我刚刚添加了一个fadeIn ,它似乎做了某种动画,虽然这是我接受的。 这是我做的: wrap.append(img).fadeIn('4000'); Well I just added a fadeIn after appending which seems to do some sort of animation although which is what I was accepting. Here is what I did: wrap.append(img).fadeIn('4000'); ...
  • 这似乎已经解决了。 我还升级到NIVO LIGHTBOX插件的新v1.1,这也可能有帮助(虽然这不是问题的直接解决方案) This appears to have resolved itself. I have also upgrade to the new v1.1 of the NIVO LIGHTBOX plugin, which might also be helping (although this was not the direct resolution to the issue)
  • 使用一些jQuery研究解决了这个问题,下面是我使用的解决方案。 你需要启动jQuery,它带有lightbox 2。 HEAD部分数据: