Posts

Read columns of a csv file using shell or pipe inside R - Windows -

i'm looking way of reading few columns csv file r using shell() or pipe. i found thread explains how accomplish on linux: quicker way read single column of csv file on linux works adding what argument: a <-as.data.frame(scan(pipe("cut -f1,2 -d, main.csv"), what=list("character","character"),sep= ",")) however doesn't seem work on windows. when using pipe("cut -f1 -d, main.csv") connection gets opened doesn't return anything. what functions/syntax need use in order make work on windows. is possible accomplish using shell()? thanks, diego make sure cut on path - in rtools . works me: # check cut availble sys.which("cut") # create test data lines <- "a,b,c 1,2,3 4,5,6" cat(lines, file = "in.csv") # read df <- read.csv(pipe("cut -f1,2 -d, in.csv"))

ios - Eventkit doesn't always delete events -

i working on app, gets student's school lessons online , saves iphone's calendar. every time lessons updated, want delete events calendar of week, , put in updated lessons whole week. i got no problems in adding events, events don't removed? dispatch_queue_t queue = dispatch_queue_create("com.xxxxr.xxxxxx.calendar", null); dispatch_async(queue, ^{ ekeventstore *eventstore = [[ekeventstore alloc] init]; [eventstore requestaccesstoentitytype:ekentitytypeevent completion:^(bool granted, nserror *error) { if (granted){ nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; ekcalendar *calendaridentifier; if ([defaults objectforkey:@"calendar"] == nil || ![eventstore calendarwithidentifier:[defaults objectforkey:@"calendar"]]){ // create calendar if needed eksource *thesource = nil; (eks...

awk printing lines in different order to original file -

i have csv file 6 columns. col3 id, , col4 count. want print col3, , convert col4 frequency. col1,col2,col3,col4,col5,col6 9,19,9,7,9,6 10,132,10,131,10,65 10.3,0,10.3,0,10.3,1 11,128,11,182,11,82 my command awk -f"," '{if (nr!=1) f[$3] = $4; sum += $4} end { (i in f) { print i, f[i]/sum } }' myfile.csv > myoutfile.txt unexpectedly, printing output lines in wrong order - 10.3 comes before 10. there way fix this 9,0.021875 10.3,0 10,0.409375 11,0.56875 here 1 way using awk : awk 'begin{fs=ofs=","}fnr==1{next}nr==fnr{sum+=$4;next}{print $3,(sum>0?$4/sum:0)}' file file 9,0.021875 10,0.409375 10.3,0 11,0.56875 you 2 passes file. both passes check if first line, skip doing fnr==1{next} . in first pass, create variable sum , keep adding column 4 value it. in second pass print 3rd column along frequency (4th column / sum). notice have used file file due 2 passes. can use brace expansion , file{,}

webforms - Parsing error after editing Asp.Net User Control markup -

i have asp.net webforms (.net 4.0, visual studio 2013) user control works right now. uses asp label controls , resource tags bring text in based on current user's language/culture setting. i need add text it. however, adding new asp label automatically creates parsing error. once error has appear, cannot delete label. have revert markup , designer code last commit. seems me must corrupted in designer code, have no idea start looking. below parsing error: description: error occurred during parsing of resource required service request. please review following specific parse error details , modify source file appropriately. parser error message: not load type 'onlineregistration.confirmation'. source error: line 1: line 2: <%@ control language="vb" autoeventwireup="false" codebehind="confirmation.ascx.vb" inherits="onlineregistration.confirmation" %> line 3: line 4: <asp:label source file: /web...

Sending data from Android to Arduino with HC-06 Bluetooth module -

i've created android app communicate arduino using bluetooth. when i'm sending data android device arduino, arduino isn't responding i've send. able connection android device arduino. that's not problem. here's full script android. package nl.handoko.lumamini; import java.io.ioexception; import java.io.outputstream; import java.util.uuid; import android.app.activity; import android.bluetooth.bluetoothadapter; import android.bluetooth.bluetoothdevice; import android.bluetooth.bluetoothsocket; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; import android.widget.toast; public class mainactivity extends activity { private static final string tag = "lumamini"; private static final int request_enable_bt = 1; privat...

android - VideoView Inside Navigation Drawer -

i trying put video view inside navigation drawer. videoview working fine freezing when navigation drawer move , videoview not moving navigation drawer. ideo fix this????? please ::: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/drop" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentleft="true" > </framelayout> <relativelayout android:id="@+id/left_drawer" android:layout_width="280dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="#00000000" android:choicemode="singlechoice" android:dividerheight="1dp" android:...

java - How to append a string after a declared string? -

a beginner asking question might sound basic!....i still learning how walk....1 day running :) i want amend following code can insert word "great" after inputted name. names length varies therefore know have change line z.insert(5, " great "); . can please instruct correct method? regards, scanner id = new scanner(system.in); string name = " "; string surname = " "; system.out.println("please enter name: "); name = id.nextline(); system.out.println(); system.out.println("please enter surname: "); surname = id.nextline(); stringbuffer z = new stringbuffer(); z.append(name + " " + surname + " king of kings"); z.insert(5, " great "); system.out.println(z); system.out.println(); you need calculate length of name , ... int len = name.length() + surname.length() + 1; should give index point after can insert additional str...