1 Reply Latest reply on Jul 25, 2018 2:05 PM by Lars Borgmann

    Multidimensional Scaling creating using R

    Lars Borgmann

      hello,

      I am trying to calculate a multidimensional scale but it just doesn't work. In addition, I am an absolute beginner when it comes to the combination of R and tableau. I want to create a data frame from my data and calculate a multidimensional scaling with this data frame and use the coordinates in tableau. I would like to graphically locate the topics based on the associated volumes (The code example only uses three volumes).

       

      My raw data looks like this:

      Screen Shot 2018-07-25 at 17.54.00.png

       

       

      Here's my code:

       

      SCRIPT_REAL("

       

      Topic<- data.frame(Topic = unlist(.arg1))

       

      Volume1 <- data.frame(Volume1= unlist(.arg2))

      Volume1$Topic <- .arg1

       

      Volume2<- data.frame(Volume2 = unlist(.arg3))

      Volume2$Topic <- .arg1

       

      Volume3<- data.frame(Volume3 = unlist(.arg4))

      Volume3$Topic <- .arg1

       

      data<-Reduce(function(x, y) merge(x,y, all=TRUE),list(Topic,Volume1, Volume2, Volume3))

       

      mdz <- cmdscale(dist(data), k=2); rep(mdz[,1], each=.5)

       

      1

       

      ",attr([Topic]),attr([Volume1]),attr([Volume2]),attr([Volume3]))

       

       

      Any help is more than welcome,

       

      best

       

      Lars

        • 1. Re: Multidimensional Scaling creating using R
          Lars Borgmann

          Hello,

           

          I already solved the problem.

           

          Here is the final code, if you see mistakes or room for improvement - any help and advice is more than welcome:

           

           

          SCRIPT_REAL("

          Topic<- data.frame(Topic = unlist(.arg1))


          Volume1 <- data.frame(Volume1= unlist(.arg2))
          Volume1$Topic <- .arg1

          Volume2<- data.frame(Volume2 = unlist(.arg3))
          Volume2$Topic <- .arg1

          Volume3<- data.frame(Volume3 = unlist(.arg4))
          Volume3$Topic <- .arg1

          data<-Reduce(function(x, y) merge(x,y, all=TRUE),list(Topic,Volume1, Volume2, Volume3))


          mdz <- cmdscale(dist(data), k=2);

          rep(mdz[,1])


          ",attr([Topic]),attr([Volume1]),attr([Volume2]),attr([Volume3]),5)