similar to: How to apply five lines of code to ten dataframes?

Displaying 20 results from an estimated 6000 matches similar to: "How to apply five lines of code to ten dataframes?"

2005 Jul 19
2
Regression lines for differently-sized groups on the same plot
Hi there, I've looked through the very helpful advice about adding fitted lines to plots in the r-help archive, and can't find a post where someone has offered a solution for my specific problem. I need to plot logistic regression fits from three differently-sized data subsets on a plot of the entire dataset. A description and code are below: I have an unbalanced dataset
2012 May 28
1
Why R order files as 1 10 100 not 1 2 3 ?
The code given below worked well. However, the problem is that when I typed dir1 to see the results I found that R order the files as: [1] "data1.flt" "data10.flt" "data100.flt" "data101.flt" [5] "data102.flt" "data103.flt" "data104.flt" "data105.flt" [9] "data106.flt" "data107.flt"
2008 Sep 03
1
Read from many files into many object
Dear all, I am new in R. I want to read data which is vector from many files and import to many object. For example I have 10(ten) files. file1.txt file2.txt : : file10.txt. I want to import each file into one object as follows. data1 data2 : : data10 I want to import file1.txt into data1, file2.txt into data2, and so on. How to do it quickly? Thanks in advance. Sigit B. Wibowo
2009 Jun 04
3
Plot and lm
I want to make a log-log plot with a regression line, but I can't figure out what I'm doing wrong. What I'm trying is: plot(mass,area, log="xy", pch=as.numeric(food)) abline(lm(mass~area)) or plot(mass,area, log="xy", pch=as.numeric(food)) islands$logmass <- log(mass) islands$logarea <- log(area) attach(islands) abline(lm(logmass~logarea)) But that does
2011 Jul 16
1
Creating composite factor and changing format from character to factor
Dear Help-list, I have a dataframe containing 6 variables, 4 of which are factors, 2 numeric. I want to create another factor variable (SitePos) by combining 2 existing factors (Site and Position). I have tried a number of approaches based on trolling the R FAQs, various R webpages, etc., none of which work. One approach e.g. Data1$SitePos <- paste(Data1$Site, Data1$Position) creates the
2017 Dec 11
1
file creating
I am using R(3.4.3), Win 7(extreme edition) 32 bit, I have 10 excel files data1,xls, data2.xls .. till data10.xls. I want to create 10 dataframes . How to do ? regards Parth [[alternative HTML version deleted]]
2006 Sep 13
2
recursive methods for concatenating sets of files
Hello, I would like to read sets of files within a folder, perhaps using recursive methods. Right now, I rename the files before import. It would be even better to do this without renaming files, without providing explicit filenames, perhaps by importing files based on chronology, and translating each filename into a header? Please excuse my ignorance, and help cure my clunky programming
2011 Oct 02
2
subset in dataframes
I need help in subseting a dataframe: data1<-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004, 2001,2002,2003,2004,2001,2002,2003,2004), firm=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),x=c(11,22,-32,25,-26,47,85,98, 101,14,87,56,12,43,67,54), y=c(110,220,302,250,260,470,850,980,1010,140,870,560,120,430,670,540)) data1 I want to keep the firms where all x>0 (where there are
2011 Oct 07
2
Merge dataframes
Hello, I am having some problems to use the 'merge' function. I'm not sure if I got its working right. What I want to do is: 1) Suppose I have a dataframe like: height width 1 1.1 2.3 2 2.1 2.5 3 1.8 1.9 4 1.6 2.1 5 1.8 2.4 2) And I generate a second
2011 Jun 22
1
lme convergence failure within a loop
Hi R-users, I'm attempting to fit a number of mixed models, all with the same structure, across a spatial grid with data points collected at various time points within each grid cell. I'm trying to use a 'for' loop to try the model fit on each grid cell. In some cells lme does not converge, giving me the error: Error message: In lme.formula(logarea ~ year + summ_d, data =
2011 Jul 18
1
Multiple comparison test on selected contrasts
Dear Help-list, How can I do a multiple comparison test (mct) on selected contrasts from a linear model while using packages lme4 and multcomp? I am running R 2.13.0 under Windows 7. The following linear model and mct produces a global mct of 15 paired contrasts of the combined (Site, Position) factor SitePos of which only 9 are of interest. Model.G = lmer(log10(SrCa) ~ SitePos + (1 | Eel),
2010 Dec 07
4
Creating binary variable depending on strings of two dataframes
Hi, consider the following two dataframes: x1=c("232","3454","3455","342","13") x2=c("1","1","1","0","0") data1=data.frame(x1,x2) y1=c("232","232","3454","3454","3455","342","13","13","13","13")
2010 Feb 19
1
order two dataframes by an integer column from either data frame
Hi, I'm an R nooob! So please pardon this easy question! I have two data frames that share a common column, data1.name and data2.name. How would I be able to order the other based on an integer column from either data frame? For example, how do I order data2 based on data1.age? Or data1 based on data2.salary? Thanks! Paul -- Paul Rigor Pre-doctoral BIT Fellow and Graduate Student
2008 May 14
2
dataframes to a list
Hi R, I have the data frames, data1, data2....data50. Now I want to put all of these in a single list. But, >list(data1, data2,.........data50) is very big to write. How do I then do it? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}}
2007 Feb 27
1
interactions and GAM
Dear R-users, I have 1 remark and 1 question on the inclusion of interactions in the gam function from the gam package. I need to fit quantitative predictors in interactions with factors. You can see an example of what I need in fig 9.13 p265 from Hastie and Tibshirani book (1990). It's clearly stated that in ?gam "Interactions with nonparametric smooth terms are not fully
2006 Mar 10
1
Winbind for five minutes?
Okay, I'm having some weird Windbind issues. Here's my plea below: Okay, here's my setup: SLES9 | Samba Version 3.0.4 | Winbind | W2K3-SP1 Active Directory Domain I have kerberos configured properly, I can successfully run this command: # knit domainuser domainuser@TESTDOMAIN.ORG's Password: kinit: NOTICE: ticket renewable lifetime is 1 week and succesfully joined the
2009 Feb 02
0
Using Information from the Stats4 package in base envir
Hi. Thank you very much in advance for your help. I have generated data from two simple linear models and used k-means clustering (stats4) to identify two clusters in the generated data. Next, I would like to do simple linear regression for each separate cluster. I can do this if I first use the cluster labels to define two separate data frames with the subset function. However, I would
2009 Nov 13
4
cleanse columns and unwanted rows
hello folks, Im trying to clean out a large file with data i dont need. The column im manipulating in the file is called "legal_status" There are three kinds of rows i want to remove. Those that have "Private", "Private (Op", or "Unknown" in the legal_status column. I wrote this code but i get errors and it says im missing a TRUE/ False thingy...im
2010 Jan 05
1
Errno::ENETUNREACH (Network is unreachable - connect(2)):
I am trying to run my first app on the Solaris server, in a production environment. I get a network unreachable. Why? Does it belongs to database.yml config? Processing CategoriesController#index (for 10.3.70.129 at 2010-01-05 14:00:47) [GET] Errno::ENETUNREACH (Network is unreachable - connect(2)): /usr/ruby-enterprise/lib/ruby/1.8/net/http.rb:560:in `initialize''
2010 Sep 06
1
combining collumns for data.frames
Hi This question is far less simple than the title suggests, please read carefully, thanks. I have 2 sets of data, both read into R >data1<-read.table ("1.txt", header=T, sep="\t") >data2<-read.table ("2.txt", header=T, sep="\t") >data1 Taxon stage1 stage2 stage3 stage4 T1 0 0 1 1 T2 0