similar to: deleting column from data frame

Displaying 20 results from an estimated 7000 matches similar to: "deleting column from data frame"

2010 Feb 22
3
gsub patterns from vector elements w/out loop?
Dear list, I have two vectors: x <- c("one","two") y <- paste(rep(x,2),"blah") I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] "something else blah" "something else blah" "something else blah" [4] "something else blah" I can do this using a loop: for (
2009 Oct 09
3
"Use R" -- term and logo copyright?
Dear list, I would like to start some R workshops at King's College London, and to do so, I would like to use the "Use R!" logo at http://www.agrocampus-ouest.fr/math/useR-2009//useR%21%202008_fichiers/useR-middle.png Since it seems to be difficult to get a shell account at KCL, I also went ahead and registered use-r.org.uk and am starting to put together a website at
2010 Nov 29
1
cross tabulate variables by subject id
Dear list, I have data like this: dat1 <- data.frame(subject=rep(1:10,2), cond1=rep(c("A","B"),each=5), cond2=rep(c("C","D"),each=10), choice=sample(0:1,10,replace=TRUE)) I would like to compare subjects' "choice" for (cond1=="A" & cond2=="C") vs
2011 Feb 02
1
pass nrow(x) to dots in function(x){plot(x,...)}
Dear Rers, I have a function to barplot() a matrix, eg myfun <- function(x, ...) { barplot(x , ... )} (The real function is more complicated, it does things to the matrix first.) So I can do: m1 <- matrix(1:20,4) myfun(m1) myfun(m1, main="My title") I'd like to be able to add the number of rows of the matrix passed to the function to the "..." argument, eg
2010 Aug 24
1
Index list by other list (w/ logical elements)?
I have two lists of the same shape, like this: x <- list() x[[1]] <- c("one","two") x[[2]] <- c("three","four","five") y <- list() y[[1]] <- c(TRUE,FALSE) y[[2]] <- c(FALSE,TRUE,TRUE) I would like to index x "by" y, that is, the result in this case should be: z [[1]] [1] "one" [[2]] [1] "four"
2009 Dec 12
1
read.csv to read output of system()?
Dear list, I have a file that is comma delimited but contains some erroneous non-delimiter commas. I would like to replace these commas with semicolons and then read the correct file into R as a data frame. I want to do this from within R, without changing the original data file. My current idea of how to do this would be to use system("sed ...") and feed the result to read.csv(), but
2009 Oct 03
2
add lines() to 1st plot in layout() after calling 2nd plot()?
Dear R users, I create a graphic with two plots side by side using layout(), like this: layout(matrix(c(1,2),1)) plot(1:10,main="left plot") lines(c(3:7,7:3),col="red") plot(10:1,main="right plot") The lines() obivously get added to the "left plot" plot. Now, I'm trying to write a function that builds up a plot bit by bit to then include it in a
2010 Nov 09
2
new column from column in another df
If I have a data frame where a species occupies several rows with different phases such as (both col's ar factors): species,phase Populus tremula,1 Populus tremula,2 Populus tremula,3 Calluna vulgaris,1 Calluna vulgaris,2 Betula alba,1 Betula alba,2 Betula alba,3 Primula veris,1 Primula veris,2 and another df where each species only have one row: species,growth_form Populus tremula,tree Acer
2009 Sep 02
1
get function to return object "name"?
Dear list, I've written a function that plots subjects. Something like: myplot <- function(subject) { plot(subject) } Subjects are vectors, e.g. ... s1 <- c(200,200,190,180) ... and plotting them works fine, e.g. ... myplot(s1) Now I want to have "s1" etc appear in the plot title, but I don't know how to refer to this generically (the object "name"? I tried
2008 Oct 05
1
barchart for aggregated (sum) data in lattice?
Hi list, I have data in a dataframe t1, with a column for different amounts spent, a column what it was spent on, and a column with dates, from which I create a new column with months. Example: amount <- rep(c(10,20,30),3) what <- rep(c("food","books","cycling"),3) when <- c(rep("2008-09-05",5),rep("2008-10-07",4)) t1 <-
2006 Feb 17
4
showing the integrated number by point size
Is there any function to show the points like this example of SPSS? http://biostatistic.de/temp/reg.jpg The point size should represent the number of data at this point. with regards Knut Krueger
2008 Feb 26
1
Split data.frames depeding values of a column
Hello to all is there a function wich splits a data.frame (column1,column2,column3,....) into data1 <-(column1,column3....) #column2 = 1 data2 <-(column1,column3....) #column2 = 2 data3 <-(column1,column3....) #column2 = 3 ... Regards Knut
2010 Nov 09
4
help to add a new column filled with value 1
Dear All, I have a data frame with 5 column and 201 row data. I want to add one more column between column 1 and 2 with value of 1. So the new column has to be the second column filled with 1. Any help will be appreciated. Thanks for your time. Thanks & Rg Mohan L
2005 Jul 12
5
High resolution plots
Is there any possibility to get high resolution plots in a windows xp system? I tried it with the device function png(filename = "c:/r/highresplot%d.png",pointsize=12, res=900) but when I try to set: width = 480, height = 480 or pointsize = 12, the text is not scaled in the same way as the plots. with regards Knut Krueger http://www.biostatistic.de
2009 Dec 23
7
String question
Hi to all I need a string like temp <- paste("m1","m2","m3",sep=",") But i must know how many items are in the string,afterwards the other option would be to use a vector temp <- c("m1","m2","m3") No problem to get the count of items but I must get afterwards the string "m1,m2,m3" No problem to build the
2009 Oct 03
1
if else statement error
Hello, I am doing a if else statement in R. But it always comes out error such as 'unexpected symbol' There are two variables. ini and b. when ini=1, a=3; when ini>1 and b>2, a=3; all other situations, a=6. I don't know where it is wrong. Here is my code ini=3 b=4 if (ini==1) { a=3 } else if (ini>1 and b>2 ) { a=3 } else {a=6} Thanks a
2010 Jan 31
1
Help with R in ubuntu
Dear R users: Maybe it is a silly question, but I'm don't understand what am I doing wrong. In a new karmik koala ubuntu installation I compile the last patched 2.10.1 version of R. Every thing was right (I install all the dev libraries I need). First I type: ./configure --enable-R-shlib And I obtain: R is now configured for i686-pc-linux-gnu Source directory: .
2010 Nov 11
2
Number above the bar?
Hi I got an barplot, and I would like to have the exact number of the bars just above the bars anyone know how to do this? Sorry for bad English, and I do hope that you understand what im after. //Joel -- View this message in context: http://r.789695.n4.nabble.com/Number-above-the-bar-tp3037438p3037438.html Sent from the R help mailing list archive at Nabble.com.
2005 Jul 13
3
texture in barplots?
Dear R list, For some reason I am unable to access neither search.r-project.org, nor http://finzi.psych.upenn.edu/ so I cannot search the archives for a possible answer (I Googled for this but didn't find anything). Is it possible to draw barplots using a texture instead of colors, for a black and white printer? TIA, Adrian -- Adrian Dusa Arhiva Romana de Date Sociale Bd. Schitu
2005 Aug 09
5
RGUI crash when opening script in XP Home enviroment
If there is a helpfile open (f.e ?glm) and it is the top window, then an exception error occurs (closing RGUI) when I hit the open file button. If the helpfile is not the top window (of the RGUI) I am able to open a new script without any error. The RGUI is not closing complete there is a blank screen left which I have to close with the X Button or Taskmanager Windows XP Home - German Version