search for: my_df

Displaying 12 results from an estimated 12 matches for "my_df".

2009 Oct 29
1
Basic question ( too broad for help topics).
I have searched help topics but don't know exactly what to search for. Need to use my_num to find any matching STREPs in my_df my_num <- c("101","102","103","104","105","107","108","112","113","114","115") ## "my_df" has 8,000 different STREPS in it. ## I have a statement where I can select ONE it...
2006 Nov 09
1
POSIXlt converted to POSIXct in as.data.frame()
...e is included in a data frame: my_POSIX <- strptime(c("11-09-2006", "11-10-2006", "11-11-2006", "11-12-2006", "11-13-2006"), "%m-%d-%Y") str(my_POSIX) my_Date <- as.Date(my_POSIX) str(my_Date) data <- format(my_Date) str(data) my_DF <- data.frame(my_POSIX) str(my_DF) DF_Date <- as.Date(my_DF$my_POSIX) str(DF_Date) DF_Date The consequence (for my LC_TIME and machine time zone) is that when as.Date() is applied to the data frame column, it dispatches on as.Date.POSIXct() not as.Date.POSIXlt(), causing a day shift (actua...
2013 Mar 20
3
summarize dataframe based on multiple cols, not their combinations
...of giving summaries for every combination of categorical columns, I want it for each value of each categorical column regardless of the other columns. I could do this with three different commands, but i'm wondering if there's a more elegant way that I'm missing. Thanks! allie > my_df = data.frame(a = c(1,1,1,0,0,0), b=c(0,0,0,1,1,1), c=c(1,0,1,0,1,0), dat=c(10,11,12,13,14,15)) > my_df a b c dat 1 1 0 1 10 2 1 0 0 11 3 1 0 1 12 4 0 1 0 13 5 0 1 1 14 6 0 1 0 15 > # not what I want > ddply(my_df, .(a,b,c), function(x) c("mean"=mean(x$dat), "n&quot...
2011 Nov 03
2
query about counting rows of a dataframe
Dear R users, I have got the following data frame, called my_df: gender day_birth month_birth year_birth labour 1 F 22 10 2001 1 2 M 29 10 2001 2 3 M 1 11 2001 1 4 F...
2008 Jan 22
2
contingency table on data frame
...gories(numbers in this case) that appears for a given factor. Example: > l <- c("Yes", "No", "Perhaps") > x <- factor( sample(l, 10, replace=T), levels=l ) > m <- c(1:5) > y <- factor( sample(m, 10, replace=T), levels=m ) > z = c(1:10) > my_df = data.frame("Z" = z, "Y"= y, "X" = x) > my_df Z Y X 1 1 4 Yes 2 2 1 No 3 3 2 Perhaps 4 4 3 Yes 5 5 4 No 6 6 5 No 7 7 1 Yes 8 8 4 Perhaps 9 9 4 Yes 10 10 2 Perhaps > I am now looking for a table that wi...
2012 Sep 13
1
remove all terms with interaction factor in formula
...t;a:b" "a:c" [7] "b:c" "a:d" "b:d" "c:d" "a:b:c" "a:b:d" [13] "a:c:d" "b:c:d" "a:b:c:d" My eventual use is to fit models with the reduced formulas. For example: > my_df = data.frame( iv = runif(100), a=runif(100), b=runif(100), c=runif(100), d=runif(100)) > lm(iv ~ a*b*c*d, data=my_df) I can remove particular terms with update(), but I don't see a way to remove all terms that contain a given combination of factors. Any help would be greatly appreciated....
2007 Jun 06
1
spgrass6 and aggregation (bis)
Dear all, I have some additionale question concerning the spgrass6 package. * When you set a region in GRASS, does the readGRASS6 function in R only load data contained in the zoomed region or the whole map ? * When you have a MASK map in grass, does the readGRASS6 function in R only load data contained inside the MASK area ? Could this be the problem ? Thanks, Jessica
2023 Jun 04
2
Adding a numeric class to a data.frame
R-Help Community How do I add a numeric class to a data .frame. For example, I have calculated the following probabilities 1 2 3 0.0011566127 0.0009267028 0.0081623324 How would I add them back into my data.frame for example My_df <- data.frame(col_1 = c('A', 'B', 'C')) such that I end up with col_1 col_2 A 0.0011566127 Though I could use a cbind. Jeff [[alternative HTML version deleted]]
2008 Jul 22
5
How to filter a data frame?
I have a question about how to filter the data frame: Suppose my data frame has variables like gender, age,... How to get a subset of the data frame, with only female (or male) and/or age > 50...? What is the typical syntax? I tried several condition expressions, but none of them worked... Thanks a lot! -- View this message in context:
2018 May 22
3
legend order in ggplot2
Hi, I'd like to graph three lines on ggplot2 and I intend the lines to be "solid", "dashed", and "dotted". The legend names are "name_b", "name_a", "name_c". I'd like to legend to present in the order: the "name_b" at the top, and "name_c" at the bottom. As a consequence, the legend is indeed in the order:
2006 May 01
3
Repeat dataframe
Hi R list: How can I "repeat" a data frame n times (with n>1000), and obtain a new data frame where all the n data frames are binded by rows? Thank you for your help Kenneth -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
2011 Feb 01
1
sqlsave and mysql database with autoincremental column
...columns (the 45th is an autoincremental column). With the following commands, colnames(df)<- a vector with the names of the 44 columns ch<-odbcDriverConnect(connection="SERVER=localhost;DRIVER=MySQL ODBC 5.1 Driver;DATABASE=my_db;UID=usercount;PWD=my_pwd;case=tolower") sqlSave(ch,my_df, "my_table", append = TRUE, rownames = FALSE, fast=FALSE) odbcClose(ch) I got the following message (in french, sorry): Erreur dans dimnames(x) <- dn : la longueur de 'dimnames' [2] n'est pas ?gale ? l'?tendue du tableau It means something like: the length of 'di...