search for: bind_row

Displaying 20 results from an estimated 41 matches for "bind_row".

Did you mean: bind_rows
2023 Apr 03
4
Simple Stacking of Two Columns
...n NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly")) > NamesLong Names 1 Tom 2 Dick 3 Larry 4 Curly Stack produces an error NamesLong<-stack(NamesWide$Name1,NamesWide$Names2) Error in if (drop) { : argument is of length zero So does bind_rows > NamesLong<-dplyr::bind_rows(NamesWide$Name1,NamesWide$Name2) Error in `dplyr::bind_rows()`: ! Argument 1 must be a data frame or a named atomic vector. Run `rlang::last_error()` to see where the error occurred. I tried making separate dataframes to get around the error in bind_rows but it...
2024 Apr 16
5
read.csv
...c 1433 which only alerts me when I tried to combine data, all_data <- data.frame() for (protein in proteins[1:7]) { cat(protein,":\n") f <- paste0(protein,".csv") if(file.exists(f)) { p <- read.csv(f) print(p) if(nrow(p)>0) all_data <- bind_rows(all_data,p) } } proteins[1:7] [1] "1433B" "1433E" "1433F" "1433G" "1433S" "1433T" "1433Z" dplyr::bind_rows() failed to work due to incompatible types nevertheless rbind() went ahead without warnings. Best wishes, Jing Hu...
2023 Apr 03
1
Simple Stacking of Two Columns
...Dick","Larry","Curly")) > > NamesLong > Names > 1 Tom > 2 Dick > 3 Larry > 4 Curly > > > Stack produces an error > NamesLong<-stack(NamesWide$Name1,NamesWide$Names2) > Error in if (drop) { : argument is of length zero > > So does bind_rows > > NamesLong<-dplyr::bind_rows(NamesWide$Name1,NamesWide$Name2) > Error in `dplyr::bind_rows()`: > ! Argument 1 must be a data frame or a named atomic vector. > Run `rlang::last_error()` to see where the error occurred. > > I tried making separate dataframes to get around...
2018 May 03
0
Converting a list to a data frame
...) > , stringsAsFactors = FALSE > ) > D$data <- L > unnest(D, data) > #> Type x y > #> 1 A 1 3 > #> 2 A 2 4 > #> 3 B 5 7 > #> 4 B 6 8 > ######## I think a slightly more idiomatic tidyverse solution is dplyr::bind_rows() l <- list( A = data.frame(x = 1:2, y = 3:4), B = data.frame(x = 5:6, y = 7:8) ) dplyr::bind_rows(l, .id = "type") #> type x y #> 1 A 1 3 #> 2 A 2 4 #> 3 B 5 7 #> 4 B 6 8 This also has the advantage of returning a data frame when the inputs are dat...
2023 Apr 04
1
Simple Stacking of Two Columns
...t;> NamesLong >> Names >> 1 Tom >> 2 Dick >> 3 Larry >> 4 Curly >> >> >> Stack produces an error >> NamesLong<-stack(NamesWide$Name1,NamesWide$Names2) >> Error in if (drop) { : argument is of length zero >> >> So does bind_rows >>> NamesLong<-dplyr::bind_rows(NamesWide$Name1,NamesWide$Name2) >> Error in `dplyr::bind_rows()`: >> ! Argument 1 must be a data frame or a named atomic vector. >> Run `rlang::last_error()` to see where the error occurred. >> >> I tried making separate da...
2023 Apr 04
1
Simple Stacking of Two Columns
...quot;,"Larry","Curly")) > > NamesLong > Names > 1 Tom > 2 Dick > 3 Larry > 4 Curly > > > Stack produces an error > NamesLong<-stack(NamesWide$Name1,NamesWide$Names2) > Error in if (drop) { : argument is of length zero > > So does bind_rows > > NamesLong<-dplyr::bind_rows(NamesWide$Name1,NamesWide$Name2) > Error in `dplyr::bind_rows()`: > ! Argument 1 must be a data frame or a named atomic vector. > Run `rlang::last_error()` to see where the error occurred. > > I tried making separate dataframes to get around...
2018 May 02
3
Converting a list to a data frame
Another approach: ######## library(tidyr) L <- list( A = data.frame( x=1:2, y=3:4 ) , B = data.frame( x=5:6, y=7:8 ) ) D <- data.frame( Type = names( L ) , stringsAsFactors = FALSE ) D$data <- L unnest(D, data) #> Type x y #> 1 A 1 3 #> 2 A 2 4 #> 3 B 5 7 #> 4 B 6 8 ######## On Wed, 2 May 2018, Eivind K.
2024 Apr 16
1
read.csv
...> all_data <- data.frame() > for (protein in proteins[1:7]) > { > cat(protein,":\n") > f <- paste0(protein,".csv") > if(file.exists(f)) > { > p <- read.csv(f) > print(p) > if(nrow(p)>0) all_data <- bind_rows(all_data,p) > } > } > > proteins[1:7] > [1] "1433B" "1433E" "1433F" "1433G" "1433S" "1433T" "1433Z" > > dplyr::bind_rows() failed to work due to incompatible types nevertheless rbind() went ahead witho...
2024 Apr 16
1
read.csv
...ta, > > all_data <- data.frame() > for (protein in proteins[1:7]) > { > cat(protein,":\n") > f <- paste0(protein,".csv") > if(file.exists(f)) > { > p <- read.csv(f) > print(p) > if(nrow(p)>0) all_data <- bind_rows(all_data,p) > } > } > > proteins[1:7] > [1] "1433B" "1433E" "1433F" "1433G" "1433S" "1433T" "1433Z" > > dplyr::bind_rows() failed to work due to incompatible types nevertheless rbind() went ahead without...
2017 Aug 04
1
Restructuring Star Wars data from rwars package
I'm having trouble restructuring data from the rwars package into a dataframe. Can someone help me? Here's what I have... library("rwars") library("tidyverse") # These data are json, so they load into R as a list people <- get_all_people(parse_result = T) people <- get_all_people(getElement(people, "next"), parse_result = T) # Look at Anakin
2017 Feb 15
2
convertir múltiples listas de múltiples dataframes en un único dataframe
Carlos: Agradecido por tu interés. Adjunto la lista que me solicitas. Saludos, Manuel --- _______________________________________________________ El 15/02/2017 17:45, Carlos Ortega escribió: > Hola, > > ¿Puedes pasar parte de estas listas para no picar un ejemplo desde cero... ? > Puedes pasarlo en un fichero ".RData" Y si te da problemas el adjuntarlo a toda la
2024 Apr 16
1
read.csv
...ine data, > > all_data <- data.frame() > for (protein in proteins[1:7]) > { > cat(protein,":\n") > f <- paste0(protein,".csv") > if(file.exists(f)) > { > p <- read.csv(f) > print(p) > if(nrow(p)>0) all_data <- bind_rows(all_data,p) > } > } > > proteins[1:7] > [1] "1433B" "1433E" "1433F" "1433G" "1433S" "1433T" "1433Z" > > dplyr::bind_rows() failed to work due to incompatible types nevertheless rbind() went ahead without...
2024 Feb 29
1
R 4.3.3 is released
The build system rolled up R-4.3.3.tar.gz and .xz (codename "Angel Food Cake") this morning. This is a minor update, intended as the wrap-up release for the 4.3.x series. This also marks the 6th anniversary of R-1.0.0. (2000-02-29) The list below details the changes in this release. You can get the source code from https://cran.r-project.org/src/base/R-4/R-4.3.3.tar.gz
2024 Feb 29
1
R 4.3.3 is released
The build system rolled up R-4.3.3.tar.gz and .xz (codename "Angel Food Cake") this morning. This is a minor update, intended as the wrap-up release for the 4.3.x series. This also marks the 6th anniversary of R-1.0.0. (2000-02-29) The list below details the changes in this release. You can get the source code from https://cran.r-project.org/src/base/R-4/R-4.3.3.tar.gz
2024 Feb 29
1
R 4.3.3 is released
The build system rolled up R-4.3.3.tar.gz and .xz (codename "Angel Food Cake") this morning. This is a minor update, intended as the wrap-up release for the 4.3.x series. This also marks the 6th anniversary of R-1.0.0. (2000-02-29) The list below details the changes in this release. You can get the source code from https://cran.r-project.org/src/base/R-4/R-4.3.3.tar.gz
2018 Aug 09
2
vctrs: a type system for the tidyverse
...n of two factors with different levels (or even > levels in a different order) should give an error. Which R currently > doesn't throw, so I get there's room for improvement. I 100% agree with you, and is this the behaviour that vctrs used to have and dplyr currently has (at least in bind_rows()). But pragmatically, my experience with dplyr is that people find this behaviour confusing and unhelpful. And when I played the full expression of this behaviour in vctrs, I found that it forced me to think about the levels of factors more than I'd otherwise like to: it made me think like a...
2017 Dec 14
2
help with recursive function
...sdf <- lapply(s, function(x) { data.frame(x, x$outlier <- ifelse(is.na(x$lp_norm), NA, ifelse(abs(x$lp_norm) == x$norm_max, "yes", "no")), x$lp <- with(x, ifelse(outlier == "yes", NA, lp))) x }) sdf2 <- bind_rows(sdf) all_dat <- bind_rows(df_clean, sdf2) all_dat } # funlp2 function funlp2<-function (dataset) { data1 <- dataset df_clean <- with(data1, data1[norm_sd < 1, ]) datD <- with(data1, data1[norm_sd >= 1, ]) s <- split(datD, datD$uniqueid)...
2016 Aug 15
2
ifelse() woes ... can we agree on a ifelse2() ?
...uld like to make sure that this remains an error: > > if_else(x > 5, x, "BLAH") > > Because that seems more likely to be a user error (but reasonable > people might certainly believe that it should just work) > > dplyr is more accommodating in other places (i.e. in bind_rows(), > collapse() and the joins) but it's surprisingly hard to get all the > details right. For example, what should the result of this call be? > > if_else(c(TRUE, FALSE), factor(c("a", "b")), factor(c("c", "b")) > > Strictly speaking I...
2017 Dec 14
0
help with recursive function
...ata.frame(x, x$outlier <- ifelse(is.na(x$lp_norm), NA, > > ifelse(abs(x$lp_norm) == x$norm_max, "yes", "no")), > > x$lp <- with(x, ifelse(outlier == "yes", NA, lp))) > > x > > }) > > sdf2 <- bind_rows(sdf) > > all_dat <- bind_rows(df_clean, sdf2) > > all_dat > > } > > > # funlp2 function > > funlp2<-function (dataset) > > { > > data1 <- dataset > > df_clean <- with(data1, data1[norm_sd < 1, ]) > > datD &...
2017 Dec 14
2
help with recursive function
...a(x$lp_norm), NA, >> >> ifelse(abs(x$lp_norm) == x$norm_max, "yes", "no")), >> >> x$lp <- with(x, ifelse(outlier == "yes", NA, lp))) >> >> x >> >> }) >> >> sdf2 <- bind_rows(sdf) >> >> all_dat <- bind_rows(df_clean, sdf2) >> >> all_dat >> >> } >> >> >> # funlp2 function >> >> funlp2<-function (dataset) >> >> { >> >> data1 <- dataset >> >> df_c...