我正在尝试访问R AppliedPredictiveModeling包中列出的cars2010数据帧:
这是数据的部分输出(package =“AppliedPredictiveModeling”)命令:
Data sets in package ‘AppliedPredictiveModeling’:
ChemicalManufacturingProcess
Chemical Manufacturing Process
Data
abalone Abalone Data
bio (hepatic) Hepatic Injury Data
cars2010 (FuelEconomy)
Fuel Economy Data
cars2011 (FuelEconomy)
Fuel Economy Data
cars2012 (FuelEconomy)
Fuel Economy Data
我可以访问包中的另一个数据帧: segmentationOriginal但不是cars201x数据帧
> library(AppliedPredictiveModeling)
> data(cars2010)
Warning message:
In data(cars2010) : data set ‘cars2010’ not found
> data(segmentationOriginal)
> data(cars2011)
Warning message:
In data(cars2011) : data set ‘cars2011’ not found
> data(cars2012)
Warning message:
In data(cars2012) : data set ‘cars2012’ not found
你知道这个的解释吗?我有最新的软件包 - 1.1.6
由于
答案 0 :(得分:0)
看看DECLARE @int INT = 1,
@cnt INT,
@sql VARCHAR(max)
SELECT TOP 1 @cnt = Count(1)OVER(partition BY [ID])
FROM Yourtable
ORDER BY Count(1)OVER(partition BY [ID]) DESC
SET @sql = ';WITH cte
AS (SELECT *,Row_number()OVER(partition BY [ID] ORDER BY [Attribute]) rn
FROM Yourtable)
SELECT [ID],'
WHILE @int <= @cnt
BEGIN
SET @sql += 'Max(CASE WHEN rn = ' + Cast(@int AS VARCHAR(20)) + ' THEN [Attribute] ELSE '''' END) AS [Attribute' + Cast(@int AS VARCHAR(20)) + '],'
SET @int +=1
END
SET @sql = LEFT(@sql, Len(@sql) - 1)
SET @sql += 'FROM cte GROUP BY [ID]'
exec (@sql)
您需要的是
InputStream is = getResources().openRawResource(R.drawable.name);
OutputStream os = new FileOutputStream(file);
byte[] data = new byte[is.available()];
is.read(data);
os.write(data);