similar to: Reading a specific column of a csv file in a loop

Displaying 20 results from an estimated 10000 matches similar to: "Reading a specific column of a csv file in a loop"

2011 Oct 11
5
Help to write to a file
Dear all: I am having some problems to use the function "sink()". Basically I am doing a loop over two files which contain unit-root variables. Then on a loop, I extract every i element of both files to create an object called z. If z meets some requirements, then I perform a unit root test (ADF test), otherwise not. As this process is repeated several times, for each i I want to get
2010 Feb 19
1
Quadprog help
I am having some problems using Quadprog in R. I want to minimize the objective function : 200*P1-1/2*10*P1^2+100*P2-1/2*5*P2^2+160*P3-1/2*8*P3^2+50*P4-1/2*10*P4^2+50*P 5-1/2*20*P5^2+50*P6-1/2*10*P6^2, Subject to a set of constrains including not only the variables P1, P2, P3, P4, P5, P6, but also the variables X1, X2,X3,X4,X5,X6,X7,X8,X9. As the set of variables X's are not
2008 Mar 07
1
Finding Interaction and main effects contrasts for two-way ANOVA
I've tried without success to calculate interaction and main effects contrasts using R. I've found the functions C(), contrasts(), se.contrasts() and fit.contrasts() in package gmodels. Given the url for a small dataset and the two-way anova model below, I'd like to reproduce the results from appended SAS code. Thanks. --Dale. ## the dataset (from Montgomery) twoway <-
2008 Aug 02
3
convert for loop into apply()
Hi all,I know this topic has came up multiple times, but I've never fully understand the apply() function. Anyway, I'm here asking for your help again to convert this loop to apply(). I have 2 data frames with the following information: a1 is the fragment that is need to be covered, a2 is the probes that cover the specific fragment. I need to count the number of probes cover every given
2012 Jan 11
3
summarizing a complex dataframe
I need some help summarizing complex data frames (small example below): m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 i1 1 1 1 2 2 2 i1 2 1 1 2 2 2 i2 2 2 1 2 2 2 For an arbitrary number of columns (say m1 ?. m199) where the column names have variable patterns, and such that each set of columns is repeated (with potentially unique data) an
2005 Jul 26
2
grep help needed
Hi, In another thread ("PBSmapping and shapefiles") I asked for an easy way to read "shapefiles" and transform them in data that PBSmapping could use. One person is exploring some ways of doing this, but it is possible I'll have to do this "manually". With package "maptools" I am able to extract the information I need from a shapefile but it is
2010 Aug 18
2
functions and multiple levels
Hi, I am trying to write a function; I want to subtract the mean of each class in level 2 from the mean of each class in level 1 and square the answer, eg..... level.1 level.2 observation 1 1 0.5 1 1 0.2 1 2 0.6 1 2 0.4 2 3
2013 Sep 20
1
Rmpfr question
Hello everyone, R beginner, I am confronted with the need to use Rmpf. In my first scripts I made use of X=read.table(file.choose(), header=FALSE, sep=",",dec=".") X=as.matrix(X) to load into a matrix data from file before matrix use. How can I do to load the same data in a "mpfrMatrix". Is it possible to use with "mpfrMatrix" the same as operations
2006 Apr 23
2
distribution of the product of two correlated normal
Hi, Does anyone know what the distribution for the product of two correlated normal? Say I have X~N(a, \sigma1^2) and Y~N(b, \sigma2^2), and the \rou(X,Y) is not equal to 0, I want to know the pdf or cdf of XY. Thanks a lot in advance. yu [[alternative HTML version deleted]]
2007 Nov 08
3
skip non-sequential lines using scan?
Hi all, Is there a way to skip non-sequential lines using the "skip" argument in the scan function? E.g., I have a matrix with 100 rows and 1e7 columns. I open a connection and want to read only lines 5, 7, 9, etc [i.e., seq(5,99,2)] It might seem that the syntax to do this would be something like this (if only the "skip" allowed vectors in the same way colClasses does in
2010 Jun 16
2
data frame
Dear list, I have the following problem. I have a data frame like this CLUSTER YEAR variable Delta R_pivot M1 2005 EC01 NA NA M1 2006 EC01 2 NA M1 2007 EC01 4 5 M2 2005
2006 Mar 13
3
hfsc and dropped packets
Hi, I''m trying to get a handle on hfsc. Here is my configuration: root@jmnrouter:/jmn# tc class show dev vlan1 class hfsc 1: root class hfsc 1:1 parent 1: ls m1 0bit d 0us m2 225000bit ul m1 0bit d 0us m2 225000bit class hfsc 1:10 parent 1:1 rt m1 191000bit d 25.0ms m2 135000bit ls m1 0bit d 0us m2 135000bit ul m1 0bit d 0us m2 225000bit class hfsc 1:20 parent 1:1 rt m1 22008bit d
2004 Jul 13
1
MLE, precision
Hi, everyone I am trying to estimate 3 parameters for my survival function. It's very complicated. The negative loglikelihood function is: l<- function(m1,m2,b) -sum( d*( log(m1) + log(m2) + log(1- exp(-(b + m2)*t)) ) + (m1/b - d)*log(m2 + b*exp(-(b + m2)*t) ) + m1*t - m1/b*log(b+m2) ) here d and t are given, "sum" means sum over these two vairables. the parameters
2010 Jun 17
1
big big problem
Dear list, I'll try to be more clear in explaining my problem. I have a data frame like this called X: CLUSTER YEAR variable value1 value2 M1 2005 EC01 NA NA M1 2006 EC01 2 5 M1 2007
2007 Feb 27
2
Creating a contended section of bandwidth with HTB and IMQ
Hi All, I''m trying to create a contended section of bandwidth using IMQ. I have the imq0 device up and running, with traffic passing through it. Firstly, I need to throttle the entire device imq0 to 2mbit/s. I would then like to add throttle rules for individual IP addresses, allowing them to pass up to 512kbit/s each, as long as imq0 has not reached its 2mbit/s. The configuration
2008 Jan 29
2
add/subtract matrices, ignoring NA or missing values
Hi, For example, given two 2x2 matrices m1 and m2. I would like to add/subtract element by element > m1 [,1] [,2] [1,] NA NA [2,] 1 2 > m2 [,1] [,2] [1,] 1 NA [2,] NA 2 > m1 + m2 [,1] [,2] [1,] NA NA [2,] NA 4 How can I ignore the NA, and get this ? Hope the solution can be extended to subtract and modulo also. [,1] [,2]
2010 Nov 15
5
How to Read a Large CSV into a Database with R
Hi, I'm working in R 2.11.1 x64 on Windows x86_64-pc-mingw32. I'm trying to insert a very large CSV file into a SQLite database. I'm pretty new to working with databases in R, so I apologize if I'm overlooking something obvious here. I'm trying to work with the American Community Survey data, which is two 1.3GB csv files. I have enough RAM to read one of them into memory,
2004 May 27
2
block diagonal matrix function
Hello List I have just written a little function that takes two matrices as arguments and returns a large matrix that is composed of the two input matrices in upper-left position and lower-right position with a padding value everywhere else. (function definition and toy example below). I need nonsquare matrices and rowname() and colname() inherited appropriately. Two questions: (1) Is there a
2010 Apr 14
5
Running cumulative sums in matrices
Dear R-helpers, I have a huge data-set so need to avoid for loops as much as possible. Can someone think how I can compute the result in the following example (that uses a for-loop) using some version of apply instead (or any other similarly super-efficient function)? example: #Suppose a matrix: m1=cbind(1:5,1:5,1:5) #The aim is to create a new matrix with every column containing the
2013 Jun 27
2
[LLVMdev] Problem with linking modules which use a shared type
Hi, I stumbled upon a strange thing regarding types and module linking, which I don't quite get, so maybe someone around here can enlighten me. Consider the following code, which will create 2 modules m1 and m2, and a named structured type %T = { i32 }; m1 contains only a function definition f(%T), m2 contains a function declaration f(%T) and a function definition h(%T), where h will call f