R programming fixing error


Hi guys I asked a similar question about this <a href="https://stackoverflow.com/questions/14983347/how-to-handle-more-than-multiple-sets-of-data-in-r-programming/14984173#comment21098039_14984173" rel="nofollow">here</a> previously and I got some really awesome answers. But it turns out I have more data I need to work with sadly. So I have sample data in this format which is generated using head(data). So I have 3 specimens with their own Time and speed data....I'm not exactly using speed for my actual data

Time Speed Time.1 Speed.1 Time.2 Speed.2 Error in unique.default(x) : unique() applies only to vectors

Would it be possible for you guys to tell me what to do? I can do this in excel with a formula but I have so much data that excel crashes so I really need 'R' but have very minimal knowledge about it...thanks guys....


Run the same code. Why are you editing by=3? You want to create idx = 1, 3, 5 .... by=3, will create 1, 4, 7.... Your data, as long as it is in the format Time, data, Time, data, Time, data, ..., ..., you can use the <strong>same</strong> code

require(IRanges) # by equals 2 because we want to get the `Time` column index every time idx <- seq(1, ncol(data), by=2) # idx is now 1, 3, 5. It will be passed one value at a time to `i`. # that is, `i` will take values 1 first, then 3 and then 5 and each time # the code within is executed. o <- lapply(idx, function(i) { ir1 <- IRanges(start=seq(0, max(data[[i]]), by=401), width=401) ir2 <- IRanges(start=data[[i]], width=1) t <- findOverlaps(ir1, ir2) d <- data.frame(mean=tapply(data[[i+1]], queryHits(t), mean)) cbind(as.data.frame(ir1), d) })

gives me for this data:

# > o # [[1]] # start end width mean # 1 0 400 401 1.05 # # [[2]] # start end width mean # 1 0 400 401 1.1 # # [[3]] # start end width mean # 1 0 400 401 1.383333


  • SELECT within SELECT with TOP
  • How to schedule dynamic function with cron job?
  • datetime field in solr schema
  • Secondary axis with twinx(): how to add to legend?
  • Collect HostCPU utilisation and disk I/O speed using XenServer Java API
  • Merging a large number of files from one directory into a data frame in R
  • Pandas v0.20 returns NotImplemented when multiplying dataframe columns
  • Indexing datetime in MySQL
  • Unity 5.1 Animator Controller not transitioning
  • Slowly changing dimension - What is Pure type 6 implementation
  • How many View Controllers should I have in my game?
  • SQL append distinct values from two columns and two tables
  • How to get file download speed (transfer rate) with php?
  • Hibernate: Inheritance and relationship mapping + generics
  • Should I use composite primary keys in Grails?
  • Changing references to deprecated methods C++
  • How do I formally document a C# Attribute in UML?
  • Salesforce Different WSDL files and when to use
  • How to print columns containing value
  • presentShareDialogWithParams posts to FB wall, but callback handler results say error
  • Marklogic : Query response time is very high
  • Time complexity of a program which involves multiple variables
  • Checking free space on FTP server
  • Scrapy recursive link crawler
  • Spring Data JPA custom method causing PropertyReferenceException
  • NetLogo BehaviorSpace - Measure runs using reporters
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Menu Color Fade on Hover with Jquery
  • Modifying destination and filename of gulp-svg-sprite
  • Perl system calls when running as another user using sudo
  • GridView Sorting works once only
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass