Programming

Programming Questions? Ask a Programmer for Answers ASAP

Hi,

Welcome to JustAnswer and thank you for utilising our services.

You may share the hw details I can help.

Regards,

G

Ok thanks,

Just two questions.

Did you mean October 20?

Are there any specific questions that need to be answered through the data analysis or a description of the data?

Ok. But I have only received node.docx and data 1.docx and there are no questions in them just data.

I see. I cannot access you earlier post you may kindly reattach all relevant files.

Ok thanks.

No it does not want to show on my dashboard, I'll wait until you get home.

Ok thank u

Just a status update. I am doing the pie charts.

I am not sure about number 2, if you understand what it wants you can break it down then I'll put it in code

=================================================================

#Number 1

links <- read.csv("links.csv")nodes <- read.csv("nodes.csv")

# Number 2nrow(nodes); length(unique(nodes$id))nrow(links); nrow(unique(links[,c("source", "target")]))

#install.packages('igraph')library('igraph')

# Number 3

# In-degreedegree(net, mode="in")

# Out-degreedegree(net, mode="out")

# Number 4

net <- graph_from_data_frame(d=links, vertices=nodes, directed=T)net <- simplify(net, remove.multiple = F, remove.loops = T)deg <- degree(net, mode="all")V(net)$size <- deg*3# Set edge width based on weight:E(net)$width <- E(net)$weight/6E(net)$width <- 1+E(net)$weight/12l <- layout.bipartiteplot(net, edge.arrow.size=.4, layout=l)

Ok I think I get it after reading it multiple times. The structuring of the sentence there is just not clear its joined 'and' too many times.

# Number 5. 1 a)

age_calc <- function(b_year){ start <- b_year end <- 2016 result <- end - start return(result)}

ages = lapply(E(net)$birth_year, age_calc);df=data.frame(id=paste('R',seq( ),sep=''),value=as.numeric(c(ages)))

# making groupsgrp1=subset(df,value<30)grp2=subset(subset(df,value>30),value<=50)grp3=subset(subset(df,value>50),value<=200)

# calculating %ages for slice

slice<-c(length(grp1[,1])/length(df[,1]),length(grp2[,1])/length(df[,1]),length(grp3[,1])/length(df[,1]))*100perct <- round(slice/sum(slice)*100)lbls <- c("under 30", "30 to 50", "Over 50")lbls <- paste(lbls, perct) lbls <- paste(lbls,"%",sep=" ")# make piepie(slice,labels=lbls,main="Ages")

# Number 5. 1 b)mytable <- table(E(net)$gender)lbls <- c("Males", "Females")pct <- round(mytable/sum(mytable)*100)lbls <- paste(lbls, pct) # add percents to labels lbls <- paste(lbls,"%",sep="")pie(mytable, labels = lbls, main="Gender")

Everything packeged together

http://wikisend.com/download/485846/graph.zip