Re: [R] Question
Sorry, I don’t think you understand my problem. dta = spark_read_csv(sc,”data_tbl”,”extension/file",delimiter = "|") dta is just a pointer to spark where the data is stored. I am using sparklyr to run this on spark. I’m not running it locally so I can’t use the $. I know how to do this locally in R. Thanks, Amrith > On Jun 22, 2017, at 4:52 PM, Jeff Newmiller wrote: > > Rows are horizontal, columns are vertical. > > You really need to spend some time with an R tutorial. > > dta <- read.table( "yourfile", header=TRUE, as.is=TRUE ) > dta2 <- dta > dta2$D <- c( "awe", "abcd", "asdf", "xyz" ) > dta2 <- dta2[ , c( "A", "D" ) ] > -- > Sent from my phone. Please excuse my brevity. > > On June 22, 2017 11:22:57 AM PDT, Amrith Deepak wrote: >> Hi, >> >> I am using Spark and the Sparklyr library in R. >> >> I have a file with several lines. For example >> >> A B C >> awer.ttp.netCode554 >> abcd.ttp.netCode747 >> asdf.ttp.netPart554 >> xyz.ttp.net Part747 >> I want to split just column A of the table and I want a new row added >> to the table D, with values awe, abcd, asdf, and xyz. I am trying to >> use a command in the sparkly library to do that. If that’s not >> possible, can you please show me another way to do it. >> >> >> Thanks, >> Amrith >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question
This function won’t work with objects in spark as you can’t do a dfda$a in spark as it’s not stored as a local variable. Thanks, Amrith > On Jun 22, 2017, at 4:15 PM, David Winsemius wrote: > > >> On Jun 22, 2017, at 11:22 AM, Amrith Deepak wrote: >> >> Hi, >> >> I am using Spark and the Sparklyr library in R. >> >> I have a file with several lines. For example >> >> A B C >> awer.ttp.netCode554 >> abcd.ttp.netCode747 >> asdf.ttp.netPart554 >> xyz.ttp.net Part747 >> I want to split just column A of the table and I want a new row added to the >> table D, with values awe, abcd, asdf, and xyz. I am trying to use a command >> in the sparkly library to do that. If that’s not possible, can you please >> show me another way to do it. >> > > Something along lines of: > > dfrm$D <- sapply( strsplit( dfrm$A, "\\.") , "[[", 1) > > > >> Thanks, >> Amrith >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question
Hi, I am using Spark and the Sparklyr library in R. I have a file with several lines. For example A B C awer.ttp.netCode554 abcd.ttp.netCode747 asdf.ttp.netPart554 xyz.ttp.net Part747 I want to split just column A of the table and I want a new row added to the table D, with values awe, abcd, asdf, and xyz. I am trying to use a command in the sparkly library to do that. If that’s not possible, can you please show me another way to do it. Thanks, Amrith [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.