HI,
May be this helps:
dat1<- read.table(text="
date1 time                  date        timeSec topic pupilId correct
02/01/2013 14:58 02/01/2013 140323 fdp.fdp 40 TRUE
02/01/2013 14:59 02/01/2013 140372 fdp.fdp 150 TRUE
03/01/2013 11:23 03/01/2013 213833 fdp.percentage_calc_foundation 15 TRUE
03/01/2013 11:23 03/01/2013 213839 fdp.percentage_calc_foundation 57 TRUE
03/01/2013 11:24 03/01/2013 213845 fdp.percentage_calc_foundation 92 TRUE
03/01/2013 11:24 03/01/2013 213852 fdp.percentage_calc_foundation 65 TRUE
03/01/2013 11:24 03/01/2013 213855 fdp.percentage_calc_foundation 111 TRUE
03/01/2013 11:24 03/01/2013 213860 fdp.percentage_calc_foundation 34 TRUE
03/01/2013 11:24 03/01/2013 213864 fdp.percentage_calc_foundation 109 FALSE
03/01/2013 11:24 03/01/2013 213868 fdp.percentage_calc_foundation 148 FALSE
03/01/2013 11:24 03/01/2013 213877 fdp.percentage_calc_foundation 69 FALSE
03/01/2013 11:24 03/01/2013 213878 fdp.percentage_calc_foundation 61 TRUE
03/01/2013 11:24 03/01/2013 213878 fdp.percentage_calc_foundation 11 TRUE
03/01/2013 11:24 03/01/2013 213879 algebra.core.formulae 134 TRUE
03/01/2013 11:24 03/01/2013 213881 fdp.percentage_calc_foundation 63 TRUE
03/01/2013 11:24 03/01/2013 213886 fdp.percentage_calc_foundation 40 TRUE
03/01/2013 11:24 03/01/2013 213887 algebra.core.formulae 68 TRUE
03/01/2013 11:24 03/01/2013 213898 fdp.percentage_calc_foundation 109 TRUE
03/01/2013 11:24 03/01/2013 213899 algebra.core.formulae 111 TRUE
03/01/2013 11:25 03/01/2013 213901 algebra.core.formulae 101 FALSE
03/01/2013 11:25 03/01/2013 213924 fdp.percentage_calc_foundation 150 TRUE
03/01/2013 11:25 03/01/2013 213958 fdp.percentage_calc_foundation 77 TRUE
03/01/2013 11:25 03/01/2013 213959 fdp.percentage_calc_foundation 134 TRUE
03/01/2013 11:26 03/01/2013 213961 algebra.core.formulae 150 TRUE
03/01/2013 11:26 03/01/2013 214007 algebra.core.formulae 114 TRUE
03/01/2013 11:26 03/01/2013 214008 fdp.percentage_calc_foundation 55 FALSE
03/01/2013 11:26 03/01/2013 214009 fdp.percentage_calc_foundation 67 TRUE
03/01/2013 11:26 03/01/2013 214010 fdp.percentage_calc_foundation 24 TRUE
03/01/2013 11:26 03/01/2013 214014 algebra.core.formulae 114 TRUE
03/01/2013 11:26 03/01/2013 214014 algebra.core.equations 55 TRUE
03/01/2013 11:26 03/01/2013 214015 algebra.core.formulae 97 TRUE
03/01/2013 11:26 03/01/2013 214015 fdp.percentage_calc_foundation 154 FALSE
03/01/2013 11:26 03/01/2013 214017 algebra.core.formulae 21 FALSE
03/01/2013 11:26 03/01/2013 214017 fdp.percentage_calc_foundation 24 TRUE
03/01/2013 11:26 03/01/2013 214019 fdp.percentage_calc_foundation 149 TRUE
03/01/2013 11:26 03/01/2013 214019 fdp.percentage_calc_foundation 119 TRUE
03/01/2013 11:27 03/01/2013 214022 algebra.core.formulae 21 TRUE
03/01/2013 11:27 03/01/2013 214023 algebra.core.formulae 103 TRUE
03/01/2013 11:27 03/01/2013 214023 fdp.percentage_calc_foundation 55 TRUE
03/01/2013 11:27 03/01/2013 214024 fdp.percentage_calc_foundation 24 TRUE
03/01/2013 11:27 03/01/2013 214026 algebra.core.formulae 149 TRUE
03/01/2013 11:27 03/01/2013 214026 fdp.percentage_calc_foundation 154 TRUE
03/01/2013 11:27 03/01/2013 214027 algebra.core.formulae 24 TRUE
03/01/2013 11:27 03/01/2013 214078 algebra.core.equations 67 FALSE
03/01/2013 11:28 03/01/2013 214085 fdp.percentage_calc_foundation 119 TRUE
03/01/2013 11:28 03/01/2013 214085 fdp.percentage_calc_foundation 55 FALSE
03/01/2013 11:28 03/01/2013 214085 fdp.percentage_calc_foundation 149 TRUE
03/01/2013 11:28 03/01/2013 214086 algebra.core.formulae 67 FALSE
03/01/2013 11:29 03/01/2013 214169 algebra.core.formulae 92 TRUE
03/01/2013 11:29 03/01/2013 214172 algebra.core.formulae 15 TRUE
03/01/2013 11:29 03/01/2013 214172 algebra.core.equations 119 TRUE
03/01/2013 11:29 03/01/2013 214173 algebra.core.formulae 46 TRUE
03/01/2013 11:29 03/01/2013 214173 fdp.percentage_calc_foundation 146 TRUE
",sep="",header=TRUE,stringsAsFactors=FALSE)
 dat2<- 
data.frame(timestamp=as.POSIXct(paste(dat1[,1],dat1[,2]),format="%m/%d/%Y 
%H:%M"), dat1[,-c(1:2)])

 library(xts)
xt1<- xts(dat2[,-1],dat2[,1])

library(stringr)

##1st part
 nrow(xt1["2013-03-01 11:15/2013-03-01 11:28"])
#[1] 46

##2nd part
table(xt1["2013-03-01 11:15/2013-03-01 11:28","topic"])
#
#        algebra.core.equations          algebra.core.formulae 
#                             2                             14 
#fdp.percentage_calc_foundation 
#                            30 


###3rd question 

Subxt1<-xt1["2013-03-01 11:15/2013-03-01 11:28"]
#Based on number of correct responses
vec1<-sort(with(Subxt1,tapply(as.logical(str_trim(correct)),list(pupilId),sum)))
head(vec1,3)
#101 148  69 
#  0   0   0 
 tail(vec1,3)
# 55 149  24 
#  2   3   4 

#Based on proportion of correct responses
vec2<-with(Subxt1,tapply(as.logical(str_trim(correct)),list(pupilId),length))
vec2New<- vec2[names(vec1)]
 vec3<-sort(vec1/vec2New)
 head(vec3,3)
#101 148  69 
#  0   0   0 
 tail(vec3,3)
#150 149  24 
#  1   1   1 

A.K.



For date 03/01/2013 I need to find how many responses I have between 
11.15 and 11.28. How do I go about producing another table just between 
that specified period and find the number of responses? (each input is a 
response) 

For this range I need to count how many different topics I have.
 The problem with the topic is that it is not a number, therefore I am 
not sure how to investigate it?? 

Finally, I need to find the 3 strongest and 3 weakest pupils in that same range 
on the proportion of correct responses given. 

Any help would be extremely appreciated!!! 

Table I have: 
timestamp                          date         timeSec  topic pupilId  correct 
02/01/2013 14:58        02/01/2013      140323  fdp.fdp 40      TRUE 
02/01/2013 14:59        02/01/2013      140372  fdp.fdp 150     TRUE 
03/01/2013 11:23        03/01/2013      213833  fdp.percentage_calc_foundation  
15      TRUE 
03/01/2013 11:23        03/01/2013      213839  fdp.percentage_calc_foundation  
57      TRUE 
03/01/2013 11:24        03/01/2013      213845  fdp.percentage_calc_foundation  
92      TRUE 
03/01/2013 11:24        03/01/2013      213852  fdp.percentage_calc_foundation  
65      TRUE 
03/01/2013 11:24        03/01/2013      213855  fdp.percentage_calc_foundation  
111     TRUE 
03/01/2013 11:24        03/01/2013      213860  fdp.percentage_calc_foundation  
34      TRUE 
03/01/2013 11:24        03/01/2013      213864  fdp.percentage_calc_foundation  
109     FALSE 
03/01/2013 11:24        03/01/2013      213868  fdp.percentage_calc_foundation  
148     FALSE 
03/01/2013 11:24        03/01/2013      213877  fdp.percentage_calc_foundation  
69      FALSE 
03/01/2013 11:24        03/01/2013      213878  fdp.percentage_calc_foundation  
61      TRUE 
03/01/2013 11:24        03/01/2013      213878  fdp.percentage_calc_foundation  
11      TRUE 
03/01/2013 11:24        03/01/2013      213879  algebra.core.formulae   134     
TRUE 
03/01/2013 11:24        03/01/2013      213881  fdp.percentage_calc_foundation  
63      TRUE 
03/01/2013 11:24        03/01/2013      213886  fdp.percentage_calc_foundation  
40      TRUE 
03/01/2013 11:24        03/01/2013      213887  algebra.core.formulae   68      
TRUE 
03/01/2013 11:24        03/01/2013      213898  fdp.percentage_calc_foundation  
109     TRUE 
03/01/2013 11:24        03/01/2013      213899  algebra.core.formulae   111     
TRUE 
03/01/2013 11:25        03/01/2013      213901  algebra.core.formulae   101     
FALSE 
03/01/2013 11:25        03/01/2013      213924  fdp.percentage_calc_foundation  
150     TRUE 
03/01/2013 11:25        03/01/2013      213958  fdp.percentage_calc_foundation  
77      TRUE 
03/01/2013 11:25        03/01/2013      213959  fdp.percentage_calc_foundation  
134     TRUE 
03/01/2013 11:26        03/01/2013      213961  algebra.core.formulae   150     
TRUE 
03/01/2013 11:26        03/01/2013      214007  algebra.core.formulae   114     
TRUE 
03/01/2013 11:26        03/01/2013      214008  fdp.percentage_calc_foundation  
55      FALSE 
03/01/2013 11:26        03/01/2013      214009  fdp.percentage_calc_foundation  
67      TRUE 
03/01/2013 11:26        03/01/2013      214010  fdp.percentage_calc_foundation  
24      TRUE 
03/01/2013 11:26        03/01/2013      214014  algebra.core.formulae   114     
TRUE 
03/01/2013 11:26        03/01/2013      214014  algebra.core.equations  55      
TRUE 
03/01/2013 11:26        03/01/2013      214015  algebra.core.formulae   97      
TRUE 
03/01/2013 11:26        03/01/2013      214015  fdp.percentage_calc_foundation  
154     FALSE 
03/01/2013 11:26        03/01/2013      214017  algebra.core.formulae   21      
FALSE 
03/01/2013 11:26        03/01/2013      214017  fdp.percentage_calc_foundation  
24      TRUE 
03/01/2013 11:26        03/01/2013      214019  fdp.percentage_calc_foundation  
149     TRUE 
03/01/2013 11:26        03/01/2013      214019  fdp.percentage_calc_foundation  
119     TRUE 
03/01/2013 11:27        03/01/2013      214022  algebra.core.formulae   21      
TRUE 
03/01/2013 11:27        03/01/2013      214023  algebra.core.formulae   103     
TRUE 
03/01/2013 11:27        03/01/2013      214023  fdp.percentage_calc_foundation  
55      TRUE 
03/01/2013 11:27        03/01/2013      214024  fdp.percentage_calc_foundation  
24      TRUE 
03/01/2013 11:27        03/01/2013      214026  algebra.core.formulae   149     
TRUE 
03/01/2013 11:27        03/01/2013      214026  fdp.percentage_calc_foundation  
154     TRUE 
03/01/2013 11:27        03/01/2013      214027  algebra.core.formulae   24      
TRUE 
03/01/2013 11:27        03/01/2013      214078  algebra.core.equations  67      
FALSE 
03/01/2013 11:28        03/01/2013      214085  fdp.percentage_calc_foundation  
119     TRUE 
03/01/2013 11:28        03/01/2013      214085  fdp.percentage_calc_foundation  
55      FALSE 
03/01/2013 11:28        03/01/2013      214085  fdp.percentage_calc_foundation  
149     TRUE 
03/01/2013 11:28        03/01/2013      214086  algebra.core.formulae   67      
FALSE 
03/01/2013 11:29        03/01/2013      214169  algebra.core.formulae   92      
TRUE 
03/01/2013 11:29        03/01/2013      214172  algebra.core.formulae   15      
TRUE 
03/01/2013 11:29        03/01/2013      214172  algebra.core.equations  119     
TRUE 
03/01/2013 11:29        03/01/2013      214173  algebra.core.formulae   46      
TRUE 
03/01/2013 11:29        03/01/2013      214173  fdp.percentage_calc_foundation  
146     TRUE

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to