由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - load data to a dictionary in R (转载)
相关主题
如何建模在多个factor影响下,两个变量之间的关系?A question in splitting dataset
what field you guys are in to handle huge dataset?Marketing方面用factor analysis 和 cluster analysis的多吗?
如何用sas macro实现这个?样本数量问题求助
问一个R的问题如何合并两个数据文件 (转载)
问个 R 的入门问题问一个关于写R Package的问题
如何用R处理大文件maximum likelihood estimation
Ask a question about one sample testA problem on PROC SQL
split numbers evenly请教个SAS ORACLE DATABASE的问题
相关话题的讨论汇总
话题: dictionary话题: data话题: region话题: load话题: country
进入Statistics版参与讨论
1 (共1页)
m******t
发帖数: 273
1
【 以下文字转载自 Quant 讨论区 】
发信人: myregmit (myregmit), 信区: Quant
标 题: load data to a dictionary in R
发信站: BBS 未名空间站 (Sun Mar 16 20:45:51 2014, 美东)
I need to load data from a .csv file and then save it in a dictionary in R.
The data format:
country,region,value
Each row may have different country and region.
I need to save the value with the same country and region together.
Any help would be appreciated.
O*********h
发帖数: 140
2
你说的dictionary是python的dict吗?R中相对应的data structure是list。
如果是的话,你的需求可以通过两步实现:
1. temp.data.frame <- read.csv("your_name.csv")
2. result.list <- split(x = temp.data.frame, f = "split_factor")
如果country间region不重名,region可以直接用作split_factor。否
则,你需要在temp.data.frame中加入个新的 “country * region”
split_factor。
C******y
发帖数: 2007
3
有hash package,可以实现hashmap功能,不过我用过,速度很慢。最好自己写一个
1 (共1页)
进入Statistics版参与讨论
相关主题
请教个SAS ORACLE DATABASE的问题问个 R 的入门问题
请问pdf还是html更容易text processing?如何用R处理大文件
[合集] 请教关于ANOVA中df=0的问题Ask a question about one sample test
[合集] 大家学统计忙不忙?split numbers evenly
如何建模在多个factor影响下,两个变量之间的关系?A question in splitting dataset
what field you guys are in to handle huge dataset?Marketing方面用factor analysis 和 cluster analysis的多吗?
如何用sas macro实现这个?样本数量问题求助
问一个R的问题如何合并两个数据文件 (转载)
相关话题的讨论汇总
话题: dictionary话题: data话题: region话题: load话题: country