search for: svdatstr

Displaying 5 results from an estimated 5 matches for "svdatstr".

2016 Apr 20
0
Data reshaping with conditions
...lly B 18 340 susan A 56 340 susan A 22 340 susan B 53 340 susan B 135 351 lee A 114 351 lee A 84 351 lee A 80 351 lee A 19 351 lee A 8 351 lee A 21 351 lee A 88 351 lee B 111 351 lee B 46 351 lee B 108 351 lee B",header=TRUE) # you can also do this with other reshape functions library(prettyR) svdatstr<-stretch_df(svdat,"id",c("Count","type")) count_ind<-grep("Count",names(svdatstr)) type_ind<-grep("type",names(svdatstr)) svdatstr$maxA<-NA svdatstr$maxB<-NA svdatstr$x<-NA svdatstr$y<-NA for(row in 1:nrow(svdatstr)) { svdatstr...
2016 Apr 21
2
Data reshaping with conditions
...135 351 lee A > 114 351 lee A > 84 351 lee A > 80 351 lee A > 19 351 lee A > 8 351 lee A > 21 351 lee A > 88 351 lee B > 111 351 lee B > 46 351 lee B > 108 351 lee B",header=TRUE) > # you can also do this with other reshape functions > library(prettyR) > svdatstr<-stretch_df(svdat,"id",c("Count","type")) > count_ind<-grep("Count",names(svdatstr)) > type_ind<-grep("type",names(svdatstr)) > svdatstr$maxA<-NA > svdatstr$maxB<-NA > svdatstr$x<-NA > svdatstr$y<-NA > for(r...
2016 Apr 21
0
Data reshaping with conditions
...lly B 18 340 susan A 56 340 susan A 22 340 susan B 53 340 susan B 135 351 lee A 114 351 lee A 84 351 lee A 80 351 lee A 19 351 lee A 8 351 lee A 21 351 lee A 88 351 lee B 111 351 lee B 46 351 lee B 108 351 lee B",header=TRUE) # you can also do this with other reshape functions library(prettyR) svdatstr<-stretch_df(svdat,"id",c("Count","type")) count_ind<-grep("Count",names(svdatstr)) type_ind<-grep("type",names(svdatstr)) svdatstr$maxA<-NA svdatstr$maxB<-NA svdatstr$x<-NA svdatstr$y<-NA for(row in 1:nrow(svdatstr)) { indicesA...
2016 Apr 20
2
Data reshaping with conditions
Dear All, I am trying to reshape the data with some conditions. A small part of the data looks like below. Like this there will be more data with repeating ID. Count id name type 117 335 sally A 19 335 sally A 167 335 sally B 18 340 susan A 56 340 susan A 22 340 susan B 53 340 susan B 135 351 lee A 114 351 lee A 84 351 lee A 80 351 lee A 19 351 lee A 8 351 lee A 21 351 lee A 88 351 lee B 111 351
2016 Apr 21
0
Data reshaping with conditions
In R, square brackets [] are called "extraction operators" as they are interpreted so as to "extract" the parts of an object specified by the information within them. Your message contained only part of the line below: AltB<-svdatstr[row,indicesA][svdatstr[row,indicesA]<svdatstr[row,"maxB"]] Extraction operators may be specified sequentially or nested. Both are used in this line. However, to understand how it works, first look at the line that defines the value of "indicesA": indicesA<-count_ind[as....