similar to: read.table as integer

Displaying 20 results from an estimated 30000 matches similar to: "read.table as integer"

2013 Mar 19
4
Copying rows in data frames
Hi, I'm trying to copy the first row of one data frame to another. This is the statement I am using : df2[1,]<-df1[1,]; I have printed them out separately: df1[1,] = A C D E F But after copying: df2[1,] = 96 29 88 122 68 Why isn't it copying? They are both data frames, and "as.character" isn't working either. Thanks for your input :) [[alternative HTML version
2012 Feb 13
3
Change dataframe-structure
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120213/d2a5afa6/attachment.pl>
2010 Oct 20
2
rowsum
Hello, I am trying to achieve something which I *think* is possible using rowsum, but a little help should be useful: Consider the following dataframe DF0: A B C 89 1 140 89 06 20 89 29 137 89 52 13 89 57 10 89 97 23 89 1 37 89 1 12 89 1 3 52 1 11 52 1 31 52 1 16 52 1 6 52 1 10 52 1 13 52 1 10 52 1 25 52 1 2 52 59 38 52 97 75 57 1 14 57 1 13 57 1 14 57 114 12 57 1 23 57 06 26 I need create a
2009 Sep 19
1
Re-order columns
Dear R'sians, Would really appreciate if you could suggest a more efficient way to order the columns of a dataset. The column names of the dataset contain indices separated by a period. Following are examples of my code and the dataset. oC <- function(tg=x2) { lth <- length(grep("T",names(tg))) thix <-
2005 Feb 04
1
(no subject)
Hi. I have a problem that I can't seem to find an optimal way of solving other than by doing things manually. I'm trying to subset a data frame by the number of observations that occurred at a given row but want to take into account the number of observations of preceding rows. Here's an example. I'm looking at intervals of data [10,20), [10, 30), ....., [10,120) which contain a
2016 May 12
2
Division entre el numero de ocurrencias parciales y totales dentro de un DataFrame de manera eficiente
Hola: A ver si me podéis ayudar que estoy atascado... Necesito contar los subcasos de la columna 2 de un dataframe respecto a los casos de la columna 1. Es decir, tengo un data.frame a<-c(rep(c('a','b','c','b','c'),3),'b') b<-c(rep(c('x','y','z','w'),4)) c<-c(rep(c(1,1,0,0),4))
2016 May 13
2
Division entre el numero de ocurrencias parciales y totalesdentro de un DataFrame de manera eficiente
Hola: Aplicaré lo que dices de usar data.table. Sobre hacer for, etc. Ya lo he hecho, pero pensaba que usar dplyr haría la tarea más rápida por estar este implementado en C (si no me equivoco). Siempre que puedo utilizo estas funciones, porque codificas menos y van más rápido. En este caso el problema es que no he encontrado la manera de hacer lo que quiero con dplyr o similar. La idea era al
2012 May 02
5
uneven vector length issue with read.zoo?
I truncated and simplified my code and the read in data that I'm working with to isolate the issue. Here is the read in data and R script respectively: http://r.789695.n4.nabble.com/file/n4604287/test.csv test.csv http://pastebin.com/rCdaDqPm Here is the terminal/R shell output that I hope the above replicates on your screen: > source("elecLoad.r", echo = TRUE) > #Load
2020 Sep 10
5
aplicar codigo
Hola: Como dice Carlos, algo así, por ejemplo: transforma <- function(df) sapply(df, function(x) ifelse(x%in%c("x1","x2","x3"), "prueba1",ifelse(x%in%c("x4","x5","x6"),"prueba2",x))) > transforma(df1)       col1  [1,] "prueba1"  [2,] "prueba1"  [3,] "x11"  [4,]
2012 Nov 14
1
R wildcards, sapply and as.factor
I want to change the type to factor of all variables in a data frame whose names match a certain pattern. So here I am trying to change the type to factor of all variables whose name begins with?namestub?in the dataframe?df. attach(df)sapply(grep(glob2rx("namestub*"),names(df)),as.factor) But this doesn't work since >levels(df$namestub1)NULL
2011 Nov 29
2
Help with recast() syntax
Dear Help-Rs,   I have data similar to the following:   DF <- structure(list(X = 1:22, RESULT = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("NEG", "POS"), class = "factor"), YR_MO = c(201011L, 201012L, 201101L, 201102L, 201103L, 201104L, 201105L, 201106L, 201107L, 201108L, 201109L, 201011L,
2016 Sep 21
2
strcapture enhancement
The new strcapture function in R-devel is handy, capturing the matches to the parenthesized subpatterns in a regular expression in the columns of a data.frame, whose column names and classes are given by the 'proto' argument. E.g., > p1 <- data.frame(Name="", Number=0) > str(strcapture("([[:alpha:]]*) +([[:digit:]]*)", c("Three 3", "Twenty
2012 Nov 22
4
Data Extraction
Hello, I would appreciate if someone could help me resolve the following: 1. df1[!is.na( X1 | X2 | X3 | X4 | X5),][,1:5] # This does not work 2. Is these message harmful? The following object(s) are masked from 'df1 (position 3)': X1, X2, X3, X4, X5 Thanks, Pradip Muhuri #Reproducible Example set.seed(5) df1<-data.frame(matrix(sample(c(1:10,NA),100,replace=TRUE),ncol=5))
2012 Jun 13
5
finding duplicates in a data frame
I have two data frames which has 3 columns each.My first data frame is large like this below "new.col ppm.p. freq.p." "1_3_diaminopropane 3.13859 5.67516" "1_3_diaminopropane 3.137 6.65388" "1_3_diaminopropane 3.13541 8.0142" "1_3_diaminopropane 3.13383 9.64184" "1_3_diaminopropane 3.12075 298.243" "1_3_diaminopropane 3.1152
2013 Apr 08
3
Reshaping a table
Hello all, I have data in the form of a table: X Y1 Y2 0.1 3 2 0.2 2 1 And I would like to transform in the form: X Y 0.1 Y1 0.1 Y1 0.1 Y1 0.1 Y2 0.1 Y2 0.2 Y1 0.2 Y1 0.2 Y2 Any ideas how? Thanks in advance, IOanna [[alternative HTML version deleted]]
2020 Sep 10
3
aplicar codigo
Hola, me gustar?a hacer algo como en el siguiente ejemplo A un df a?adirle una columna que es la transformaci?n de otra, en plan a todo lo que sea x1, x2, x3 lo llamo prueba 1 todo lo que sea x4,x5,x6 lo llamo prueba 2 el resto de x las dejo como est?n. Ser?a algo as? col1 <- c('x1', 'x2', 'x11', 'x1','x33', 'x1','x4', 'x5',
1997 Apr 30
2
R-alpha: New Incomplete Beta Function
Here is a drop-in replacement for the R incomplete beta function. src/math/pbeta.c It is a slightly modified version of the cephes library one from Netlib. In the few cases I tried it seems to give at least 14 digit agreement with the one in S-PLUS (its hard to get more). I'm not sure what performance is like. I'd like to know if it helps with some of the problems which have been
2011 Dec 08
2
read.table question
Hello All, This works, results <- read.table("plink.txt",T) while this doesn't. results <- read.table("plink.txt") Make sure your data frame contains columns CHR, BP, and P What does adding the "T" in read.table do? Which argument does this correspond to? I tried searching for it but didn't find the answer in: read.table(file, header = FALSE,
2020 Sep 10
2
aplicar codigo
Yo copio y pego este código y me sale correctamente. Se me ocurre que pueda deberse a la versión de R ¿cuál usas? El 10/09/2020 a las 17:51, Samura . escribió: > Gracias por las respuestas. > > Probé lo de hacer la función y no me salía. Pensaba que hacía algo mal. > Ahora con el código de Marcelino tampoco me sale. > > col1 <- c('x1', 'x2', 'x11',
2012 Jul 17
2
Table/Frame - output
I would like to output a nicely formatted data frame to a bitmap. Is this possible in R? -- View this message in context: http://r.789695.n4.nabble.com/Table-Frame-output-tp4636790.html Sent from the R help mailing list archive at Nabble.com.