data-manipulation

R: arranging multiple plots together using gridExtra

 ̄綄美尐妖づ 提交于 2021-02-02 09:59:07
问题 I am using the R programming language. I am trying to arrange "plot1, plot2, plot3, plot4" on the same page: library(kohonen) #fitting SOMs library(ggplot2) #plots library(GGally) #plots library(RColorBrewer) #colors, using predefined palettes iris_complete <-iris[complete.cases(iris),] #only complete cases... the iris dataset floats around in the sky with diamonds. iris_unique <- unique(iris_complete) # Remove duplicates #scale data iris.sc = scale(iris_unique[, 1:4]) #build grid iris.grid =

R: arranging multiple plots together using gridExtra

好久不见. 提交于 2021-02-02 09:57:29
问题 I am using the R programming language. I am trying to arrange "plot1, plot2, plot3, plot4" on the same page: library(kohonen) #fitting SOMs library(ggplot2) #plots library(GGally) #plots library(RColorBrewer) #colors, using predefined palettes iris_complete <-iris[complete.cases(iris),] #only complete cases... the iris dataset floats around in the sky with diamonds. iris_unique <- unique(iris_complete) # Remove duplicates #scale data iris.sc = scale(iris_unique[, 1:4]) #build grid iris.grid =

Plot causes “Error: Incorrect Number of Dimensions”

北城以北 提交于 2021-02-01 05:17:26
问题 I am learning about the "kohonen" package in R for the purpose of making Self Organizing Maps (SOM, also called Kohonen Networks - a type of Machine Learning algorithm). I am following this R language tutorial over here: https://www.rpubs.com/loveb/som I tried to create my own data (this time with both "factor" and "numeric" variables) and run the SOM algorithm (this time using the "supersom()" function instead): #load libraries and adjust colors library(kohonen) #fitting SOMs library(ggplot2

Plot causes “Error: Incorrect Number of Dimensions”

只愿长相守 提交于 2021-02-01 05:17:21
问题 I am learning about the "kohonen" package in R for the purpose of making Self Organizing Maps (SOM, also called Kohonen Networks - a type of Machine Learning algorithm). I am following this R language tutorial over here: https://www.rpubs.com/loveb/som I tried to create my own data (this time with both "factor" and "numeric" variables) and run the SOM algorithm (this time using the "supersom()" function instead): #load libraries and adjust colors library(kohonen) #fitting SOMs library(ggplot2

R: Obtaining Rules from a Function

百般思念 提交于 2021-01-30 09:13:36
问题 I am using the R programming language. I used the "rpart" library and fit a decision tree using some data: #from a previous question : https://stackoverflow.com/questions/65678552/r-changing-plot-sizes library(rpart) car.test.frame$Reliability = as.factor(car.test.frame$Reliability) z.auto <- rpart(Reliability ~ ., car.test.frame) plot(z.auto) text(z.auto, use.n=TRUE, xpd=TRUE, cex=.8) This is good, but I am looking for an easier way to summarize the results of this tree in case the tree

R: Obtaining Rules from a Function

一世执手 提交于 2021-01-30 09:10:23
问题 I am using the R programming language. I used the "rpart" library and fit a decision tree using some data: #from a previous question : https://stackoverflow.com/questions/65678552/r-changing-plot-sizes library(rpart) car.test.frame$Reliability = as.factor(car.test.frame$Reliability) z.auto <- rpart(Reliability ~ ., car.test.frame) plot(z.auto) text(z.auto, use.n=TRUE, xpd=TRUE, cex=.8) This is good, but I am looking for an easier way to summarize the results of this tree in case the tree

R: Obtaining Rules from a Function

蓝咒 提交于 2021-01-30 09:09:58
问题 I am using the R programming language. I used the "rpart" library and fit a decision tree using some data: #from a previous question : https://stackoverflow.com/questions/65678552/r-changing-plot-sizes library(rpart) car.test.frame$Reliability = as.factor(car.test.frame$Reliability) z.auto <- rpart(Reliability ~ ., car.test.frame) plot(z.auto) text(z.auto, use.n=TRUE, xpd=TRUE, cex=.8) This is good, but I am looking for an easier way to summarize the results of this tree in case the tree

R: Obtaining Rules from a Function

故事扮演 提交于 2021-01-30 09:09:38
问题 I am using the R programming language. I used the "rpart" library and fit a decision tree using some data: #from a previous question : https://stackoverflow.com/questions/65678552/r-changing-plot-sizes library(rpart) car.test.frame$Reliability = as.factor(car.test.frame$Reliability) z.auto <- rpart(Reliability ~ ., car.test.frame) plot(z.auto) text(z.auto, use.n=TRUE, xpd=TRUE, cex=.8) This is good, but I am looking for an easier way to summarize the results of this tree in case the tree

proportion of factors and dummies

▼魔方 西西 提交于 2021-01-29 11:32:05
问题 I have a data set full of factors and dummies, I want to see the proportion of each value after dplyr::group_by(cyl) mtcars; rownames(mtcars) <- NULL df <- mtcars[,c(2,8,9)] head(df) cyl vs am 1 6 0 1 2 6 0 1 3 4 1 1 4 6 1 0 5 8 0 0 6 6 1 0 Expected answer I have in cyl 6 6 6 6 for vs column two of them is 1 two of them 0 1 0 6 50% 50% 4 100% 0% 8 0% 100% same as this for column am too 回答1: Here's a first crack: (df %>% pivot_longer(-cyl) ## spread out variables (vs, am) %>% group_by(cyl,name

Remove values from rows under specific columns in csv file

天大地大妈咪最大 提交于 2021-01-29 08:30:54
问题 I'm currently trying to remove specific values from rows under specific columns in a CSV-file. Whats the best way of doing this? Is it to use a XSLT map file in the code or doing this only by code? (Using c#) What I want to do is this: BEFORE MANIPULATION: id, name, email, phoneNumber, dob 1,John Doe,JohnDoe@mail.com,123456789,1988-08-08 2,Jane Doe,JaneDoe@mail.com,987654321,1987-07-07 AFTER MANIPULATION: id, name, email, phoneNumber, dob 1,John Doe,,,1988-08-08 2,Jane Doe,,,1987-07-07 As you