james.ryan.white
unread,Sep 25, 2012, 11:05:54 PM9/25/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tropi...@googlegroups.com
Hey all,
This isn't really a spatial question but more of a formatting question. I'm trying to get my data in an array format in order to run a three way parallel factor analysis using the package "PTAk". So far, I can get it converted to an array but it throws my values in the wrong spot when I double check the array. I think it has something to do with the unlist command. Here's my code so far:
#load necessary libraries
library(PTAk)
#import file
minor= read.csv(file.choose(), header=T)
#creates array
reduced= minor[3:10]
dataarray= array(data = unlist(reduced), dim = c(8,3,33))
dimnames(dataarray)= list(c("bite", "DM", "DV", "maxDV", "height", "boldness", "latency", "aggression"), c("F", "L", "S"), c("1", "3", "4", "5", "6", "14", "15", "16", "18", "20", "21", "22", "23", "24", "26", "27", "28", "71", "72", "74", "76", "77", "78", "79", "81", "82", "83", "84", "85", "86", "87", "88", "90"))
My data consists of 8 behavioral traits measured (3 repeated measures) for 33 individual fish (with unique fish ID numbers). The raw data file (.csv) is setup in your typical stacked format:
tank, fishid, bite, dm, dv, maxdv, height, boldness, latency, aggression
F,1,values...
L,1,values...
S,1,values...
F,3,etc.
L,3,etc.
S,3,etc.
Any ideas on how to get this data converted to an array correctly? I feel like it's some dumb little thing I'm missing.
Thanks,
James