Displaying 20 results from an estimated 20000 matches similar to: "read.table with different row lengths"
2010 May 26
2
reading in table with different number of elements in each row
HI all,
This is probably simple, but I haven't been able to locate the answer either
in the Import Manual or from searching the listserve.
I have tab-delimited data with different numbers of elements in each row. I
want to read it into R, such that R fills in "NA" in elements that have no
data. How do I accomplish this?
Example:
DATA on disk:
1 -0.068191 -0.050729
2010 Oct 04
3
How To Extract Row from A Data Frame
I have a data frame that looks like this:
> print(df)
V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12
1 FN 8.637 28.890 31.430 31.052 29.878 33.215 32.728 32.187 29.305 31.462
2 FP 19.936 30.284 33.001 35.100 30.238 34.452 35.849 34.185 31.242 35.635
3 TN 0.000 17.190 16.460 21.100 17.960 15.120 17.200 17.190 15.270 15.310
4 TP 22.831 31.246 33.600 35.439 32.073
2012 Nov 17
1
Strange problem with reading a pipe delimited file
I am trying to read in a pipe delimited file that has rows with varying number of columns, here is my sample data:
A|B|C|D
A|B|C|D|E|F
A|B|C|D|E
A|B|C|D|E|F|G|H|I
A|B|C|D
A|B|C|D|E|F|G|H|I|J
You can see line 6 has 10 columns. Yet, I can't explain why R does like so:
> test <- read.delim("mypaths4.txt", sep="|", quote=NULL, header=F,
2014 Jul 02
7
error al leer una linea desde un archivo de texto
Estimada comunidad, estoy extrayendo una linea de texto desde varios
archivos (unos 200) de esta manera:
dat <- read.csv(filenames[i], header=FALSE, sep=",", dec=".", skip=11,
nrows=1)
pero al tratar de leer esa linea desde el archivo numero 54 obtengo el
siguiente error:
Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings
= character(0L)) :
2005 Oct 20
5
search a value in variables dataset
Dear R-list,
I have a dataset, say (the real dataset is 20 columns,110200 rows).
> my.reducedID
V1 V2 V3 V4 V5 V6 V7 V8 V9
[1,] 1 0 0 1 14 3 1 0 2
[2,] 2 0 0 1 14 3 1 0 2
[3,] 0 1 0 1 14 2 1 0 2
[4,] 0 0 1 1 14 3 1 0 2
[5,] 0 1 1 0 14 2 1 0 2
[6,] 0 0 0 1 14 3 1 0 2
[7,] 0 0 0 1 0 3 1 0 2
[8,] 0
2007 Sep 28
2
simple matching with R
Hello!
I am R beginner and I have a question obout a simple matching.
I have to datasets that i read in with:
MalVar29_37<-read.table("MalVar29_37.csv", sep = ";")
FemVar29_37<-read.table("FemVar29_37.csv", sep = ";")
They look like this and show binary variables:
V1 V2 V3 V4 V5 V6 V7 V8 V9
1 0 0 0 0 0 1 0 0 0
2 0 0 0 0 0 1
2006 Sep 21
1
Problems with making a complex graphic
En innebygd og tegnsett-uspesifisert tekst ble skilt ut...
Navn: ikke tilgjengelig
Nettadresse: https://stat.ethz.ch/pipermail/r-help/attachments/20060921/b479a8df/attachment.ksh
2012 Aug 15
2
to remove columns and rows
Dear,
I am using R I'm trying to identify and remove columns and rows in a data
frame that are has elements equals. For example in dataframe below. The
columns 1, 2,3,4,5 ,6 and 10 (file1) has elements equal then should be
removed. How can I ask R to remove those columns with same elements in new
dataframe (file2) to result a matrix as follows:
file1
1 0 2 2 1 1 5 1 1 1
1 0
2004 Oct 06
3
flac-1.1.1 completely broken on linux/ppc and on macosx if built with the standard toolchain (not xcode)
Sadly the latest optimization broke completely everything.
The asm code isn't gas compliant. the libFLAC linker script has a typo,
disabling the asm optimization and/or altivec won't let a correct build
anyway.
Instant fixes for the asm stuff:
sed -i -e"s:;:\#:" on the lpc_asm.s
to load address instead of addis+ori you could use
lis and la and PLEASE use the @l(register)
2007 Jul 30
4
how to combine data of several csv-files
Hello,
I'm looking for a solution for the following problem:
1) I have a folder with several csv files; each contains a set of
measurement values
2) The measurements of each file belong to a position in a two
dimensional matrix (lets say "B02.csv" belongs to position 2,2
3) The size of the matrix is fix
4) I cannot assure to have a csv file for each position
5) Each position
2005 Dec 14
4
unable to force the vector format
Dear all,
I am so ashamed to pollute the list with a trivial question, but it is a
long time I have not used R, and I need a result in the next one or two
hour...
I have a table which I have loaded with read.table, and I want to make
the mean of its columns.
> slides <- read.table("slides.txt")
> slides [1:5,]
V1 V2 V3 V4 V5 V6 V7 V8
1
2013 Feb 15
3
datos climáticos cambio de formato
Hola!!
tengo un data.frame donde cada fila corresponde a un año y cada columna a
un mes (De enero a diciembre)
> head(valT)
V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13
1941 18.0 16.3 15.2 10.1 8.1 8.3 8.8 9.2 7.9 12.2 11.9 14.6
1942 17.2 15.9 13.6 11.6 8.7 6.2 6.4 7.2 9.7 12.0 14.1 16.7
1943 17.6 17.3 13.5 12.5 10.5 7.0 8.2 7.9 -999.9 -999.9
2011 Mar 14
2
code for "permutative" operation
Hello, I need some form of a "permutative" operation on a numeric
vector x
x = (v1, v2, v3, ..., vN)
that produces
x.r = (v1, v1+2, v1+v2+v3, ... v1+v2+...+vN)
If the operation is sum() I can run
x <- 5:8
m <- matrix(rep(x, length(x)), ncol=length(x))
(x.r <- rowsum(m * upper.tri(m, diag=TRUE), rep(1, length(x))))
But there's two things I don't know and kindly
2012 Jan 08
1
creating vectors from data-frames
I am having a problem with creating a vector from a rows or columns, I
searched around and found as.vector(x), but it does not seem to do what it
says it does
I have included an example below, of doing what would seem to be the method
required to create a vector, but instead it creates a one row data frame.
What is required to actually create a vector.
Many thanks
Philip
> data
2011 Jul 24
2
Deleting rows and store the deleted rows in new data frame
Dear all,
I am using grep but I did not understand the problem as I am doing something wrong.Please help me.
I am using this code-
sf=data.frame(sapply(df[],function(x) grep('\\.&\\,', df[,9])))
the thing is i have a data frame(df) like this-
10 135349467 g G 4 0 0 5 ,,,.,
10 135349468 t T 2 0 0 5 ,,c.,
10 135349469 g G 7 0 0 5 ,,a.,
10 135349470 c C 8 0 0 5 ,,,.,
10 135349471
2010 Apr 19
2
Select single column, preserve name?
Hi, list-
?? I've got a large list of multi-column data and I'd like to filter
it according to a threshold, such as, "show me the values that are
above 0.4 for each line."
For instance, if the line of data were:
> line
v1 v2 v3 v4 v5 v6 v7 v8 v9
1 -0.32 0.66 -0.35 -0.82 0.38 0.66 -0.02 -0.11 -0.64
I can do this
> line[,line >= 0.4]
2015 Mar 09
2
Calculos matrices diferentes tamaños
Buen Día Jorge,
Es algo parecido a lo que necesito, pero no debo tener en cuenta la suma de
la columna sino por ejemplo:
Tengo el elemento [1,2] en la matriz A que contiene el número 5 y por otra
parte tengo la columna [,2] de la Matriz B con valores por ejemplo
(1,2,3,4,5,6,7,8,9,10,11,12). El resultado debería ser un vector que en la
posición uno debe indicar que existen 7 valores mayores a 5
2009 Dec 28
4
Accessing members
Consider the following....
> fileLines
V1 V2 V3 V4 V5 V6 V7 V8
1 AB 20091224 156.0 156.0 154.00 154.00 55 1198
2 AB.C 20091224 156.0 156.0 156.00 156.00 0 0
3 ABF10 20091224 156.0 156.0 156.00 156.00 55 444
4 ABH10 20091224 156.0 156.0 156.00 156.00 0 749
5 ABH11 20091224 157.2 157.2 157.20 157.20 0 0
6 ABH12
2011 Nov 28
2
problem in reading file
Hi,
I have a file that looks like this :
one,0
two,0.591,0
three,0.356,0.350,0
four,-0.098,0.072,0.380,0
five,0.573,0.408,0.382,0.062,0
six,0.156,0.232,0.517,0.424,0.303,0
seven,0.400,0.414,0.611,0.320,0.401,0.479,0
eight,0.282,0.375,0.512,0.346,0.308,0.463,0.605,0
nine,0.519,0.484,0.467,0.167,0.455,0.311,0.574,0.557,0
I want to create a data matrix out of it, so I tried this :
2013 Apr 10
3
how to calculate average of each column
Hey All,
I have a large dataset and I want to calculate the average of each column
then return a new dataset.
Here is my question: I dont know if there is a function that can allow me
to calculate the average every 60 records of data in the whole dataset, and
return a new data frame. Not sure if I have to divide the dataset first for
every 60, then do the mean or can i directly do that.
thanks