m*******y 发帖数: 314 | 1 %% assume test.csv file has 12345 345435 23 12312 34324
_
%% note the last one is a char '-'
A = importdata('test.csv');
B = str2mat(A);
C = B(1: length(B)-1);
%% please first try to see the final char is one or two (or X) in the string
B, and adjust length(B)-X
D = str2num(C);
Can you try above codes to see if this works or not? |
|
a******e 发帖数: 80 | 2 我用的Cadence 5.10,但我想我问的问题应该试用于各个版本
我已经用cadence做好了仿真,现在想把一条具体的电压曲线的仿真数据export出来,
然后用matlab画图。
因为curve的数据量很大,含有很多points。如果我用传统的方法,就是点calculator
上的“tabular results display”(如果是cadence IC4.46,就是点“printvs”),
然后会生成一个table,然后再把table里的数据save as成csv。但因为数据点太多,
load到table里的时候要花太多的时间。
有没有办法能在ICW window直接输入一个command,指定待导出node名和目标文件名,
直接生成一个csv或txt file。我记得是可以的,但忘记具体格式了
谢谢。 |
|
m********a 发帖数: 4 | 3 我来回答你。
1. go to www.arcgis.com
2. click "Map" button on the bottom in "Maps for Personal Use
Discover useful maps, data, and other information. Home | Map | Gallery"
3. click "Add" button once the base map shows up, and choose "Add Layer From
File".
4. navigate the csv file that you have. If your file is excel format, save
it as .csv.
5. once your data appears on the map, you can pick different base map to
meet your needs.
6. click "Save" button. It will ask you to log in. You can click the "Cre... 阅读全帖 |
|
l******9 发帖数: 579 | 4 【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: data grouping, sub-grouping by column variable in R
发信站: BBS 未名空间站 (Wed Feb 26 13:25:43 2014, 美东)
I am working on data collection by R on Win7.
The given data is:
var1 var2 value
I need to do grouping by var1 and then for each var1 , do grouping by var2.
Then, the output is column vectors of values that are associated with the
same var1 and var2. Here, var1 and var2 are like keys.
Example,
var1 var2 value
... 阅读全帖 |
|
l******9 发帖数: 579 | 5 【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: data grouping, sub-grouping by column variable in R
发信站: BBS 未名空间站 (Wed Feb 26 13:25:43 2014, 美东)
I am working on data collection by R on Win7.
The given data is:
var1 var2 value
I need to do grouping by var1 and then for each var1 , do grouping by var2.
Then, the output is column vectors of values that are associated with the
same var1 and var2. Here, var1 and var2 are like keys.
Example,
var1 var2 value
... 阅读全帖 |
|
w**********y 发帖数: 1691 | 6 如果你非要一行,做法也很多,比如:
ddply(data, ~ var1, function(x) write.csv(x, file=paste0(x$var1[[1]],".csv")
))
量体裁衣。给个1万行的data和1亿行的data当然该有不同的选择
() |
|
y***n 发帖数: 309 | 7 You can use Excel to save the file as .csv format and then use read.csv
command
in R directly.
的大作中提到: 】
,
下 |
|
p********a 发帖数: 5352 | 8 ☆─────────────────────────────────────☆
mitbbs1988 (korena) 于 (Wed May 28 16:00:56 2008) 提到:
版上的同学们都熟悉unix吗? 我现在在unix里有若干个比较大的txt files,我想要把
这些files转成excel或csv文件,但是文件实在太大了,如果manually copy paste的话
根本不可能。
有没有什么办法可以直接在unix里把这些txt文件转成excel或csv文件?
谢谢
☆─────────────────────────────────────☆
papertigra (长工胖头猪) 于 (Wed May 28 16:41:29 2008) 提到:
UNIX一共就那么几个破命令,哪里能转TEXT file,肯定需要其它软件才行。你就没有
SAS?
☆─────────────────────────────────────☆
gtaww (gtaww) 于 (Wed May 28 16:49:01 2008) 提到:
you can ch |
|
r*****y 发帖数: 199 | 9 但是根本没有涉及到libname的code啊
我又做了个实验,把.xls文件保存为.csv然后用dbms=csv 就能正常的导入数据了,真他妈见鬼了~ |
|
w*********e 发帖数: 1 | 10 不知道各位XDJM用SAS有没有碰到LOST CARD的情况?
今天要读进一个csv文件,有将近60个variables:
data;
infile "C:/..../.csv" dsd dlm="," firstobs=2;
input ID $ ......;
run;
结果报告
...LRECL=256
LSOT CARD.
*************
在infile语句加入LRECL=400;貌似能读入所有variables,但是ID却变成数字的形势,
小数点后有两个零。
哪位高手能给答疑?十分感谢! |
|
c*****s 发帖数: 180 | 11 我也考了,但都忘了。楼主说的很全,我补充几点:
4.text="句子";
Find(text',US'i, 5 )问i=?;
5.是给出几个单词,然后问用什么命令能成一个他要求的例子:貌似catx的对。
6.debug还是debuger加在data语句后,好像选项有data sasuser.xxx debug; data....
/debug; data...debuger; data.../debuger;
13 没有PROC REPORT考试内容,大纲不考了。
14.题目特别长,然后问题大体是dlm=还是dsd 和dlm一起用。
16.考点在rename用法还有set a b,set a set b 和merge的区别。还有一题问set a b
的第一行输出是什么。
17.ods csvall "file"...
ods close;
问输出结果的文件是用什么格式读的。选项貌似有excel only.excel, txt and csv
;csv only.
20.如何输出这个lib里的文件名。貌似proc data=something _all_.
其他:
1. |
|
s****y 发帖数: 21 | 12 用sas import一个csv表格,看起来总是检测不到record的末尾标记,造成这个数据被
输入到那个变
量中,数据和变量乱七八糟的,不相吻合。试了把csv转化成txt,或者excel,都不行。
有没有人碰到过这种情况,该怎么解决呢? |
|
D******n 发帖数: 2836 | 13 u mean proc import or just use data statement?
用sas import一个csv表格,看起来总是检测不到record的末尾标记,造成这个数据被
输入到那个变
量中,数据和变量乱七八糟的,不相吻合。试了把csv转化成txt,或者excel,都不行。
有没有人碰到过这种情况,该怎么解决呢? |
|
d*******1 发帖数: 854 | 14 i see. 谢谢了, 改来改去就晕了. 这回work了, 而且很快:
> glist<- read.csv('all_diff_exp_list.csv',header=TRUE)
> nmglist<- glist[glist$SYMBOL !='',]
>
> system.time(
+ songkun<- tapply(nmglist$fold, nmglist$SYMBOL,
+ function(x) x[order(abs(x), decreasing = T)][1])
+ )
user system elapsed
0.63 0.00 0.63
> songkun<- as.matrix(songkun)
> tail(songkun)
[,1]
ZYG11A 1.01860
ZYG11B 1.18808
ZYG11BL -1.16001
ZYX 1.07424
ZZEF1 -1.11228
ZZZ3 1.19661 |
|
S******y 发帖数: 1123 | 15 it is every easy to do it in R.
1) export your data to .csv format
2) use read.csv to read into R
3) use rpart or tree package in R |
|
D*********2 发帖数: 535 | 16 data structure:
1 col of character
3 cols of numeric
tried following ways:
1) .sas7bdat to .csv, then read.csv
problem: character be trimmed, eg. 007 to 7. I really need the trial number
to be 3 digits.
2) .sas7bdat to .txt, then read.table
problem: numeric variables be read as factor, say, 167.400, after using as.
numeric, it became 1674.
I also tried colClasses, but unless set the numeric cols to "factor" or "
character", there is an error message.
Thanks a lot!!!!!!!!!! |
|
D*******a 发帖数: 207 | 17
."
I
You can change the dot to NA, then R can recognize it as NA. 999 is not a
good idea, as later on you may confuse it with valid numbers.
Your R code complained maybe because you used quoted txt file. I guess your number is "117.200" (quoted by "") other than 117.200 (not quoted by ""). Take a look of your .csv file (using a text editor).
In my previous answer I answered your first choice too (csv). Did you try to read 007 as character? |
|
D*******a 发帖数: 207 | 18
First change the dots to NA in the X1,X2,X3 columns. Then:
dat.corr <- read.csv(file="xxx.csv", colClass=c("character",rep("numeric",3)
), T) |
|
o****o 发帖数: 8077 | 19 t<-c(1,3,24)
for (i in 1:3){
write.csv(all_diffs[alldiffs$time==t[i],
paste('c:/diff_',t[i],'h.csv', sep=''),
row.names=F)
} |
|
i********f 发帖数: 206 | 20 试试把
file_name<- paste('"','diffs_',i,'h.csv','"',sep="")
改成
file_name<- paste('diffs_',i,'h.csv',sep="") |
|
D******n 发帖数: 2836 | 21 as.character after read.csv
colClasses= inside the read.csv |
|
w******a 发帖数: 25 | 22
e1071 only has one method called e1071.e1071-deprecated().
i don't know how to use it.
> e1071-deprecated()
Error: object 'e1071' not found
nnet
>train<-read.csv("dataset_nee.csv",header=T)
> nnet(x=train[,2:4],y=train[,5])
Error in nnet.default(x = train[, 2:4], y = train[, 5]) :
element 1 is empty;
the part of the args list of 'c' being evaluated was:
(size, dim(y)[2]) |
|
n*****5 发帖数: 61 | 23 I checked the factor variables, and didn't see anything wrong. Is it because
of the control parameters?
library(rpart)
test<-read.csv("H:\CBECS\r test\test.CSV",header=TRUE,sep=",")
names(test)
dim(test)
test$frame2<-factor(test$FRAME)
test$use<-factor(test$FRMACTVC)
names(test)
summary(test$frame2)
print(test$respond)
my.control<-c(minsplit=5,cp=0.001,maxcompete=1,maxsurrogate=1,
usesurrogate=2,surrogatestyle=1)
test.rp <- rpart(respond~ frame2+region+size_scf,data=test,
method="class",control= |
|
c******5 发帖数: 22 | 24
columns.
的确是有mixed的数据。可是我转了个相似的data没问题啊。详细说说吧:
1. 我在access里要用到它的3个tables中的信息。首先,我一个table一个table的把它
们变成了excel file,然后用proc import一个一个的把它们转到SAS中。成功。
2. 因为我想把3个tables中的信息放在一个table中在SAS中做Analysis,但SAS中用
merge什么我怕有multiple entries (不同的table有不同数量的multiple entries)
容易出错。所以我在access里用query把这三个tables先放到一起,然后转成一个excel
sheet,最后录入SAS。 于是就给出了error message。
所以我觉得mixed的数据类型应该不是问题,因为之前没有出错啊。我能想到的就是
combine了以后row 太多,但前面也有朋友说SAS能handle很大的数据,应该也不是问题
。还有就是SAS能发现我这个新的excelsheet是从access中combine了不同的tables来的
所以有问题? 觉得这... 阅读全帖 |
|
c****s 发帖数: 395 | 25 我有个sas data file,总共有200多G,在SAS里处理起来太慢
我想加快处理,想把它转为csv file,然后用r处理,会不会快点,关键从sas变到csv又
得半天
。请教各位,有没有更好的方法?sql就算了,现在用不了。 |
|
b*****e 发帖数: 223 | 26 左边那个,用 plot,大概是
read.csv ("path", header=T)
pdf(file='c:/temp/leftplot.pdf')
plot (x, y, lty=2, pch=22 col='red', main="My Plot Title", xlab="My x axis label", ylab='My y axis label')
dev.off ()
右边那个,用 plot 加 lines
read.csv ("path", header=T)
pdf(file='c:/temp/rightplot.pdf')
plot (x, y, lty=2, pch=22 col='red', main="My Plot Title", xlab="My x axis label", ylab='My y axis label') - 用第一条线的 x,y 画
lines (x, y, lty=3, pch=23, col='blue') - 用第二条线的 x,y 画
lines (x, y, lty=4, pch=24, col='purple... 阅读全帖 |
|
j*******2 发帖数: 309 | 27 I just save the file in .csv format. then use read.csv() |
|
y******d 发帖数: 65 | 28 I agree with dapangmao, I think it is good to transfer xls to csv to R, or
you could output the file into some sort of txt file, then read in by R. If
you have multiple sheets in one excel file, you have to use some software of
outputing the sheets into separate csv files, then use R. The software
could be download the trial version online. It worked pretty well, however,
the time limit is very short though. |
|
D*********2 发帖数: 535 | 29 恩,xls/xlsx -> csv -> R
有个问题不知道各位遇到过没有:
比如,一个units里面的数本该是两位小数,比如3.12,doctor误操作,format成
numbers w/ 0 decimal. excel的好处是你点units还可以看到,加decimal还可以改回
去。可怕的是转成csv就只有3了,转进R就成integer了。
每次都得在excel里手动改好,每次follow up都要改,variable一多就很是奔溃...
哪位大侠有好办法?谢谢谢谢。 |
|
S********a 发帖数: 359 | 30 label 已经是在pie的外面了,只是有的slice实在是太细小了,但是又不想放到other
里去,结果就label重叠了。
说到R,我真心请教,弱弱的问:
有year=1999,2000,2001,2002,2003, monitor是地名,我想每年做一个pie chart of
the number of observations contributed by each monitor.
已经引进了dataset 如下:
mydata = read.csv(file="C:\pie.csv", header=TRUE, sep=",")
怎么根据每年做pie chart 呢? 谢谢!
送包子先 |
|
d**********r 发帖数: 24123 | 31 还有一个方法就是把Excel 存为csv文件,然后读入csv文件就可以选择starting row。
不过这样的话每个sheet都要save一次。
如果会VBA的话,就很容易,不会VBA的话,就比较麻烦。 |
|
t********1 发帖数: 799 | 32 yes, .csv works, all cols can be imported into dataset.
one more question, in the .csv file there are two sheets, how can i point
out which sheet sas should import?
thank you. |
|
R*********i 发帖数: 7643 | 33 I thought there is only one sheet allowed for each .csv file. So in your
case you will have to save each sheet as a separate .csv file. - I did not
test so again maybe I am not right. |
|
u*********r 发帖数: 1181 | 34 在run 一个程序,用csv 文件读入数据
但是 发现程序隔行读数据,本来灭个变量有24个数据,最后读了12个
不晓得发生什么问题,我是SAS 蝌蚪
请大牛指教
现贴开始的一段code
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile 'k:\Kaiwang\run20\run20.CSV' delimiter = ',' firstobs=2 dsd ;
informat LVCYP1A1 best32. ; |
|
l***a 发帖数: 12410 | 35 我以前弄过一个类似的步骤,code改一下帖这里,后面主要是import你可能用不到
options noxsync noxwait noxmin;
x "dir /b /s yourpath\import.csv";
options mprint mlogic;
%macro import(file, name);
data _&name.;
infile "&file";
run;
proc append base=total data=_&name. force;
run;
%mend import;
proc datasets lib=work;
delete total;
run;
data import;
infile 'yourpath\import.csv' truncover;
input file $100.;
length=index(upcase(reverse(scan(reverse(file),1,'\'))),'.TXT');
length name $20.;
if length>0 then do;
name=substr(revers... 阅读全帖 |
|
l*******h 发帖数: 151 | 36 read.csv() is used to read CSV which is delimited by commas. read.table is
usually used to read raw data delimited by space. For your case, reading tab
delimited files, you can also try read.delim(..., sep="\t"). |
|
J********J 发帖数: 571 | 37 Thanks for the reply.
Is there anyway that I can change XLSX to CSV in the program? I think I
would have to import the XLSX file first, then I can change it to CSV.
LIBNAME won't work for XLSX, as far as the info I can google. |
|
n*****r 发帖数: 36 | 38 scrip?
是CSV file
能用SAS, R, 或者 Matlab吗?
现在是这样的CSV file 太多了,不能一个一个来,一定要批处理。 |
|
M*********t 发帖数: 250 | 39 我一直都这么做的,不知道怎么的今天code就不行了。。。
libname trial 'C:';
proc import datafile='C:\trial1.csv'
out=trial.item dbms=csv replace;
getnames=yes;
run;
error is "Physical file does not exist"...
但是trial这个路径下有trial1.dat file 啊 |
|
a***d 发帖数: 336 | 40 this is kind of expensive..
read.csv("test.csv",as.is=T)
keep numerical as numerical and characters as characters. StringAsFactor=F
does the same |
|
j******o 发帖数: 127 | 41 昨天刚写了几段code,不过是对csv的,请你改一下用在Excel文件上吧。中间有些地方
可能不太完善(比如文件名不能有空格等),欢迎改进及简化。
----------------------------------------------------------------
libname backup "C:\Documents and Settings\Ying\Desktop\Test";
filename blah pipe 'dir "C:\Documents and Settings\Ying\Desktop\Test\*.csv"
';
data dirlist;
infile blah truncover lrecl=200;
input line $200. ;
if upcase(substr(line, 1, 9))='DIRECTORY' then call symput('direc', trim
(substr(line, 14, length(line))));
if input(substr(line,1,10), ??... 阅读全帖 |
|
s********r 发帖数: 297 | 42 Column1 Column2: (#.of.A) / (total.#)
A, B, C 1 / 3
A, B, A, D 2 / 4
A, B, A, D, A 3 / 5
.....
请问已知在一个CSV文件里 column 1 里面 是无次序并且可能重复的人的代号(用A,B..
.等字母代表)
delimiter是 ","
请问怎么在csv文件里添加一个 new column (column2) 并且算出 A 那个人在每个row
的出现的frequency 除以 总共人数的ratio呢 |
|
d******9 发帖数: 404 | 43 If you do NOT have so many variables, you can rename the variables manually,
the below MACRO will work.
Please send me your BAOZI, thank you.
-------------------------------------------------------------
libname A 'your physical path';
****Use SAS MACRO to read in external CSV files from storage library.****;
filename Raw 'your physical path';
data AAA (drop=RC);
length Memname In_Name Out_Name $30;
Did=dopen("Raw");
if did> 0 then do;
Num=dnum(did);
do J=1 to Num;
Memname=dread(did, J);
In_Na... 阅读全帖 |
|
d******9 发帖数: 404 | 44 This is a good idea.
"if all files have same layout and structure, i see no reason
If the CSV file does NOT have the first 3 non-data lines, it will work.
Unfortunately, her CSV files do have. So I am afraid the wild card and
filevar will not work.
I encountered this problem when using wild card before because the flat file
contains some non-data rows at the begining. |
|
q**j 发帖数: 10612 | 45 我看了你的文章。像
r('r_mean <- colMeans(r_data)')
这样用一行还是可以。但是如果我的R里面有很多行,看起来会非常别扭。而且如果
colMeans是一个我自己的R 函数怎么办?
我以前用Matlab也有和R接口的办法,后来还是放弃了。选择output .csv,r input,
then
output another .csv as result。这样的途径。不知道这样会不会影响速度。如果数
据已经大概被Python处理好了,应该问题不太大吧。 |
|
o****o 发帖数: 8077 | 46 thanks, will study it.
now I found I can use SAVE(), LOAD() when I need to use the file a lot of
times in the future, shake off 50% more time comparing to read.csv(...,
colClass=colAttr), or using SCAN function
directly read ZIPPED CSV file observes no time saving so far, anyone got
luck? |
|
s*****a 发帖数: 2735 | 47 如果不用做批输入,你试试吧csv file存为xls/xlsx,然后把date column format成
text or date,然后在做proc import 试试? 不太清楚csv file可以定制column
format。
还有一种,就是不要直接写code做import,在sas program左上方有个“file” tab,
从那里用鼠标选import data,再一步一步来,或许有用。最后把code另存留下来,将
来备用。 |
|
c**********e 发帖数: 2007 | 48 Could you anybody test running the following SAS code? Of course, the output
path should be changed to yours. Thanks a ton!
data one;
input x y;
datalines;
-1 -1
-1 0
0 -1
0 1
1 0
1 1
;
run;
proc export DBMS=CSV
data=one
outfile="C:/Users/CareerChange/My Documents/one.csv"
replace;
putnames=yes;
run;
quit; |
|
t*****w 发帖数: 254 | 49 outfile="C:/Users/CareerChange/My Documents/one.csv"
should be: outfile="C:\Users\CareerChange\My Documents\one.csv" |
|
p*****n 发帖数: 265 | 50 我用read.csv,发现问题是一样的,csv没有区别
得到的数据length是1,很奇怪。。。 |
|