Expand grid with an ordered pair and a third variable in R -


i have been trying generate combinations of ordered pair of variables third variable, combine every pair (z1, z2) below z3.

theta <- seq(0, 2*pi, length = 5)  z1 <- cos(theta) ;z2 <- sin(theta) z3 <- seq(-3, 3, length = 5)  

i use expand.grid function here not appropriate generate combinations of 3 variables destroying ordering. wondering, there function in r can this? appreciated, thank you.

we paste 'z1' , 'z2' , expand.grid 'z3'. output ('d1'), split 'var1' i.e. pasted vectors 2 columns.

d1 <- expand.grid(paste(z1,z2), z3) transform(read.table(text=as.character(d1$var1), header=false), v3= d1$var2) 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -