search for: data_frame

Displaying 20 results from an estimated 29 matches for "data_frame".

2008 Apr 27
1
parallel max, min, and median of dataframe columns
...umns. I want to show the maximum, minimum, and median with a vertical line and a central dot (I'd use a boxplot, but with only three data points, that's overkill; I can't just use points, because of overlap and some of the other data plotted on the graph). This works: > boxplot(data_frame, col="transparent", border="dark grey", xaxt="n", add=TRUE) But these don't: > st <- c(1:19) > segments(st, pmax(data_frame), st, pmin(data_frame)) (no, I haven't tried to put in the median points yet) I can plot them individually with > segmen...
2005 Aug 16
1
predict nbinomial glm
Dear R-helpers, let us assume, that I have the following dataset: a <- rnbinom(200, 1, 0.5) b <- (1:200) c <- (30:229) d <- rep(c("q", "r", "s", "t"), rep(50,4)) data_frame <- data.frame(a,b,c,d) In a first step I run a glm.nb (full code is given at the end of this mail) and want to predict my response variable a. In a second step, I would like to run a glm.nb based on a subset of the data_frame. As soon as I want to predict the response variable a, I get the foll...
2008 Aug 13
1
need help with stat functions(like adaboost, random forests and glm)
Ok, so basically I have a dataframe named data_frame data_frame contains: startdate startprice endpricethreshold1 endpricethreshold2 endpricethreshold3 all of these endpricethresholds are true/false binary vectors. They are true or false depending on whether the endprice was above or below whatever the endpricethreshold is. now I want to try to...
2006 Jan 24
1
No scientific notation in format
...0.07919450,0.02808281,0, 0.06958082 08,0,0,1.05600e+05,0.3930612, 0.0,0,0, 8.955513,0.08800232,0.28571429,0, 0.06691399 09,0,0,0.00000e+00,0.0000000,12.5,0,0,13.513589,0.05575315,0.00000000,0, 0.04875261 10,0,0,4.75889e-01,0.0000000, 0.0,0,0,10.084557,0.10251731,0.00000000,0, 0.15396753 I am using data_frame <- format(data_frame, trim = TRUE, digits = 3, nsmall = 4, width = 5) for format. And data_frame <- formatC(data_frame, digits = 3, width = 4, format = "f", mode = NULL) leads to the following error: Error in as.integer.default(floor(log10(abs(x + ifelse(x == 0, 1, 0))))) :...
2012 Jan 01
1
empty files created with trellis xyplot jpeg device
...t; <> 22376 Dec 31 16:20 isoranp-z1.zone_cpu.jpg -rw-rw-r-- 1 <> <> 18910 Dec 31 16:20 isoranp-z1.zone_mem.jpg -rw-rw-r-- 1 <> <> 0 Dec 31 16:20 isoranp-z1.zone_util.jpg # here is the gen_zone_charts function: > gen_zone_charts function(zone,year,wk){ data_frame<-get_zonedata_url(year,wk,zone) # this results in a 0 length file # i have tried using jpeg(), and trellis.device() with the same results #jpeg(file=paste("charts/",zone,".zone_util.jpg",sep="")) trellis.device(jpeg,file=paste("charts/",z...
2009 Jul 02
3
Testing for membership in an array of strings
...contains a column with text values. What I am trying to do is use the subset function on the data frame to select only data for "sue" or "jane" (for example.) But maybe I have not taken the correct approach? So obviously I could do something like the following. subset( data_frame, name = "sue" | name == "jane", select = c(name, age, birthdate)) However, my subset needs to be much more than 2 and being lazy I do not want to type "| name == "some text" for each one. Is there an other way? Neil
2002 Mar 02
1
accessing factor levels from C
Hi, I am trying to get information about factors from a C-program. As I see, the factors are basically integers with attribute ,,levels''. But unfortunately I am not been able to read the levels information. I am using: SEXP variable, levels; ... variable = VECTOR_ELT( data_frame, j); switch( TYPEOF( variable)) { case INTSXP: if( isFactor( VECTOR_ELT( data_frame, j))) { fvalue = INTEGER( variable)[i]; levels = STR_PTR( GET_LEVELS( variable)); .... but the variable levels is not an array of strings as I expected. I am probably doing something in the wr...
2017 Nov 08
2
Ggplot error
...rallel_3.4.2 survival_2.41-3 yaml_2.1.14 [66] colorspace_1.3-2 rvest_0.3.2 bindr_0.1 haven_1.1.0 > conflicts(detail = TRUE) $.GlobalEnv [1] "iris" $`package:dplyr` [1] "%>%" "%>%" "add_row" "as_data_frame" "as_tibble" "data_frame" [7] "data_frame_" "frame_data" "glimpse" "lst" "lst_" "tbl_sum" [13] "tibble" "tribble" "trunc_mat" "type_sum&...
2017 Nov 08
0
Ggplot error
...14 > [66] colorspace_1.3-2 rvest_0.3.2 bindr_0.1 haven_1.1.0 > > > > conflicts(detail = TRUE) > $.GlobalEnv > [1] "iris" > > $`package:dplyr` > [1] "%>%" "%>%" "add_row" "as_data_frame" > "as_tibble" "data_frame" > [7] "data_frame_" "frame_data" "glimpse" "lst" > "lst_" "tbl_sum" > [13] "tibble" "tribble" "trunc_mat"...
2001 Dec 19
2
R strings from C
Hi, I am trying to study R internal behaviour. So long, I have not succeeded to access the value of R strings from C. I use: void salvesta_tabel( SEXP data_frame, SEXP file ) { printf( "nimi %d\n", (R_CHAR)( file)); } and from the R side: salvesta.tabel <- function (x, file = "") { .Call( "salvesta_tabel", x, file) } When calling from R as salvesta.tabel( x, "file") R always crashes while...
2010 Aug 17
3
Weird differing results when using the Wilcoxon-test
...ly, when ties are involved 2) wilcox_test{coin}, which does calculate the distribution _exactly_ even, with ties. I have the following scenario: #---BeginCode--- # big example size = 60 big1 = rnorm(size, 0, 1) big2 = rnorm(size, 0.5, 1 g1f = rep(1, size) g2f = rep(2, size) big = c(big1, big2) data_frame = data.frame(big, gr=as.factor(c(g1f, g2f))) wilcox_approx = wilcox.test(big1, big2) wilcox_exact = wilcox_test(big ~ gr, data=data_frame, distribution="exact") #---EndCode--- I found here http://www-stat.stanford.edu/~susan/courses/s141/hononpara.pdf that wilcox.test (at least for the...
2009 Jul 21
2
Show representation of a data structure
I'm currently working with some large complex data structures eg list of lists of data_frames containing lots more variables and lists etc. Sometimes, I'd like to be able to bring up a simple representation of the structure I'm working with, minus all of the values it contains (so simply printing the variable doesn't work as its too hard to see structure when there are 1000s of...
2017 Nov 08
1
Ggplot error
...2.1.14 > [66] colorspace_1.3-2? rvest_0.3.2? ? ? ? bindr_0.1? ? ? ? ? haven_1.1.0 > > > > conflicts(detail = TRUE) > $.GlobalEnv > [1] "iris" > > $`package:dplyr` >? [1] "%>%"? ? ? ? ? "%>%"? ? ? ? ? "add_row"? ? ? "as_data_frame" > "as_tibble"? ? "data_frame" >? [7] "data_frame_"? "frame_data"? ? "glimpse"? ? ? "lst" >? "lst_"? ? ? ? ? "tbl_sum" > [13] "tibble"? ? ? ? "tribble"? ? ? "trunc_mat"? ?...
2007 Jun 05
4
Refactor all factors in a data frame
...levels of the factors seem to be the same as in the original data frames, probably because subset() calls [.factor without drop = TRUE (that's what I gather from scanning the mailing lists). I wonder if there is a easy way to refactor all factors in the data frame at once. I noted that fix(data_frame) does the trick, however, this needs user interaction, which I'd like to avoid. Subsequent write.table / read.table would be another option but I'm not sure if R can guess the factor/char/numeric-type correctly when reading the table. So, is there any way in drop the unused factor level...
2017 Nov 08
0
Ggplot error
...2.1.14 > [66] colorspace_1.3-2 rvest_0.3.2 bindr_0.1 haven_1.1.0 > > > > conflicts(detail = TRUE) > $.GlobalEnv > [1] "iris" > > $`package:dplyr` > [1] "%>%" "%>%" "add_row" "as_data_frame" > "as_tibble" "data_frame" > [7] "data_frame_" "frame_data" "glimpse" "lst" > "lst_" "tbl_sum" > [13] "tibble" "tribble" "trunc_mat"...
2006 Sep 14
2
Adding predicted values as a new variable in a data frame
I am running a regression: ols.reg1 <- lm(y ~ x1 + x2 + x3 + x4) on a data.frame and then generating fitted values: y.hat <- ols.reg1$fitted.values Then I would like to add these fitted values to the data.frame as a new variable. The problem is that when the values are predicted the resulting output has too few rows. for some reason certian observations do not get predicted values. So
2017 Oct 16
1
Download data from NASA for multiple locations - RCurl
I have done the following using readLines directory <- "~/" files <- list.files(directory) data_frames <- vector("list", length(files)) for (i in seq_along(files)) { df <- readLines(file.path(directory, files[i])) df <- df[-(1:13)] df <- data.frame(year = substr(df,1,4), month = substr(df, 6,7), day = substr(df, 9, 10),...
2017 Sep 04
1
Dataframe Manipulation
...imilar, and the logic is identical: > > library(readr) > library(dplyr) > library(stringr) > library(tidyr) > > data_help <- read_csv("data_help.csv") > cat_help <- read_csv("cat_help.csv") > > # Helper function to split the Items and create a data_frame > split_items <- function(items){ > x <- items$Items_purchased_on_Receipts %>% > str_split(pattern = ",") %>% > unlist(use.names = FALSE) > > data_frame(Item = x, Purchase_ID = items$Purchase_ID) > } > > data_help <- > data_help %...
2017 Aug 31
0
Dataframe Manipulation
Hi Hemant, the solution is really quite similar, and the logic is identical: library(readr) library(dplyr) library(stringr) library(tidyr) data_help <- read_csv("data_help.csv") cat_help <- read_csv("cat_help.csv") # Helper function to split the Items and create a data_frame split_items <- function(items){ x <- items$Items_purchased_on_Receipts %>% str_split(pattern = ",") %>% unlist(use.names = FALSE) data_frame(Item = x, Purchase_ID = items$Purchase_ID) } data_help <- data_help %>% mutate(Purchase_ID = 1:n()) %>% gro...
2017 Aug 30
1
Dataframe Manipulation
by using these two tables we have to create third table in this format where categories will be on the top and transaction will be in the rows, On 30 August 2017 at 16:42, Hemant Sain <hemantsain55 at gmail.com> wrote: > Hello Ulrik, > Can you please once check this code again on the following data set > because it doesn't giving same output to me due to absence of quantity,a