similar to: dataframe to list conversion

Displaying 20 results from an estimated 7000 matches similar to: "dataframe to list conversion"

2009 Jul 16
3
DataFrame help
Alright, so I am trying to write my own function to calculate column sums in a matrix. I want the result as a single list with the values. So far I have: csum<-function(m) { a = data.frame(m) s = lapply(a,sum) return(s) } What is the easiest way to have it return in a format such as [1] 6 15 24 ? Thanks. -- View this message in context:
2009 Aug 06
1
Time Series smoothing
I have a set of data (in a matrix). I spliced a column out and parsed it as.ts (time series). I then plotted the time series but I found that it was very noisy. I wanted to smooth it out. However, I am having some problems smoothing and plotting the smoothed version. > A <- as.ts(read.table(choose.files())) > x <- as.ts(A[,10]) > plot(x) > > plot(smooth(x))
2013 Apr 13
1
how to add a row vector in a dataframe
Hi, Using S=1000 and simdata <- replicate(S, generate(3000)) #If you want both "m1" and "m0" #here the missing values are 0 res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1}) res1[,997:1000] #????? [,1]???????? [,2]???????? [,3]???????? [,4]??????? #x1??? Numeric,3000 Numeric,3000
2009 Jul 28
2
Check functions in package
Hi, I run R on a server via SSH, over a terminal. After loading a specific package, how do I know what functions are in that package? Is there any way to list or display them? tia. -- View this message in context: http://www.nabble.com/Check-functions-in-package-tp24707084p24707084.html Sent from the R help mailing list archive at Nabble.com.
2013 Oct 04
3
quote a column of a dataframe by its name
Dear All, I have a question, suppose X is a dataframe, with column names as "x1", "x2", "x3", ..... And I would like to use the i-th column by X[,'xi']. But it seems the single quote and double quote are different. So if I run X[, names(X)[i]], it has some error. Please use the below example code X = matrix(rnorm(50),ncol = 5) X = data.frame(X)
2012 Mar 08
8
Copy dataframe for another
I'm trying to copy the results of a dataframe to another within a cycle for but I am not able to implement the rbind, because give th d<-Null df<-NULL for(r in 2: nrow(x)) { val_user<-x.name[[r]] pos<-x.pos[[r]] -4 age <-x.age[[r]] d<-data.frame(val_user,pos,) print(d) } df<-rbind(df,d) } someone can help me solve this Thanks
2011 Nov 15
1
Remove thw data from the dataframe
Hi, I want to remove the entire row from the dataset if any of the row contains blank or NA my dataset look like State Year Y X2 X3 X4 X5 X6 State1 1960 27.8 397.5 42.2 50.7 78.3 65.8 State2 1960 29.9 413.3 38.1 52 79.2 66.9 State1 1961 29.8 439.2 40.3 54 79.2 67.8 State2 1961 30.8 459.7 39.5 79.2 69.6 State1 1962 31.2 492.9 37.3 54.7 77.4 68.7 State2 1962 528.6 38.1 80.2 73.6 State1 1963
2010 Apr 03
1
"moving product", by rows, of a dataframe?
What is a "good" way to calculate the "moving product", for each row of a dataframe, where I wish to be able to specify the length of the moving product? Depending on my needs, I'd like to be able to specify the "length" over which to calculate the moving average (in this example, length=3). For example, if I have a dataframe with 20 rows and 6 columns, and I
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0): > xtabs(~.,data[,idx:(idx+4)]) , , x3 = 1, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 31 2 0 0 112 3 0 0 94 , , x3 = 2, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 3, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 1, x4
2015 Sep 10
2
tinc generating invalid packet checksums?
We have a Zenoss server in our main office monitoring (among many other things) an Apache server in a remote network, with a Tinc link between the two networks. The monitoring simply involves making an HTTP request to a URL once every 5 minutes and confirming that a response page comes back. Most of the requests to this particular web server succeed (and similar requests to other web servers
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,]
2011 Oct 31
3
How to get Quartiles when data contains both numeric variables and factors
When data contains both factor and numeric variables, how to get quartiles for all numeric variables? n <- 100 x1 <- runif(n) x2 <- runif(n) x3 <- x1 + x2 + runif(n)/10 x4 <- x1 + x2 + x3 + runif(n)/10 x5 <- factor(sample(c('a','b','c'),n,replace=TRUE)) x6 <- factor(1*(x5=='a' | x5=='c')) data1 <- cbind(x1,x2,x3,x4,x5,x6) data
2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
Hello I have data like this x1 x2 x3 x4 x5 I want to create a matrix similar to a correlation matrix, but with the difference between the two values, like this x1 x2 x3 x4 x5 x1 x2-x1 x3-x1 x4-x1 x5-x1 x2 x3-x2 x4-x2 x5-x2 x3 x4-x3 x5-x3 x4 x5-x4 x5 Then I
2009 May 26
4
Oops on a converted ext4 system
I converted an ext4 filesystem with btrfs-convert, mounted it, and wanted to do "lzop -d ...". The result was an immediate Oops (btrfs is on LVM, on dm-crypt, on /dev/sdb which is USB-connected). mini-904.img.lzo dentry_open failed BUG: unable to handle kernel paging request at ffffffcd IP: [<c01b5f36>] fput+0x6/0x30 *pde = 00575067 *pte = 00000000 Oops: 0002 [#1] SMP last sysfs
2020 Mar 29
3
Upgrade to CentOS8
Hi Phil Here it is: [root at totorbex ~]# lspci -nn .00:00.0 Host bridge [0600]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series SoC Transaction Register [8086:2280] (rev 21) 00:02.0 VGA compatible controller [0300]: Intel Corporation Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Integrated Graphics Controller [8086:22b1] (rev 21) 00:10.0 SD Host controller
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',
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))
2013 May 29
3
bootstrap
Hi, You might need to check library(boot).? I have never used that before.? So, I can't comment much.? It is better to post on R-help list.? I had seen your postings on Nabble in the past.? Unfortunately those postings were not accepted in R-help.? You have to directly post at ? r-help at r-project.org after registering at: https://stat.ethz.ch/mailman/listinfo/r-help ?
2003 Oct 05
3
stepAIC problem
Dear R-users I have a probelm running stepAIC in R1.7.1 I wrote a program which used stepAIC as a part of it, and it worked fine while I was using the previous version of R1.7.0. However, I found the program did not work any more. Now, R produces a message which tells "Error in as.data.frame.default(data) : can't coerce function into a data.frame" every time I run the part of
2005 Oct 05
8
R crashes for large formulas in lm() (PR#8180)
Full_Name: Hallgeir Grinde Version: 2.1.1 OS: Windows XP Submission from: (NULL) (144.127.1.1) While using lm(y~(x*z*c*...*v)^2) R crashes/closes if the numbers of variables are at least 8.