search for: rowwise

Displaying 20 results from an estimated 36 matches for "rowwise".

2018 May 30
0
Evaluation failure of IAPWS95 functions in a rowwise manner (tidyverse style)
Hi Shawn, I don't think it has anything to do with the tidyverse. If you keep simplifying your example you'll get all the way down to > DTp(T=c(279,294),p=c(0.46,0.46)) [1] 1000.12283 --Ista On Wed, May 30, 2018 at 2:14 PM, Shawn Way <SWay at meco.com> wrote: > I'm trying to use the IAPWS95 package with the tidyverse packages. For some reason, the function is not
2010 Jul 09
3
apply is slower than for loop?
...e ## Example of how apply is SLOWER than for loop: #rm(list=ls()) ## DEFINE VARIABLES mu=0.05 ; sigma=0.20 ; dt=.25 ; T=50 ; sims=1e5 timesteps = T/dt ## MAKE PHI AND DS phi = matrix(rnorm(timesteps*sims), nrow=sims, ncol=timesteps) ds = mu*dt + sigma * sqrt(dt) * phi ## USE APPLY TO CALCULATE ROWWISE CUMULATIVE PRODUCT system.time(y1 <- apply(1+ds, 1, cumprod)) ## UNTRANSFORM Y1, BECAUSE ROW APPLY FLIPS THE MATRIX y1=t(y1) ## USE FOR LOOP TO CALCULATE ROWWISE CUMULATIVE PRODUCT y2=matrix(NA,nrow(ds),ncol(ds)) system.time( for (i in 1:nrow(ds)){ y2[i,]<-cumprod(1+ds[i,]) }...
2018 May 30
2
Evaluation failure of IAPWS95 functions in a rowwise manner (tidyverse style)
I'm trying to use the IAPWS95 package with the tidyverse packages. For some reason, the function is not outputting the correct rho. A minimal example with results is below. I've also included the definition of the DTp function from the IAPWS95 library. ==================================== library(IAPWS95) library(tidyverse) initial <- data.frame(T=c(279,294),p=c(0.46,0.46))
2010 Jun 03
4
data-management: Rowwise NA
Dear RĀ“ers.. In this mock dataset how can I generate a logical variable based on whether just tes or tes3 are NA in each row?? test<-sample(c("A",NA,"B"),100,replace=T) test2<-sample(c("A",NA,"B"),100,replace=T) test3<-sample(c("A",NA,"B"),100,replace=T) tes<-cbind(test,test2,test3)
2010 Oct 19
2
head.matrix() unintelligent
...question really. I?ve got these large 2d matrices that I?d like to inspect, but not from start to finish. The head() command is convenient when columns are few. For large nxn matrices, however, head() and head.matrix() are still cumbersome. Is there a simple way of viewing both the columnwise and rowwise heads of a matrix? cheers, Bruce -- View this message in context: http://r.789695.n4.nabble.com/head-matrix-unintelligent-tp3002346p3002346.html Sent from the R help mailing list archive at Nabble.com.
2006 Feb 16
2
Help to find correlation.
Respected Sir, I am trying to import excel file into R, but I need to truncate some columns from the original file. How to delete unwanted columns when I import data from excel file. How to use cor.test for the data when I want the output rowwise. How to do grouping and use cor.test on that data I need some help regarding how to calculate the correlation. I don't know whether you understood my question, but I need help. Any help is appreciated. Thanks, [[alternative HTML version deleted]]
2011 Sep 06
2
subsetting tables
Hi guys, one of the questions where you need a real human instead of a search engine, so it would be great if you could help. I have a matrix of z-scores which I would like to filter, sometimes columnwise, sometimes rowwise. Data looks like this: Allstar hsa.let.7a hsa.let.7a.1 hsa.let.7a.2 2 0.87 0.79 -0.57 1.07 3 0.67 -1.14 -0.78 -0.95 4 -0.46 -0.30 -0.36 1.14 Now I want to find all elements which are below/above some threshold. Subset works fin...
2012 Dec 07
1
Help with manipulation of matrix object
Hi list, I have a problem which I was stuck on for a while, and after many days still cannot find a solution to. I have a matrix, measuring m X n. An example matrix will be this: >dput(sample) structure(c(2315101, 2315102, 2315103, 2315104, 2315105, 2315107, 2315108, 2315110, 2315112, 2315114, 2315116, 2315118, 2315120, 2315122, 2315124, 2315126, 2315127, 2315128, 2315130, 2315131, 2315132,
2006 Jul 21
1
table elemets testing
Hi everybody, i'm dealing with some percentage tables, of which i should test rowwise if the entries are sgnificantly equal or not. Namely, on row 1, test H0: element 1= element2, H0: element 1= element3...H0: element 2= element3...H0: element n-1= element n. The same on the other rows. Anybody knows how this can be done in quick way? I don't have large matrices, but it see...
2017 Nov 28
2
dplyr - add/expand rows
...970 , "QMC", >> "07EA001" , 1971 , 1971 , "QMM", >> "07EA001" , 1972 , 1976 , "QMC", >> "07EA001" , 1977 , 1983 , "QRC" >> ) >> >> result <- input %>% >> rowwise() %>% >> do(tibble(station = .$station, >> year = seq(.$from, .$to), >> record = .$record) >> ) >> >> ########################### >> > > In a bit more 'base R' mode I did > > input$year <- with(inp...
2017 Nov 29
0
dplyr - add/expand rows
...quence(d$to-d$from+1) transform(d[i,], year=from+j-1, from=NULL, to=NULL) } ## Michael - IRanges fun_michael <- function(d) { df <- with(d, DataFrame(station, record, year=IRanges(from, to))) expand(df, "year") } ## Jim - dplyr fun_jim <- function(d) { d %>% rowwise() %>% do(tibble(station = .$station, record = .$record, year = seq(.$from, .$to)) ) } ## Martin - Map fun_martin <- function(d) { d$year <- with(d, Map(seq, from, to)) res0 <- with(d, Map(data.frame, station=station,...
2017 Nov 29
2
dplyr - add/expand rows
...m=NULL, to=NULL) > } > > ## Michael - IRanges > fun_michael <- function(d) { > ? df <- with(d, DataFrame(station, record, year=IRanges(from, to))) > ? expand(df, "year") > } > > ## Jim - dplyr > fun_jim <- function(d) { > ? d %>% > ??? rowwise() %>% > ??? do(tibble(station = .$station, > ????????????? record = .$record, > ????????????? year = seq(.$from, .$to)) > ??? ) > } > > ## Martin - Map > fun_martin <- function(d) { > ? d$year <- with(d, Map(seq, from, to)) > ? res0 <- with(d, Map(da...
2017 Nov 28
0
dplyr - add/expand rows
...EA001" , 1961 , 1970 , "QMC", > "07EA001" , 1971 , 1971 , "QMM", > "07EA001" , 1972 , 1976 , "QMC", > "07EA001" , 1977 , 1983 , "QRC" > ) > > result <- input %>% > rowwise() %>% > do(tibble(station = .$station, > year = seq(.$from, .$to), > record = .$record) > ) > > ########################### In a bit more 'base R' mode I did input$year <- with(input, Map(seq, from, to)) res0 <- with(input,...
2017 Nov 27
2
dplyr - add/expand rows
..., 1960 , "QMS", "07EA001" , 1961 , 1970 , "QMC", "07EA001" , 1971 , 1971 , "QMM", "07EA001" , 1972 , 1976 , "QMC", "07EA001" , 1977 , 1983 , "QRC" ) result <- input %>% rowwise() %>% do(tibble(station = .$station, year = seq(.$from, .$to), record = .$record) ) ########################### Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Nov 26,...
2000 Mar 08
0
RODBC: follow up
...qtable)) ? The above mentioned one-line-only problem with sqlTables() of course breaks this code (6) Some more comments (perhaps due to my ignorance about ODBC, can ODBC write data without sending sql statements?) (6.1) looping sqlwrite() sqlgetresults() uses for-loops for writing/reading data rowwise. I expect this to be rather slow. Is it possible to have this done in C instead of R? If in R, might it be that the sequence of multiple rbind() leads to memory segmentation (growing lists)?? May be one should ask on R-Help, if it is better to first create an object of approbriate size and then re...
2017 Nov 29
0
dplyr - add/expand rows
...## Michael - IRanges >> fun_michael <- function(d) { >> df <- with(d, DataFrame(station, record, year=IRanges(from, to))) >> expand(df, "year") >> } >> >> ## Jim - dplyr >> fun_jim <- function(d) { >> d %>% >> rowwise() %>% >> do(tibble(station = .$station, >> record = .$record, >> year = seq(.$from, .$to)) >> ) >> } >> >> ## Martin - Map >> fun_martin <- function(d) { >> d$year <- with(d, Map(seq, from, to)...
2010 Oct 08
3
Import Multiple csv files and merge into one Master file
Dear R Group: How to import multiple csv files and merge into one dataset. Thanks and Regards, Xing [[alternative HTML version deleted]]
2004 Jul 19
10
How to compare X1 = X2 = ... = Xn?
Dear All, I have a data frame with n columns: X1, X2, ., Xn. Now I want to create a new column: if X1 = X2 = . = Xn, the value is 1; Otherwise, the value is 0. How to do that in a quick way instead of doing (n choose 2) comparisons? Thank you, Frank [[alternative HTML version deleted]]
2008 Apr 10
0
Adding columns to a grouped data frame
Hello! I'm working with a big data set of patients. The data consists of different variables sorted rowwise for each patient. Now I want to add a new variable for each patient by adding two different variables of the data frame. [[alternative HTML version deleted]]
2009 Oct 15
2
converting to data.frame
dear allI have a data set with three types (Tree, Sapling, Seedling). I have estimated the correlation values. now i need to bring all the correlation values in a table like the one i have shown in attached file with R codes.could you please give me idea on this problem thanking you MSNepal _________________________________________________________________ Hotmail: Trusted email with