如何映射R中的每个分类变量组合?(How do you map every combination of categorical variables in R?)
使用R,有没有办法获取数据集并绘制出每个分类变量的每个可能组合?
例如,假设我从在线商店获得了10,000行客户数据。 我想知道哪些购物者花的钱最多。 我从客户那里得到以下数据:
电子邮件(yahoo,gmail,hotmail,aol)浏览器(Mozilla,IE,Chrome,Opera)国家(美国,加拿大,中国,澳大利亚,埃及,韩国,巴西)每位用户在我的商店花了多少钱。
我想绘制出上述三个分类变量的每种可能组合,并看看每个客户的平均支出是多少。
在R中这样做的好方法是什么? (注意:我的R经验现在很平均)
谢谢。
Using R, is there a way to take a data set and map out every possible combination of every categorical variable?
For example, let's say I had 10,000 rows of customer data from an online shop. I want to find out which shoppers spend the most money. I have the following data from the customer:
E-mail (yahoo, gmail, hotmail, aol) Browser (Mozilla, IE, Chrome, Opera) Country (USA, Canada, China, Australia, Egypt, S.Korea, Brazil) How much total money each user spent at my store.
I want to graph out every possible combination of the above three categorical variables and see what was the average spending of each customer.
What is a good way to do this in R? (note: my R experience is average right now)
Thanks.
原文:https://stackoverflow.com/questions/23020826
最满意答案
也许将图像的
max-width
从50%更改为100%并删除margin-left: 90px;
和margin-right: 90px;
容器。您还可以将
width:100%
添加到img
以使图像粘贴到红色边框。Perhaps change the
max-width
of image from 50% to 100% and remove themargin-left: 90px;
andmargin-right: 90px;
of the container.You can also add
width:100%
toimg
to get the images sticked to the red border.
相关问答
更多-
想学拍DV和制作怎么办?[2022-07-17]
-
除非你可以对python安装进行系统范围的更改,否则你必须在同一个虚拟环境中运行Apache,python和Django。 如果不可能,请使用gunicorn (而不是apache)在virtualenv中运行Django应用程序(在与Apache不同的端口中)。 如果此应用程序在子域中运行,您应该考虑在PAAS(Heroku,Google App Engine等)中托管Django应用程序,以便您轻松切换运行环境。 Unless you can make a system wide change to y ...
-
需要关于将我的第一个rails应用程序部署到中介(dv)的建议(Need advice on deploying my first rails app to a mediatemple (dv))[2023-08-17]
我刚刚在我的dv服务器上完成了这个工作,所以这里快速浏览一下。 我将假定你正在使用Ruby 1.9.3和Rails 3.2,并以root身份运行下面的所有命令。 您的服务器上还安装了最新版本的rake和乘客安装程序。 如果不是,请尝试: gem update --system gem install rake gem install passenger 下一步是登录到您的MediaTemple管理面板。 点击你感兴趣的域的管理按钮(不是Plesk的),然后选择“Root Access and Develo ... -
Sub Button11_Click() Application.ScreenUpdating = False Dim cell As Range Dim rgDV As Range Dim DV_Cell As Range Dim ws As Worksheet Dim strPath As String Dim myFile As Variant Dim strFile As String Dim LA As Boolean Dim A As Integer Dim B As Integer S ...
-
在dv中放大图像(Enlarging images in dv)[2021-10-15]
也许将图像的max-width从50%更改为100%并删除margin-left: 90px; 和margin-right: 90px; 容器。 您还可以将width:100%添加到img以使图像粘贴到红色边框。 Codepen Perhaps change the max-width of image from 50% to 100% and remove the margin-left: 90px; and margin-right: 90px; of the container. You can al ... -
MediaTemple(dv)vhosts配置文件在哪里存在?(Where do MediaTemple (dv) vhosts configuration files live?)[2022-07-15]
看起来它们出于某种原因位于 /var/www/vhosts/mydomain.com/conf/httpd.include It appears they are located, for some reason, in /var/www/vhosts/mydomain.com/conf/httpd.include -
在调用ezANOVA的自定义R函数中:如何参数化dv?(In a custom R function that calls ezANOVA: How do I parameterize the dv?)[2021-09-09]
不得不自己解决这个问题。 事实证明,eval()和substitute()的组合解决了这个难题: # ---------------------------------- # Aha, it works! # ---------------------------------- library(ez) df<-data.frame(ID=as.factor(101:120), Training=rep(c("Jedi", "Sith"), 10), ... -
abc <- function(i){ form <- as.formula(paste0(colnames(exampledf)[i], "~1")) lme(form,random=~1|id_num,na.action=na.fail,data=exampledf,control=my.control) } lapply(seq_along(colnames(exampledf)), abc) abc <- function(i){ form <- as.formula(paste0( ...
-
我尝试了一切并失败了。 但我找到了解决方案。 打开记事本并复制和粘贴 SPORTS DV UPDATE:N FORMAT EV:6 CTST:100 SAT:100 AWB:0 SHARPNESS:100 AudioVol:1 QUALITY:0 LIGHTFREQ:0 AE:0 RTCDisplay:1 year:2014 month:7 date:7 hour:16 minute:11 second:0 ------------------------------- Exposure(E ...