Skip to content
Prev 392152 / 398502 Next

printing with bothe print and cat...

Here is an alternative that makes a dataframe and then prints the dataframe.
n_rows <- 5
n_cols <- 5
p_mat<-matrix(0,nrow=n_rows,ncol=n_cols)
for(i in 1:n_rows) {
  for(j in 1:n_cols){
    p_mat[i,j]<-(j)
  }
}
p_df <- data.frame(p_mat,1:n_rows)
print(p_df)


Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of akshay kulkarni
Sent: Saturday, July 9, 2022 1:02 PM
To: David Winsemius <dwinsemius at comcast.net>
Cc: R help Mailing list <r-help at r-project.org>
Subject: Re: [R] printing with bothe print and cat...

[External Email]

Dear David,
                    THe code given was a reprex, and unfortunately, I cannot skip the for loops: Its a very big  web scraping code. Any alternative?

Many thanks in advance...

Yours sincrely,
AKSHAY M KULKARNI
Message-ID: <BN6PR2201MB155324CBC9C8C91B89C32FF1CF859@BN6PR2201MB1553.namprd22.prod.outlook.com>
In-Reply-To: <PU4P216MB15689EED85F17F711D8340A6C8859@PU4P216MB1568.KORP216.PROD.OUTLOOK.COM>